1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| import urllib
iput=raw_input("Code of the protein (ex: 4S18) : ")
url=urllib.urlopen("http://www.rcsb.org/pdb/download/downloadFile.do?fileFormat=pdb&compression=NO&structureId="+str(iput))
pdbfile=url.readlines()
dico={"MSE":"M*","VAL":"V","ILE":"I","LEU":"L","MET":"M","PHE":"F","GLY":"G","ALA":"A","PRO":"P","TRP":"W","TYR":"Y","SER":"S","THR":"T","CYS":"C","ASN":"N","GLN":"Q","ARG":"R","LYS":"K","HIS":"H","ASP":"D","GLU":"E"}
codeA,codeB,codeC,codeD,codeE,codeF,codeG,codeH,codeI="","","","","","","","",""
seq0=[]
for i in range(len(pdbfile)):
if pdbfile[i][0:6]=="SEQRES":
seq0.append(pdbfile[i])
print pdbfile[4][21:]
for i in seq0:
seq1=i.split()
for j in seq1[4:]:
if seq1[2]=="A":
codeA=codeA+dico[j]
if seq1[2]=="B":
codeB=codeB+dico[j]
if seq1[2]=="C":
codeC=codeC+dico[j]
if seq1[2]=="D":
codeD=codeD+dico[j]
if seq1[2]=="E":
codeE=codeE+dico[j]
if seq1[2]=="F":
codeF=codeF+dico[j]
if seq1[2]=="G":
codeG=codeG+dico[j]
if seq1[2]=="H":
codeH=codeH+dico[j]
if seq1[2]=="I":
codeI=codeI+dico[j]
if codeA!="":
print "A chain sequence (length =",len(codeA),"amino acids) :",codeA,"\n"
if codeB!="":
print "B chain sequence (length =",len(codeB),"amino acids) :",codeB,"\n"
if codeC!="":
print "C chain sequence (length =",len(codeC),"amino acids) :",codeC,"\n"
if codeD!="":
print "D chain sequence (length =",len(codeD),"amino acids) :",codeD,"\n"
if codeE!="":
print "E chain sequence (length =",len(codeE),"amino acids) :",codeE,"\n"
if codeF!="":
print "F chain sequence (length =",len(codeF),"amino acids) :",codeF,"\n"
if codeG!="":
print "G chain sequence (length =",len(codeG),"amino acids) :",codeG,"\n"
if codeH!="":
print "H chain sequence (length =",len(codeH),"amino acids) :",codeH,"\n"
if codeI!="":
print "I chain sequence (length =",len(codeI),"amino acids) :",codeI
if codeA=="":
print "There is no proteins associated to this code" |
Partager