Hi all,
I would like to extract specific domains from protein sequence. To do that I have two files + python script (from http://www.bioinformatics-made-simple.com/2013/10/actually-i-have-hundreds-of-protein.html). For example (I don't know if it is possible to attach files...):
File 1 (.fasta; tab delimited):
>sp|P17672.2|E75BA_DROMERecName:Full=Ecdysone-inducedprotein75B,isoformA;Short=E75-B;AltName:Full=Nuclearreceptorsubfamily1groupDmember3,isoformA
MVCAMQEVAAVQHQQQQQQLQLPQQQQQQQQTTQQQHATTIVLLTGNGGGNLHIVATPQQHQPMHQLHHQ
HQHQHQHQQQAKSQQLKQQHSALVKLLESAPIKQQQQTPKQIVYLQQQQQQPQRKRLKNEAAIVQQQQQT
PATLVKTTTTSNSNSNNTQTTNSISQQQQQHQIVLQHQQPAAAATPKPCADLSAKNDSESGIDEDSPNSD
EDCPNANPAGTSLEDSSYEQYQCPWKKIRYARELKQRELEQQQTTGGSNAQQQVEAKPAAIPTSNIKQLH
CDSPFSAQTHKEIANLLRQQSQQQQVVATQQQQQQQQQHQHQQQRRDSSDSNCSLMSNSSNSSAGNCCTC
NAGDDQQLEEMDEAHDSGCDDELCEQHHQRLDSSQLNYLCQKFDEKLDTALSNSSANTGRNTPAVTANED
ADGFFRRSIQQKIQYRPCTKNQQCSILRINRNRCQYCRLKKCIAVGMSRDAVRFGRVPKREKARILAAMQ
QSTQNRGQQRALATELDDQPRLLAAVLRAHLETCEFTKEKVSAMRQRARDCPSYSMPTLLACPLNPAPEL
QSEQEFSQRFAHVIRGVIDFAGMIPGFQLLTQDDKFTLLKAGLFDALFVRLICMFDSSINSIICLNGQVM
RRDAIQNGANARFLVDSTFNFAERMNSMNLTDAEIGLFCAIVLITPDRPGLRNLELIEKMYSRLKGCLQY
IVAQNRPDQPEFLAKLLETMPDLRTLSTLHTEKLVVFRTEHKELLRQQMWSMEDGNNSDGQQNKSPSGSW
ADAMDVEAAKSPLGSVSSTESADLDYGSPSSSQPQGVSLPSPPQQQPSALASSAPLLAATLSGGCPLRNR
ANSGSSGDSGAAEMDI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LQQQQQ
QQHQPQLQQHHQLQQQPHVSGVRVKTPSTPQTPQMCSIASSPSELGGCNSANNNNNNNNNSSSGNASGGS
GVSVGVVVVGGHQQLVGGSMVGMAGMGTDAHQVGMCHDGLAGTANELTVYDVIMCVSQAHRLNCSYTEEL
TRELMRRPVTVPQNGIASTVAESLEFQKIWLWQQFSARVTPGVQRIVEFAKRVPGFCDFTQDDQLILIKL
GFFEVWLTHVARLINEATLTLDDGAYLTRQQLEILYDSDFVNALLNFANTLNAYGLSDTEIGLFSAMVLL
ASDRAGLSEPKVIGRARELVAEALRVQILRSRAGSPQALQLMPALEAKIPELRSLGAKHFSHLDWLRMNW
TKLRLPPLFAEIFDIPKADDEL
File 2 (.txt; tab delimited):
sp|P17672.2|E75BA_DROMERecName:Full=Ecdysone-inducedprotein75B,isoformA;Short=E75-B;AltName:Full=Nuclearreceptorsubfamily1groupDmember3,isoformA 415 484
sp|P45447.4|E78C_DROMERecName:Full=Ecdysone-inducedprotein78C;Short=DR-78;AltName:Full=Nuclearreceptorsubfamily1groupEmember1 363 443
Script file domainseq.py):
import sys
import re
FASTA= sys.argv[1]
BED= sys.argv[2]
fasta= open(FASTA, 'U')
fasta_dict= {}
for line in fasta:
line= line.strip()
if line == '':
continue
if line.startswith('>'):
seqname= line.lstrip('>')
seqname= re.sub('\..*', '', seqname)
fasta_dict[seqname]= ''
else:
fasta_dict[seqname] += line
fasta.close()
bed= open(BED, 'U')
for line in bed:
line= line.strip().split('\t')
outname= line[0] + ':' + line[1] + '-' + line[2]
print('>' + outname)
s= int(line[1])
e= int(line[2])
print(fasta_dict[line[0]][s:e])
bed.close()
sys.exit()
And finally the error I get:
File "domainseq.py", line 27, in <module>
outname= line[0] + ':' + line[1] + '-' + line[2]
IndexError: list index out of range
Do you have any suggestions? Thank you very much, Julien
Thank you very much!!! :)