A comprehensive database of human phosphosites within their full context. Scop3P integrates sequences (UniProtKB/Swiss-Prot), structures (PDB), and uniformly reprocessed phosphoproteomics data (PRIDE) to annotate all known human phosphosites.
Scop3P, available at https://iomics.ugent.be/scop3p, presents a unique resource for visualization and analysis of phosphosites and for understanding of phosphosite structure–function relationships.
%%capture
!jupyter labextension install jupyterlab_3dmol
!jupyter labextension install @jupyter-widgets/jupyterlab-manager
!pip install pandas matplotlib py3Dmol b2btools==3.0.7b2
%%capture
import requests, tempfile,json,sys
sys.path.append("./scripts") ## get python scripts from this directory
import pandas as pd
from b2bTools import SingleSeq, constants
import py3Dmol
import ipywidgets as widgets
wid=widgets.FileUpload(
accept='', # Accepted file extension e.g. '.txt', '.pdf', 'image/*', 'image/*,.pdf'
multiple=False # True to accept multiple files upload else False
)
display(wid)
# wid.values
# print (infile)
# content=infile['content']
# content=io.String(content.decode('utf-8'))
# df=pd.read_csv(content)
pepfile=pd.read_csv('peptidefile.txt',sep='\t',usecols=[1,2,4,5,6,7])
proteincol=input("Enter Protein ID column number: ")
proteincolname=pepfile.columns[int(proteincol)-1]
print ("Protein column name in provided file is: ", proteincolname)
Enter Protein ID column number: 5 Protein column name in provided file is: ACC_ID
pepgroup=pepfile.groupby(proteincolname)
proteinlist=list(set(pepfile[proteincolname].tolist()))
print ("Total number of proteins in your file: ", len(proteinlist))
Total number of proteins in your file: 4
def fetch_prot_sequence(accession):
BASE_URL = f"http://uniprot.org/uniprotkb/{accession}.fasta"
url = f'{BASE_URL}?accession={accession}'
response = requests.get(url)
if response.status_code == 200:
raw_fasta_sequence = response.content.decode("utf-8")
else:
raw_fasta_sequence = ""
lines = raw_fasta_sequence.split('\n')
protein_id = str(lines[0])
amino_acids = "".join([str(l) for l in lines[1:]])
return protein_id, amino_acids
# def UPseqfetch(protseq,accsn,pep):
import re
def add_element(tmpdict, key, value):
if key not in tmpdict:
tmpdict[key] = []
tmpdict[key].append(value)
def pepMapper(protDF):
dataDF={}
for idx, grp in pepgroup:
protid=grp[proteincolname].tolist()[0]
peplis=list(set(grp['Pep_seq'].tolist()))
id_,protseq=fetch_prot_sequence(protid)
for pep in peplis:
for match in re.finditer(pep, protseq):
newpos=[match.start()+1, match.end()+1]
add_element(dataDF,protid,[pep,newpos[0],newpos[1]])
return dataDF
mapped_peptides=pepMapper(pepgroup)
print ("Protein\t#Peptides")
print("\n".join("{}\t{}".format(key,len(value)) for key,value in mapped_peptides.items()))
Protein #Peptides P55884 1 Q9BXS5 2 Q9H0H5 1 Q9HC35 1
structureID=input("Please enter the protein Id for 3D visualization: ")
peptides=mapped_peptides[structureID]
Please enter the protein Id for 3D visualization: Q9BXS5
## Get alphaFold model for the protein
import urllib.request
AFurl="https://alphafold.ebi.ac.uk/files/AF-"
modelurl = f'{AFurl}{structureID}{"-F1-model_v4.pdb"}'
AFmodel = urllib.request.urlretrieve(modelurl,f'{structureID}{".pdb"}')
import itertools
def display_3D(peptides):
view = py3Dmol.view()
view.addModel(open((structureID+'.pdb'), 'r').read(),'pdb')
allpos=[]
colordict,commoncol={},{}
view.setStyle({'cartoon': { 'color': 'silver' }})
view.addSurface(py3Dmol.VDW, {'opacity': 0.60, 'color': 'white' })
for pep in peptides:
for aapos in range(pep[1],pep[2]+1):
allpos.append(list(range(pep[1],pep[2]+1)))
mergedPos = list(itertools.chain.from_iterable(allpos))
commonPos=list(set.intersection(*map(set, allpos)))
for aapos in mergedPos:
colordict[aapos]='blue'
# view.addSurface(py3Dmol.VDW, {'opacity': 0.6,'color':'red'},{'resi': [aapos]})
for aapos1 in commonPos:
commoncol[aapos1]='purple'
# view.addSurface(py3Dmol.VDW, {'opacity': 0.6,'color':'purple'},{'resi': [aapos1]})
print ("Common positions colored in Purple")
view.setStyle({'cartoon': {'colorscheme':{'prop':'resi','map':colordict}}})
view.setStyle({'cartoon': {'colorscheme':{'prop':'resi','map':commoncol}}})
view.zoomTo()
return view
display_3D(peptides)
Common positions colored in Purple
You appear to be running in JupyterLab (or JavaScript failed to load for some other reason). You need to install the 3dmol extension:
jupyter labextension install jupyterlab_3dmol
<py3Dmol.view at 0x7f29d3f8aa70>