File: loop_backbone.py

package info (click to toggle)
promod3 3.4.2%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 966,596 kB
  • sloc: cpp: 55,820; python: 18,058; makefile: 85; sh: 51
file content (33 lines) | stat: -rw-r--r-- 1,052 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from ost import io
from ost import conop
from promod3 import loop

sequence = "AAAAAAAA"

# the backbone gets initially constructed with backbone dihedrals
# typical for helices
bb_list = loop.BackboneList(sequence)

# let's have a look at the set dihedral angles
for i in range(len(bb_list)):
    print("Looking at position %d" % i)
    if i > 0:
        print("phi: %.4f" % bb_list.GetPhiTorsion(i))
    if i < len(bb_list)-1:
        print("psi: %.4f" % bb_list.GetPsiTorsion(i))


# we now use a TorsionSampler to set random dihedral angles
torsion_sampler = loop.LoadTorsionSampler()
idx = torsion_sampler.GetHistogramIndex(conop.ALA, 
                                        conop.ALA, 
                                        conop.ALA)
for i in range(len(bb_list)):
    dihedrals = torsion_sampler.Draw(idx)
    if i > 0:
        bb_list.SetPhiTorsion(i, dihedrals[0])
    if i < len(bb_list)-1:
        bb_list.SetPsiTorsion(i, dihedrals[1])

# let's save down the randomized fragment
io.SavePDB(bb_list.ToEntity(), "randomized_fragment.pdb")