Skip to content
Snippets Groups Projects
Commit aca26f51 authored by Rafal Gumienny's avatar Rafal Gumienny
Browse files

docs: SCHWED-3121 Update lDDT examples

parent 18dcd749
No related branches found
No related tags found
No related merge requests found
......@@ -198,11 +198,16 @@ One can replicate the binary using simple python script:
CheckStructure,
LocalDistDiffTest,
GetlDDTPerResidueStats,
PrintlDDTPerResidueStats)
from ost.io import StereoChemicalParamsReader
PrintlDDTPerResidueStats,
ResidueNamesMatch)
from ost.io import ReadStereoChemicalPropsFile
model_path = "Path to your model pdb file"
reference_path = "Path to your reference pdb file"
structural_checks = True
bond_tolerance = 12
angle_tolerance = 12
cutoffs = [0.5, 1.0, 2.0, 4.0]
#
# Load model and prepare its view
model = LoadPDB(model_path)
......@@ -220,29 +225,44 @@ One can replicate the binary using simple python script:
CleanlDDTReferences(references)
#
# Prepare residue map from references
rdmap = PreparelDDTGlobalRDMap(references, settings)
rdmap = PreparelDDTGlobalRDMap(references,
cutoffs=cutoffs,
sequence_separation=0,
radius=15)
#
# This part is optional and it depends on our settings parameter
if settings.structural_checks:
stereochemical_parameters = StereoChemicalParamsReader(
settings.parameter_file_path)
stereochemical_parameters.Read()
if structural_checks:
stereochemical_parameters = ReadStereoChemicalPropsFile()
CheckStructure(ent=model_view,
bond_table=stereochemical_parameters.bond_table,
angle_table=stereochemical_parameters.angle_table,
nonbonded_table=stereochemical_parameters.nonbonded_table,
bond_tolerance=settings.bond_tolerance,
angle_tolerance=settings.angle_tolerance)
bond_tolerance=bond_tolerance,
angle_tolerance=angle_tolerance)
#
# Check consistency
is_cons = ResidueNamesMatch(model_view, references[0], True)
print "Consistency check: ", "OK" if is_cons else "ERROR"
#
# Calculate lDDT
LocalDistDiffTest(model_view, references, rdmap, settings)
LocalDistDiffTest(model_view,
references,
rdmap,
settings)
#
# Get the local scores
local_scores = GetlDDTPerResidueStats(model, rdmap, settings)
local_scores = GetlDDTPerResidueStats(model_view,
rdmap,
structural_checks,
settings.label)
#
# Pring local scores
PrintlDDTPerResidueStats(local_scores, settings)
PrintlDDTPerResidueStats(local_scores, structural_checks, len(cutoffs))
Similar effect could be obtained using lDDTScorer. See :class:`~ost.mol.alg.lDDTScorer`
for a simple example.
This can be useful when we already have an models and references already read
in the memory and we do not want run the binary.
The Python API can be useful when we already have an models and references already
read in the memory and we do not want run the binary.
Please refere to specific function documentation for more details.
......@@ -548,11 +548,33 @@ Local Distance Test scores (lDDT, DRMSD)
Object to compute lDDT scores.
Example usage with pre-prepared references.
Example usage.
.. code:: python
import ost
#! /bin/env python
"""Run lDDT from within script."""
from ost.io import LoadPDB
from ost.mol.alg import (CleanlDDTReferences,
lDDTSettings, lDDTScorer)
from ost.io import ReadStereoChemicalPropsFile
ent_full = LoadPDB('3ia3', remote=True)
model_view = ent_full.Select('cname=A')
references = [ent_full.Select('cname=C')]
#
# Initialize settings with default parameters and print them
settings = lDDTSettings()
settings.PrintParameters()
# Clean up references
CleanlDDTReferences(references)
#
# Calculate lDDT
scorer = lDDTScorer(references=references, model=model_view, settings=settings)
print "Global score:", scorer.global_score
scorer.PrintPerResidueStats()
:param references: Sets :attr:`references`
:param model: Sets :attr:`model`
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment