Skip to content
Snippets Groups Projects
Commit 9530a74d authored by Gerardo Tauriello's avatar Gerardo Tauriello
Browse files

Doc update: removed BackboneLoopScorer, added new loop example.

parent 291b9ec6
Branches
Tags
No related merge requests found
......@@ -43,6 +43,7 @@ set (DOC_TEST_SCRIPTS
scripts/modelling_fill_loops_by_database.py
scripts/modelling_fill_loops_by_monte_carlo.py
scripts/modelling_model_termini.py
scripts/modelling_loop_candidates.py
scripts/sidechain_reconstruct.py
scripts/sidechain_steps.py
......
from ost import io
from promod3 import loop, scoring, modelling
# let's load a crambin structure from the pdb
crambin = io.LoadPDB('data/1CRN.pdb')
SEQRES = ''.join([r.one_letter_code for r in crambin.residues])
# this is the sequence we want to remodel
loop_seq = SEQRES[23:31]
# let's define the stem residues
n_stem = crambin.residues[23]
c_stem = crambin.residues[30]
# we use the StructureDB as source for structural information
structure_db = loop.LoadStructureDB()
# the FragDB allows to access the StructureDB based on geometric
# features of the loop stem residue
from ost import io, seq
from promod3 import loop
# load an example structure
prot = io.LoadPDB('data/1CRN.pdb')
# extract some additional information
seqres = ''.join([r.one_letter_code for r in prot.residues])
frag_pos = 35
frag_length = 9
frag_seq = seqres[frag_pos:frag_pos+frag_length]
frag_residues = prot.residues[frag_pos:frag_pos+frag_length]
ref_backbone = loop.BackboneList(frag_seq, frag_residues)
n_stem = prot.residues[frag_pos]
c_stem = prot.residues[frag_pos+frag_length-1]
# extract potential loops from fragment database based on geometry
frag_db = loop.LoadFragDB()
# the LoopCandidates allow to handle several loops at once
# we directly want to find potential loop candidates from the
# previously loaded databases
loop_candidates = modelling.LoopCandidates.FillFromDatabase(\
n_stem, c_stem, loop_seq, frag_db, structure_db)
# candidates usually don't match exactly the required stem coords.
# CCD (Cyclic Coordinate Descent) is one way to enforce this match.
loop_candidates.ApplyCCD(n_stem, c_stem)
# setup backbone scorer with clash and cbeta scoring
score_env = scoring.BackboneScoreEnv(SEQRES)
score_env.SetInitialEnvironment(crambin)
scorer = scoring.BackboneOverallScorer()
scorer["cbeta"] = scoring.LoadCBetaScorer()
scorer["clash"] = scoring.ClashScorer()
scorer.AttachEnvironment(score_env)
# the scorer can then be used on the LoopCandidates object to
# calculate a desired score (here: cbeta + clash, resnum = 24)
weights = {"cbeta": 1, "clash": 1}
scores = loop_candidates.CalculateLinearScores(scorer, weights, 24)
# let's get the best one, insert it into our structure and save it
min_score = min(scores)
min_candidate = scores.index(min_score)
bb_list = loop_candidates[min_candidate].bb_list
bb_list.InsertInto(crambin.chains[0], n_stem.GetNumber())
io.SavePDB(crambin, "modified_crambin.pdb")
fragments = frag_db.SearchDB(n_stem, c_stem, frag_length)
print "Num. fragments found in FragDB: %d" % len(fragments)
# compare with reference
struct_db = loop.LoadStructureDB()
for i in range(len(fragments)):
# get structure from structural database
bb_list = struct_db.GetBackboneList(n_stem, c_stem, fragments[i])
ca_rmsd = bb_list.CARMSD(ref_backbone, True)
print "-> fragment %d has CA RMSD of %.3f" % (i, ca_rmsd)
# extract potential loops from fragment database based on sequence
fragger = loop.Fragger(frag_seq)
# for simplicity we just use a sequence similarity score
fragger.AddSeqSimParameters(1.0, seq.alg.BLOSUM62)
fragger.Fill(struct_db, 1.0, 5)
print "Num. fragments found in Fragger: %d" % len(fragments)
# compare fraggers with reference
for i in range(len(fragger)):
ca_rmsd = fragger[i].CARMSD(ref_backbone, True)
print "-> fragment %d has CA RMSD of %.3f" % (i, ca_rmsd)
from ost import io
from promod3 import loop, scoring, modelling
# let's load a crambin structure from the pdb
crambin = io.LoadPDB('data/1CRN.pdb')
SEQRES = ''.join([r.one_letter_code for r in crambin.residues])
# this is the sequence we want to remodel
loop_seq = SEQRES[23:31]
# let's define the stem residues
n_stem = crambin.residues[23]
c_stem = crambin.residues[30]
# we use the StructureDB as source for structural information
structure_db = loop.LoadStructureDB()
# the FragDB allows to access the StructureDB based on geometric
# features of the loop stem residue
frag_db = loop.LoadFragDB()
# the LoopCandidates allow to handle several loops at once
# we directly want to find potential loop candidates from the
# previously loaded databases
loop_candidates = modelling.LoopCandidates.FillFromDatabase(\
n_stem, c_stem, loop_seq, frag_db, structure_db)
# candidates usually don't match exactly the required stem coords.
# CCD (Cyclic Coordinate Descent) is one way to enforce this match.
loop_candidates.ApplyCCD(n_stem, c_stem)
# setup backbone scorer with clash and cbeta scoring
score_env = scoring.BackboneScoreEnv(SEQRES)
score_env.SetInitialEnvironment(crambin)
scorer = scoring.BackboneOverallScorer()
scorer["cbeta"] = scoring.LoadCBetaScorer()
scorer["clash"] = scoring.ClashScorer()
scorer.AttachEnvironment(score_env)
# the scorer can then be used on the LoopCandidates object to
# calculate a desired score (here: cbeta + clash, resnum = 24)
weights = {"cbeta": 1, "clash": 1}
scores = loop_candidates.CalculateLinearScores(scorer, weights, 24)
# let's get the best one, insert it into our structure and save it
min_score = min(scores)
min_candidate = scores.index(min_score)
bb_list = loop_candidates[min_candidate].bb_list
bb_list.InsertInto(crambin.chains[0], n_stem.GetNumber())
io.SavePDB(crambin, "modified_crambin.pdb")
......@@ -170,12 +170,8 @@ class DocTests(unittest.TestCase):
################################################################
def testLoopMain(self):
# run it
# just check that it doesn't crash
self.checkPMRun('loop_main.py', [], 0)
# check that result exists and is readable
io.LoadPDB('modified_crambin.pdb')
# clean up
os.remove('modified_crambin.pdb')
def testLoopBackbone(self):
# run it
......@@ -337,6 +333,14 @@ class DocTests(unittest.TestCase):
'Number of gaps before: 2\n' +
'Number of gaps after: 0')
def testModellingLoopCandidates(self):
# run it
self.checkPMRun('modelling_loop_candidates.py', [], 0)
# check that result exists and is readable
io.LoadPDB('modified_crambin.pdb')
# clean up
os.remove('modified_crambin.pdb')
################################################################
def testSidechainReconstruct(self):
......
......@@ -3,7 +3,6 @@ set(LOOP_RST
torsion_sampler.rst
loop_closing.rst
backbone.rst
backbone_loop_score.rst
monte_carlo.rst
structure_db.rst
load_loop_objects.rst
......
This diff is collapsed.
......@@ -22,7 +22,6 @@ Contents:
Have a closer look at backbone dihedral angles <torsion_sampler>
A dump for structural data <structure_db>
Closing Loops - adapt them to the environment <loop_closing>
Loop Scoring <backbone_loop_score>
Generating Loops DeNovo <monte_carlo>
Loading Precomputed Loop Objects <load_loop_objects>
Helper Classes <helper_classes>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment