diff --git a/modules/mol/alg/doc/lddt.rst b/modules/mol/alg/doc/lddt.rst index 6529c47758e29d8fa292c475d7a212ce25cc9e56..48a9493c9fe8e8e3b1d1799da5149c784657ce74 100644 --- a/modules/mol/alg/doc/lddt.rst +++ b/modules/mol/alg/doc/lddt.rst @@ -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. diff --git a/modules/mol/alg/doc/molalg.rst b/modules/mol/alg/doc/molalg.rst index fd9490a52f1fdc6338725be92011c1bc8bada147..158f4465307c53e503866fb2d77cf16acb2a394d 100644 --- a/modules/mol/alg/doc/molalg.rst +++ b/modules/mol/alg/doc/molalg.rst @@ -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`