2014-12-10 4 views
0

단백질의 특정 위치에 대한 2 차 구조 (예 : strand, helix 등)와 도메인 (예 : 신호)을 Swissprot 파일에서 결정할 수 있어야합니다. 다음과 같이 SWISSPROT 파일에서 FT 라인에보고 한 결과입니다Swissprot에서 2 차 strucutre 데이터 추출하기 특징 튜플 Python

RecName: Full=Insulin; Contains: RecName: Full=Insulin B chain; Contains: RecName: Full=Insulin A  chain; Flags: Precursor; 
('SIGNAL', 1, 24, '{ECO:0000269|PubMed:14426955}.', '') 
('PEPTIDE', 25, 54, 'Insulin B chain.', 'PRO_0000015819') 
('PROPEP', 57, 87, 'C peptide.', 'PRO_0000015820') 
('PEPTIDE', 90, 110, 'Insulin A chain.', 'PRO_0000015821') 
('STRAND', 26, 29, '{ECO:0000244|PDB:4EFX}.', '') 
('HELIX', 33, 43, '{ECO:0000244|PDB:3W7Y}.', '') 
('HELIX', 44, 46, '{ECO:0000244|PDB:3W7Y}.', '') 
('HELIX', 91, 97, '{ECO:0000244|PDB:3W7Y}.', '') 
('STRAND', 98, 101, '{ECO:0000244|PDB:4EFX}.', '') 
('HELIX', 102, 106, '{ECO:0000244|PDB:3W7Y}.', '') 
('TURN', 107, 109, '{ECO:0000244|PDB:1HIQ}.', '') 

이 형식은 나를 던졌다, 나는 그것이 중첩 된 튜플 추측하고있다. 아미노산에 대한 위치가 주어지면 예. 45 헬릭스에 있는지 확인하기 위해 정보를 추출하려면 어떻게해야합니까?

내 코드는 지금까지입니다 : 내가 튜플에 미친처럼 읽고있다 (지금 거의 일주일 동안 tryign하고) 내가 그들로부터 정보를 추출하는 방법을 일한 생각

#!/usr/bin/env python 

import time 
import sys 
import os 
from Bio import ExPASy 
from Bio import SwissProt 

# This section receives the parameters from user input via the website: 
# This will be commented out during the development period and temp. 
# variables will be used. 

# acc_number = sys.argv[1] 
# wild_aa = sys.argv[2] 
# position = sys.arg[3] 
# mutant_aa = sys.arg[4] 

#Temp variables for developing: 

acc_number = 'P01308' 
wild_aa = 'L' 
position = '43' 
mutant_aa = 'P' 

handle = ExPASy.get_sprot_raw(acc_number) 

# this reads the swissprot file: 
record = SwissProt.read(handle) 

# test to see if record has been retrieved: 
print record.description 

# next section will parse the sequence information using the position variable 
# and then will determine the secondary structure and domain location of the mutation 

# accessing the secondary structure and domain information from FT lines 
for feature in record.features: 
    print feature 

, 그것은 더있다 한 번 위치를 2 차 구조와 일치시킨 경우

내가 감각을 만든 희망

, 앨리

답변

0

당신은 그들의 색인하여 튜플 내의 항목에 액세스 할 수 있으므로 기능의 시작은 기능이 될 것이다 [1] 끝이 기능이 될 것이다 [2]. 관심의 위치를 ​​중복 기능 만 인쇄하려면, 당신은 같은 것을 사용할 수 있습니다

if feature[1] <= position and feature[2] >= position: 
    print feature 

(위치가 숫자 인 경우에만 동작합니다 코드, 그것은 문자열의 당신은 따옴표를 제거해야합니다..)

+0

좋아, 나는 내 책상에 머리를 두드리는 소리를 끝내고 내가 지나치게 긴 버전을 삭제하고이 짧은 우아한 해결책을 찾아 갔다. 작동합니다. 감사합니다. – Ally