提取secondary strucutre数据从Swissprot特征元组Python

2024-10-03 19:23:50 发布

您现在位置:Python中文网/ 问答频道 /正文

我需要能够从Swissprot文件中确定蛋白质中特定位置的二级结构(如链、螺旋等)和结构域(如信号)。查看swissprot文件中的FT行后,结果如下:

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,我如何提取信息来确定它在螺旋中?你知道吗

到目前为止,我的代码是:

#!/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

我正在疯狂地阅读元组(已经尝试了将近一个星期了),并且认为我已经找到了如何从元组中提取信息的方法,这更像是一个将位置匹配到二级结构的案例。你知道吗

我希望我说得有道理, 盟友


Tags: andthefromimportchainsysrecordwill
1条回答
网友
1楼 · 发布于 2024-10-03 19:23:50

您可以通过元组的索引访问元组中的项,因此特性开始是特性[1],结束是特性[2]。要仅打印与您感兴趣的位置重叠的要素,可以使用以下方法:

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

(请注意,这仅在位置为数字时有效。在代码中,它是一个字符串。您需要删除值周围的引号。)

相关问题 更多 >