Exemple #1
0
#
# t.show(tree_style=ts)

for node in t:  #.iter_search_nodes():
    # name = node.name
    # name = name[name.find("_")+1:]
    # node.name = name
    print node.name
    if node.name == "41":
        node.dist = 5e-05

# t.write(outfile='/Volumes/MP_HD/CI_GENOME_SEQ/CI_gene_coverage (generate stat for sig diff cov)/gene_copy_no_tree/CI_node_assignments_tree_nos.nwk',format=1,)

ts = TreeStyle()

t.show(tree_style=ts)

#
# print infile
#
# def rem_names(s):
#     if "_" in s:
#         p = s.find("_")
#         nstr = s[:p-3]+s[p+1:]
#         return rem_names(nstr)
#     else:
#         return s
#
# def rem_supports(s):
#     if ":" in s:
#         p = s.find(":")
Exemple #2
0
                           >Chimp
                           HARWLNEKLRCELRTLKKLGLDGYKAVSQYVKGRA
                           >Orangutan
                           DARWINEKLRCVSRTLKKLGLDGYKGVSQYVKGRP
                           >Human
                           DARWHNVKLRCELRTLKKLGLVGFKAVSQFVIRRA
                           """)
    nt_sequences = {"Human"    : "GACGCACGGTGGCACAACGTAAAATTAAGATGTGAATTGAGAACTCTGAAAAAATTGGGACTGGTCGGCTTCAAGGCAGTAAGTCAATTCGTAATACGTCGTGCG",
                    "Chimp"    : "CACGCCCGATGGCTCAACGAAAAGTTAAGATGCGAATTGAGAACTCTGAAAAAATTGGGACTGGACGGCTACAAGGCAGTAAGTCAGTACGTTAAAGGTCGTGCG",
                    "Orangutan": "GATGCACGCTGGATCAACGAAAAGTTAAGATGCGTATCGAGAACTCTGAAAAAATTGGGACTGGACGGCTACAAGGGAGTAAGTCAATACGTTAAAGGTCGTCCG"
                }
    for l in nt_sequences:
        (tree & l).nt_sequence = nt_sequences[l]
    tree.dist = 0
    ts = TreeStyle()
    ts.title.add_face(TextFace("Example for nucleotides...", fsize=15), column=0)
    ts.layout_fn = test_layout_evol
    tree.show(tree_style=ts)

    # Show very large algs
    tree = PhyloTree('(Orangutan,Human,Chimp);')
    tree.link_to_alignment(">Human\n"       + ''.join([_aabgcolors.keys()[int(random() * len (_aabgcolors))] for _ in xrange (5000)]) + \
                           "\n>Chimp\n"     + ''.join([_aabgcolors.keys()[int(random() * len (_aabgcolors))] for _ in xrange (5000)]) + \
                           "\n>Orangutan\n" + ''.join([_aabgcolors.keys()[int(random() * len (_aabgcolors))] for _ in xrange (5000)]))
    tree.dist = 0
    ts = TreeStyle()
    ts.title.add_face(TextFace("better not set interactivity if alg is very large", fsize=15), column=0)
    ts.layout_fn = test_layout_phylo_aa
    
    tree.show(tree_style=ts)
from Bio import SeqIO
from Bio import motifs
from Bio.Cluster import distancematrix
from Bio.Cluster import clustercentroids
records = list(SeqIO.parse("./txt/cm_perm_sequence_27_social.fasta", "fasta"))
for seq_record in SeqIO.parse("./txt/cm_perm_sequence_27_social.fasta", "fasta"):
    print seq_record.id
    print repr(seq_record.seq)
    print len(seq_record)
from Bio.Align.Applications import ClustalwCommandline
clustalx = '/Applications/PhylogeneticAnalysis/clustalw2'
cline = ClustalwCommandline(clustalx, infile="./txt/cm_perm_sequence_27_social.fasta")
print cline
stdout, stderr = cline()
from Bio import Phylo
tree = Phylo.read("./txt/cm_perm_sequence_27_social.dnd", "newick")
tree.rooted = True
#Phylo.draw(tree)

from ete2 import Tree
from ete2 import PhyloTree
t = PhyloTree('./txt/cm_perm_sequence_27_social.dnd')
t.link_to_alignment(alignment="./txt/cm_perm_sequence_27_social.fasta", alg_format="fasta")
#from ete2 import ClusterTree
#t = ClusterTree('./txt/cm_perm_sequence_27_social.dnd')
t.show()
#t.show("heatmap")
#t.show("cluster_cbars")
#t.show("cluster_bars")
#t.show("cluster_lines")
Exemple #4
0
#         |                              /-Cfa_001
#         |                    /--------|
#         |                   |          \-Mms_001
#---------|          /--------|
#         |         |         |                    /-Hsa_001
#         |         |         |          /--------|
#         |         |          \--------|          \-Ptr_001
#         |         |                   |
#         |         |                    \-Mmu_001
#          \--------|
#                   |                    /-Mms
#                   |          /--------|
#                   |         |          \-Cfa
#                   |         |
#                   |         |                              /-Hsa
#                    \--------|                    /--------|
#                             |          /--------|          \-Ptr_002
#                             |         |         |
#                             |         |          \-Mmu
#                              \--------|
#                                       |                    /-Ptr
#                                       |          /--------|
#                                        \--------|          \-Hsa_002
#                                                 |
#                                                  \-Mmu_002
#
# And we can visualize the trees using the default phylogeny
# visualization layout
genetree.show()
recon_tree.show()