Beispiel #1
0
alignment = DnaCharacterMatrix.get(file=open(
    "/home/nehleh/Documents/0_Research/PhD/Data/simulationdata/recombination/exampledataset/wholegenome.fasta"
),
                                   schema="fasta")

tree2 = Tree.get_from_path(
    '/home/nehleh/Documents/0_Research/PhD/Data/simulationdata/recombination/exampledataset/RerootTree_node12',
    'newick')

pi = [0.317, 0.183, 0.367, 0.133]
rates = [0.000100, 0.636612, 2.547706, 0.000100, 2.151395]
GTR_sample = myPhylo.GTR_model(rates, pi)

column = myPhylo.get_DNA_fromAlignment(alignment)
dna = column[0]
myPhylo.set_index(tree, dna)

print("Original tree:::::::::::::::")
print(tree.as_string(schema='newick'))
print(tree.as_ascii_plot())

LL_normal = myPhylo.computelikelihood(tree, dna, GTR_sample)
W_LL_normal = myPhylo.wholeAlignmentLikelihood(tree, alignment, GTR_sample)

n = W_LL_normal[0]
print(n)

filter_fn = lambda n: hasattr(n, 'index') and n.index == 11
target_node = tree.find_node(filter_fn=filter_fn)
tree.reroot_at_node(target_node,
                    update_bipartitions=False,
Beispiel #2
0
print(column[5002])

print("partial    ll old ===========================================")
persite_ll1, partial1 = myPhylo.computelikelihood(tree, column[5002],GTR_sample)
print(partial1)


# LL_root1, LL_partial1 = myPhylo.wholeAlignmentLikelihood(tree,alignment,GTR_sample)
#
# print(LL_partial1[5000])
# print(LL_root1[5000:5050])
# print(tree.as_ascii_plot(show_internal_node_labels = True))


print("partial ll new ===========================================")
myPhylo.set_index(tree,alignment)
persite_ll, partial = myPhylo.computelikelihood_new(tree, column[5002],GTR_sample)
print(partial)
# LL_root, LL_partial = myPhylo.wholeAlignmentLikelihood_new(tree,alignment,GTR_sample)
# print(LL_partial[5000])
# print(LL_root[5000:5050])
# print(LL_partial.shape)





# print("partial mixture ===========================================")
# tipdata = myPhylo.set_tips_partial(tree,alignment)
# LL_root2, LL_partial2 = myPhylo.computelikelihood_mixture(tree,alignment,tipdata,GTR_sample)
# print(LL_partial2[5000])
Beispiel #3
0

# ==============================================   input  ==============================================================
tree_path = '/home/nehleh/Documents/0_Research/PhD/Data/simulationdata/BaciSim/1/RAxML_bestTree.tree'
tree = Tree.get_from_path(tree_path, 'newick')
alignment = dendropy.DnaCharacterMatrix.get(file=open("/home/nehleh/Documents/0_Research/PhD/Data/simulationdata/BaciSim/1/wholegenome.fasta"), schema="fasta")


pi = [0.2184,0.2606,0.3265,0.1946]
rates = [0.975070 ,4.088451 ,0.991465 ,0.640018 ,3.840919 ]
GTR_sample = myPhylo.GTR_model(rates,pi)


column = myPhylo.get_DNA_fromAlignment(alignment)
dna = column[0]
myPhylo.set_index(tree,alignment)


taxon = tree.taxon_namespace
nu = 0.03

print(alignment.sequence_size)


print("Original tree:::::::::::::::")
print(tree.as_string(schema='newick'))
print(tree.as_ascii_plot(show_internal_node_labels = True))



Beispiel #4
0
import numpy as np
import phyloHMM

tree_path = '/home/nehleh/Documents/0_Research/PhD/Data/simulationdata/recombination/phyloHMM/tree_6taxa.tree'
tree = Tree.get_from_path(tree_path, 'newick')
alignment = dendropy.DnaCharacterMatrix.get(file=open(
    "/home/nehleh/Documents/0_Research/PhD/Data/simulationdata/recombination/phyloHMM/sample_6taxa.fasta"
),
                                            schema="fasta")

pi = [0.2184, 0.2606, 0.3265, 0.1946]
rates = [0.975070, 4.088451, 0.991465, 0.640018, 3.840919]
GTR_sample = myPhylo.GTR_model(rates, pi)

column = myPhylo.get_DNA_fromAlignment(alignment)
myPhylo.set_index(tree, column[0])

print("Original tree")
print(tree.as_string(schema='newick'))
print(tree.as_ascii_plot(plot_metric='length'))


def tree_evolver2(tree, node, nu):
    recombination_trees = []
    co_recom = nu / 2
    parent = node.parent_node
    grandparent = parent.parent_node
    br_length = node.edge_length
    print("My node is:", node.index, node.edge_length)
    print("parent::", parent.index)
    print("grandparent::", grandparent.index)
Beispiel #5
0
# ==============================================   input  ==============================================================
tree_path = '/home/nehleh/Documents/0_Research/PhD/Data/simulationdata/recombination/ShortDataset/RAxML_bestTree.tree'
tree = Tree.get_from_path(tree_path, 'newick')
alignment = dendropy.DnaCharacterMatrix.get(file=open(
    "/home/nehleh/Documents/0_Research/PhD/Data/simulationdata/recombination/ShortDataset/wholegenome.fasta"
),
                                            schema="fasta")

pi = [0.317, 0.183, 0.367, 0.133]
rates = [0.000100, 0.636612, 2.547706, 0.000100, 2.151395]
GTR_sample = myPhylo.GTR_model(rates, pi)

column = myPhylo.get_DNA_fromAlignment(alignment)
dna = column[0]
myPhylo.set_index(tree, dna)

taxon = tree.taxon_namespace
nu = 0.4

print(alignment.sequence_size)

print("Original tree:::::::::::::::")
print(tree.as_string(schema='newick'))
print(tree.as_ascii_plot())

mytree = []
recombination_trees = []
filter_fn = lambda n: hasattr(n, 'index') and n.index == 10
target_node = tree.find_node(filter_fn=filter_fn)
# ----------- Step 1 : Make input for hmm ------------------------------------------------------