diff --git a/Contact.py b/Contact.py new file mode 100755 index 0000000..d185fd4 --- /dev/null +++ b/Contact.py @@ -0,0 +1,129 @@ +#!/usr/bin/env python3 + + + +print ("Content-type:text/html\r\n\r\n") +print ("") +print ("") + +print ("") + +print ("LiBiSCo") +print ("") + + +print ("
") +print ("
") + + + +print ("") +print ("") + +#Body size Determination + + +print ("
") +print ("

Please send any comments or suggestions about the MSALigMap server to:

") +print ("
") + + + +print("
") + +print ("") +print("
") + + +print("
") +print ("

Professor Henrik Aronsson

") +print ("

Head of Department

") +print ("

Department of Biological & Environmental Sciences

") +print ("

Email: henrik.aronsson@bioenv.gu.se

") +print("
") + + + +print("
") +print ("") +print("
") + +print("
") +print ("

Sameer Hassan

") +print ("

Researcher

") +print ("

OlsAro

") +print ("

Email: sameer.hassan@olsaro.com

") +print ("
") + +print("
") + +print ("") +print("
") +print("
") +print ("

Mats Topel

") +print ("

Researcher

") +print ("

Department of Marine Sciences

") +print ("

Email: mats.topel@marine.gu.se

") +print ("
") + +print("
") +print ("") +print("
") +print("
") +print ("

Haleemath Sameena Sameer

") +print ("

Master Student, Department of Computer and Systems Sciences

") +print ("

Stockholm University

") +print ("

Email: sameenah.tm@gmail.com

") +print ("
") + +print ("
") +print ("
") + +print ("") +print ("") diff --git a/DNABinding.py b/DNABinding.py old mode 100644 new mode 100755 index 4a289ca..7bd1488 --- a/DNABinding.py +++ b/DNABinding.py @@ -649,4 +649,4 @@ def Convert(string): shutil.rmtree('PDB') print ("") -print ("" ) \ No newline at end of file +print ("" ) diff --git a/DNAPage1.py b/DNAPage1.py new file mode 100644 index 0000000..4be0c2e --- /dev/null +++ b/DNAPage1.py @@ -0,0 +1,246 @@ +#!/usr/bin/env python3 + +# Import modules for CGI handling +import cgi, cgitb +cgitb.enable() +import collections +import os +import argparse +import sys +import re +# from Bio import SeqIO +# from Bio.Align.Applications import MafftCommandline +#from StringIO import StringIO +# from Bio import AlignIO +# from Bio.PDB import * +# from Bio.PDB.Polypeptide import PPBuilder +import subprocess +import urllib +from urllib.request import urlopen +from collections import OrderedDict +import requests +from bs4 import BeautifulSoup +import itertools +import shutil +import pandas as pd +# from Bio import motifs +# from Bio.Seq import Seq + +import random +import string + +sys.path.append('/usr/local/Anaconda3/lib/') +url="https://www.rcsb.org/structure/" + + +# Create instance of FieldStorage +form = cgi.FieldStorage() + +# Get data from field +if form.getvalue('textcontent'): + text_content = form.getvalue('textcontent') + +else: + text_content = None + +print ("Content-type:text/html\r\n\r\n") +print ("") +print ("") + +#HTML style details for web page +print ("") +#Style ends here + +print ("MSALigMap") +print ("") +#print "

CoFactComp

" +print ("
") +print ("
") +print ("") +print ("") +print ("
") +print ("

Protein Details!

")#print lig_content + + +if text_content != None: + for i in text_content: + text_content1=text_content.replace(' ', '') + l=text_content1.split(',') + + + + + foldernamer= ''.join(random.choices(string.ascii_letters, k=4)) + ProtLigfolder= '/opt/lampp/htdocs/MSALigMap/tmp/' + 'ProtDNA' + + isExist = os.path.exists(ProtLigfolder) + + if not isExist: + os.mkdir( ProtLigfolder) + + folderpath= ProtLigfolder + '/' +foldernamer + os.mkdir(folderpath) + + + fileitem = form['filename'] + fileattached = fileitem.value + + InputFileName = folderpath + '/sequenceInputfile.fasta' + with open(InputFileName, 'wb') as fout: + fout.write(fileattached) + + pdbid_list=[] + url_list=[] + prot_lig_dict=collections.defaultdict(dict) + + pdbid_chain_dict={} + + for i in l: + + each= i.upper()#.split(':') + pdbcode= each[0].upper() + chain=each[1].upper() # i am removing the +"="+"[]" + pdbid_list.append(each) + pdbid_chain_dict[pdbcode]=chain + + + #linking the PDB url address to the selected PDB ids + for x in l: + pdbcodename= x.split(':')[0].upper() + pdbid=url+pdbcodename#+".pdb" + url_list.append(pdbid) + + + + + #Listing the PDB ids and their bound ligands + Protein_DNAComplex_dict={} + for link,id in zip(url_list,pdbid_list):#list(pdbid_chain_dict.keys() + + PDB_id = id.upper() #+ '_' + Chain + Protein_DNAComplex_dict[PDB_id]={} + + page = urlopen(link) + html = page.read().decode("utf-8") + soup = BeautifulSoup(html, "html.parser") + + divs = soup.find(id="MacromoleculesButton_NucleicAcids") + + + divs1 = soup.find(id="MacromoleculeTable") + + + divs2 = soup.find(id="MacromoleculeTableDNA") + + + # Defining of the dataframe + df = pd.DataFrame(columns=['PDB_Code','Molecule', 'Chain', 'Length']) + for row in divs1.tbody.find_all('tr', id="macromolecule-entityId-1-rowDescription"): + # Find all data for each column + columns = row.find_all('td') + #print (columns) + if(columns != []): + molecule= columns[0].text.strip() + chain=columns[1].text.strip() + + Protein_DNAComplex_dict[PDB_id][chain]={} + length= columns[2].text.strip() + Protein_DNAComplex_dict[PDB_id][chain]['Molecule']= "Protein" + Protein_DNAComplex_dict[PDB_id][chain]['Detail']= molecule + Protein_DNAComplex_dict[PDB_id][chain]['Length']= length + + + + df = df.append({'PDB_Code':PDB_id,'Molecule':molecule, 'Chain':chain, 'Length':length}, ignore_index=True) + + + + + for tr in soup.find_all('table',class_='table table-bordered table-condensed tableEntity',id=re.compile("^table_macromolecule-dna-entityId")): + + columns2 = tr.find_all('td') + if(columns2 != []): + moleculeDNA= columns2[0].text.strip() + chainDNA=columns2[1].text.strip() + Protein_DNAComplex_dict[PDB_id][chainDNA]={} + lengthDNA= columns2[2].text.strip() + + Protein_DNAComplex_dict[PDB_id][chainDNA]['Molecule']="DNA" + Protein_DNAComplex_dict[PDB_id][chainDNA]['Detail']= moleculeDNA + Protein_DNAComplex_dict[PDB_id][chainDNA]['Length']= lengthDNA + + df = df.append({'PDB_Code':PDB_id,'Molecule':moleculeDNA, 'Chain':chainDNA, 'Length':lengthDNA}, ignore_index=True) + + + + # Form for selecting the Peptide chains of interest for the USERR + print ("
") + + print ("") + print ("") + print ("") + print ("") + print ("") + + print ("") + print ("") + + for k,dk in Protein_DNAComplex_dict.items(): + length_of_rowspan = len(Protein_DNAComplex_dict[k]) + print ("") + print ("") + + for chainKey, lengthValue in dk.items(): + print ("") + print ("") + print ("") + print ("") + print ("") + print ("
") + print ("
") + print ("
PDB IDChainMoleculeLengthSelect
"% length_of_rowspan,k, "", chainKey,"", dk[chainKey]['Detail'],"", dk[chainKey]['Length'],"") + values_add = k + ':' + chainKey + if dk[chainKey]['Molecule']=='Protein': + + print ("" % (values_add)) + print ("
") + print ("
") + + print ("") + print ("") + print ("" %(InputFileName)) + + print ("
") + +else: + print ("

Please enter a PDB code and try again!

") + sys.exit() + + + + + + + + + + + + + + +print ("") +print ("") \ No newline at end of file diff --git a/DNA_binding_samplefile.fasta b/DNA_binding_samplefile.fasta deleted file mode 100644 index 54067e7..0000000 --- a/DNA_binding_samplefile.fasta +++ /dev/null @@ -1,15 +0,0 @@ ->Myb13 -KGPWTEQEDMKLAWFVRLFGERRWDFLAKVSGLNRTGKSCRLRWVNYLHPDLKR -GRMSPEEERLVVDLHARWGNRWSRIAKAMPGRTDNEIKNYWRTHTRKLHK ->Myb59 -GGFRKGPWTEQEDMKLAWFVRLFGERRWDFLAKVSGLNRTGKSCRLRWVNYLHPDLKR -GRMSPEEERLVVDLHARWGNRWSRIAKAMPGRTDNEIKNYWRTHTRKLHK ->6KKS:A -GNNEYKKGLWTVEEDKILMDYVKAHGKGHWNRIAKKTGLKRCGKSCRLRWMNYLSPNVKR -GNFTEQEEDLIIRLHKLLGNRWSLIAKRVPGRTDNQVKNYWNTHLSKKLGIKDQKTKQS ->Myb3 -EGVKRGAWTSKEDQTLASYIKAHGEGRWKEVPLKAGLRRCGKSCRLRWLNYLRPSIKR -GNISDDDEELIVRLHRLLGNRWSLIAGRLPGRTDNEIKNYWNSTLGRK ->Myb4 -KAHTNKGAWTKEEDDRLTAYIKAHGEGCWRSLPKAAGLLRCGKSCRLRWINYLRPDLKR -GNFSDEEDELIIKLHSLLGNKWSLIAGRLPGRTDNEIKNYWNTHIRRK diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f9141a7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,75 @@ +FROM ubuntu:22.04 + +# Initialise apt-get +RUN apt-get update --fix-missing + +# Install programs needed for the server to run +RUN apt-get install -y net-tools +RUN apt-get install -y wget +RUN apt-get install -y sudo +RUN apt-get install -y vim-tiny +RUN apt-get install -y libgl1-mesa-glx +RUN apt-get install -y cron +RUN apt-get install -y clustalo +RUN apt-get install -y mafft +RUN apt-get install -y python3-pip +RUN pip install panel bokeh +RUN pip install nglview +RUN pip install biotite +#RUN pip install pybioviz +RUN pip install plotly==5.11.0 +RUN pip install dash + +# Set the working directory +RUN mkdir -p /opt/MSALigMap +WORKDIR /opt/MSALigMap + +# Install XAMPP +#RUN wget https://downloadsapachefriends.global.ssl.fastly.net/8.1.6/xampp-linux-x64-8.1.6-0-installer.run +RUN wget https://sourceforge.net/projects/xampp/files/XAMPP%20Linux/8.1.6/xampp-linux-x64-8.1.6-0-installer.run +RUN chmod +x xampp-linux-x64-8.1.6-0-installer.run +RUN sudo /opt/MSALigMap/xampp-linux-x64-8.1.6-0-installer.run + +# Install Anaconda +RUN wget https://repo.anaconda.com/archive/Anaconda3-2022.05-Linux-x86_64.sh +RUN chmod +x Anaconda3-2022.05-Linux-x86_64.sh +RUN ./Anaconda3-2022.05-Linux-x86_64.sh -b -p /usr/local/Anaconda3 + +# Install python dependencies +RUN /usr/local/Anaconda3/bin/conda install -y -c conda-forge biopython + +# Configure a con job to regularly remove SVG files +RUN echo "* 0 * * * root rm /opt/lampp/htdocs/MSALigMap/tmp/*.svg" >> /etc/crontab +RUN echo "* 0 * * * root rm /opt/lampp/htdocs/MSALigMap/tmp/*.zip" >> /etc/crontab + +# Install MSALigMap +RUN mkdir /opt/lampp/htdocs/MSALigMap +RUN mkdir /opt/lampp/htdocs/MSALigMap/tmp +#RUN mkdir /opt/lampp/htdocs/MSALigMap/jalview-js +RUN chmod 775 /opt/lampp/htdocs/MSALigMap/tmp +#RUN chmod 775 /opt/lampp/htdocs/MSALigMap/jalview-js +RUN chmod 775 /opt/lampp/htdocs/MSALigMap +RUN chgrp -R daemon /opt/lampp/htdocs/MSALigMap + +WORKDIR /opt/lampp/htdocs/MSALigMap +ADD httpd.conf /opt/lampp/etc/ +ADD *.py /opt/lampp/htdocs/MSALigMap/ +#ADD *.gif /opt/lampp/htdocs/MSALigMap/ +#ADD *.png /opt/lampp/htdocs/MSALigMap/ +ADD *.jpg /opt/lampp/htdocs/MSALigMap/ +ADD *.jpeg /opt/lampp/htdocs/MSALigMap/ +#ADD jalview-js /opt/lampp/htdocs/MSALigMap/jalview-js +RUN chmod +x /opt/lampp/htdocs/MSALigMap/*.py +#RUN ln -s /usr/bin/clustalo +#RUN pip install biotite +#RUN sudo apt-get install -y mafft +#RUN sudo apt-get install -y dssp + + +# TO BE MOVED +#RUN apt-get install -y nano + +# Start the server +ENV PATH=/usr/local/Anaconda3/bin:/opt/lampp/htdocs/MSALigMap:$PATH +EXPOSE 80 +CMD /opt/lampp/xampp start; service cron start; bash diff --git a/HA.jpg b/HA.jpg new file mode 100755 index 0000000..b8452c4 Binary files /dev/null and b/HA.jpg differ diff --git a/HomePage.py b/HomePage.py new file mode 100755 index 0000000..2cec515 --- /dev/null +++ b/HomePage.py @@ -0,0 +1,96 @@ +#!/usr/bin/env python3.9 + +# Import modules for CGI handling +import cgi, cgitb +# Create instance of FieldStorage +form = cgi.FieldStorage() + +# Get data from fields +if form.getvalue('subject'): + subject = form.getvalue('subject') +else: + subject = "Not set" + + +print("Content-type:text/html\r\n\r\n") +print("") +print("") + +print("") + +print("MSALigMap") +print("") +#print "

CoFactComp

" +#print "
" +#print "" + +#print "
" +#print "LiBisCo " +#print "

Ligand Binding Site Comparison

" +#print "
" + +print("
") +#print "
" +#print "LiBiSCo","
" +#print " Li gand Binding Site Comparison" +print("
") +#print "
" + + + +print("") +print("") +#Body size Determination + + +print("
") +print("

MSALigMap - Comparing the Binding Residues for the Selected Protein Sequences

") +#print "
" +print("
") +print("

Proteins binds to ligands (small molecules, DNA, RNA, peptide and proteins) to perform all kinds of important and essential cellular processes. They bind via a network of weak, noncovalent intermolecular interactions such as hydrogen bonding, hydrophobic and electrostatic interactions. Thus, binding of substrate is required for many proteins to function properly. Ligands are recognized in the binding pockets of the proteins through amino acids of specific properties. With increasing number of genomes having now sequenced, computational approach is the method of choice for characterizing proteins using homology-based information. Homology based approach is widely used for functional annotating sequences for identifying ligand, peptide and DNA binding sites etc from proteins with known function that are bound with ligand molecules. The MSALigMap is a tool that can be used for annotating protein sequences based on homology using protein structural information. User should submit protein sequences (homologous) and homologous protein structures bound to ligands of interest or DNA to map the binding sites for the uncharacterized protein sequences.

") + + + +print("
") +print("
") +#print "" + +print("") +print("") diff --git a/LigPage.py b/LigPage.py new file mode 100755 index 0000000..e030257 --- /dev/null +++ b/LigPage.py @@ -0,0 +1,941 @@ +#!/usr/bin/env python3 + +# Import modules for CGI handling +import cgi, cgitb +cgitb.enable() +import os +import argparse +import sys +from Bio import SeqIO +from Bio.Align.Applications import MafftCommandline +#from StringIO import StringIO +from Bio import AlignIO +from Bio.PDB import * +from Bio.PDB.Polypeptide import PPBuilder +import subprocess +import urllib +from collections import OrderedDict +import requests +from bs4 import BeautifulSoup +import itertools +import shutil +from Bio import motifs +from Bio.Seq import Seq + +import random +import string + +sys.path.append('/usr/local/Anaconda3/lib/') + +# Create instance of FieldStorage +form = cgi.FieldStorage() + + +# Get data from field +if form.getvalue('textcontent'): + text_content = form.getvalue('textcontent') +else: + text_content = "Not entered" + + + +print ("Content-type:text/html\r\n\r\n") +print ("") +print ("") + +#HTML style details for web page +print ("") +#Style ends here + +print ("MSALigMap") +print ("") +#print "

CoFactComp

" +print ("
") +print ("
") +print ("") +print ("") +print ("
") +print ("

Below is shown the mapped binding sites for the sequences

") + +#print lig_content +#capturing the entered pdb ids into list +variable = "" +value = "" +r = "" +value_dict={} +lig_sel=[] +l="" +InputFileName="" + +l=[] +for key in form.keys(): + if key !='ligatom': + variable = str(key) + value = str(form.getvalue(variable)) + if variable == 'SequencePath': + InputFileName= value + + if variable== 'LigSelection': + l.append(value) + value_dict.setdefault(variable,[]).append(value) + r += "

"+ variable +", "+ value +"

\n" + + + +folderpath= os.path.split(InputFileName)[0] + + +out_file= folderpath + '/seqaligned1.fasta' +mafft_exe = "mafft" +pdbl=PDBList() +ppb=PPBuilder() +pdb_id=[] +pdburl="https://files.rcsb.org/download/" +PDBdir= folderpath + "/PDB" +pdb_seq_dict=OrderedDict() +pdb_seq_dict_numbering=OrderedDict() +pdb_seqfin=OrderedDict() +non_pdb_id=[] +non_pdb_seq_dict=OrderedDict() +non_pdb_seq_dictfin=OrderedDict() +pdbid_lig=OrderedDict() +check_aa=[] +NONHcheck_aa=[] +updated_indexed_bindingsite=OrderedDict() +updated_indexed_NONHbindingsite=OrderedDict() + +Alignment_adjusted_indexed_Hbindingsite=OrderedDict() +Alignment_adjusted_indexed_NONHbindingsite=OrderedDict() + +##dssp +dssp_urlpart1='https://mrs.cmbi.umcn.nl/search?db=all&q=' +dssp_urlpart2='&count=3' +dssp_final_url1='https://mrs.cmbi.umcn.nl/entry?db=dssp&nr=' +dssp_final_url2='&rq=' + +##dssp + + +aa_dict={'CYS': 'C', 'ASP': 'D', 'SER': 'S', 'GLN': 'Q', 'LYS': 'K', + 'ILE': 'I', 'PRO': 'P', 'THR': 'T', 'PHE': 'F', 'ASN': 'N', + 'GLY': 'G', 'HIS': 'H', 'LEU': 'L', 'ARG': 'R', 'TRP': 'W', + 'ALA': 'A', 'VAL':'V', 'GLU': 'E', 'TYR': 'Y', 'MET': 'M'} + +pdbsum_URL="http://www.ebi.ac.uk/thornton-srv/databases/cgi-bin/pdbsum/GetPage.pl?pdbcode=" +pdbsum_URL2="&template=links.html" +ebiurl="www.ebi.ac.uk" +pdbsum_dict=OrderedDict() +DSSP_SS=OrderedDict() +Prot_AA=OrderedDict() +aa_text_dict=OrderedDict() +PDB_code_ligand_dict ={} +for items_names in l: + print (items_names) + + items_names_split= items_names.split('_') + ligand_name= items_names_split[1] + PDB_id = items_names_split[0].split(':')[0] + # print (PDB_id) + PDB_code_ligand_dict[PDB_id]={} + # PDB_code_ligand_dict[PDB_id]['Chain']={} + # PDB_code_ligand_dict[PDB_id]['Ligand']={} + Chain_id = items_names_split[0].split(':')[1] + PDB_code_ligand_dict[PDB_id]['Chain']=Chain_id + PDB_code_ligand_dict[PDB_id]['Ligand']=ligand_name + pdbid_lig.setdefault(items_names_split[0],[]).append(ligand_name) + + + + + +def merge_pdb_nonpdb(dict1,dict2): + combine=dict1.copy() + combine.update(combine) + return combine + +PDBCode_FromSequenceFile={} +with open(InputFileName, 'r') as f: + for record in SeqIO.parse(f, "fasta"): + ids_pdb=record.id.split(':')[:1] + if len(''.join(ids_pdb)) == 4: + chain_name=record.id.split(':')[1:] + ext=chain_name[0] + PDBCode_FromSequenceFile[ids_pdb[0]]=ext + filesset=pdbl.download_pdb_files(ids_pdb, obsolete=False, pdir=PDBdir, file_format="pdb", overwrite=False) + if len(''.join(ids_pdb)) > 4: + non_pdb_id.append(record.id) + swis_seq=str(record.seq) + non_pdb_seq_dict.setdefault(record.id,[]).append(record.seq) + non_pdb_seq_dictfin.setdefault(record.id,[]).append(swis_seq) + + + pdb_id.append(record.id) + for data in os.listdir(PDBdir): + paths= PDBdir + '/'+ data + # print ('paths',paths) + # print("
") + idschange =os.path.splitext(paths)[0].split('/')[-1].replace('pdb', '') + # idschange=paths.split("/")[1][3:] + # print ('idschange',idschange) + # print("
") + pdbid_dict=os.path.splitext(idschange)[0]+':'+ext + # print ('pdbid_dict',pdbid_dict) + + with open(paths, 'r') as f: + for line in f: + lines=line.split() + if lines[0]=="ATOM" and lines[2]=="CA" and lines[4]==ext : + if len(lines[3])==3: + found= (aa_dict[key] for key in aa_dict.keys() if key == lines[3]) + for item in found: + pdb_seq_dict.setdefault(pdbid_dict, []).append(item) + pdb_seq_dict_numbering.setdefault(pdbid_dict, []).append(lines[5]) + elif lines[3][0]==ext: + found1= (aa_dict[key] for key in aa_dict.keys() if key == lines[3][1:]) + for item1 in found1: + pdb_seq_dict.setdefault(pdbid_dict, []).append(item1) + pdb_seq_dict_numbering.setdefault(pdbid_dict, []).append(lines[5]) +print("
") +print("
") + +#Checking PDB ids in sequence file (using here pdbid_dict) and PDB ids in selected forms (using here PDB_code_ligand_dict) are the same + +for Checkkeys, Checkvalues in PDBCode_FromSequenceFile.items(): + if Checkkeys in PDB_code_ligand_dict.keys(): + if not PDBCode_FromSequenceFile[Checkkeys] == PDB_code_ligand_dict[Checkkeys]['Chain']: + print(f"

ERROR! The typed protein CHAIN for the PDB code '{Checkkeys}' is '{PDB_code_ligand_dict[Checkkeys]['Chain']}' whereas the CHAIN for PDB code '{Checkkeys}' in the uploaded sequence file is ' {PDBCode_FromSequenceFile[Checkkeys]} ', which are not the same.

") + sys.exit() + + +for keys,vals in pdb_seq_dict.items(): + aas_string=''.join(map(str,vals)) + pdb_seqfin.setdefault(keys,[]).append(aas_string) + + +combine=dict(list(non_pdb_seq_dictfin.items()) + list(pdb_seqfin.items())) +# print (combine) +with open(folderpath+'/trimmedfasta.fasta', 'w') as files: + for seqids, seqn in combine.items(): + files.write( ">" + seqids) + files.write("\n") + files.write (seqn[0]) + files.write("\n") + +trimmedfastafile = folderpath+'/trimmedfasta.fasta' +mafft_cline = MafftCommandline(mafft_exe, input=trimmedfastafile) +stdout, stderr = mafft_cline() + +with open(out_file, "w") as handle: + handle.write(stdout) + + +with open(folderpath+ '/file_tab.txt', 'w') as files_tab: + for record in SeqIO.parse(out_file, 'fasta'): + tabform='{}\t{}'.format(record.description, record.seq) + files_tab.write(tabform) + files_tab.write('\n') + +#Preparing PdbSum Url with selected PDB ids +for ids,lig in pdbid_lig.items(): + ids_splitslig=str(ids).split(':')[0] + pdbsumurl=pdbsum_URL+ids_splitslig+pdbsum_URL2 + pdbsum_dict.setdefault('%s'%ids,[]).append(pdbsumurl) +#Extracting the Href links from PDBSum home page for the selected PDB ids and Ligands using BeautifulSoup + +mydictcheck=OrderedDict() + +for (lurl,murl), (lid,mid) in zip(pdbsum_dict.items(), pdbid_lig.items()): + page = requests.get(murl[0]) + + soup = BeautifulSoup(page.content, 'html.parser') + for h in soup.find_all('a', class_='menuClass' , attrs={"onmouseover" : "return overlib('Go to Ligands page for this ligand', WRAP);"}): + for i in h: + try: + if i.strip()==mid[0]: + # print (i.strip()) + linkfin="http://" + ebiurl + str(h).split()[2].split('"')[1] + page2 = requests.get(linkfin) + soup2 = BeautifulSoup(page2.content, 'html.parser') + for h2 in soup2.find_all('td', class_='ftxt'): + for i2 in h2: + fort=str(i2).split('"') + for tan in fort: + + if 'List of interactions' in tan: + index_pos_list = [ i for i in range(len(fort)) if '/thornton-srv/databases/cgi-bin/pdbsum/GetLigInt.pl?pdb' in fort[i]] + # print ("tan",tan, '--><---', fort) + finalliglink="http://www.ebi.ac.uk" + fort[index_pos_list[0]].replace('amp;', '') + mydictcheck[lid]="http://www.ebi.ac.uk" + fort[index_pos_list[0]].replace('amp;', '') + except TypeError: + i=str(i).replace('
', '\n') + +#selecting common ligand atoms that are hydrogen bonded in selected PDB structures +H_printing = False +H_atoms_commoncomp={} +for pdbsumids, pdbsumlink in mydictcheck.items(): + H_links_sel1=str(pdbsumlink).replace("&", "&") + pdbsumids_chain=str(pdbsumids).split(":")[1] + + weblink=requests.get(H_links_sel1) + for H_atomlines in weblink.iter_lines(): + H_atomlines1=H_atomlines.strip() + + if H_atomlines1.startswith(b'Hydrogen bonds'): + H_printing = True + elif H_atomlines1.startswith(b'Non-bonded contacts'): + H_printing = False + if H_printing: + if H_atomlines1.startswith((b'0', b'1', b'2', b'3', b'4', b'5', b'6', b'7', b'8', b'9')): + H_atomlines2=H_atomlines1.split() + H_atomlines2 = [w1.decode('utf8').replace('b', '') for w1 in H_atomlines2] + H_atm_sel=H_atomlines2[3] + if pdbsumids_chain==H_atomlines2[5]: + concat_aa_no=H_atm_sel+"_"+H_atomlines2[4] + if concat_aa_no not in check_aa: + check_aa.append(concat_aa_no) + found_aa= (aa_dict[key] for key in aa_dict.keys() if key == H_atomlines2[3]) + for items_aa in found_aa: + H_atm_sel=items_aa+"_"+H_atomlines2[4] + H_atoms_commoncomp.setdefault(pdbsumids,[]).append(H_atm_sel) + check_aa=[] +NONH_printing = False +NONHatoms_commoncomp={} + +for NONHpdbsumids,NONHpdbsumlink in mydictcheck.items(): + NONHlinks_sel1=str(NONHpdbsumlink).replace("&", "&") + NONHpdbsumids_chain=str(NONHpdbsumids).split(":")[1] + weblink1=requests.get(NONHlinks_sel1) + for NONHatomlines in weblink1.iter_lines(): + NONHatomlines1=NONHatomlines.strip() + if NONHatomlines1.startswith(b"Non-bonded contacts"): + NONH_printing = True + + elif NONHatomlines1.startswith(b"Hydrogen bonds"): + NONH_printing = False + if NONH_printing: + if NONHatomlines1.startswith((b'0', b'1', b'2', b'3', b'4', b'5', b'6', b'7', b'8', b'9')): + + NONHatomlines2=NONHatomlines1.split() + NONHatomlines2 = [w.decode('utf8').replace('b', '') for w in NONHatomlines2] + # print(NONHatomlines2) + NONHatm_sel=NONHatomlines2[3] + if NONHatomlines2[5]==NONHpdbsumids_chain: + NONHconcat_aa_no=NONHatm_sel+"_"+ NONHatomlines2[4] + if NONHconcat_aa_no not in NONHcheck_aa: + # print (NONHconcat_aa_no) + NONHcheck_aa.append(NONHconcat_aa_no) + found_aa= (aa_dict[key] for key in aa_dict.keys() if key == NONHatomlines2[3]) + for items_aa in found_aa: + NONH_atm_sel=items_aa+"_"+NONHatomlines2[4] + NONHatoms_commoncomp.setdefault(NONHpdbsumids,[]).append(NONH_atm_sel) + NONHcheck_aa=[] +for ids,aa_numb1 in H_atoms_commoncomp.items(): + aa_numb= [w3.replace('u', '') for w3 in aa_numb1] + for ids1, numb in pdb_seq_dict_numbering.items(): + if ids==ids1.upper(): + for j in aa_numb: + numb_split=j.split('_') + updated_indexed_bindingsite.setdefault(ids,[]).append(numb.index(numb_split[1])) + +for ids_1,aa_numb1 in NONHatoms_commoncomp.items(): + for ids2, numb2 in pdb_seq_dict_numbering.items(): + if ids_1==ids2.upper(): + for j1 in aa_numb1: + numb_split1=j1.split('_') + updated_indexed_NONHbindingsite.setdefault(ids_1,[]).append(numb2.index(numb_split1[1])) + + +with open(folderpath + "/file_tab.txt",'r') as files: + for line in files: + + line1=line.split()[1:] + SS_list=[] + pdbids_chain=line.split()[:1] + + pdbids_chain_split=''.join(pdbids_chain).split(':') + if len(pdbids_chain_split) > 1: + + check_ids=''.join(pdbids_chain).split(':')[0]#[1:] + + pdb_chain=''.join(pdbids_chain).split(':')[1] + dssp_urlpart12_concat= dssp_urlpart1+check_ids+dssp_urlpart2 + + dssp_allDBpage = requests.get(dssp_urlpart12_concat) + dsspsource = BeautifulSoup(dssp_allDBpage.content, 'html.parser') + for MRSallDB_link in dsspsource.find_all('a'): + for dssplink in MRSallDB_link: + + if dssplink==(check_ids.upper()): + + dssp_href= str(MRSallDB_link).split(';') + + if dssp_href[0]==''): + check_ids=''.join(check_ids.split('>')) + Prot_AA.setdefault(check_ids, []).append(''.join(AA_temp)) + else: + Prot_AA.setdefault(check_ids, []).append(''.join(AA_temp)) + +####updating index number for binding site based on alignment for the given sequences + +for Hkey1,Hvalues1 in updated_indexed_bindingsite.items(): + H_count =0 + H_count1=0 + # print ("Hkey1",Hkey1) + Hkey1=str(Hkey1).split(':')[0] + if Hkey1.lower() in aa_text_dict.keys(): + for H_X, H_i in enumerate(aa_text_dict[str(Hkey1.lower()).split(':')[0]]): + if H_i=='-': + H_count+=1 + else: + if H_count1 in Hvalues1: + Alignment_adjusted_indexed_Hbindingsite.setdefault(Hkey1, []).append(H_X) + H_count1+=1 + + + +# print (Alignment_adjusted_indexed_Hbindingsite) +for NONHkey1,NONHvalues1 in updated_indexed_NONHbindingsite.items(): + NONH_count =0 + NONH_count1=0 + NONHkey1=str(NONHkey1).split(':')[0] + if NONHkey1.lower() in aa_text_dict.keys(): + for NONH_X, NONH_i in enumerate(aa_text_dict[NONHkey1.lower()]): + if NONH_i=='-': + NONH_count+=1 + else: + if NONH_count1 in NONHvalues1: + Alignment_adjusted_indexed_NONHbindingsite.setdefault(NONHkey1, []).append(NONH_X) + NONH_count1+=1 +prot_Idsname=list(Prot_AA.keys()) +digits1=len(max(prot_Idsname)) +f1 = '{0:>%d}: ' % (digits1) + +print ("
") + +print("Color coded secondary structure elements ") +print('
') +structurecode="B = beta-bridge residue, E = extended strand (in beta ladder), G = 3/10-helix, H= alpha-helix, I = Pi helix, S = bend , T = H-bonded turn" +print(structurecode) +print('
') +print('
') +print("")# align='center'>") +##holding the keys of Prot_AA dictionary +SeqID_ref= list(sorted(Prot_AA.keys()))[0] + +for itemlength in range(len(Prot_AA[SeqID_ref])): + + for dictkeys in sorted(Prot_AA.keys()): + + gapcount=0 + resindex=0 + + if dictkeys in DSSP_SS: + + print("") + # print("") + print("") + if itemlength==0: + + count=0 + resindex=0 + elif itemlength>0: + count=itemlength*60 + resindex=itemlength*60 + + if dictkeys in DSSP_SS.keys(): + + ss=DSSP_SS[dictkeys][itemlength] + # print (ss) + print("") + # print("") + print("") + print("") + print("") + ##print secondary structure and sequences + print("") + print("") + + + + print("") + print("") + print("") + +print("
") + DSS_ID_print1=dictkeys+'_Sec_Str'+'\t' + print(DSS_ID_print1) + print("") + # print("
")
+            for sec_str in ss:
+                
+                
+                if sec_str=='H':
+                    helix= "%s"%sec_str
+                    print(helix)
+                elif sec_str=='E':
+                    strand="%s"%sec_str
+                    print(strand)
+                elif sec_str=='S':
+                    bend="%s"%sec_str
+                    print(bend)  
+                elif sec_str=='T':
+                    turn="%s"%sec_str
+                    print(turn)
+                elif sec_str=='G':
+                    helix_310="%s"%sec_str
+                    print(helix_310)
+                elif sec_str=='I':
+                    Pi_helix="%s"%sec_str
+                    print(Pi_helix)
+                elif sec_str=='B':
+                    beta_bridge="%s"%sec_str
+                    print(beta_bridge)
+                else:
+                    other_SS="%s"%sec_str
+                    print(other_SS)
+        print("
") + # print('
') + dictkeys2=dictkeys+'\t' + dictkeys1="%s" %dictkeys2 + print(dictkeys1) + print("
") + for i in Prot_AA[dictkeys][itemlength]: + + + if i=='-': + res_size= "%s" %i + print(res_size) + count+=1 + gapcount+=1 + elif dictkeys.upper() in Alignment_adjusted_indexed_Hbindingsite.keys() or dictkeys.upper() in Alignment_adjusted_indexed_NONHbindingsite.keys(): + if count in Alignment_adjusted_indexed_Hbindingsite[dictkeys.upper()]: #and not Alignment_adjusted_indexed_NONHbindingsite[dictkeys]: + if i.startswith(('A','I','L','M','V')): + bolded="%s" %i+'' + print(bolded) + if i.startswith(('F','W', 'Y')): + bolded="%s" %i+'' + print(bolded) + if i.startswith(('K','R', 'H')): + bolded="%s" %i+'' + print(bolded) + if i.startswith(('E','D')): + bolded="%s" %i+'' + print(bolded) + if i.startswith(('N','Q','S','T')) : + bolded="%s" %i+'' + print(bolded) + if i.startswith(('G','P')): + bolded="%s" %i+'' + print(bolded) + if i.startswith(('C')): + bolded="%s" %i+'' + print(bolded) + count+=1 + elif count in Alignment_adjusted_indexed_NONHbindingsite[dictkeys.upper()]: #and not Alignment_adjusted_indexed_Hbindingsite[dictkeys]: + if i.startswith(('A','I','L','M','V')): + underlined="%s" %i+'' + print(underlined) + if i.startswith(('F','W', 'Y')): + underlined="%s" %i+'' + print(underlined) + if i.startswith(('K','R', 'H')): + underlined="%s" %i+'' + print(underlined) + if i.startswith(('E','D')): + underlined="%s" %i+'' + print(underlined) + if i.startswith(('N','Q','S','T')): + underlined="%s" %i+'' + print(underlined) + if i.startswith(('G','P')): + underlined="%s" %i+'' + print(underlined) + if i.startswith(('C')): + underlined="%s" %i+'' + print(underlined) + count+=1 + + + else: + res_sizePDB= "%s" %i + print(res_sizePDB) + count+=1 + else: + res_sizeNonPDB= "%s" %i + print(res_sizeNonPDB) + print("
") + print("
") + + +## making of Weblog and binding residues alignment +# merginf og hydrogen and nonhydrogen bondong residues +mergeH_H_NHddict= {key: value + Alignment_adjusted_indexed_NONHbindingsite[key] for key, value in Alignment_adjusted_indexed_Hbindingsite.items()} +#making a unique list for each key in dictionary by removing duplicate items in the list +unique_mergeddict_H_NH= {k:sorted(set(j),key=j.index) for k,j in mergeH_H_NHddict.items()} +#making a list of binding residue indexes (according to aligned positions) from unique_mergeddict +H_NHnew_list=[] +for H_NHkey in unique_mergeddict_H_NH.keys(): + for index_items in unique_mergeddict_H_NH[H_NHkey]: + if index_items not in H_NHnew_list: + H_NHnew_list.append(index_items) +#making a dictionary for creating a weblogo +weblogo_align=OrderedDict() +weblogo_gap_to_X=OrderedDict() + +for pdbid in aa_text_dict.keys(): + for H_NHnum in sorted(H_NHnew_list): + H_NHresidues=aa_text_dict[pdbid][H_NHnum] + weblogo_align.setdefault(pdbid, []).append(H_NHresidues)# dictionary where gaps are not replaced with X + if aa_text_dict[pdbid][H_NHnum]!='-': + residuesnew=aa_text_dict[pdbid][H_NHnum] + weblogo_gap_to_X.setdefault(pdbid, []).append(residuesnew) + else: + residuesX='X' + weblogo_gap_to_X.setdefault(pdbid, []).append(residuesX)# dictionary where gaps are replaced with X + + +#### For hydrongen bonded interactions only +H_new_list=[] +for key in Alignment_adjusted_indexed_Hbindingsite.keys(): + for H_index_items in Alignment_adjusted_indexed_Hbindingsite[key]: + if H_index_items not in H_new_list: + H_new_list.append(H_index_items) + +H_weblogo_align=OrderedDict() +H_weblogo_gap_to_X=OrderedDict() + +for H_pdbid in aa_text_dict.keys(): + for H_num in sorted(H_new_list): + H_residues=aa_text_dict[H_pdbid][H_num] + H_weblogo_align.setdefault(H_pdbid, []).append(H_residues) + if aa_text_dict[H_pdbid][H_num]!='-': + H_residuesnew=aa_text_dict[H_pdbid][H_num] + H_weblogo_gap_to_X.setdefault(H_pdbid, []).append(H_residuesnew) + else: + H_residuesX='X' + H_weblogo_gap_to_X.setdefault(H_pdbid, []).append(H_residuesX) + +print ("
") + + +print ("
") + +print("
Alignment of hydrogen bonded interacting residues
") +print("
") + + +H_identical_index=[] +for H_ind, H_elems in enumerate(zip(*H_weblogo_align.values())): + # print ("%d %s" % (H_ind, H_elems)) + + if H_elems[1:] == H_elems[:-1]: + H_identical_index.append(H_ind) + + +print("") +for H_dictkeys in sorted(H_weblogo_align.keys()): + print("") + print("") + + print("") + print("") + print("") +print("
") + H_ident_count=0 + if str(H_dictkeys).startswith('>'): + H_dictkeys_split=str(H_dictkeys).split('>') + + print(str(H_dictkeys_split[1])) + print("") + for H_res in H_weblogo_align[H_dictkeys]: + if H_ident_count in H_identical_index: + H_underlined="%s" %H_res + print(H_underlined) + H_ident_count+=1 + else: + H_no_conse="%s" %H_res+'' + print(H_no_conse) + H_ident_count+=1 + else: + print(H_dictkeys) + print("") + for H_res in H_weblogo_align[H_dictkeys]: + if H_ident_count in H_identical_index: + H_underlined1="%s" %H_res + print(H_underlined1) + H_ident_count+=1 + else: + H_no_conse1="%s" %H_res+'' + print(H_no_conse1) + H_ident_count+=1 + + print("
") + + +# #making H_weblogo +# H_protmotif=[] +# H_bonding='Hbonding'+'.svg' +# print ("H_weblogo_gap_to_X",H_weblogo_gap_to_X) +# for H_webid in H_weblogo_gap_to_X.keys(): +# H_var=''.join(H_weblogo_gap_to_X[H_webid]) +# H_protmotif.append(Seq(H_var, generic_protein)) +# H_seq = motifs.create(H_protmotif) +# print (H_seq) +# H_seq.weblogo(H_bonding,format='SVG',xaxis_label= 'Residues', show_errorbars= False, color_scheme= 'color_chemistry') +# Hsrc="
"%H_bonding +# print(Hsrc) +# print("
") +# print("
") + + +#### For Non_hydrongen bonded interactions only +NH_new_list=[] +for NHkey in Alignment_adjusted_indexed_NONHbindingsite.keys(): + for NHindex_items in Alignment_adjusted_indexed_NONHbindingsite[NHkey]: + if NHindex_items not in NH_new_list: + NH_new_list.append(NHindex_items) + +NH_weblogo_align=OrderedDict() +NH_weblogo_gap_to_X=OrderedDict() + +for NH_pdbid in aa_text_dict.keys(): + for NH_num in sorted(NH_new_list): + NH_residues=aa_text_dict[NH_pdbid][NH_num] + NH_weblogo_align.setdefault(NH_pdbid, []).append(NH_residues) + if aa_text_dict[NH_pdbid][NH_num]!='-': + NH_residuesnew=aa_text_dict[NH_pdbid][NH_num] + NH_weblogo_gap_to_X.setdefault(NH_pdbid, []).append(NH_residuesnew) + else: + NH_residuesX='X' + NH_weblogo_gap_to_X.setdefault(NH_pdbid, []).append(NH_residuesX) + + +print("
") +print("
") +print("
Alignment of non-bonded interacting residues
") +print("
") + +NH_identical_index=[] +for NH_ind, NH_elems in enumerate(zip(*NH_weblogo_align.values())): + + if NH_elems[1:] == NH_elems[:-1]: + NH_identical_index.append(NH_ind) + + +print("") +for NH_dictkeys in sorted(NH_weblogo_align.keys()): + print("") + print("") + + print("") + print("") + print("") +print("
") + NH_ident_count=0 + if str(NH_dictkeys).startswith('>'): + NH_dictkeys_split=str(NH_dictkeys).split('>') + + print(str(NH_dictkeys_split[1])) + print("") + for NH_res in NH_weblogo_align[NH_dictkeys]: + if NH_ident_count in NH_identical_index: + NH_underlined="%s" %NH_res + print(NH_underlined) + NH_ident_count+=1 + else: + NH_no_conse="%s" %NH_res+'' + print(NH_no_conse) + NH_ident_count+=1 + else: + print(NH_dictkeys) + print("") + for NH_res in NH_weblogo_align[NH_dictkeys]: + if NH_ident_count in NH_identical_index: + NH_underlined1="%s" %NH_res + print(NH_underlined1) + NH_ident_count+=1 + else: + NH_no_conse1="%s" %NH_res+'' + print(NH_no_conse1) + NH_ident_count+=1 + + print("
") + +# #making H_NH_weblogo +# NH_protmotif=[] +# NH_bonding='Nhbonding'+'.svg' +# print ("NH_weblogo_gap_to_X", NH_weblogo_gap_to_X) +# for NH_webid in NH_weblogo_gap_to_X.keys(): +# NH_var=''.join(NH_weblogo_gap_to_X[NH_webid]) +# NH_protmotif.append(Seq(NH_var, generic_protein)) +# NH_seq = motifs.create(NH_protmotif) +# NH_seq.weblogo(NH_bonding,format='SVG',xaxis_label= 'Residues', show_errorbars= False, color_scheme= 'color_chemistry') +# NHsrc="
"%NH_bonding +# print(NHsrc) +# print("
") +# print("
") + + +#print("Alignment of Both Hydrogen and Non-hydrogen interaction Residues") +print("
") +print("
") +print("
Alignment of hydrogen and non-bonded interacting residues
") +print("
") + +H_NH_identical_index=[] +for H_NH_ind, H_NH_elems in enumerate(zip(*weblogo_align.values())): + + if H_NH_elems[1:] == H_NH_elems[:-1]: + H_NH_identical_index.append(H_NH_ind) + + +print("") +for H_NH_dictkeys in sorted(weblogo_align.keys()): + print("") + print("") + + print("") + print("") + print("") +print("
") + H_NH_ident_count=0 + if str(H_NH_dictkeys).startswith('>'): + H_NH_dictkeys_split=str(H_NH_dictkeys).split('>') + + print(str(H_NH_dictkeys_split[1])) + print("") + for H_NH_res in weblogo_align[H_NH_dictkeys]: + if H_NH_ident_count in H_NH_identical_index: + H_NH_underlined="%s" %H_NH_res + print(H_NH_underlined) + H_NH_ident_count+=1 + else: + H_NH_no_conse="%s" %H_NH_res+'' + print(H_NH_no_conse) + H_NH_ident_count+=1 + else: + print(H_NH_dictkeys) + print("") + for H_NH_res in weblogo_align[H_NH_dictkeys]: + if H_NH_ident_count in H_NH_identical_index: + H_NH_underlined1="%s" %H_NH_res + print(H_NH_underlined1) + H_NH_ident_count+=1 + else: + H_NH_no_conse1="%s" %H_NH_res+'' + print(H_NH_no_conse1) + H_NH_ident_count+=1 + + print("
") + +print ("
") +# #making H_NH_weblogo +# protmotif=[] +# H_NONH='HNONH'+'.svg' +# for webid in weblogo_gap_to_X.keys(): +# var=''.join(weblogo_gap_to_X[webid]) +# protmotif.append(Seq(var, generic_protein)) +# seq = motifs.create(protmotif) +# print (seq) +# seq.weblogo(H_NONH,format='SVG',xaxis_label= 'Residues', show_errorbars= False, color_scheme= 'color_chemistry') +# H_NONHsrc="
"%H_NONH +# print(H_NONHsrc) +# print("
") +# print("
") + +os.remove(out_file) +# os.remove('/opt/lampp/htdocs/MSALigMap/tmp/ProtPep/foldernamer/trimmedfasta.fasta') +# shutil.rmtree('/opt/lampp/htdocs/MSALigMap/obsolete') +shutil.rmtree(folderpath) + +print ("") +print ("") diff --git a/LigPage1.py b/LigPage1.py new file mode 100644 index 0000000..83b3c64 --- /dev/null +++ b/LigPage1.py @@ -0,0 +1,231 @@ +#!/usr/bin/env python3 + +# Import modules for CGI handling +import cgi, cgitb +cgitb.enable() +import os +import argparse +import sys +# from Bio import SeqIO +# from Bio.Align.Applications import MafftCommandline +#from StringIO import StringIO +# from Bio import AlignIO +# from Bio.PDB import * +# from Bio.PDB.Polypeptide import PPBuilder +import subprocess +import urllib +from collections import OrderedDict +import requests +from bs4 import BeautifulSoup +import itertools +import shutil +# from Bio import motifs +# from Bio.Seq import Seq + +import random +import string + +sys.path.append('/usr/local/Anaconda3/lib/') +url="https://files.rcsb.org/view/" + + +# Create instance of FieldStorage +form = cgi.FieldStorage() + +# Get data from field +if form.getvalue('textcontent'): + text_content = form.getvalue('textcontent') + +else: + text_content = "" + +print ("Content-type:text/html\r\n\r\n") +print ("") +print ("") + +#HTML style details for web page +print ("") +#Style ends here + +print ("MSALigMap") +print ("") +#print "

CoFactComp

" +print ("
") +print ("
") +print ("") +print ("
") +print ("
") +print ("

Select a Ligand of interest!

")#print lig_content + +##Sequence file +#print lig_content +#capturing the entered pdb ids into list +if any(form.getvalue('filename').decode("utf-8")) == False : + print ("

Error!

") + print ("

Please upload a sequence file and try again!.

") + sys.exit() + +if text_content != None: + try: + for i in text_content: + text_content1=text_content.replace(' ', '') + l=text_content1.split(',') + + + + + foldernamer= ''.join(random.choices(string.ascii_letters, k=4)) + ProtLigfolder= '/opt/lampp/htdocs/MSALigMap/tmp/' + 'ProtLig' + + + isExist = os.path.exists(ProtLigfolder) + + if not isExist: + os.mkdir( ProtLigfolder) + + folderpath= ProtLigfolder + '/' +foldernamer + os.mkdir(folderpath) + + + fileitem = form['filename'] + fileattached = fileitem.value + InputFileName = folderpath + '/sequenceInputfile.fasta' + with open(InputFileName, 'wb') as fout: + fout.write(fileattached) + + + + + + ## + f2_list=[] + combined_list=[] + #print "entered id's",l + pdbid_list=[] + url_list=[] + prot_lig_dict={} + count=1 + + + pdbid_chain_dict={} + for i in l: + + each= i.split(':') + + pdbcode= each[0].upper() + chain=each[1].upper() # i am removing the +"="+"[]" + pdbid_list.append(each) + + pdbid_chain_dict[pdbcode]=chain + + + + + + #linking the PDB url address to the selected PDB ids + for x in l: + pdbcodename= x.split(':')[0] + pdbid=url+pdbcodename+".pdb" + url_list.append(pdbid) + + + + + + #Listing the PDB ids and their bound ligands + + for link,id in zip(url_list,list(pdbid_chain_dict.keys())): + + count=count+1 + try: + + f=urllib.request.urlopen(link) + f=f.readlines() + #print (f) + PDBCode_Chains=[] + for li in f: + if li.startswith(b'HET '): + + li= li.decode('UTF-8').split() + + + PDBCode_Chains.append(li[2]) + + if li[2]==pdbid_chain_dict[id]: + f2=li[1] + prot_lig_dict.setdefault(id,[]).append(f2) + + if not pdbid_chain_dict[id] in PDBCode_Chains: + print ("

Error! Please enter the correct chain for the PDB code and try again!

") + sys.exit() + + + + + except: + if pdbid_chain_dict=={}: + + print("

Error! Check the PDB code and the chain. Try again!

") + + ## Checking + + + + + # Form for selecting the ligands for interest for the USER + if not prot_lig_dict =={}: + + print ("
") + print ("") + print ("") + print ("") + print ("") + + + + + for k,dk in prot_lig_dict.items(): + + count= len(dk) + print ("") + print ("") + #print "" + for x in dk: + value_code = k + ':' + pdbid_chain_dict[k] + print ("") + print ("") + print ("") + print ("
") + print ("
") + print ("
PDB IDLIGANDS
"% count,k,":",pdbid_chain_dict[k], "
", "%s" % x,"") + values_add = value_code + '_' + x + print ("" % (values_add)) + + print ("
") + print ("
") + + print ("") + print ("") + print ("" %(InputFileName)) + print ("
") + + except: + print ("
") + print ("

ERROR!! Please enter PDB code with chain and try again!

") + + +print ("") +print ("") \ No newline at end of file diff --git a/LigPageDNA.py b/LigPageDNA.py new file mode 100755 index 0000000..b353a2c --- /dev/null +++ b/LigPageDNA.py @@ -0,0 +1,746 @@ +#!/usr/bin/env python3 + +# Import modules for CGI handling +import cgi, cgitb +cgitb.enable() +import os +import argparse +import sys +from Bio import SeqIO +from Bio.Align.Applications import MafftCommandline +#from StringIO import StringIO +from Bio import AlignIO +from Bio.PDB import * +from Bio.PDB.Polypeptide import PPBuilder +import subprocess +import urllib +from collections import OrderedDict +import requests +from bs4 import BeautifulSoup +import itertools +import shutil +from Bio import motifs +from Bio.Seq import Seq +import re +import random +import string +# sys.path.append('/Users/xhasam/anaconda2/lib') + +# Create instance of FieldStorage +form = cgi.FieldStorage() + + +# Get data from field +if form.getvalue('textcontent'): + text_content = form.getvalue('textcontent') +else: + text_content = "Not entered" + +#if form.getvalue('textcontent'): +# lig_content = form.getvalue('ligatom') +#else: +# lig_content = "Not entered" + +print ("Content-type:text/html\r\n\r\n") +print ("") +print ("") + +#HTML style details for web page +print ( "") +#Style ends here + +print ("MSALigMap") +print ("") +#print "

CoFactComp

" +print ("
") +# print ("") +print ("") +print ("") +print ("
") +print ("

Below is shown the mapped binding sites for the sequences

") + +#capturing the entered pdb ids into list +for i in text_content: + text_content1=text_content.replace(' ', '') + l=text_content1.split(',') +# print l +# Information of the selected ligands and PDB ids from LigPage.py +# print (form) + +if "DNASelection" not in form : + print ("

Error!

") + print ("

Please fill in the PDB code and sequence file fields.

") + + + + +PDB_Selected_list=[] +for key in form.keys(): + + + variable = (key) + value = (form.getvalue(variable)) + # print (variable,value) + # print ("
") + if variable== 'DNASelection': + # print ('DNASelection',value) + PDB_Selected_list.append(value) + + + + if variable == 'SequencePath': + InputFileName= value + +# print(PDB_Selected_list) +# print (InputFileName) + + + +folderpath= os.path.split(InputFileName)[0] +# print (folderpath) + +# foldernamer= ''.join(random.choices(string.ascii_letters, k=4)) +# ProtLigfolder= '/opt/lampp/htdocs/MSALigMap/tmp/' + 'ProtDNA' + +# isExist = os.path.exists(ProtLigfolder) + +# if not isExist: +# os.mkdir( ProtLigfolder) + +# folderpath= ProtLigfolder + '/' +foldernamer +# os.mkdir(folderpath) + + +# fileitem = form['filename'] +# fileattached = fileitem.value + +# InputFileName = folderpath + '/sequenceInputfile.fasta' +# with open(InputFileName, 'wb') as fout: +# fout.write(fileattached) + + +out_file= folderpath + '/seqaligned1.fasta' +mafft_exe = "mafft" +pdbl=PDBList() +ppb=PPBuilder() +pdb_id=[] +pdburl="https://files.rcsb.org/download/" +PDBdir= folderpath + "/PDB" +pdb_seq_dict=OrderedDict() +pdb_seq_dict_numbering=OrderedDict() +pdb_seqfin=OrderedDict() +non_pdb_id=[] +non_pdb_seq_dict=OrderedDict() +non_pdb_seq_dictfin=OrderedDict() +pdbid_lig=OrderedDict() +check_aa=[] +NONHcheck_aa=[] +updated_indexed_bindingsite=OrderedDict() +updated_indexed_NONHbindingsite=OrderedDict() + +Alignment_adjusted_indexed_Hbindingsite=OrderedDict() +Alignment_adjusted_indexed_NONHbindingsite=OrderedDict() + +##dssp +dssp_urlpart1='https://mrs.cmbi.umcn.nl/search?db=all&q=' +dssp_urlpart2='&count=3' +dssp_final_url1='https://mrs.cmbi.umcn.nl/entry?db=dssp&nr=' +dssp_final_url2='&rq=' + +##dssp + +##NUCPLOT +NUcplot_URL1 = 'https://www.ebi.ac.uk/thornton-srv/databases/cgi-bin/pdbsum/GetPS.pl?pdbcode=' +NUcplot_URL2 = '&psfile=nucplot.ps' + + + + + +aa_dict={'CYS': 'C', 'ASP': 'D', 'SER': 'S', 'GLN': 'Q', 'LYS': 'K', + 'ILE': 'I', 'PRO': 'P', 'THR': 'T', 'PHE': 'F', 'ASN': 'N', + 'GLY': 'G', 'HIS': 'H', 'LEU': 'L', 'ARG': 'R', 'TRP': 'W', + 'ALA': 'A', 'VAL':'V', 'GLU': 'E', 'TYR': 'Y', 'MET': 'M'} + +pdbsum_URL="http://www.ebi.ac.uk/thornton-srv/databases/cgi-bin/pdbsum/GetPage.pl?pdbcode=" +pdbsum_URL2="&template=links.html" +ebiurl="www.ebi.ac.uk" +pdbsum_dict=OrderedDict() +DSSP_SS=OrderedDict() +Prot_AA=OrderedDict() +aa_text_dict=OrderedDict() + +def merge_pdb_nonpdb(dict1,dict2): + combine=dict1.copy() + combine.update(combine) + return combine +PDB_ids_list= [] +Exp_dict = {} +with open(InputFileName, 'r') as f: + for record in SeqIO.parse(f, "fasta"): + + ids_pdb=record.id.split(':')[:1] + chain_name=record.id.split(':')#[1:] + if len(chain_name) > 1: + pdb_code=chain_name[0].upper() + ext=chain_name[1].upper() + PDB_ids_list.append(pdb_code+':'+ext) + + filesset=pdbl.download_pdb_files(ids_pdb, obsolete=False, pdir=PDBdir, file_format="pdb", overwrite=False) + if len(chain_name) == 1: + non_pdb_id.append(record.id) + swis_seq=str(record.seq) + non_pdb_seq_dict.setdefault(record.id,[]).append(record.seq) + non_pdb_seq_dictfin.setdefault(record.id,[]).append(swis_seq) + + + pdb_id.append(record.id) + + #Checking PDB ids in sequence file and PDB ids in selected forms are the same + #print ("PDB_ids_list",PDB_ids_list, "-->","PDB_Selected_list", PDB_Selected_list) + res = [x for x in PDB_ids_list if x not in PDB_Selected_list] + + if res: + print("

The selected PDB codes and that in the uploaded sequence file are not the same

") + sys.exit() + + + + + for data in os.listdir(PDBdir): + paths= PDBdir + '/'+ data + idschange =os.path.splitext(paths)[0].split('/')[-1].replace('pdb', '') + # idschange=paths.split("/")[1][3:] + pdbid_dict=os.path.splitext(idschange)[0]+':'+ext + with open(paths, 'r') as f: + root,extension= os.path.splitext(paths) + if extension == ".ent": + for line in f: + lines=line.split() + if lines[0]=='EXPDTA' and lines[2]=='NMR':#.startswith('EXPDTA SOLUTION NMR'): + NMR_printing = True + Exp_dict[pdbid_dict] = 'NMR' + elif lines[0]=='EXPDTA' and lines[1]=='X-RAY':#.startswith('EXPDTA SOLUTION NMR'): + Exp_dict[pdbid_dict] = 'X-RAY' + if 'NMR' in Exp_dict.values() : + + if lines[0]=='MODEL' and lines[1]=='1':#("MODEL 1"): + NMR_printing = True + elif lines[0]=='MODEL' and lines[1]!='1': + NMR_printing = False + if NMR_printing: + if lines[0]=="ATOM" and lines[2]=="CA" and lines[4]==ext : + if len(lines[3])==3: + found= (aa_dict[key] for key in aa_dict.keys() if key == lines[3]) + for item in found: + pdb_seq_dict.setdefault(pdbid_dict, []).append(item) + pdb_seq_dict_numbering.setdefault(pdbid_dict, []).append(lines[5]) + elif lines[3][0]==ext: + found1= (aa_dict[key] for key in aa_dict.keys() if key == lines[3][1:]) + for item1 in found1: + pdb_seq_dict.setdefault(pdbid_dict, []).append(item1) + pdb_seq_dict_numbering.setdefault(pdbid_dict, []).append(lines[5]) + if 'X-RAY' in Exp_dict.values(): + if lines[0]=="ATOM" and lines[2]=="CA" and lines[4]==ext : + + + if len(lines[3])==3: + found= (aa_dict[key] for key in aa_dict.keys() if key == lines[3]) + for item in found: + pdb_seq_dict.setdefault(pdbid_dict, []).append(item) + pdb_seq_dict_numbering.setdefault(pdbid_dict, []).append(lines[5]) + elif lines[3][0]==ext: + found1= (aa_dict[key] for key in aa_dict.keys() if key == lines[3][1:]) + for item1 in found1: + pdb_seq_dict.setdefault(pdbid_dict, []).append(item1) + pdb_seq_dict_numbering.setdefault(pdbid_dict, []).append(lines[5]) + +for keys,vals in pdb_seq_dict.items(): + aas_string=''.join(map(str,vals)) + pdb_seqfin.setdefault(keys,[]).append(aas_string) + + +combine=dict(list(non_pdb_seq_dictfin.items()) + list(pdb_seqfin.items())) + +with open(folderpath+'/trimmedfasta.fasta', 'w') as files: + for seqids, seqn in combine.items(): + files.write( ">" + seqids) + files.write("\n") + files.write (seqn[0]) + files.write("\n") + +trimmedfastafile = folderpath+'/trimmedfasta.fasta' + +mafft_cline = MafftCommandline(mafft_exe, input=trimmedfastafile) +stdout, stderr = mafft_cline() + +with open(out_file, "w") as handle: + handle.write(stdout) +seq1 = SeqIO.parse(out_file, 'fasta') +SeqIO.write(seq1, folderpath+'/file_tabDNA.fasta', 'tab') +record_seq_dict = SeqIO.to_dict(SeqIO.parse(out_file, "fasta")) + + +## Downloading NUCplot +aa = ''' +(ala +(arg +(asn +(asp +(cys +(glu +(gln +(gly +(his +(ile +(leu +(lys +(met +(phe +(pro +(ser +(thr +(trp +(tyr +(val +'''.split() + + +aa = [each_string.title() for each_string in aa] + +##NUCPLOT +DNA_binding_res_list2 = [] +DNA_binding_res_list1 = OrderedDict() +with open(folderpath+'/file_tabDNA.fasta','r') as files: + for line in files: + pdbcode1=line.split()[0] + pdbcode1_split=pdbcode1.split(':') + if len(pdbcode1_split) >1: + url = NUcplot_URL1 + pdbcode1_split[0] +NUcplot_URL2 + + data = requests.get(url, allow_redirects=True) + nuclplotfilename = folderpath+'/' + pdbcode1_split[0] + '_Nucplot.txt' + open(nuclplotfilename, 'wb').write(data.content) + + + + with open(nuclplotfilename, 'r') as file1: + for lines in file1: + if lines.startswith(tuple(aa)): + lines_split_aminoacid= lines.split()[0].split('(', 1)[1].split('*')[0] + if not lines_split_aminoacid in DNA_binding_res_list2: + DNA_binding_res_list2.append(lines_split_aminoacid.replace('))', ')')) + DNA_binding_res_list1.setdefault(pdbcode1, []).append(lines_split_aminoacid.replace('))', ')')) + aa1= [aa_string.replace('(','') for aa_string in aa] + t = filter(lambda x:x in lines, aa1) + for ts in t: + if not lines.startswith(tuple(aa)): + if not lines.startswith('%'): + # print (lines) + lines_split2_aa = lines.split()[1].split('*')[0] + # print (lines_split2_aa) + if not lines_split2_aa in DNA_binding_res_list2: + DNA_binding_res_list2.append(lines_split2_aa.replace('))', ')')) + DNA_binding_res_list1.setdefault(pdbcode1, []).append(lines_split2_aa.replace('))', ')')) + + + +DNA_binding_res_singlecode_dict={} +for PDBidKey, aavalue in DNA_binding_res_list1.items(): + aa_temp =[] + for aavalue1 in aavalue: + first_slit_chain = aavalue1.split('(') + aaminoacid = re.split(r'(\d+)', first_slit_chain[0])[0].upper() + aaminoacidposition = re.split(r'(\d+)', first_slit_chain[0])[1] + if aaminoacid in aa_dict: + + aminoacid_position_value= aa_dict[aaminoacid] + '_' + aaminoacidposition + # print (aminoacid_position_value) + if not aminoacid_position_value in aa_temp: + aa_temp.append(aminoacid_position_value) + DNA_binding_res_singlecode_dict.setdefault(PDBidKey, []).append(aminoacid_position_value) + + +for ids,aa_numb in DNA_binding_res_singlecode_dict.items(): + for ids1, numb in pdb_seq_dict_numbering.items(): + if ids==ids1: + #if ids==str(ids1).split(':')[0]: + for j in aa_numb: + numb_split=j.split('_') + updated_indexed_bindingsite.setdefault(ids,[]).append(numb.index(numb_split[1])) + + +#################### +def Convert(string): + list1=[] + list1[:0]=string + return list1 +lines_DSSP_list=[] +lines_DSSP_dict ={} +always_print = False +with open(folderpath+'/file_tabDNA.fasta','r') as files: + for line in files: + line1=line.split()[1:] + SS_list=[] + pdbids_chain=line.split()[:1] + + pdbids_chain_split=''.join(pdbids_chain).split(':') + if len(pdbids_chain_split) > 1: + + check_ids=''.join(pdbids_chain).split(':')[0]#[1:] + + pdb_chain=''.join(pdbids_chain).split(':')[1] + dssp_urlpart12_concat= dssp_urlpart1+check_ids+dssp_urlpart2 + dssp_allDBpage = requests.get(dssp_urlpart12_concat) + dsspsource = BeautifulSoup(dssp_allDBpage.content, 'html.parser') + for MRSallDB_link in dsspsource.find_all('a'): + for dssplink in MRSallDB_link: + if dssplink==(check_ids.upper()): + + dssp_href= str(MRSallDB_link).split(';') + + + if dssp_href[0]=='"+''.join(check_ids)+'\t'+'\t' + else: + check_ids=''.join(pdbids_chain).split(':')[0] + NonPDBseqID_print=''.join(check_ids)+'\t'+'\t' + aa_text1=list(str(line1[0])) + aa_text=aa_text1#[:-2] + aa_text_dict[check_ids]=aa_text + for aa_t in range(0,len(''.join(aa_text)),60): + AA_temp=[] + AA_temp.append(''.join(aa_text)[aa_t:aa_t+60]) + if check_ids.startswith('>'): + check_ids=''.join(check_ids.split('>')) + Prot_AA.setdefault(check_ids, []).append(AA_temp[0]) + else: + Prot_AA.setdefault(check_ids, []).append(AA_temp[0]) + +####updating index number for DNA binding site based on alignment for the given sequences +print('
') +print('
') +for Hkey1,Hvalues1 in updated_indexed_bindingsite.items(): + H_count =0 + H_count1=0 + Hkey1=str(Hkey1).split(':')[0] + if Hkey1 in aa_text_dict.keys(): + for H_X, H_i in enumerate(aa_text_dict[str(Hkey1).split(':')[0]]): + if H_i=='-': + H_count+=1 + else: + if H_count1 in Hvalues1: + Alignment_adjusted_indexed_Hbindingsite.setdefault(Hkey1, []).append(H_X) + H_count1+=1 + +# print (Alignment_adjusted_indexed_Hbindingsite) + +prot_Idsname=list(Prot_AA.keys()) +digits1=len(max(prot_Idsname)) +f1 = '{0:>%d}: ' % (digits1) + +print ("
") +print("Color coded secondary structure elements ") +print('
') +structurecode="B = beta-bridge residue, E = extended strand (in beta ladder), G = 3/10-helix, H= alpha-helix, I = Pi helix, S = bend , T = H-bonded turn" +print(structurecode) +print('
') +print('
') +print("") +##holding the keys of Prot_AA dictionary +SeqID_ref= list(sorted(Prot_AA.keys()))[0] + +for itemlength in range(len(Prot_AA[SeqID_ref])): + for dictkeys in sorted(Prot_AA.keys()): + gapcount=0 + resindex=0 + + if dictkeys in DSSP_SS: + print("") + print("") + if itemlength==0: + count=0 + resindex=0 + elif itemlength>0: + count=itemlength*60 + resindex=itemlength*60 + + if dictkeys in DSSP_SS.keys(): + ss=DSSP_SS[dictkeys][itemlength] + print("") + print("") + print("") + print("") + ##print secondary structure and sequences + print("") + print("") + + print("") + print("") + print("") + + + +print("
") + DSS_ID_print1=dictkeys+'_Sec_Str'+'\t' + print(DSS_ID_print1) + print("") + for sec_str in ss: + + + if sec_str=='H': + helix= "%s"%sec_str + print(helix) + elif sec_str=='E': + strand="%s"%sec_str + print(strand) + elif sec_str=='S': + bend="%s"%sec_str + print(bend) + elif sec_str=='T': + turn="%s"%sec_str + print(turn) + elif sec_str=='G': + helix_310="%s"%sec_str + print(helix_310) + elif sec_str=='I': + Pi_helix="%s"%sec_str + print(Pi_helix) + elif sec_str=='B': + beta_bridge="%s"%sec_str + print(beta_bridge) + else: + other_SS="%s"%sec_str + print(other_SS) + print("
") + dictkeys2=dictkeys+'\t' + dictkeys1="%s" %dictkeys2 + print(dictkeys1) + print("") + for i in Prot_AA[dictkeys][itemlength]: + + if i=='-': + res_size= "%s" %i + print(res_size) + count+=1 + gapcount+=1 + elif dictkeys in Alignment_adjusted_indexed_Hbindingsite.keys() or dictkeys in Alignment_adjusted_indexed_NONHbindingsite.keys(): + if count in Alignment_adjusted_indexed_Hbindingsite[dictkeys]: #and not Alignment_adjusted_indexed_NONHbindingsite[dictkeys]: + + if i.startswith(('A','I','L','M','V')): + bolded="%s" %i+'' + print(bolded) + if i.startswith(('F','W', 'Y')): + bolded="%s" %i+'' + print(bolded) + if i.startswith(('K','R', 'H')): + bolded="%s" %i+'' + print(bolded) + if i.startswith(('E','D')): + bolded="%s" %i+'' + print(bolded) + if i.startswith(('N','Q','S','T')) : + bolded="%s" %i+'' + print(bolded) + if i.startswith(('G','P')): + bolded="%s" %i+'' + print(bolded) + if i.startswith(('C')): + bolded="%s" %i+'' + count+=1 + + + else: + res_sizePDB= "%s" %i + print(res_sizePDB) + #resindex+=1 + count+=1 + else: + res_sizeNonPDB= "%s" %i + print(res_sizeNonPDB) + + print("
") + print("
") + +print('
') + +#making a list of binding residue indexes (according to aligned positions) from unique_mergeddict +H_NHnew_list=[] +for H_NHkey in Alignment_adjusted_indexed_Hbindingsite.keys(): + for index_items in Alignment_adjusted_indexed_Hbindingsite[H_NHkey]: + if index_items not in H_NHnew_list: + H_NHnew_list.append(index_items) + +#making a dictionary for creating a weblogo +weblogo_align=OrderedDict() +weblogo_gap_to_X=OrderedDict() + +for pdbid in aa_text_dict.keys(): + for H_NHnum in sorted(H_NHnew_list): + # print ("H_NHnum", H_NHnum) + H_NHresidues=aa_text_dict[pdbid][H_NHnum] + weblogo_align.setdefault(pdbid, []).append(H_NHresidues)# dictionary where gaps are not replaced with X + if aa_text_dict[pdbid][H_NHnum]!='-': + residuesnew=aa_text_dict[pdbid][H_NHnum] + weblogo_gap_to_X.setdefault(pdbid, []).append(residuesnew) + else: + residuesX='X' + weblogo_gap_to_X.setdefault(pdbid, []).append(residuesX)# dictionary where gaps are replaced with X + + +# making H_NH_weblogo +# protmotif=[] +# H_NONH='HNONH'+'.svg' +# for webid in weblogo_gap_to_X.keys(): +# var=''.join(weblogo_gap_to_X[webid]) +# protmotif.append(Seq(var, IUPAC.extended_protein)) +# seq = motifs.create(protmotif) +# # print (seq) +# seq.weblogo(H_NONH,format='SVG',xaxis_label= 'Residues', show_errorbars= False, color_scheme= 'color_chemistry') +# H_NONHsrc="
"%H_NONH +# print(H_NONHsrc) +# print("
") +# print("
") + +print ("
") + + +print ("
") +#print("Alignment of DNA interaction Residues") +print("
Alignment of DNA binding residues
") +print("
") + +H_NH_identical_index=[] +for H_NH_ind, H_NH_elems in enumerate(zip(*weblogo_align.values())): + + if H_NH_elems[1:] == H_NH_elems[:-1]: + H_NH_identical_index.append(H_NH_ind) + + +#H_NHSeqID_ref= list(sorted(weblogo_align.keys()))[0] +print("") +for H_NH_dictkeys in sorted(weblogo_align.keys()): + print("") + print("") + + print("") + print("") + print("") +print("
") + H_NH_ident_count=0 + if str(H_NH_dictkeys).startswith('>'): + H_NH_dictkeys_split=str(H_NH_dictkeys).split('>') + + print(str(H_NH_dictkeys_split[1])) + print("") + for H_NH_res in weblogo_align[H_NH_dictkeys]: + if H_NH_ident_count in H_NH_identical_index: + H_NH_underlined="%s" %H_NH_res + print(H_NH_underlined) + H_NH_ident_count+=1 + else: + H_NH_no_conse="%s" %H_NH_res+'' + print(H_NH_no_conse) + H_NH_ident_count+=1 + else: + print(H_NH_dictkeys) + print("") + for H_NH_res in weblogo_align[H_NH_dictkeys]: + if H_NH_ident_count in H_NH_identical_index: + H_NH_underlined1="%s" %H_NH_res + print(H_NH_underlined1) + H_NH_ident_count+=1 + else: + H_NH_no_conse1="%s" %H_NH_res+'' + print(H_NH_no_conse1) + H_NH_ident_count+=1 + + print("
") +print ("
") +os.remove(out_file) +# os.remove('/opt/lampp/htdocs/MSALigMap/tmp/ProtPep/foldernamer/trimmedfasta.fasta') +# shutil.rmtree('/opt/lampp/htdocs/MSALigMap/obsolete') +shutil.rmtree(folderpath) + + + +print ("") +print ("") diff --git a/LigPagePeptide.py b/LigPagePeptide.py new file mode 100755 index 0000000..aab1ef5 --- /dev/null +++ b/LigPagePeptide.py @@ -0,0 +1,963 @@ +#!/usr/bin/env python3 + +# Import modules for CGI handling +import cgi, cgitb +cgitb.enable() +import os +import argparse +import sys +from Bio import SeqIO +from Bio.Align.Applications import MafftCommandline +#from StringIO import StringIO +from Bio import AlignIO +from Bio.PDB import * +from Bio.PDB.Polypeptide import PPBuilder +import subprocess +import urllib +from collections import OrderedDict +import requests +from bs4 import BeautifulSoup +import itertools +import shutil +from Bio import motifs +from Bio.Seq import Seq +import random +import string +sys.path.append('/Users/xhasam/anaconda2/lib') + +# Create instance of FieldStorage +form = cgi.FieldStorage() + +print ("Content-type:text/html\r\n\r\n") +print ("") +print ("") + +#HTML style details for web page +print( "") +#Style ends here + +print ("MSALigMap") +print ("") +#print "

CoFactComp

" +print ("
") +print ("
") +print ("") +print ("
") +print ("
") +print ("

Below is shown the mapped binding sites for the sequences

") + +###Start of inititaions +mafft_exe = "mafft" +pdbl=PDBList() +ppb=PPBuilder() +pdb_id=[] +pdburl="https://files.rcsb.org/download/" + +pdb_seq_dict=OrderedDict() +pdb_seq_dict_numbering=OrderedDict() +pdb_seqfin=OrderedDict() +non_pdb_id=[] +non_pdb_seq_dict=OrderedDict() +non_pdb_seq_dictfin=OrderedDict() +pdbid_lig=OrderedDict() +check_aa=[] +NONHcheck_aa=[] +updated_indexed_bindingsite=OrderedDict() +updated_indexed_NONHbindingsite=OrderedDict() + +Alignment_adjusted_indexed_Hbindingsite=OrderedDict() +Alignment_adjusted_indexed_NONHbindingsite=OrderedDict() + +##dssp +dssp_urlpart1='https://mrs.cmbi.umcn.nl/search?db=all&q=' +dssp_urlpart2='&count=3' +dssp_final_url1='https://mrs.cmbi.umcn.nl/entry?db=dssp&nr=' +dssp_final_url2='&rq=' + +##dssp + + +aa_dict={'CYS': 'C', 'ASP': 'D', 'SER': 'S', 'GLN': 'Q', 'LYS': 'K', + 'ILE': 'I', 'PRO': 'P', 'THR': 'T', 'PHE': 'F', 'ASN': 'N', + 'GLY': 'G', 'HIS': 'H', 'LEU': 'L', 'ARG': 'R', 'TRP': 'W', + 'ALA': 'A', 'VAL':'V', 'GLU': 'E', 'TYR': 'Y', 'MET': 'M'} + +pdbsum_URL="http://www.ebi.ac.uk/thornton-srv/databases/cgi-bin/pdbsum/GetPage.pl?pdbcode=" +pdbsum_URL2="&template=links.html" +ebiurl="www.ebi.ac.uk" +pdbsum_dict=OrderedDict() +DSSP_SS=OrderedDict() +Prot_AA=OrderedDict() +aa_text_dict=OrderedDict() +PDB_code_ligand_dict ={} +###ENd of inititaions + +#capturing the entered pdb ids into list +###Modified +###Modified END part + +###Updated part +value_dict={} +#print (form) +for key in form.keys(): + + + variable = (key) + value = (form.getvalue(variable)) + + print ("
") + + if variable== 'LigSelection': + variable_split_PDBCode1=value.split(':')[0] + variable_split_PeptideChain1= value.split(':')[1] + value_dict.setdefault(variable_split_PDBCode1, []).append(variable_split_PeptideChain1) + + #value_dict[variable_split_PDBCode]['PeptideChain']= variable_split_PeptideChain + + if variable== 'ProteinSelection': + #print (value) + variable_split_PDBCode=value.split(':')[0] + variable_split_PDBChain= value.split(':')[1] + + ## Option for making a diction with protein chain and peptide chain + #value_dict[variable_split_PDBCode]={} + #value_dict[variable_split_PDBCode]['ProteinChain']= variable_split_PDBChain + + + value_dict.setdefault(variable_split_PDBCode, []).append(variable_split_PDBChain) + + + if variable == 'SequencePath': + InputFileName= value + + + +for PDBkey, chainValues in value_dict.items(): + #print (chainValues[0]) + items_names_split= PDBkey + ':' + chainValues[0] + + PDB_code_ligand_dict[PDBkey]={} + PDB_code_ligand_dict[PDBkey]['Chain']=chainValues[0] + PDB_code_ligand_dict[PDBkey]['Ligand']=chainValues[1] + + pdbid_lig.setdefault(items_names_split,[]).append(chainValues[1]) + + + +folderpath= os.path.split(InputFileName)[0] + + +##End of Updated part +out_file= folderpath + '/seqaligned1.fasta' +PDBdir= folderpath + "/PDB" + +# for items_names in l: + +# items_names_split= items_names.split('_') +# ligand_name= items_names_split[1] +# PDB_id = items_names_split[0].split(':')[0] +# PDB_code_ligand_dict[PDB_id]={} +# Chain_id = items_names_split[0].split(':')[1] +# PDB_code_ligand_dict[PDB_id]['Chain']=Chain_id +# PDB_code_ligand_dict[PDB_id]['Ligand']=ligand_name +# pdbid_lig.setdefault(items_names_split[0],[]).append(ligand_name) + + + + + + +def merge_pdb_nonpdb(dict1,dict2): + combine=dict1.copy() + combine.update(combine) + return combine + +PDBCode_FromSequenceFile={} +with open(InputFileName, 'r') as f: + for record in SeqIO.parse(f, "fasta"): + ids_pdb=record.id.split(':')[:1] + if len(''.join(ids_pdb)) == 4: + chain_name=record.id.split(':')[1:] + ext=chain_name[0] + + PDBCode_FromSequenceFile[ids_pdb[0]]=ext + filesset=pdbl.download_pdb_files(ids_pdb, obsolete=False, pdir=PDBdir, file_format="pdb", overwrite=False) + if len(''.join(ids_pdb)) > 4: + non_pdb_id.append(record.id) + swis_seq=str(record.seq) + non_pdb_seq_dict.setdefault(record.id,[]).append(record.seq) + non_pdb_seq_dictfin.setdefault(record.id,[]).append(swis_seq) + + + pdb_id.append(record.id) + for data in os.listdir(PDBdir): + paths= PDBdir + '/'+ data + idschange =os.path.splitext(paths)[0].split('/')[-1].replace('pdb', '') + # idschange=paths.split("/")[1][3:] + pdbid_dict=os.path.splitext(idschange)[0]+':'+ext + + with open(paths, 'r') as f: + for line in f: + lines=line.split() + if lines[0]=="ATOM" and lines[2]=="CA" and lines[4]==ext : + if len(lines[3])==3: + found= (aa_dict[key] for key in aa_dict.keys() if key == lines[3]) + for item in found: + pdb_seq_dict.setdefault(pdbid_dict, []).append(item) + pdb_seq_dict_numbering.setdefault(pdbid_dict, []).append(lines[5]) + elif lines[3][0]==ext: + found1= (aa_dict[key] for key in aa_dict.keys() if key == lines[3][1:]) + for item1 in found1: + pdb_seq_dict.setdefault(pdbid_dict, []).append(item1) + pdb_seq_dict_numbering.setdefault(pdbid_dict, []).append(lines[5]) +print("
") +print("
") + +#Checking PDB ids in sequence file (using here pdbid_dict) and PDB ids in selected forms (using here PDB_code_ligand_dict) are the same + +for Checkkeys, Checkvalues in PDBCode_FromSequenceFile.items(): + if not PDBCode_FromSequenceFile[Checkkeys] == PDB_code_ligand_dict[Checkkeys]['Chain']: + print("

The selected protein chain for the PDB code and that in the uploaded sequence file are not the same

") + sys.exit() + + + +###End of this part + + +for keys,vals in pdb_seq_dict.items(): + aas_string=''.join(map(str,vals)) + pdb_seqfin.setdefault(keys,[]).append(aas_string) + + +combine=dict(list(non_pdb_seq_dictfin.items()) + list(pdb_seqfin.items())) +with open(folderpath+'/trimmedfasta.fasta', 'w') as files: + for seqids, seqn in combine.items(): + files.write( ">" + seqids) + files.write("\n") + files.write (seqn[0]) + files.write("\n") + +trimmedfastafile = folderpath+'/trimmedfasta.fasta' +mafft_cline = MafftCommandline(mafft_exe, input=trimmedfastafile) +stdout, stderr = mafft_cline() + +with open(out_file, "w") as handle: + handle.write(stdout) + + +with open(folderpath+ '/file_tab.txt', 'w') as files_tab: + for record in SeqIO.parse(out_file, 'fasta'): + tabform='{}\t{}'.format(record.description, record.seq) + files_tab.write(tabform) + files_tab.write('\n') + +#Preparing PdbSum Url with selected PDB ids +for ids,lig in pdbid_lig.items(): + ids_splitslig=str(ids).split(':')[0] + pdbsumurl=pdbsum_URL+ids_splitslig+pdbsum_URL2 + pdbsum_dict.setdefault('%s'%ids,[]).append(pdbsumurl) +#Extracting the Href links from PDBSum home page for the selected PDB ids and Ligands using BeautifulSoup + +mydictcheck=OrderedDict() +pdbsum_peptide_url1= 'http://www.ebi.ac.uk/thornton-srv/databases/cgi-bin/pdbsum/GetPage.pl?pdbcode=' +pdbsum_peptide_url2= '&template=interfaces.html&c=999' + +for pdbpep,lid in pdbid_lig.items(): + pdbid_pep = pdbpep.split(':')[0] + chain_first = pdbpep.split(':')[1] + chain_second = lid[0] + pdbsum_peptide_concaat_url = pdbsum_peptide_url1 + pdbid_pep + pdbsum_peptide_url2 + page = requests.get(pdbsum_peptide_concaat_url) + + chainurl1 = '/thornton-srv/databases/pdbsum/templates/gif/chain' + chain_first + '.jpg' + chainurl2 = '/thornton-srv/databases/pdbsum/templates/gif/chain' + chain_second + '.jpg' + temp_ebiurl = [] + soup = BeautifulSoup(page.content, 'html.parser') + for h in soup.find_all('a', class_='menuClass' ): + if chainurl1 in str(h) and chainurl2 in str(h): + if not h['href'] in temp_ebiurl: + temp_ebiurl.append(h['href']) + for temp_ebiurl1 in temp_ebiurl: + linkfin="http://" + ebiurl + temp_ebiurl1 + temp_ebiurl2 = [] + page2 = requests.get(linkfin) + soup2 = BeautifulSoup(page2.content, 'html.parser') + for h2 in soup2.find_all('a'): + search_1= '/thornton-srv/databases/cgi-bin/pdbsum/GetIface.pl?pdb=' + search_2 = 'List of interactions' + if search_1 in str(h2) and search_2 in str(h2): + + if not h2['href'] in temp_ebiurl2: + temp_ebiurl2.append(h2['href']) + pep_pep_interactionlink ="http://www.ebi.ac.uk" + h2['href'] + mydictcheck[pdbpep]=pep_pep_interactionlink + +#selecting common ligand atoms that are hydrogen bonded in selected PDB structures +H_printing = False +H_atoms_commoncomp={} +for pdbsumids, pdbsumlink in mydictcheck.items(): + H_links_sel1=str(pdbsumlink).replace("&", "&") + pdbsumids_chain=str(pdbsumids).split(":")[1] + + weblink=requests.get(H_links_sel1) + for H_atomlines in weblink.iter_lines(): + H_atomlines1=H_atomlines.strip() + + if H_atomlines1.startswith(b'Hydrogen bonds'): + H_printing = True + elif H_atomlines1.startswith(b'Non-bonded contacts'): + H_printing = False + if H_printing: + if H_atomlines1.startswith((b'0', b'1', b'2', b'3', b'4', b'5', b'6', b'7', b'8', b'9')): + H_atomlines2=H_atomlines1.split() + H_atomlines2 = [w1.decode('utf8').replace('b', '') for w1 in H_atomlines2] + H_atm_sel=H_atomlines2[3] + if pdbsumids_chain==H_atomlines2[5]: + concat_aa_no=H_atm_sel+"_"+H_atomlines2[4] + if concat_aa_no not in check_aa: + check_aa.append(concat_aa_no) + found_aa= (aa_dict[key] for key in aa_dict.keys() if key == H_atomlines2[3]) + for items_aa in found_aa: + H_atm_sel=items_aa+"_"+H_atomlines2[4] + H_atoms_commoncomp.setdefault(pdbsumids,[]).append(H_atm_sel) + check_aa=[] + + +NONH_printing = False +NONHatoms_commoncomp={} + +for NONHpdbsumids,NONHpdbsumlink in mydictcheck.items(): + NONHlinks_sel1=str(NONHpdbsumlink).replace("&", "&") + NONHpdbsumids_chain=str(NONHpdbsumids).split(":")[1] + weblink1=requests.get(NONHlinks_sel1) + for NONHatomlines in weblink1.iter_lines(): + NONHatomlines1=NONHatomlines.strip() + if NONHatomlines1.startswith(b"Non-bonded contacts"): + NONH_printing = True + + elif NONHatomlines1.startswith(b"Hydrogen bonds"): + NONH_printing = False + if NONH_printing: + if NONHatomlines1.startswith((b'0', b'1', b'2', b'3', b'4', b'5', b'6', b'7', b'8', b'9')): + + NONHatomlines2=NONHatomlines1.split() + NONHatomlines2 = [w.decode('utf8').replace('b', '') for w in NONHatomlines2] + NONHatm_sel=NONHatomlines2[3] + if NONHatomlines2[5]==NONHpdbsumids_chain: + NONHconcat_aa_no=NONHatm_sel+"_"+ NONHatomlines2[4] + if NONHconcat_aa_no not in NONHcheck_aa: + NONHcheck_aa.append(NONHconcat_aa_no) + found_aa= (aa_dict[key] for key in aa_dict.keys() if key == NONHatomlines2[3]) + for items_aa in found_aa: + NONH_atm_sel=items_aa+"_"+NONHatomlines2[4] + NONHatoms_commoncomp.setdefault(NONHpdbsumids,[]).append(NONH_atm_sel) + NONHcheck_aa=[] + +for ids,aa_numb1 in H_atoms_commoncomp.items(): + aa_numb= [w3.replace('u', '') for w3 in aa_numb1] + for ids1, numb in pdb_seq_dict_numbering.items(): + if ids==ids1.upper(): + for j in aa_numb: + numb_split=j.split('_') + updated_indexed_bindingsite.setdefault(ids,[]).append(numb.index(numb_split[1])) + +for ids_1,aa_numb1 in NONHatoms_commoncomp.items(): + for ids2, numb2 in pdb_seq_dict_numbering.items(): + if ids_1==ids2.upper(): + for j1 in aa_numb1: + numb_split1=j1.split('_') + updated_indexed_NONHbindingsite.setdefault(ids_1,[]).append(numb2.index(numb_split1[1])) + + +with open(folderpath + "/file_tab.txt",'r') as files: + for line in files: + + line1=line.split()[1:] + SS_list=[] + pdbids_chain=line.split()[:1] + + pdbids_chain_split=''.join(pdbids_chain).split(':') + if len(pdbids_chain_split) > 1: + + check_ids=''.join(pdbids_chain).split(':')[0]#[1:] + + pdb_chain=''.join(pdbids_chain).split(':')[1] + dssp_urlpart12_concat= dssp_urlpart1+check_ids+dssp_urlpart2 + + dssp_allDBpage = requests.get(dssp_urlpart12_concat) + dsspsource = BeautifulSoup(dssp_allDBpage.content, 'html.parser') + for MRSallDB_link in dsspsource.find_all('a'): + for dssplink in MRSallDB_link: + + if dssplink==(check_ids.upper()): + + dssp_href= str(MRSallDB_link).split(';') + + if dssp_href[0]=='"+''.join(check_ids)+'\t'+'\t' + else: + check_ids=''.join(pdbids_chain).split(':')[0] + NonPDBseqID_print=''.join(check_ids)+'\t'+'\t' + + aa_text=list(str(line1)[2:]) + aa_text=aa_text[:-2] + aa_text_dict[check_ids]=aa_text + for aa_t in range(0,len(''.join(aa_text)),60): + AA_temp=[] + AA_temp.append(''.join(aa_text)[aa_t:aa_t+60]) + if check_ids.startswith('>'): + check_ids=''.join(check_ids.split('>')) + Prot_AA.setdefault(check_ids, []).append(''.join(AA_temp)) + else: + Prot_AA.setdefault(check_ids, []).append(''.join(AA_temp)) + +####updating index number for binding site based on alignment for the given sequences + +for Hkey1,Hvalues1 in updated_indexed_bindingsite.items(): + H_count =0 + H_count1=0 + Hkey1=str(Hkey1).split(':')[0] + if Hkey1.lower() in aa_text_dict.keys(): + for H_X, H_i in enumerate(aa_text_dict[str(Hkey1.lower()).split(':')[0]]): + if H_i=='-': + H_count+=1 + else: + if H_count1 in Hvalues1: + Alignment_adjusted_indexed_Hbindingsite.setdefault(Hkey1, []).append(H_X) + H_count1+=1 + + + +# print (Alignment_adjusted_indexed_Hbindingsite) +for NONHkey1,NONHvalues1 in updated_indexed_NONHbindingsite.items(): + NONH_count =0 + NONH_count1=0 + NONHkey1=str(NONHkey1).split(':')[0] + if NONHkey1.lower() in aa_text_dict.keys(): + for NONH_X, NONH_i in enumerate(aa_text_dict[NONHkey1.lower()]): + if NONH_i=='-': + NONH_count+=1 + else: + if NONH_count1 in NONHvalues1: + Alignment_adjusted_indexed_NONHbindingsite.setdefault(NONHkey1, []).append(NONH_X) + NONH_count1+=1 +prot_Idsname=list(Prot_AA.keys()) +digits1=len(max(prot_Idsname)) +f1 = '{0:>%d}: ' % (digits1) + +print ("
") +print("Color coded secondary structure elements ") +print('
') +structurecode="B = beta-bridge residue, E = extended strand (in beta ladder), G = 3/10-helix, H= alpha-helix, I = Pi helix, S = bend , T = H-bonded turn" +print(structurecode) +print('
') +print('
') +print("")# align='center'>") +##holding the keys of Prot_AA dictionary +SeqID_ref= list(sorted(Prot_AA.keys()))[0] + +for itemlength in range(len(Prot_AA[SeqID_ref])): + + for dictkeys in sorted(Prot_AA.keys()): + + gapcount=0 + resindex=0 + + if dictkeys in DSSP_SS: + + print("") + print("") + if itemlength==0: + + count=0 + resindex=0 + elif itemlength>0: + count=itemlength*60 + resindex=itemlength*60 + + if dictkeys in DSSP_SS.keys(): + + ss=DSSP_SS[dictkeys][itemlength] + print("") + print("") + print("") + print("") + ##print secondary structure and sequences + print("") + # print("") + print("") + + + + print("") + print("") + print("") + +print("
") + DSS_ID_print1=dictkeys+'_Sec_Str'+'\t' + print(DSS_ID_print1) + print("") + for sec_str in ss: + + + if sec_str=='H': + helix= "%s"%sec_str + print(helix) + elif sec_str=='E': + strand="%s"%sec_str + print(strand) + elif sec_str=='S': + bend="%s"%sec_str + print(bend) + elif sec_str=='T': + turn="%s"%sec_str + print(turn) + elif sec_str=='G': + helix_310="%s"%sec_str + print(helix_310) + elif sec_str=='I': + Pi_helix="%s"%sec_str + print(Pi_helix) + elif sec_str=='B': + beta_bridge="%s"%sec_str + print(beta_bridge) + else: + other_SS="%s"%sec_str + print(other_SS) + print("
") + dictkeys2=dictkeys+'\t' + dictkeys1="%s" %dictkeys2 + print(dictkeys1) + print("") + for i in Prot_AA[dictkeys][itemlength]: + + + if i=='-': + res_size= "%s" %i + print(res_size) + count+=1 + gapcount+=1 + elif dictkeys.upper() in Alignment_adjusted_indexed_Hbindingsite.keys() or dictkeys.upper() in Alignment_adjusted_indexed_NONHbindingsite.keys(): + if count in Alignment_adjusted_indexed_Hbindingsite[dictkeys.upper()]: #and not Alignment_adjusted_indexed_NONHbindingsite[dictkeys]: + if i.startswith(('A','I','L','M','V')): + bolded="%s" %i+'' + print(bolded) + if i.startswith(('F','W', 'Y')): + bolded="%s" %i+'' + print(bolded) + if i.startswith(('K','R', 'H')): + bolded="%s" %i+'' + print(bolded) + if i.startswith(('E','D')): + bolded="%s" %i+'' + print(bolded) + if i.startswith(('N','Q','S','T')) : + bolded="%s" %i+'' + print(bolded) + if i.startswith(('G','P')): + bolded="%s" %i+'' + print(bolded) + if i.startswith(('C')): + bolded="%s" %i+'' + print(bolded) + #resindex+=1 + count+=1 + elif count in Alignment_adjusted_indexed_NONHbindingsite[dictkeys.upper()]: #and not Alignment_adjusted_indexed_Hbindingsite[dictkeys]: + if i.startswith(('A','I','L','M','V')): + underlined="%s" %i+'' + print(underlined) + if i.startswith(('F','W', 'Y')): + underlined="%s" %i+'' + print(underlined) + if i.startswith(('K','R', 'H')): + underlined="%s" %i+'' + print(underlined) + if i.startswith(('E','D')): + underlined="%s" %i+'' + print(underlined) + if i.startswith(('N','Q','S','T')): + underlined="%s" %i+'' + print(underlined) + if i.startswith(('G','P')): + underlined="%s" %i+'' + print(underlined) + if i.startswith(('C')): + underlined="%s" %i+'' + print(underlined) + #resindex+=1 + count+=1 + + + else: + res_sizePDB= "%s" %i + print(res_sizePDB) + #resindex+=1 + count+=1 + else: + res_sizeNonPDB= "%s" %i + print(res_sizeNonPDB) + print("
") + print("
") + + +## making of Weblog and binding residues alignment +# merginf og hydrogen and nonhydrogen bondong residues +mergeH_H_NHddict= {key: value + Alignment_adjusted_indexed_NONHbindingsite[key] for key, value in Alignment_adjusted_indexed_Hbindingsite.items()} + +#making a unique list for each key in dictionary by removing duplicate items in the list +unique_mergeddict_H_NH= {k:sorted(set(j),key=j.index) for k,j in mergeH_H_NHddict.items()} + +#making a list of binding residue indexes (according to aligned positions) from unique_mergeddict +H_NHnew_list=[] +for H_NHkey in unique_mergeddict_H_NH.keys(): + for index_items in unique_mergeddict_H_NH[H_NHkey]: + if index_items not in H_NHnew_list: + H_NHnew_list.append(index_items) + +#making a dictionary for creating a weblogo +weblogo_align=OrderedDict() +weblogo_gap_to_X=OrderedDict() + +for pdbid in aa_text_dict.keys(): + for H_NHnum in sorted(H_NHnew_list): + # print ("H_NHnum", H_NHnum) + H_NHresidues=aa_text_dict[pdbid][H_NHnum] + weblogo_align.setdefault(pdbid, []).append(H_NHresidues)# dictionary where gaps are not replaced with X + if aa_text_dict[pdbid][H_NHnum]!='-': + residuesnew=aa_text_dict[pdbid][H_NHnum] + weblogo_gap_to_X.setdefault(pdbid, []).append(residuesnew) + else: + residuesX='X' + weblogo_gap_to_X.setdefault(pdbid, []).append(residuesX)# dictionary where gaps are replaced with X + + +#### For hydrongen bonded interactions only +H_new_list=[] +for key in Alignment_adjusted_indexed_Hbindingsite.keys(): + for H_index_items in Alignment_adjusted_indexed_Hbindingsite[key]: + if H_index_items not in H_new_list: + H_new_list.append(H_index_items) + +H_weblogo_align=OrderedDict() +H_weblogo_gap_to_X=OrderedDict() + +for H_pdbid in aa_text_dict.keys(): + for H_num in sorted(H_new_list): + H_residues=aa_text_dict[H_pdbid][H_num] + H_weblogo_align.setdefault(H_pdbid, []).append(H_residues) + if aa_text_dict[H_pdbid][H_num]!='-': + H_residuesnew=aa_text_dict[H_pdbid][H_num] + H_weblogo_gap_to_X.setdefault(H_pdbid, []).append(H_residuesnew) + else: + H_residuesX='X' + H_weblogo_gap_to_X.setdefault(H_pdbid, []).append(H_residuesX) + +print ("
") + + +print ("
") +print("
Alignment of hydrogen bonded interacting residues
") +print("
") + + +H_identical_index=[] +for H_ind, H_elems in enumerate(zip(*H_weblogo_align.values())): + + if H_elems[1:] == H_elems[:-1]: + H_identical_index.append(H_ind) + + +print("") +for H_dictkeys in sorted(H_weblogo_align.keys()): + print("") + print("") + + print("") + print("") + print("") +print("
") + H_ident_count=0 + if str(H_dictkeys).startswith('>'): + H_dictkeys_split=str(H_dictkeys).split('>') + + print(str(H_dictkeys_split[1])) + print("") + for H_res in H_weblogo_align[H_dictkeys]: + if H_ident_count in H_identical_index: + H_underlined="%s" %H_res + print(H_underlined) + H_ident_count+=1 + else: + H_no_conse="%s" %H_res+'' + print(H_no_conse) + H_ident_count+=1 + else: + print(H_dictkeys) + print("") + for H_res in H_weblogo_align[H_dictkeys]: + if H_ident_count in H_identical_index: + H_underlined1="%s" %H_res + print(H_underlined1) + H_ident_count+=1 + else: + H_no_conse1="%s" %H_res+'' + print(H_no_conse1) + H_ident_count+=1 + + print("
") + + +# #making H_weblogo +# H_protmotif=[] +# H_bonding='Hbonding'+'.svg' +# print ("H_weblogo_gap_to_X",H_weblogo_gap_to_X) +# for H_webid in H_weblogo_gap_to_X.keys(): +# H_var=''.join(H_weblogo_gap_to_X[H_webid]) +# H_protmotif.append(Seq(H_var, generic_protein)) +# H_seq = motifs.create(H_protmotif) +# print (H_seq) +# H_seq.weblogo(H_bonding,format='SVG',xaxis_label= 'Residues', show_errorbars= False, color_scheme= 'color_chemistry') +# Hsrc="
"%H_bonding +# print(Hsrc) +# print("
") +# print("
") + + +#### For Non_hydrongen bonded interactions only +NH_new_list=[] +for NHkey in Alignment_adjusted_indexed_NONHbindingsite.keys(): + for NHindex_items in Alignment_adjusted_indexed_NONHbindingsite[NHkey]: + if NHindex_items not in NH_new_list: + NH_new_list.append(NHindex_items) + +NH_weblogo_align=OrderedDict() +NH_weblogo_gap_to_X=OrderedDict() + +for NH_pdbid in aa_text_dict.keys(): + for NH_num in sorted(NH_new_list): + NH_residues=aa_text_dict[NH_pdbid][NH_num] + NH_weblogo_align.setdefault(NH_pdbid, []).append(NH_residues) + if aa_text_dict[NH_pdbid][NH_num]!='-': + NH_residuesnew=aa_text_dict[NH_pdbid][NH_num] + NH_weblogo_gap_to_X.setdefault(NH_pdbid, []).append(NH_residuesnew) + else: + NH_residuesX='X' + NH_weblogo_gap_to_X.setdefault(NH_pdbid, []).append(NH_residuesX) + + +#print("Alignment of Non-Hydrogen Interaction Residues") +print("
") +print("
") +print("
Alignment of non-bonded interacting residues
") +print("
") + +NH_identical_index=[] +for NH_ind, NH_elems in enumerate(zip(*NH_weblogo_align.values())): + + if NH_elems[1:] == NH_elems[:-1]: + NH_identical_index.append(NH_ind) + + +#NHSeqID_ref= list(sorted(NH_weblogo_align.keys()))[0] +print("") +for NH_dictkeys in sorted(NH_weblogo_align.keys()): + print("") + print("") + + print("") + print("") + print("") +print("
") + NH_ident_count=0 + if str(NH_dictkeys).startswith('>'): + NH_dictkeys_split=str(NH_dictkeys).split('>') + + print(str(NH_dictkeys_split[1])) + print("") + for NH_res in NH_weblogo_align[NH_dictkeys]: + if NH_ident_count in NH_identical_index: + NH_underlined="%s" %NH_res + print(NH_underlined) + NH_ident_count+=1 + else: + NH_no_conse="%s" %NH_res+'' + print(NH_no_conse) + NH_ident_count+=1 + else: + print(NH_dictkeys) + print("") + for NH_res in NH_weblogo_align[NH_dictkeys]: + if NH_ident_count in NH_identical_index: + NH_underlined1="%s" %NH_res + print(NH_underlined1) + NH_ident_count+=1 + else: + NH_no_conse1="%s" %NH_res+'' + print(NH_no_conse1) + NH_ident_count+=1 + + print("
") + +# #making H_NH_weblogo +# NH_protmotif=[] +# NH_bonding='Nhbonding'+'.svg' +# print ("NH_weblogo_gap_to_X", NH_weblogo_gap_to_X) +# for NH_webid in NH_weblogo_gap_to_X.keys(): +# NH_var=''.join(NH_weblogo_gap_to_X[NH_webid]) +# NH_protmotif.append(Seq(NH_var, generic_protein)) +# NH_seq = motifs.create(NH_protmotif) +# NH_seq.weblogo(NH_bonding,format='SVG',xaxis_label= 'Residues', show_errorbars= False, color_scheme= 'color_chemistry') +# NHsrc="
"%NH_bonding +# print(NHsrc) +# print("
") +# print("
") + + +#print("Alignment of Both Hydrogen and Non-hydrogen interaction Residues") +print("
") +print("
") +print("
Alignment of hydrogen and non-bonded interacting residues
") +print("
") + +H_NH_identical_index=[] +for H_NH_ind, H_NH_elems in enumerate(zip(*weblogo_align.values())): + + if H_NH_elems[1:] == H_NH_elems[:-1]: + H_NH_identical_index.append(H_NH_ind) + + +#H_NHSeqID_ref= list(sorted(weblogo_align.keys()))[0] +print("") +for H_NH_dictkeys in sorted(weblogo_align.keys()): + print("") + print("") + + print("") + print("") + print("") +print("
") + H_NH_ident_count=0 + if str(H_NH_dictkeys).startswith('>'): + H_NH_dictkeys_split=str(H_NH_dictkeys).split('>') + + print(str(H_NH_dictkeys_split[1])) + print("") + for H_NH_res in weblogo_align[H_NH_dictkeys]: + if H_NH_ident_count in H_NH_identical_index: + H_NH_underlined="%s" %H_NH_res + print(H_NH_underlined) + H_NH_ident_count+=1 + else: + H_NH_no_conse="%s" %H_NH_res+'' + print(H_NH_no_conse) + H_NH_ident_count+=1 + else: + print(H_NH_dictkeys) + print("") + for H_NH_res in weblogo_align[H_NH_dictkeys]: + if H_NH_ident_count in H_NH_identical_index: + H_NH_underlined1="%s" %H_NH_res + print(H_NH_underlined1) + H_NH_ident_count+=1 + else: + H_NH_no_conse1="%s" %H_NH_res+'' + print(H_NH_no_conse1) + H_NH_ident_count+=1 + + print("
") +print ("
") +# #making H_NH_weblogo +# protmotif=[] +# H_NONH='HNONH'+'.svg' +# for webid in weblogo_gap_to_X.keys(): +# var=''.join(weblogo_gap_to_X[webid]) +# protmotif.append(Seq(var, generic_protein)) +# seq = motifs.create(protmotif) +# print (seq) +# seq.weblogo(H_NONH,format='SVG',xaxis_label= 'Residues', show_errorbars= False, color_scheme= 'color_chemistry') +# H_NONHsrc="
"%H_NONH +# print(H_NONHsrc) +# print("
") +# print("
") + +os.remove(out_file) +# os.remove('/opt/lampp/htdocs/MSALigMap/tmp/ProtPep/foldernamer/trimmedfasta.fasta') +# shutil.rmtree('/opt/lampp/htdocs/MSALigMap/obsolete') +shutil.rmtree(folderpath) + +print ("") +print ("") diff --git a/LigandBinding.py b/LigandBinding.py index cf0ecca..381675e 100755 --- a/LigandBinding.py +++ b/LigandBinding.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jun 27 20:22:45 2019 @@ -831,4 +831,4 @@ def merge_pdb_nonpdb(dict1,dict2): shutil.rmtree('PDB') print ("") -print ("" ) \ No newline at end of file +print ("" ) diff --git a/MSALigMap.py b/MSALigMap.py deleted file mode 100755 index 0277b75..0000000 --- a/MSALigMap.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -""" -Created on Mon May 30 21:34:40 2022 - -@author: xhasam -""" - -import sys -import subprocess - - -feature= sys.argv[1] -sequence= sys.argv[2] - -if feature == 'Lig': - lig= sys.argv[3] - - subprocess.call("python LigandBinding.py %s %s" %(sequence, lig), shell=True) - -elif feature == 'DNA': - subprocess.call("python DNABinding.py %s" %(sequence), shell=True) - - - - - - - diff --git a/MT.jpg b/MT.jpg new file mode 100755 index 0000000..b42513d Binary files /dev/null and b/MT.jpg differ diff --git a/PepPage1.py b/PepPage1.py new file mode 100644 index 0000000..122f0cf --- /dev/null +++ b/PepPage1.py @@ -0,0 +1,235 @@ +#!/usr/bin/env python3 + +# Import modules for CGI handling +import cgi, cgitb +cgitb.enable() +import collections +import os +import argparse +import sys +# from Bio import SeqIO +# from Bio.Align.Applications import MafftCommandline +#from StringIO import StringIO +# from Bio import AlignIO +# from Bio.PDB import * +# from Bio.PDB.Polypeptide import PPBuilder +import subprocess +import urllib +from collections import OrderedDict +import requests +from bs4 import BeautifulSoup +import itertools +import shutil +# from Bio import motifs +# from Bio.Seq import Seq + +import random +import string + + +sys.path.append('/usr/local/Anaconda3/lib/') +url="https://files.rcsb.org/view/" + + +# Create instance of FieldStorage +form = cgi.FieldStorage() + +# Get data from field +if form.getvalue('textcontent'): + text_content = form.getvalue('textcontent') + +else: + text_content = None + +print ("Content-type:text/html\r\n\r\n") +print ("") +print ("") + +#HTML style details for web page +print ("") +#Style ends here + +print ("MSALigMap") +print ("") +#print "

CoFactComp

" +print ("
") +print ("
") +print ("") +print ("
") +print ("
") +print ("

Select a Protein chain and a Peptide chain of Interest!

")#print lig_content + +##Sequence file +#print lig_content +#capturing the entered pdb ids into list + + +if any(form.getvalue('filename').decode("utf-8")) == False : + print ("

Error!

") + print ("

Please upload a sequence file and try again!.

") + sys.exit() + +if text_content != None: + try: + for i in text_content: + text_content1=text_content.replace(' ', '') + l=text_content1.split(',') + + + foldernamer= ''.join(random.choices(string.ascii_letters, k=4)) + ProtLigfolder= '/opt/lampp/htdocs/MSALigMap/tmp/' + 'ProtPep' + + isExist = os.path.exists(ProtLigfolder) + + if not isExist: + os.mkdir( ProtLigfolder) + + folderpath= ProtLigfolder + '/' +foldernamer + os.mkdir(folderpath) + + fileitem = form['filename'] + fileattached = fileitem.value + InputFileName = folderpath + '/sequenceInputfile.fasta' + with open(InputFileName, 'wb') as fout: + fout.write(fileattached) + + + + ## + f2_list=[] + combined_list=[] + #print "entered id's",l + pdbid_list=[] + url_list=[] + prot_lig_dict=collections.defaultdict(dict) + count=1 + + + pdbid_chain_dict={} + for i in l: + each= i#.split(':') + pdbcode= each.upper() + ##chain=each[1] # i am removing the +"="+"[]" + pdbid_list.append(pdbcode) + #pdbid_chain_dict[pdbcode]=chain #(not used i later part of the code) + + + + #linking the PDB url address to the selected PDB ids + for x in l: + pdbcodename= x.split(':')[0] + pdbid=url+pdbcodename+".pdb" + url_list.append(pdbid) + + + #Listing the PDB ids and their bound ligands + for link,id in zip(url_list,pdbid_list): #list(pdbid_chain_dict.keys())): + #prot_lig_dict[id]={} + dict_primarykey = id #+ '_' + Chain + count=count+1 + try: + f=urllib.request.urlopen(link) + f=f.readlines() + #print (f) + for li in f: + if li.startswith(b'SEQRES'): + + li= li.decode('UTF-8').split() + Chain=li[2] + prot_lig_dict[dict_primarykey][Chain]={} + Seq_length= int(li[3]) + + if Seq_length > 100: + prot_lig_dict[dict_primarykey][Chain]['Length']= Seq_length + prot_lig_dict[dict_primarykey][Chain]['Type']= 'Protein' + + if Seq_length < 100: + prot_lig_dict[dict_primarykey][Chain]['Length']= Seq_length + prot_lig_dict[dict_primarykey][Chain]['Type']= 'Peptide' + + except: + print("

The entered PDB code is not identitifed in PDB database. Try again!

") + + + + + + print("

Sequences that are shorter than 100 amino acid in length is named as peptide

") + + # Form for selecting the Peptide chains of interest for the USERR + + + print ("
") + + print ("") + print ("") + print ("") + print ("") + print ("") + print ("") + print ("") + + #length_of_rowspan= len(prot_lig_dict) + + + for k,dk in prot_lig_dict.items(): + + length_of_rowspan = len(prot_lig_dict[k]) + k= k.split('_')[0] + + + + print ("") + print ("") + #print "" + for chainKey, lengthValue in dk.items(): + + print ("") + print ("") + print ("") + print ("") + print ("") + print ("
") + print ("
") + print ("
PDB IDChainLengthTypeSelect
"% length_of_rowspan,k, "
", chainKey,"", dk[chainKey]['Length'],"", dk[chainKey]['Type'],"") + if dk[chainKey]['Type']== 'Protein': + values_add = k + ':' + chainKey + print ("" % (values_add)) + + if dk[chainKey]['Type']== 'Peptide': + values_add = k + ':' + chainKey + print ("" % (values_add)) + + print ("
") + print ("
") + + print ("") + print ("") + print ("" %(InputFileName)) + + print ("
") + + except: + print ("

Please upload your sequence file and PDB code. Try again!

") + +else: + print ("

Please enter a PDB code and try again!

") + sys.exit() + + + +print ("") +print ("") \ No newline at end of file diff --git a/ProtDNA/WRKY.fasta b/ProtDNA/WRKY.fasta new file mode 100644 index 0000000..6e563b5 --- /dev/null +++ b/ProtDNA/WRKY.fasta @@ -0,0 +1,10 @@ +>2LEX:A +GSSGSSGVQTTSEVDLLDDGYRWRKYGQKVVKGNPYPRSYYKCTTPGCGVRKHVERAATDPKAVVTTYEGKHNHDLPA +>1_Traes_1A01G070400.1_GRP1 +DDGFRWRKYGQKVVKGNPNPRSYYKCTTVGCPVRKHVERASHDNRAVITTYEGKHSH +>5_Traes_1A01G298600.1_GRP1 +DDGYRWRKYGQKVVKGNPNPRSYYKCTTPNCPVRKHVERASQDLRAVVTTYEGKHNH +>19_Traes_1B01G088900.1_GRP1 +DDGFRWRKYGQKVVKGNPNPRSYYKCTTVGCPVRKHVERASHDNRAVITTYEGRHSH +>72_Traes_2A01G182700.1_GRP1 +DDGYRWRKYGQKVVRGNPHPRSYYKCTYQGCDVKKHIERSSEEPHAVITTYEGKHTH diff --git a/Ligand_binding_samplefile.fasta b/ProtLig/sequence.fasta similarity index 100% rename from Ligand_binding_samplefile.fasta rename to ProtLig/sequence.fasta diff --git a/ProtPep/peptideseq.fasta b/ProtPep/peptideseq.fasta new file mode 100644 index 0000000..49937ec --- /dev/null +++ b/ProtPep/peptideseq.fasta @@ -0,0 +1,9 @@ +>2AN6:A +NSVLFPCKYASSGCEITLPHTEKAEHEELCEFRPYSCPCPGASCKWQGSLDAVMPHLMHQHKSITTLQGEDIVFLATDINLPGAVDWVMMQSCFGFHFMLVLEKQEKYDGHQQFFAIVQLIGTRKQAENFAYRLELNGHRRRLTWEATPRSIHEGIATAIMNSDCLVFDTSIAQLFAENGNLGINVTISMC +>sequence1 +NSVLFPCKYASSGCEITLPHTEKAEHEELCEFRPYSCPCPGASCKWQGSLDAVMPHLMHQHKSITTLQGEDIVFLATDINLPGAVDWVMMQSCFGFHFMLVLEKQEKYDGHQQFFAIVQLIGTRKQAE +NFAYRLELNGHRRRLTWEATPRSIHEGIATAIMNSDCLVFDTSIAQLFAENGNLGINVTISMC + +>sequence2 +NSVLFPCKYASSGCEITLPHTEKAEHEELCEFRPYSCPCPGASCKWQGSLDAVMPHLMHQHKSITTLQGEDIVFLATDINLPGAVDWVMMQSCFGFHFMLVLEKQEKYDGHQQFFAIVQLIGTRKQAE +NFAYRLELNGHRRRLTWEATPRSIHEGIATAIMNSDCLVFDTSIAQLFAENGNLGINVTISMC diff --git a/ProteinDNA.py b/ProteinDNA.py new file mode 100755 index 0000000..a30da12 --- /dev/null +++ b/ProteinDNA.py @@ -0,0 +1,99 @@ +#!/usr/bin/env python3 + +# Import modules for CGI handling +import cgi, cgitb +# Create instance of FieldStorage +form = cgi.FieldStorage() + +# Get data from fields +if form.getvalue('subject'): + subject = form.getvalue('subject') +else: + subject = "Not set" + + +print ("Content-type:text/html\r\n\r\n") +print ("") +print ("") + +print ("") + +print ("MSALigMap") +print ("") + + +print ("
") +print ("
") + + + +print ("") +print ("") + + +print ("
") +print ("

Mapping the DNA Binding Amino Acid Residues for the Unannotated Protein Sequences

") +print ("
") + + + +print ("

Protein - DNA binding Site Mapping

") + + +print ("

Upload protein sequences in fasta format:

") +print ("
") +print ("") + +print ("

Enter PDB ids (eg: 2LEX):

") +print ("") + + + +print ("

") + +print ("
") + + +print ("
") + + +print ("") +print ("") + diff --git a/ProteinLigand.py b/ProteinLigand.py new file mode 100755 index 0000000..3daddca --- /dev/null +++ b/ProteinLigand.py @@ -0,0 +1,100 @@ +#!/usr/bin/env python3 + +# Import modules for CGI handling +import cgi, cgitb + +# Create instance of FieldStorage +form = cgi.FieldStorage() + +# Get data from fields +if form.getvalue('subject'): + subject = form.getvalue('subject') +else: + subject = "Not set" + + +print ("Content-type:text/html\r\n\r\n") +print ("") +print ("") + +print ("") + +print ("MSALigMap") +print ("") + + +print ("
") +print ("
") + + + +print ("") +print ("") + + +print ("
") +print ("

Mapping the Ligand Binding Amino Acid Residues for the Unannotated Protein Sequences

") +print ("
") + + +print ("

Protein - Ligand Binding Site Mapping

") + +print ("

Upload protein sequences in fasta format:

") +print ("") +print ("") + +print ("

Enter PDB ids and Ligand ids (eg: 3WXB:A):

") +print ("") + +print ("

") + +print ("
") +print ("
") + +print (" ") +print ("
") + + + +print ("
") + + +print ("") +print ("") diff --git a/ProteinPeptide.py b/ProteinPeptide.py new file mode 100755 index 0000000..81b0e2e --- /dev/null +++ b/ProteinPeptide.py @@ -0,0 +1,99 @@ +#!/usr/bin/env python3 + +# Import modules for CGI handling +import cgi, cgitb + +# Create instance of FieldStorage +form = cgi.FieldStorage() + +# Get data from fields +if form.getvalue('subject'): + subject = form.getvalue('subject') +else: + subject = "Not set" + + +print ("Content-type:text/html\r\n\r\n") +print ("") +print ("") + +print ("") + +print ("MSALigMap") +print ("") + + +print ("
") +print ("
") + + + +print ("") +print ("") + + +print ("
") +print ("

Mapping the Peptide Binding Amino Acid Residues for the Unannotated Protein Sequences

") +print ("
") + + + +print ("

Protein - Peptide Binding Site Mapping

") + +print ("

Upload protein sequences in fasta format:

") +print ("
") +print ("") + +print ("

Enter PDB ids and Ligand ids (eg: 2AN6):

") +print ("") + +print ("

") + +print ("
") +print ("
") + + + + +print ("
") + + +print ("") +print ("") diff --git a/README.md b/README.md index 1053277..6b8547b 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +# MSALigMap +MSALigMap – a tool for mapping active site amino acids in PDB structures onto homologous sequences MSALigMap (Multiple Sequence Alignment Ligand Mapping) is a tool for mapping active site amino acid residues that bind selected ligands or DNA on to target protein sequences of interest. To run ligand (small molecule) or DNA binding site analysis, the user needs to specify Lig or DNA respectively. MSALigMap is implemented in Python (3) and is run from the command line. To be able to use the tool one will need: @@ -42,4 +44,14 @@ Input.fasta: The input.fasta file to be provided is a fasta file containing prot GNNEYKKGLWTVEEDKILMDYVKAHGKGHWNRIAKKTGLKRCGKSCRLRWMNYLSPNVKRGNFTEQEEDLIIRLHKLLGNRWSLIAKRVPGRTDNQVKNYWNTHLSKKLGIKDQKTKQS -For example: python MSALigMap.py DNA DNA_binding_samplefile.fasta \ No newline at end of file +For example: python MSALigMap.py DNA DNA_binding_samplefile.fasta + +# Run in Docker +* sudo docker build -t msaligmap . + +## Interactive session +* sudo docker run -p 8080:80 -ti msaligmap:latest + +# The page will be available at +* http://localhost/MSALigMap/HomePage.py + diff --git a/SH.jpg b/SH.jpg new file mode 100755 index 0000000..7a26464 Binary files /dev/null and b/SH.jpg differ diff --git a/SH3.jpeg b/SH3.jpeg new file mode 100755 index 0000000..bce77b7 Binary files /dev/null and b/SH3.jpeg differ diff --git a/Sameena.jpeg b/Sameena.jpeg new file mode 100644 index 0000000..9d4235b Binary files /dev/null and b/Sameena.jpeg differ diff --git a/httpd.conf b/httpd.conf new file mode 100644 index 0000000..1359d37 --- /dev/null +++ b/httpd.conf @@ -0,0 +1,523 @@ +# +# This is the main Apache HTTP server configuration file. It contains the +# configuration directives that give the server its instructions. +# See for detailed information. +# In particular, see +# +# for a discussion of each configuration directive. +# +# Do NOT simply read the instructions in here without understanding +# what they do. They're here only as hints or reminders. If you are unsure +# consult the online docs. You have been warned. +# +# Configuration and logfile names: If the filenames you specify for many +# of the server's control files begin with "/" (or "drive:/" for Win32), the +# server will use that explicit path. If the filenames do *not* begin +# with "/", the value of ServerRoot is prepended -- so 'log/access_log' +# with ServerRoot set to '/www' will be interpreted by the +# server as '/www/log/access_log', where as '/log/access_log' will be +# interpreted as '/log/access_log'. + +# +# ServerRoot: The top of the directory tree under which the server's +# configuration, error, and log files are kept. +# +# Do not add a slash at the end of the directory path. If you point +# ServerRoot at a non-local disk, be sure to specify a local disk on the +# Mutex directive, if file-based mutexes are used. If you wish to share the +# same ServerRoot for multiple httpd daemons, you will need to change at +# least PidFile. +# +ServerRoot "/opt/lampp" + +# +# Mutex: Allows you to set the mutex mechanism and mutex file directory +# for individual mutexes, or change the global defaults +# +# Uncomment and change the directory if mutexes are file-based and the default +# mutex file directory is not on a local disk or is not appropriate for some +# other reason. +# +# Mutex default:logs + +# +# Listen: Allows you to bind Apache to specific IP addresses and/or +# ports, instead of the default. See also the +# directive. +# +# Change this to Listen on specific IP addresses as shown below to +# prevent Apache from glomming onto all bound IP addresses. +# +#Listen 12.34.56.78:80 +Listen 80 + +# +# Dynamic Shared Object (DSO) Support +# +# To be able to use the functionality of a module which was built as a DSO you +# have to place corresponding `LoadModule' lines at this location so the +# directives contained in it are actually available _before_ they are used. +# Statically compiled modules (those listed by `httpd -l') do not need +# to be loaded here. +# +# Example: +# LoadModule foo_module modules/mod_foo.so +# +LoadModule authn_file_module modules/mod_authn_file.so +LoadModule authn_dbm_module modules/mod_authn_dbm.so +LoadModule authn_anon_module modules/mod_authn_anon.so +LoadModule authn_dbd_module modules/mod_authn_dbd.so +LoadModule authn_socache_module modules/mod_authn_socache.so +LoadModule authn_core_module modules/mod_authn_core.so +LoadModule authz_host_module modules/mod_authz_host.so +LoadModule authz_groupfile_module modules/mod_authz_groupfile.so +LoadModule authz_user_module modules/mod_authz_user.so +LoadModule authz_dbm_module modules/mod_authz_dbm.so +LoadModule authz_owner_module modules/mod_authz_owner.so +LoadModule authz_dbd_module modules/mod_authz_dbd.so +LoadModule authz_core_module modules/mod_authz_core.so +LoadModule authnz_ldap_module modules/mod_authnz_ldap.so +LoadModule access_compat_module modules/mod_access_compat.so +LoadModule auth_basic_module modules/mod_auth_basic.so +LoadModule auth_form_module modules/mod_auth_form.so +LoadModule auth_digest_module modules/mod_auth_digest.so +LoadModule allowmethods_module modules/mod_allowmethods.so +LoadModule file_cache_module modules/mod_file_cache.so +LoadModule cache_module modules/mod_cache.so +LoadModule cache_disk_module modules/mod_cache_disk.so +LoadModule socache_shmcb_module modules/mod_socache_shmcb.so +LoadModule socache_dbm_module modules/mod_socache_dbm.so +LoadModule socache_memcache_module modules/mod_socache_memcache.so +LoadModule dbd_module modules/mod_dbd.so +LoadModule bucketeer_module modules/mod_bucketeer.so +LoadModule dumpio_module modules/mod_dumpio.so +LoadModule echo_module modules/mod_echo.so +LoadModule case_filter_module modules/mod_case_filter.so +LoadModule case_filter_in_module modules/mod_case_filter_in.so +LoadModule buffer_module modules/mod_buffer.so +LoadModule ratelimit_module modules/mod_ratelimit.so +LoadModule reqtimeout_module modules/mod_reqtimeout.so +LoadModule ext_filter_module modules/mod_ext_filter.so +LoadModule request_module modules/mod_request.so +LoadModule include_module modules/mod_include.so +LoadModule filter_module modules/mod_filter.so +LoadModule substitute_module modules/mod_substitute.so +LoadModule sed_module modules/mod_sed.so +LoadModule charset_lite_module modules/mod_charset_lite.so +LoadModule deflate_module modules/mod_deflate.so +LoadModule mime_module modules/mod_mime.so +LoadModule ldap_module modules/mod_ldap.so +LoadModule log_config_module modules/mod_log_config.so +LoadModule log_debug_module modules/mod_log_debug.so +LoadModule logio_module modules/mod_logio.so +LoadModule env_module modules/mod_env.so +LoadModule mime_magic_module modules/mod_mime_magic.so +LoadModule cern_meta_module modules/mod_cern_meta.so +LoadModule expires_module modules/mod_expires.so +LoadModule headers_module modules/mod_headers.so +LoadModule usertrack_module modules/mod_usertrack.so +LoadModule unique_id_module modules/mod_unique_id.so +LoadModule setenvif_module modules/mod_setenvif.so +LoadModule version_module modules/mod_version.so +LoadModule remoteip_module modules/mod_remoteip.so +LoadModule proxy_module modules/mod_proxy.so +LoadModule proxy_connect_module modules/mod_proxy_connect.so +LoadModule proxy_ftp_module modules/mod_proxy_ftp.so +LoadModule proxy_http_module modules/mod_proxy_http.so +LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so +LoadModule proxy_scgi_module modules/mod_proxy_scgi.so +LoadModule proxy_ajp_module modules/mod_proxy_ajp.so +LoadModule proxy_balancer_module modules/mod_proxy_balancer.so +LoadModule proxy_express_module modules/mod_proxy_express.so +LoadModule session_module modules/mod_session.so +LoadModule session_cookie_module modules/mod_session_cookie.so +LoadModule session_dbd_module modules/mod_session_dbd.so +LoadModule slotmem_shm_module modules/mod_slotmem_shm.so +LoadModule ssl_module modules/mod_ssl.so +LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so +LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so +LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so +LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so +LoadModule unixd_module modules/mod_unixd.so +LoadModule dav_module modules/mod_dav.so +LoadModule status_module modules/mod_status.so +LoadModule autoindex_module modules/mod_autoindex.so +LoadModule info_module modules/mod_info.so +LoadModule suexec_module modules/mod_suexec.so +LoadModule cgi_module modules/mod_cgi.so +LoadModule cgid_module modules/mod_cgid.so +LoadModule dav_fs_module modules/mod_dav_fs.so +LoadModule vhost_alias_module modules/mod_vhost_alias.so +LoadModule negotiation_module modules/mod_negotiation.so +LoadModule dir_module modules/mod_dir.so +LoadModule actions_module modules/mod_actions.so +LoadModule speling_module modules/mod_speling.so +LoadModule userdir_module modules/mod_userdir.so +LoadModule alias_module modules/mod_alias.so +LoadModule rewrite_module modules/mod_rewrite.so + + +LoadModule php4_module modules/libphp4.so +LoadModule php5_module modules/libphp5.so + + + +# +# If you wish httpd to run as a different user or group, you must run +# httpd as root initially and it will switch. +# +# User/Group: The name (or #number) of the user/group to run httpd as. +# It is usually good practice to create a dedicated user and group for +# running httpd, as with most system services. +# +User daemon +Group daemon + + +# 'Main' server configuration +# +# The directives in this section set up the values used by the 'main' +# server, which responds to any requests that aren't handled by a +# definition. These values also provide defaults for +# any containers you may define later in the file. +# +# All of these directives may appear inside containers, +# in which case these default settings will be overridden for the +# virtual host being defined. +# + +# +# ServerAdmin: Your address, where problems with the server should be +# e-mailed. This address appears on some server-generated pages, such +# as error documents. e.g. admin@your-domain.com +# +ServerAdmin you@example.com + +# +# ServerName gives the name and port that the server uses to identify itself. +# This can often be determined automatically, but we recommend you specify +# it explicitly to prevent problems during startup. +# +# If your host doesn't have a registered DNS name, enter its IP address here. +# +#ServerName www.example.com:@@Port@@ +# XAMPP +ServerName localhost + +# +# Deny access to the entirety of your server's filesystem. You must +# explicitly permit access to web content directories in other +# blocks below. +# + + AllowOverride none + Require all denied + + +# +# Note that from this point forward you must specifically allow +# particular features to be enabled - so if something's not working as +# you might expect, make sure that you have specifically enabled it +# below. +# + +# +# DocumentRoot: The directory out of which you will serve your +# documents. By default, all requests are taken from this directory, but +# symbolic links and aliases may be used to point to other locations. +# +DocumentRoot "/opt/lampp/htdocs" + + # + # Possible values for the Options directive are "None", "All", + # or any combination of: + # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews + # + # Note that "MultiViews" must be named *explicitly* --- "Options All" + # doesn't give it to you. + # + # The Options directive is both complicated and important. Please see + # http://httpd.apache.org/docs/trunk/mod/core.html#options + # for more information. + # + #Options Indexes FollowSymLinks + # XAMPP + Options Indexes FollowSymLinks ExecCGI Includes + + # + # AllowOverride controls what directives may be placed in .htaccess files. + # It can be "All", "None", or any combination of the keywords: + # Options FileInfo AuthConfig Limit + # + #AllowOverride None + # since XAMPP 1.4: + AllowOverride All + + # + # Controls who can get stuff from this server. + # + Require all granted + + +# +# DirectoryIndex: sets the file that Apache will serve if a directory +# is requested. +# + + #DirectoryIndex index.html + # XAMPP + DirectoryIndex index.html index.html.var index.php index.php3 index.php4 + + +# +# The following lines prevent .htaccess and .htpasswd files from being +# viewed by Web clients. +# + + Require all denied + + +# +# ErrorLog: The location of the error log file. +# If you do not specify an ErrorLog directive within a +# container, error messages relating to that virtual host will be +# logged here. If you *do* define an error logfile for a +# container, that host's errors will be logged there and not here. +# +ErrorLog "logs/error_log" + +# +# LogLevel: Control the number of messages logged to the error_log. +# Possible values include: debug, info, notice, warn, error, crit, +# alert, emerg. +# +LogLevel warn + + + # + # The following directives define some format nicknames for use with + # a CustomLog directive (see below). + # + LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined + LogFormat "%h %l %u %t \"%r\" %>s %b" common + + + # You need to enable mod_logio.c to use %I and %O + LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio + + + # + # The location and format of the access logfile (Common Logfile Format). + # If you do not define any access logfiles within a + # container, they will be logged here. Contrariwise, if you *do* + # define per- access logfiles, transactions will be + # logged therein and *not* in this file. + # + CustomLog "logs/access_log" common + + # + # If you prefer a logfile with access, agent, and referer information + # (Combined Logfile Format) you can use the following directive. + # + #CustomLog "logs/access_log" combined + + + + # + # Redirect: Allows you to tell clients about documents that used to + # exist in your server's namespace, but do not anymore. The client + # will make a new request for the document at its new location. + # Example: + # Redirect permanent /foo http://www.example.com/bar + + # + # Alias: Maps web paths into filesystem paths and is used to + # access content that does not live under the DocumentRoot. + # Example: + # Alias /webpath /full/filesystem/path + # + # If you include a trailing / on /webpath then the server will + # require it to be present in the URL. You will also likely + # need to provide a section to allow access to + # the filesystem path. + + # + # ScriptAlias: This controls which directories contain server scripts. + # ScriptAliases are essentially the same as Aliases, except that + # documents in the target directory are treated as applications and + # run by the server when requested rather than as documents sent to the + # client. The same rules about trailing "/" apply to ScriptAlias + # directives as to Alias. + # + ScriptAlias /cgi-bin/ "/opt/lampp/cgi-bin/" + + + + + # + # ScriptSock: On threaded servers, designate the path to the UNIX + # socket used to communicate with the CGI daemon of mod_cgid. + # + #Scriptsock logs/cgisock + + +# +# "/opt/lampp/cgi-bin" should be changed to whatever your ScriptAliased +# CGI directory exists, if you have that configured. +# + + AllowOverride None + Options None + Require all granted + + + + # + # TypesConfig points to the file containing the list of mappings from + # filename extension to MIME-type. + # + TypesConfig etc/mime.types + + # + # AddType allows you to add to or override the MIME configuration + # file specified in TypesConfig for specific file types. + # + #AddType application/x-gzip .tgz + # + # AddEncoding allows you to have certain browsers uncompress + # information on the fly. Note: Not all browsers support this. + # + #AddEncoding x-compress .Z + #AddEncoding x-gzip .gz .tgz + # + # If the AddEncoding directives above are commented-out, then you + # probably should define those extensions to indicate media types: + # + AddType application/x-compress .Z + AddType application/x-gzip .gz .tgz + + # + # AddHandler allows you to map certain file extensions to "handlers": + # actions unrelated to filetype. These can be either built into the server + # or added with the Action directive (see below) + # + # To use CGI scripts outside of ScriptAliased directories: + # (You will also need to add "ExecCGI" to the "Options" directive.) + # + #AddHandler cgi-script .cgi + # XAMPP, since LAMPP 0.9.8: + AddHandler cgi-script .cgi .pl .py + + # For type maps (negotiated resources): + #AddHandler type-map var + + # + # Filters allow you to process content before it is sent to the client. + # + # To parse .shtml files for server-side includes (SSI): + # (You will also need to add "Includes" to the "Options" directive.) + # + # XAMPP + AddType text/html .shtml + AddOutputFilter INCLUDES .shtml + + +# +# The mod_mime_magic module allows the server to use various hints from the +# contents of the file itself to determine its type. The MIMEMagicFile +# directive tells the module where the hint definitions are located. +# +#MIMEMagicFile etc/magic + +# +# Customizable error responses come in three flavors: +# 1) plain text 2) local redirects 3) external redirects +# +# Some examples: +#ErrorDocument 500 "The server made a boo boo." +#ErrorDocument 404 /missing.html +#ErrorDocument 404 "/cgi-bin/missing_handler.pl" +#ErrorDocument 402 http://www.example.com/subscription_info.html +# + +# +# MaxRanges: Maximum number of Ranges in a request before +# returning the entire resource, or one of the special +# values 'default', 'none' or 'unlimited'. +# Default setting is to accept 200 Ranges. +#MaxRanges unlimited + +# +# EnableMMAP and EnableSendfile: On systems that support it, +# memory-mapping or the sendfile syscall may be used to deliver +# files. This usually improves server performance, but must +# be turned off when serving from networked-mounted +# filesystems or if support for these functions is otherwise +# broken on your system. +# Defaults: EnableMMAP On, EnableSendfile Off +# +EnableMMAP off +EnableSendfile off + +# Supplemental configuration +# +# The configuration files in the etc/extra/ directory can be +# included to add extra features or to modify the default configuration of +# the server, or you may simply copy their contents here and change as +# necessary. + +# Server-pool management (MPM specific) +#Include etc/extra/httpd-mpm.conf + +# Multi-language error messages +Include etc/extra/httpd-multilang-errordoc.conf + +# Fancy directory listings +Include etc/extra/httpd-autoindex.conf + +# Language settings +#Include etc/extra/httpd-languages.conf + +# User home directories +#Include etc/extra/httpd-userdir.conf + +# Real-time info on requests and configuration +#Include etc/extra/httpd-info.conf + +# Virtual hosts +#Include etc/extra/httpd-vhosts.conf + +# Local access to the Apache HTTP Server Manual +#Include etc/extra/httpd-manual.conf + +# Distributed authoring and versioning (WebDAV) +#Include etc/extra/httpd-dav.conf + +# Various default settings +Include etc/extra/httpd-default.conf + +# Configure mod_proxy_html to understand HTML4/XHTML1 + +Include etc/extra/proxy-html.conf + + +# Secure (SSL/TLS) connections + +# XAMPP + +Include etc/extra/httpd-ssl.conf + + +# +# Note: The following must must be present to support +# starting without SSL on platforms with no /dev/random equivalent +# but a statically compiled-in mod_ssl. +# + +SSLRandomSeed startup builtin +SSLRandomSeed connect builtin + + +# XAMPP +Include etc/extra/httpd-xampp.conf +Include "/opt/lampp/apache2/conf/httpd.conf" diff --git a/ligand.txt b/ligand.txt deleted file mode 100644 index 689d8f8..0000000 --- a/ligand.txt +++ /dev/null @@ -1,2 +0,0 @@ -3wxb:A NDP -3o26:A NDP \ No newline at end of file