본문 바로가기
생물정보학/Biopython (바이오파이썬)

[바이오파이썬] 4.3.1 SeqFeature 객체

by HanJoohyun 2018. 5. 22.
반응형

 

 


 

안녕하세요 한주현입니다.


오늘은 Biopython에서 SeqFeature 객체에 대하여 알아보겠습니다.



바이오파이썬에서 새로 로고가 나왔더군요 ㅎㅎ


참 예쁘게 잘 만드신 것 같습니다 ㅎㅎㅎ



목표


이전 포스팅에서 FASTA, GenBank 파일로 부터 SeqRecord 객체를 만드는 방법에 대해 배워봤습니다.


http://korbillgates.tistory.com/89


오늘은 SeqRecord 의 정보를 담고 있는 SeqFeature 객체에 대해 알아보려 합니다.




준비물


실습에 사용할 파일입니다 ㅎㅎ


https://raw.githubusercontent.com/biopython/biopython/master/Tests/GenBank/NC_005816.gb


다운 받아 주세요 ㅎㅎ




SeqFeature 객체


SeqFeature 객체는 GenBank/EMBL을 토대로 작성되어 GenBank/EMBL의 구조와 비슷합니다.


SeqFeature 객체가 무엇인지 살펴보기 위해,


GenBank 파일로 부터 SeqRecord 객체를 만들어 보죠.


1
2
3
from Bio import SeqIO
 
record = SeqIO.read("NC_005816.gb","genbank")
cs


record 객체는 이렇게 생겼습니다.


1
2
>>> record
SeqRecord(seq=Seq('TGTAACGAACGGTGCAATAGTGATCCACACCCAACGCCTGAAATCAGATCCAGG...CTG', IUPACAmbiguousDNA()), id='NC_005816.1', name='NC_005816', description='Yersinia pestis biovar Microtus str. 91001 plasmid pPCP1, complete sequence', dbxrefs=['Project:58037'])
cs


record 객체의 features 변수는 SeqFeature 객체를 리스트 형태로 담고 있습니다.


1
2
3
4
>>> record.features
[SeqFeature(FeatureLocation(ExactPosition(0), ExactPosition(9609), strand=1), type='source'),
 SeqFeature(FeatureLocation(ExactPosition(0), ExactPosition(1954), strand=1), type='repeat_region'),
... ]
cs


1
2
>>> len(record.features)
41
cs


이 SeqFeature 객체가 담고 있는 변수들을 살펴보지요.


우선 실제 genbank 파일에 어떤 정보가 담겨있는지 보도록 하겠습니다.


genbank 파일 내부 모습




아래쪽에 FEATURES 가 보이시나요?


SeqFeatures 가 담긴 record.features 리스트는 FEATURES 아래의 항목들이 리스트 요소 하나씩 입니다.


.type


.type은 말 그대로 FEATURE의 각 type 을 말합니다.


1
2
3
4
5
6
7
8
9
for feature in record.features:
    print(feature.type)
 
source
repeat_region
gene
CDS
misc_feature
...
cs




.location

.location은 SeqFeature의 각 location을 말합니다.


1
2
3
4
5
6
7
8
9
for feature in record.features:
    print(feature.location)
 
[0:9609](+)
[0:1954](+)
[86:1109](+)
[86:1109](+)
[86:959](+)
...
cs


.location.strand


1, -1, 0 또는 None으로 표기합니다


1 은 top strand,

-1 은 bottom strand,

0은 알 수 없는 경우,

None 은 protein이나 single stranded 서열인 경우 입니다.





.qualifiers


FEATURES 아래 의 정보들을 파이썬 사전 형태로 저장하였습니다.


genbank 파일의 첫 번째 FEATURES 는 이렇게 생겼는데,


1
2
3
4
5
6
7
8
FEATURES             Location/Qualifiers
     source          1..9609
                     /organism="Yersinia pestis biovar Microtus str. 91001"
                     /mol_type="genomic DNA"
                     /strain="91001"
                     /db_xref="taxon:229193"
                     /plasmid="pPCP1"
                     /biovar="Microtus"
cs


record.features[0] 으로 첫 번째 요소에 접근하여 qualifiers를 출력해보니 아래와 같이 사전 형태로 저장되어있습니다.

1
2
3
4
5
6
7
8
>>> record.features[0].qualifiers
 
OrderedDict([('organism', ['Yersinia pestis biovar Microtus str. 91001']),
             ('mol_type', ['genomic DNA']),
             ('strain', ['91001']),
             ('db_xref', ['taxon:229193']),
             ('plasmid', ['pPCP1']),
             ('biovar', ['Microtus'])])
cs









오늘은 Biopython에서 SeqFeature 객체에 대해 알아보았습니다.


부디 여러분들께 도움되셨음 좋겠네요

 

그럼 다음 시간에 만나요 ~~~~

 

 

 


반응형

댓글