from Bio import SeqIO
for long_sequence_record in SeqIO.parse(open('long_sequences.fasta'), 'fasta'):
long_sequence = str(long_sequence_record.seq)
for short_sequence_record in SeqIO.parse(open('short_sequences.fasta'), 'fasta'):
short_sequence = str(short_sequence_record.seq)
if short_sequence in long_sequence:
start = long_sequence.index(short_sequence) + 1
stop = start + len(short_sequence) - 1
print short_sequence_record.id, start, stop
使用
BioPyton
输出:index=5,要得到6,14,使用index+1,index+len(str2)
相关问题 更多 >
编程相关推荐