GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — pymodsim/modprep.py at main · GPCR-ModSim/pymodsim

Expand file tree

/

modprep.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
53 lines (47 loc) · 2.35 KB
/

modprep.py

Copy path

File metadata and controls

53 lines (47 loc) · 2.35 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import modeller
from modeller import automodel
from modeller.selection import Selection
import sys
def run_modeller(**kwargs):
"""
Refine protein structure using MODELLER. Only the edited regions move.
"""
default_stdout = sys.stdout
sys.stdout = open("pymodsim.log", "a")
try:
if kwargs["mode"] == "run":
modeller.log.minimal()
env = modeller.Environ()
env.io.atom_files_directory = ['.', '../atom_files']
aln = modeller.Alignment(env, file=kwargs["alnfile"])
def build(ext, randomize):
class EditedRegionsOnly(automodel.AutoModel):
def select_atoms(self):
# Linkers and cut loop ends (+ext residues each side) move; everything
# else keeps the input coordinates. loops() does not report trimmed
# termini, so the first and last ext+1 residues always move.
res = self.residues
n = len(res)
ends = [res[i] for i in range(ext + 1)] + [res[n - 1 - i] for i in range(ext + 1)]
return Selection(self.loops(aln, minlength=1, maxlength=10000,
insertion_ext=ext, deletion_ext=ext,
include_termini=True), ends)
a = EditedRegionsOnly(env, alnfile=kwargs["alnfile"],
knowns=kwargs["knowns"], sequence='refined')
a.starting_model = 1
a.ending_model = 1
a.md_level = None
if not randomize:
a.rand_method = None
a.make()
return a.outputs[0]["failure"] is None
# The random start can make the objective function NaN when few atoms are free
# (2 of 1601 GPCRdb models). Retry without randomization, then with a wider selection.
for ext, randomize in ((1, True), (1, False), (3, False)):
if build(ext, randomize):
break
print("MODELLER failed (selection +{0}, randomize={1}); retrying".format(ext, randomize))
else:
raise RuntimeError("MODELLER produced no model (see pymodsim.log)")
finally:
sys.stdout = default_stdout
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.