如何确定/找到任何基因组中最长的聚嘌呤管道(连续的As和Gs,没有散布的C或T,反之亦然),这需要在大肠杆菌基因组上。 是要弄清楚多嘌呤管道,然后找出最长的链?或者它是否将内含子和外显子与DNA分开?因为大肠杆菌的基因组长度是460万BP, 我需要一些帮助来打破这个?
答案 0 :(得分:3)
我同意这个问题的方法论方面更适合https://biology.stackexchange.com/(即内外物/外显子应该被删除等),但简单地说,这完全取决于你试图回答的生物学问题。如果你关心那些延伸是否跨越内含子/外显子边界,那么你不应该先拆分它们。然而,我不确定这与大肠杆菌序列有关(据我所知)内含子和外显子是真核生物特异性的。
为了解决这个问题的技术方面,这里有一些代码说明了如何使用scikit-bio来做到这一点。 (我还将其作为scikit-bio cookbook食谱here发布。)
from __future__ import print_function
import itertools
from skbio import parse_fasta, NucleotideSequence
# Define our character sets of interest. We'll define the set of purines and pyrimidines here.
purines = set('AG')
pyrimidines = set('CTU')
# Obtain a single sequence from a fasta file.
id_, seq = list(parse_fasta(open('data/single_sequence1.fasta')))[0]
n = NucleotideSequence(seq, id=id_)
# Define a ``longest_stretch`` function that takes a ``BiologicalSequence`` object and the characters of interest, and returns the length of the longest contiguous stretch of the characters of interest, as well as the start position of that stretch of characters. (And of course you could compute the end position of that stretch by summing those two values, if you were interested in getting the span.)
def longest_stretch(sequence, characters_of_interest):
# initialize some values
current_stretch_length = 0
max_stretch_length = 0
current_stretch_start_position = 0
max_stretch_start_position = -1
# this recipe was developed while reviewing this SO answer:
# http://stackoverflow.com/a/1066838/3424666
for is_stretch_of_interest, group in itertools.groupby(sequence,
key=lambda x: x in characters_of_interest):
current_stretch_length = len(list(group))
current_stretch_start_position += current_stretch_length
if is_stretch_of_interest:
if current_stretch_length > max_stretch_length:
max_stretch_length = current_stretch_length
max_stretch_start_position = current_stretch_start_position
return max_stretch_length, max_stretch_start_position
# We can apply this to find the longest stretch of purines...
longest_stretch(n, purines)
# We can apply this to find the longest stretch of pyrimidines...
longest_stretch(n, pyrimidines)
# Or the longest stretch of some other character or characters.
longest_stretch(n, set('N'))
# In this case, we try to find a stretch of a character that doesn't exist in the sequence.
longest_stretch(n, set('X'))
答案 1 :(得分:2)
现在,BiologicalSequence
类的scikit-bio的(开发版本)中有一个方法叫做(和子类)find_features
。例如
my_seq = DNASequence(some_long_string)
for run in my_seq.find_features('purine_run', min_length=10):
print run
或
my_seq = DNASequence(some_long_string)
all_runs = list(my_seq.find_features('purine_run', min_length=10))