Function that find the ATP binding site
0
0
Entering edit mode
4.8 years ago
nessrineN • 0

Hello ,

I'm currently doing a python project where I need a code that extract the ATP binding site from a FASTA file thanks to an regular expression more precisely a pattern.

Thanks for your help :)

Ps: Look at what I already did

sequence alignment • 779 views
ADD COMMENT
0
Entering edit mode

What's the question? What have you tried?

ADD REPLY
0
Entering edit mode

I've tried this code but it does not work. It opens a new file but the file is empty. I don't know what's wrong.

from Bio import SeqIO
import re
import os
path="C:/Users/nessr/Desktop/info projet"
os.chdir(path)
records=list(SeqIO.parse("plasmo.fasta","fasta"))
ATPM="[LIV]G[^P]G[^P][FYWMGSTNH][SGA][^PW][LIVCAT][^PD].[GSTACLIVMFY].{5,18}[LIVMFYWCSTAR][AIVP][LIVMFAGCKR]K"
patern=re.compile(r"(ATPM)")

def atp_binding(records,patern):

    for item in records:
        for m in patern.findall(str(item)):
            istart=m.start()
            iend=m.end()

            iend=iend+50

            print(istart,m.group())


file = open("output.txt","w")

for seq_record in SeqIO.parse(records, "fasta"): 
    file.write(atp_binding(seq_record.records,patern)+"\n")
    file.write('-------------------\n')
file.close()
ADD REPLY

Login before adding your answer.

Traffic: 2039 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6