일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
- 행렬
- 파이썬
- 알파폴드
- 바이오인포매틱스
- Kaggle
- 이항분포
- 인공신경망
- 바이오파이썬
- 인공지능 수학
- ncbi
- AP
- CNN
- 인공지능
- 결정트리
- SVM
- bioinformatics
- 자바
- 시그모이드
- 오류역전파
- Java
- 생명정보학
- COVID
- BLaST
- AP Computer Science A
- MERS
- 생물정보학
- 캐글
- 서열정렬
- 딥러닝
- 블록체인
- Today
- Total
데이터 과학
바이오파이썬에서 계통수 그리기 본문
바이오파이썬에서 계통수를 그리는 방법을 알아보겠습니다.
우선, 5개정도의 핵산 서열을 찾아서 실험을 위한 표본으로 만들어 놓습니다.
MEGA-X에서 서열분석을 통해 정렬을 해 놓으면 좀 편합니다.
sample0822.fasta는 정렬하기전에 NCBI에서 찾은 파일입니다.
5개의 spike 핵산을 다음과 같습니다.
>AY463060.1 SARS coronavirus ShanghaiQXC2
>KJ650296.1 Middle East respiratory syndrome coronavirus isolate KFU-HKU 19Dam
>NC_004718.3 SARS coronavirus Tor2
>MN996531.1 Severe acute respiratory syndrome coronavirus 2 isolate WIV07
>MT226600.1 Middle East respiratory syndrome-related coronavirus isolate Camel/B8-03
MEGA에서 Clustal로 서열정렬한 파일은 5_sars_spike_ncl.fas 입니다.
서열정렬을 해 놓아야 Phylip 형식으로 변환할 때 무리가 없습니다.
주피터 노트북을 실행해서 5_sars_spike_ncl.fas 파일을 업로드합니다.
from Bio import SeqIO
records = SeqIO.parse("5_sars_spike_ncl.fas", "fasta")
count = SeqIO.write(records, "5_sars_spike_ncl.phylip", "phylip")
print("Converted %i records" % count)
이 명령어를 실행해서 phylip 파일로 저장합니다.
Converted 5 records
라고 변환되었다는 메시지가 나옵니다.
from Bio import Phylo, AlignIO
from Bio.Phylo.TreeConstruction import DistanceCalculator, DistanceTreeConstructor
align = AlignIO.read('5_sars_spike_ncl.phylip','phylip')
print(align)
Alignment with 5 rows and 30779 columns
--------------------------------------------...--- AY463060.1
-------------------TAGCTTGGCTATCTCACTTCCCCTC...--- KJ650296.1
ATATTAGGTTTTTACCTACCCAGGAAA--AGCCAACCAACCT-C...AAA NC_004718.
-------------ACCTTCCCAGGTAACAAACCAACCAACTTTC...--- MN996531.1
-------GATTTAAGTGAATAGCTTGGCTATCTCACTTCCCCTC...--- MT226600.1
바이오파이썬에서 PhyIo, AlignIO 모듈을 임포트합니다.
TreeConstruction 라이브러리를 이용해서 거리 값 계산하는 모듈과 트리를 생성하는 모듈을 지정해 봅니다.
이후에 phylip 형식으로 저장되었던 5개의 spike 핵산을 불러옵니다.
calculator = DistanceCalculator('identity')
distMatrix = calculator.get_distance(align)
print(distMatrix)
거리값은 다음과 같습니다.
AY463060.1 0
KJ650296.1 0.49527275090158873 0
NC_004718. 0.025341953929627348 0.4878975925143767 0
MN996531.1 0.2219045453068651 0.48883979336560646 0.20393774976444978 0
MT226600.1 0.4958575652230417 0.0038987621430195407 0.4876701647227005 0.4889697521037071 0
AY463060.1 KJ650296.1 NC_004718. MN996531.1 MT226600.1
constructor = DistanceTreeConstructor()
UGMATree = constructor.upgma(distMatrix)
NJTree = constructor.nj(distMatrix)
Phylo.draw_ascii(UGMATree)
UPGMA 트리결과입니다.
SARS는 SARS와의 유사성이 MERS는 MERS끼리의 유사성이 높다고 결과 나옵니다.
Phylo.draw_ascii(NJTree)
NJ tree의 경우는 조금 다른 결과가 나옵니다.
다른 트리도 결과가 가능합니다.
계통수 결과가 나오는 알고리즘 몇가지가 더 있습니다. 찾아서 한번 더 해보고 왜 다른지 이유를 찾아봅시다.
이상으로 간단하게 바이오파이썬으로 계통수 그리는 방법에 대해 알아봤습니다.
https://bmcbioinformatics.biomedcentral.com/articles/10.1186/1471-2105-13-209
Bio.Phylo: A unified toolkit for processing, analyzing and visualizing phylogenetic trees in Biopython - BMC Bioinformatics
Background Ongoing innovation in phylogenetics and evolutionary biology has been accompanied by a proliferation of software tools, data formats, analytical techniques and web servers. This brings with it the challenge of integrating phylogenetic and other
bmcbioinformatics.biomedcentral.com
'생명정보학 & 화학정보학 > 바이오파이썬' 카테고리의 다른 글
Artemis 실행 방법 (0) | 2021.09.05 |
---|---|
블라스트 XML에서의 검색 (0) | 2021.08.29 |
2021버전 SARS-CoV-2 핵산서열 분석 (1) | 2021.08.15 |
GenBank 정보 불러오기 (2) | 2021.08.15 |
바이오파이썬 단백질 분석 : COVID-19 게놈(Genome) (1) | 2021.07.27 |