在FASTA文件的多个序列中查找读取帧2中最长的ORF(开放读取帧)



我看到了一些关于该领域问题的问题,但无法将其用于我的问题,尽管我花了很多小时试图理解Biopyson方法。

我可以用逻辑做到这一点,但我相信最好使用Biopython。

我试着利用我发现的一个代码:

f = open(r"C:Users97254Downloadsdna2.fasta")
sequences = {}
count = 0
for line in f:
line = line.rstrip()
if line[0] == '>':
count += 1
first_row = line.split()
name = first_row[0][1:]
sequences[name] = ''
else:
sequences[name] = sequences[name] + line
startP = re.compile('ATG')
for sequence in sequences.values():
sequence = squence[1:]
longest = (0,)
for m in startP.finditer(sequence):
if len(Seq.Seq(sequence)[m.start():].translate(to_stop=True)) > longest[0]:
pro = Seq.Seq(sequence)[m.start():].translate(to_stop=True)
longest = (len(sequence[m.start():m.start()+len(pro)*3+3]), 
m.start(), 
sequence[m.start():m.start()+len(pro)*3+3])

我应该使用诸如for循环之类的逻辑来迭代3的跳跃中的序列吗?或者有一种Bioythonic的方法可以做到这一点吗?

谢谢!

BioPython教程和食谱包含以下用于查找开放阅读框架的代码:

from Bio import SeqIO
record = SeqIO.read("NC_005816.fna", "fasta")
table = 11
min_pro_len = 100
for strand, nuc in [(+1, record.seq), (-1, record.seq.reverse_complement())]:
for frame in range(3):
length = 3 * ((len(record)-frame) // 3) #Multiple of three
for pro in nuc[frame:frame+length].translate(table).split("*"):
if len(pro) >= min_pro_len:
print("%s...%s - length %i, strand %i, frame %i" 
% (pro[:30], pro[-3:], len(pro), strand, frame))

输出:

GCLMKKSSIVATIITILSGSANAASSQLIP...YRF - length 315, strand 1, frame 0
KSGELRQTPPASSTLHLRLILQRSGVMMEL...NPE - length 285, strand 1, frame 1
GLNCSFFSICNWKFIDYINRLFQIIYLCKN...YYH - length 176, strand 1, frame 1
VKKILYIKALFLCTVIKLRRFIFSVNNMKF...DLP - length 165, strand 1, frame 1
NQIQGVICSPDSGEFMVTFETVMEIKILHK...GVA - length 355, strand 1, frame 2
RRKEHVSKKRRPQKRPRRRRFFHRLRPPDE...PTR - length 128, strand 1, frame 2
TGKQNSCQMSAIWQLRQNTATKTRQNRARI...AIK - length 100, strand 1, frame 2
QGSGYAFPHASILSGIAMSHFYFLVLHAVK...CSD - length 114, strand -1, frame 0
IYSTSEHTGEQVMRTLDEVIASRSPESQTR...FHV - length 111, strand -1, frame 0
WGKLQVIGLSMWMVLFSQRFDDWLNEQEDA...ESK - length 125, strand -1, frame 1
RGIFMSDTMVVNGSGGVPAFLFSGSTLSSY...LLK - length 361, strand -1, frame 1
WDVKTVTGVLHHPFHLTFSLCPEGATQSGR...VKR - length 111, strand -1, frame 1
LSHTVTDFTDQMAQVGLCQCVNVFLDEVTG...KAA - length 107, strand -1, frame 2
RALTGLSAPGIRSQTSCDRLRELRYVPVSL...PLQ - length 119, strand -1, frame 2

由于它直接来自教程,我认为这是找到ORF的最具生物学意义的方法。它还迭代"jumpsof3"中的序列,但它使用BioPython函数SeqIO.read()来解析fasta文件。

相关内容

  • 没有找到相关文章

最新更新