Open yukiregista opened 1 week ago
c_prune と STD_greedy_pruning の結果が一致するかのテスト。
c_prune
STD_greedy_pruning
二つの木が一致しているかどうか見るには、例えば src/booster/pysrc/test_equivalent.pyのコードを参考にしてください(t1_data と t2_data を対象のnewick string にすれば動くと思います)
src/booster/pysrc/test_equivalent.py
t1_data
t2_data
(検証してないですが)次のような感じで二つのバージョンの木が得られます:
import Consensus import dendropy init_file = /path/to/init/file input_file = /path/to/input/trees/file # c version newick_c = Consensus.c_prune(inittree_file=init_file, inputtrees_file=input_file, K=20) # newick file # python version init_tree = Consensus.Tree_with_support.get(path = init_file, schema="newick") input_trees = Consensus.TreeList_with_support.get(path = input_file, schema="newick", taxon_namespace=init_tree.taxon_namespace) pruned_tree = init_tree.STD_greedy_pruning(input_trees) # comparison c_pruned = Consensus.Tree_with_support.get(data = newick_c, schema="newick", taxon_namespace=pruned_tree.taxon_namespace) fp, fn = dendropy.calculate.treecompare.false_positives_and_negatives(pruned_tree,c_pruned) print(fp,fn)
同様に、unscaled versionも c_prune(..., scaled=False), init_tree.SUTD_greedy_pruning(input_trees) も比較してもらえると助かります。
c_prune(..., scaled=False)
init_tree.SUTD_greedy_pruning(input_trees)
すいません、test_equivalent.py はサポートが一致しているか見るために作ったものでした... 同じ木であるかどうかだけ興味が一旦あるので、RF距離が0であれば良いです。dendropy.calculate.treecompare.false_positives_and_negatives(t1,t2) みたいな感じで実行して、(0,0)が帰ってくればokです。
test_equivalent.py
dendropy.calculate.treecompare.false_positives_and_negatives(t1,t2)
(0,0)
c_prune
とSTD_greedy_pruning
の結果が一致するかのテスト。二つの木が一致しているかどうか見るには、例えば
src/booster/pysrc/test_equivalent.py
のコードを参考にしてください(t1_data
とt2_data
を対象のnewick string にすれば動くと思います)(検証してないですが)次のような感じで二つのバージョンの木が得られます:
同様に、unscaled versionも
c_prune(..., scaled=False)
,init_tree.SUTD_greedy_pruning(input_trees)
も比較してもらえると助かります。