我正在尝试使用python脚本来提取给定氨基酸两侧的12个氨基酸序列(每个方向6个)fasta序列。在
我有两个输入:一个fasta文件和一个panda数据帧。在
fasta文件如下所示:
> sp|P00001| some text here 1
MKLLILTCLVAVALARPKHPIKKVSPTFDTNMVGKHQGLPQEVLNENLLRFFVAPFPEVFGKEKVSLDAGPGMCSRNE
>sp|P00002| some text here 2
MSSGNAKIGHPAPNFKATAVMPDGQFKDISLSDYKGKYVVFFFYPLDFTFVCPTGLGRSSYRATSCLPALCLP
>sp|P00003| some text here 3
MSVLDSGNFSWKMTEACMKVKIPLVKKKSLRQNLIENGKLKEFMRTHKYNLGSKYIREAATLVSEQPLQN
这是我的第二个输入,熊猫的数据框(2列'ProteinID'和'Phosphopeptide')
^{pr2}$我需要做的是以下几点。对于每个“磷酸肽”,我需要在fasta文件头中找到蛋白质(ProteinID)(以“>;”开头)。然后我需要用星号标记提取氨基酸前面和后面的6个氨基酸。在
我的输出是写入数据帧的新列,如下所示:
ProteinID -- Phosphopeptide -- NewColumn
P00001 -- KVSPT*FDTNMVGK -- IKKVSPTFDTNMV
P00001 -- SLDAGPGMCS*R -- AGPGMCSRNE
P00003 -- LDS*GNFSWKMTEACMK -- MSVLDSGNFSWK
请注意,后两行在它们各自蛋白质的末端或开始处含有肽,因此我们在这些情况下不需要提取12个氨基酸。在
我有一个困难的时间(很少的编程经验)写这个程序,并将非常感谢任何帮助(建议,提示,函数等)。在
下面是一个提取相关子字符串的函数:
示例:
^{pr2}$印刷品:
嗨,请检查一下:我的fasta文件名为'txt':
代码段:
输出:
^{pr2}$相关问题 更多 >
编程相关推荐