In [1]:
# to keep reloading the project (during testing)
%load_ext autoreload
%autoreload 2
In [2]:
# loading the module...
from pdbe import pyPDBeREST
p = pyPDBeREST()
In [3]:
# printing out the version
p.version
Out[3]:
In [4]:
# having a look at the default base_url
p.base_url
Out[4]:
In [5]:
# one can also override the base url with the dev branch of the api
# but this is not advisable unless you are testing new endpoints...
p = pyPDBeREST(base_url='https://wwwdev.ebi.ac.uk/pdbe/')
p.base_url
Out[5]:
In [6]:
# base to the default
p = pyPDBeREST()
In [7]:
# printing out all the available method endpoints...
print(p.endpoints())
In [8]:
# the same information can be found in
p.values
Out[8]:
In [9]:
# for each of these top level endpoints, print available methods
pdb = p.PDB
print(pdb.endpoints())
In [10]:
# values...
pdb.values
Out[10]:
In [11]:
# example of a GET query...
data = pdb.getSummary(pdbid='1cbs')
print(data)
In [12]:
# two things to consider now
# one is that the default output json mode is set to be 'pretty'
print(p.pretty_json)
In [13]:
# one can override that to compress the json output
p = pyPDBeREST(pretty_json=False)
print(p.pretty_json)
In [14]:
# running the same example...
pdb = p.PDB
data = pdb.getSummary(pdbid='1cbs')
print(data)
In [15]:
# the second aspect is that for each endpoint one might want to try learn more about
# which params are needed, etc.
p = pyPDBeREST()
pdb = p.PDB
In [16]:
# read the doc provided for each method
print(pdb.getSummary.doc)
In [17]:
# getting a look on the url
print(p.base_url + pdb.getSummary.url)
In [18]:
# getting to know which params are needed for a particular endpoint
print(pdb.getSummary.var.keys())
print(pdb.getSummary.var)
In [19]:
# getting to read the doc provided for each param
print(pdb.getSummary.var['pdbid']['doc'])
In [20]:
# checking whether this method allows for POST requests
print(pdb.getSummary.method)
'POST' in pdb.getSummary.method
Out[20]:
In [21]:
# now that we know POST request can be made to this endpoint let's try
# an example POST query...
# up to 1000 pdb ids can be queried with post methods
data = pdb.getSummary(pdbid='1cbs, 2pah', method='POST')
print(data)
In [22]:
# loading the data into python common data-structures
import json
pdata = json.loads(data)
print(pdata)
PDB
In [23]:
# using default parameters and compressed json output
p = pyPDBeREST(pretty_json=False)
print(p.PDB.endpoints())
In [ ]:
# Not running everything here because the output can be massive...
In [ ]:
print(p.PDB.getReleaseStatus(pdbid='2pah'))
In [ ]:
print(p.PDB.getSummary(pdbid='2pah'))
In [ ]:
print(p.PDB.getBindingSites(pdbid='2pah'))
In [ ]:
print(p.PDB.getObservedRanges(pdbid='2pah'))
In [ ]:
print(p.PDB.getRelatedPublications(pdbid='2pah'))
In [ ]:
print(p.PDB.getResidueListingChain(pdbid='2pah', chainid='A'))
In [ ]:
# needs an NMR structure
print(p.PDB.getNmrResources(pdbid='2k8v'))
In [ ]:
print(p.PDB.getExperiments(pdbid='2pah'))
In [ ]:
print(p.PDB.getVariousUrls(pdbid='2pah'))
In [ ]:
# needs a pdbid with DNA or RNA
print(p.PDB.getModifiedResidues(pdbid='4v5j'))
In [ ]:
print(p.PDB.getResidueListing(pdbid='2pah'))
In [ ]:
print(p.PDB.getExperiments(pdbid='2pah'))
In [ ]:
print(p.PDB.getPublications(pdbid='2pah'))
In [ ]:
# needs a structure with mutated residues
print(p.PDB.getMutatedResidues(pdbid='1bgj'))
In [ ]:
print(p.PDB.getMolecules(pdbid='2pah'))
In [ ]:
# post method
print(p.PDB.getSummary(pdbid='2pah, 1cbs', method='POST'))
COMPOUNDS
In [24]:
print(p.COMPOUNDS.endpoints())
In [ ]:
print(p.COMPOUNDS.getBounds(compid='ATP'))
In [ ]:
print(p.COMPOUNDS.getAtoms(compid='ATP'))
In [ ]:
print(p.COMPOUNDS.getSummary(compid='ATP'))
In [ ]:
print(p.COMPOUNDS.getInPdbs(compid='ATP'))
In [ ]:
# post method
print(p.COMPOUNDS.getSummary(compid='ATP, HEM', method='POST'))
EMDB
In [25]:
print(p.EMDB.endpoints())
In [ ]:
print(p.EMDB.getInfo(property='summary', emdbid='EMD-1200'))
SIFTS
In [26]:
print(p.SIFTS.endpoints())
In [ ]:
print(p.SIFTS.getMappings(accession='1cbs'))
In [ ]:
print(p.SIFTS.getPdbPfam(pdbid='1cbs'))
In [ ]:
print(p.SIFTS.getPdbGo(pdbid='1cbs'))
In [ ]:
print(p.SIFTS.getPdbInterpro(pdbid='1cbs'))
In [ ]:
print(p.SIFTS.getPdbUniprot(pdbid='1cbs'))
In [ ]:
print(p.SIFTS.getPdbCath(pdbid='1cbs'))
In [ ]:
print(p.SIFTS.getPdbEc(pdbid='2pah'))
In [ ]:
print(p.SIFTS.getPdbScop(pdbid='1cbs'))
In [ ]:
print(p.SIFTS.getSequenceDomains(pdbid='1cbs'))
In [ ]:
print(p.SIFTS.getStructuralDomains(pdbid='1cbs'))
In [ ]:
print(p.SIFTS.getBestStructures(uniprotid='P29373'))
In [ ]:
print(p.SIFTS.getHomologene(pdbid='1cbs', entity='1'))
PISA
In [27]:
print(p.PISA.endpoints())
In [ ]:
print(p.PISA.getVersion())
In [ ]:
print(p.PISA.getNumberEntries())
In [ ]:
print(p.PISA.getPdbsList())
In [ ]:
print(p.PISA.getAsisList(pdbid='3gcb'))
In [ ]:
print(p.PISA.getAsisDetails(pdbid='3gcb', assemblyid='0'))
In [ ]:
print(p.PISA.getAsisSummary(pdbid='3gcb', assemblyid='0'))
In [ ]:
print(p.PISA.getAsisComponent(pdbid='3gcb', assemblyid='0',
assembly_component='energetics'))
In [ ]:
print(p.PISA.getAssembly(pdbid='3gcb', assemblyid='0',
set=0, assembly_index=0))
In [ ]:
print(p.PISA.getAnalysis(pdbid='3gcb', assemblyid='0'))
In [ ]:
print(p.PISA.getAssembliesList(pdbid='3gcb', assemblyid='0'))
In [ ]:
print(p.PISA.getAssemblyDetails(pdbid='3gcb', assemblyid='0',
assembly_index=0))
In [ ]:
print(p.PISA.getAssemblyComponent(pdbid='3gcb', assemblyid='0',
assembly_index=0,
assembly_component='energetics'))
In [ ]:
print(p.PISA.getMonomersList(pdbid='3gcb', assemblyid='0'))
In [ ]:
print(p.PISA.getMonomerDetails(pdbid='3gcb', assemblyid='0',
monomer_index=1))
In [ ]:
print(p.PISA.getMonomerComponent(pdbid='3gcb', assemblyid='0',
monomer_index=1,
monomer_component='energetics'))
In [ ]:
print(p.PISA.getInterfaces(pdbid='3gcb', assemblyid='0'))
In [ ]:
print(p.PISA.getNumberInterfaces(pdbid='3gcb', assemblyid='0'))
In [ ]:
print(p.PISA.getInterfacesList(pdbid='3gcb', assemblyid='0'))
In [ ]:
print(p.PISA.getInterfaceDetails(pdbid='3gcb', assemblyid='0',
interface_index=1))
In [ ]:
print(p.PISA.getInterfaceComponent(pdbid='3gcb', assemblyid='0',
interface_index=1,
interface_component='energetics'))
SSM
In [28]:
print(p.SSM.endpoints())
In [ ]:
print(p.SSM.getVersion())
In [ ]:
print(p.SSM.getMatchStandard(pdbid='3gcb'))
In [ ]:
print(p.SSM.getNumberMatches(pdbid='3gcb'))
In [ ]:
print(p.SSM.getMatchSummary(pdbid='3gcb'))
In [ ]:
print(p.SSM.getMatchDetail(pdbid='3gcb', ssm_index=1))
VALIDATION
In [29]:
print(p.VALIDATION.endpoints())
In [ ]:
print(p.VALIDATION.getGlobalRelativePercentiles(pdbid='1cbs'))
In [ ]:
print(p.VALIDATION.getGlobalAbsolutePercentilesSummary(pdbid='1cbs'))
In [ ]:
print(p.VALIDATION.getGlobalPercentilesDetails(pdbid='1cbs'))
In [ ]:
print(p.VALIDATION.getDiffractionRefinementDescriptors(pdbid='1cbs'))
In [ ]:
print(p.VALIDATION.getRamachandranSidechainOutliers(pdbid='1cbs'))
In [ ]:
print(p.VALIDATION.getBackboneSidechainQuality(pdbid='1cbs'))
In [ ]:
print(p.VALIDATION.getSuitePuckerRnaOutliers(pdbid='1cbs'))
In [ ]:
print(p.VALIDATION.getOutlierTypesResidues(pdbid='1cbs'))
In [ ]:
print(p.VALIDATION.getVanDerWaalOverlaps(pdbid='1cbs'))
In [ ]:
print(p.VALIDATION.getGeometryOutliers(pdbid='1cbs'))
In [ ]:
print(p.VALIDATION.getAllOutliersUnitId(pdbid='1cbs'))
In [ ]:
# post method
print(p.VALIDATION.getAllOutliersUnitId(pdbid='2pah, 1cbs', method='POST'))
TOPOLOGY
In [30]:
print(p.TOPOLOGY.endpoints())
In [ ]:
print(p.TOPOLOGY.getTopology(pdbid='1csb'))
In [ ]:
print(p.TOPOLOGY.getTopologyPerChain(pdbid='1csb', chainid='A'))
SEARCH
In [31]:
print(p.SEARCH.endpoints())
In [ ]:
print(p.SEARCH.getSearch(query='q=pfam_name:Lipocalin&wt=json'))