Код: Выделить всё
with open("/Users/adia/Downloads/FGFR_fusion.fasta",'r') as fasta:
test = fasta.read()
test = test.split(">")
del test[0]
out = open("/Users/adia/Desktop/PSB HW_6.txt", 'w')
for x in test:
if 'fibroblast growth factor receptor 1 isoform' in x:
out.write(x)
with open("/Users/adia/Desktop/PSB HW_6.txt", 'r') as filtered:
test2 = filtered.read()
out = open("/Users/adia/Desktop/564ID.txt", 'w')
** AA564 = re.compile('^M.{562}[IVE]')**
matches = re.finditer(AA564,test2)
found = []
for match in matches:
found.append(match.group(0))
print(f"Found {match.group(0)} at position {match.start()}.\n")
if found == []:
print("No match found.")
No match found.
Я пробовал массу вариантов этого регулярного выражения:
- re.compile('M.{562}[IVE]')
- re.compile('^M.{562}[IVE]')
- re.compile('^M.{562}[IVE]', re.M)
- re.compile('^M.{562}[IVE]',re.DOTALL)
- re.compile( 'M.{562}[IVE].*')
- re.compile('^M.{562}[IVE].*')
- re.compile('^M[GALMFWKQESOVICYHRNDT]{562}[IVE]')
- re.compile('M[GALMFWKQESOVICYHRNDT]{562}[IVE]')< /li>
re.compile('^M[A-Z]{562}[IVE]'
TIA!
Подробнее здесь: https://stackoverflow.com/questions/791 ... d-sequence