print ('\n---------\nNow working with leaf ' + leaf.name) tree.mark_tree([leaf.node_id], marks=['#1']) print (tree.write()) # to organize a bit, we name model with the name of the marked node # any character after the dot, in model name, is not taken into account # for computation. (have a look in /tmp/ete3.../bsA.. directory) print ('running model bsA and bsA1') tree.run_model('bsA.'+ leaf.name) tree.run_model('bsA1.' + leaf.name) print ('p-value of positive selection for sites on this branch is: ') ps = tree.get_most_likely('bsA.' + leaf.name, 'bsA1.'+ leaf.name) rx = tree.get_most_likely('bsA1.'+ leaf.name, 'M0') print (str(ps)) print ('p-value of relaxation for sites on this branch is: ') print (str(rx)) if ps < 0.05 and float(tree.get_model("bsA." + leaf.name).wfrg2a) > 1: print ('we have positive selection on sites on this branch') elif rx<0.05 and ps>=0.05: print ('we have relaxation on sites on this branch') else: print ('no signal detected on this branch, best fit for M0') print ('\nclean tree, remove marks') tree.mark_tree(map(lambda x: x.node_id, tree.get_descendants()), marks=[''] * len(tree.get_descendants()), verbose=True) # nothing working yet to get which sites are under positive selection/relaxation, # have to look at the main outfile or rst outfile print ('The End.')
print('\n---------\nNow working with leaf ' + leaf.name) tree.mark_tree([leaf.node_id], marks=['#1']) print(tree.write()) # to organize a bit, we name model with the name of the marked node # any character after the dot, in model name, is not taken into account # for computation. (have a look in /tmp/ete3.../bsA.. directory) print('running model bsA and bsA1') tree.run_model('bsA.' + leaf.name) tree.run_model('bsA1.' + leaf.name) print('p-value of positive selection for sites on this branch is: ') ps = tree.get_most_likely('bsA.' + leaf.name, 'bsA1.' + leaf.name) rx = tree.get_most_likely('bsA1.' + leaf.name, 'M0') print(str(ps)) print('p-value of relaxation for sites on this branch is: ') print(str(rx)) if ps < 0.05 and float(tree.get_model("bsA." + leaf.name).wfrg2a) > 1: print('we have positive selection on sites on this branch') elif rx < 0.05 and ps >= 0.05: print('we have relaxation on sites on this branch') else: print('no signal detected on this branch, best fit for M0') print('\nclean tree, remove marks') tree.mark_tree(map(lambda x: x.node_id, tree.get_descendants()), marks=[''] * len(tree.get_descendants()), verbose=True) # nothing working yet to get which sites are under positive selection/relaxation, # have to look at the main outfile or rst outfile print('The End.')