[BioPython] Bio.Phylo
2024. 9. 22. 12:20ㆍBioinformatics
0. Bio.Phylo 모듈은 계통을 그려주는 모듈이다. Bio.Phylo는 4개의 파일형식을 읽을 수 있다. Newick, Nexus, Phyloxml, Nexml
1. 사용법
from Bio import Phylo
tree = Phylo.read("../nwk/sample_tree1.nwk","newick")
tree.rooted = True
tree.root.color = (128,128,128)
print(tree)
tree.clade[0].color = "blue"
tree.clade[1].color = "red"
tree.clade[2,0].color = "green"
tree.clade[2,1].color = "green"
Phylo.draw(tree, branch_labels = lambda c : c.branch_length)
clade는 계통군이다.
output

tree.clade [0] --> A, tree.clade [1] --> B , tree.clade [2,0] --> C, tree.clade [2,1] --> D 가 된다.
Phylo.draw()에는 tree객체를 넣어주고, branch_labels 인자를 넣을 수 있다. branch_labels는 길이를 표시해 주는 인자다. 따라서, 이 인자를 설정하면 다음과 같은 output이 나오게 된다.

'Bioinformatics' 카테고리의 다른 글
| [Bioinformatics] pipeline tool installation (19) | 2024.11.17 |
|---|---|
| [BioPython] KEGG (1) | 2024.09.23 |
| [BioPython] Bio.SwissProt (2) | 2024.09.21 |
| [M/O] Akkermansia muciniphila (0) | 2024.09.20 |
| [BioPython] Entrez (0) | 2024.09.19 |