from __future__ import with_statement from __future__ import division import collections from utils import memoize_m from utils.tool import _, _dir_init, CmdTool, ProviMixin import provi_prep as provi DIR, PARENT_DIR, TMPL_DIR = _dir_init(__file__, "hbexplore") HBEXPLORE_CMD = "HBX" # 1=donor, 2=acceptor ??? HbxHbond = collections.namedtuple("HbxHbond", [ "chain1", "resno1", "resname1", "atomname1", "chain2", "resno2", "resname2", "atomname2", "dDA", "dHA", "aDHA", "aHAhyb", "type" ]) def parse_hbx_output(hbexplore_file): """Function that parses HBexplores .anal files""" hbonds = [] id_dict = {} hbpart = 0 # SG CYS 127 O ILE 124 3.2597 # TOM 18 CB VAL 2 3.462 14.126 6.256 1.00 14.07 193L 162 # parse HBX.anal file #87 NH2 ARG A 71 O MET A 1 3.0821 2.356 128.0 53.8 s-s with open(hbexplore_file, "r") as fp: for l in fp:
import os from utils.tool import _, _dir_init, CmdTool, ScriptMixin DIR, PARENT_DIR, TMPL_DIR = _dir_init(__file__, "jmol") JAVA_CMD = "java" JMOL_PATH = os.environ.get("JMOL_PATH", "") JMOL_JAR = os.path.join(JMOL_PATH, "JmolData.jar") class Jmol(CmdTool, ScriptMixin): args = [_("script_file", type="file", ext="jspt")] script_tmpl = None tmpl_dir = TMPL_DIR def _init(self, script_file, *args, **kwargs): # TODO when args is empty check for self.script_tmpl # to get rid of script_file if script_file == "__tmpl__": self.script_file = self.outpath(self.script_tmpl) self.cmd = [ JAVA_CMD, "-Xmx6000M", "-jar", JMOL_JAR, "-oxdl", "-s", self.script_file ] class JmolImage(Jmol): args = [ _("jmol_file", type="file", ext="jmol"),
from utils import copy_dict, try_float, try_div, flatten from utils.math import point_plane_dist from utils.tool import (_, _dir_init, PyTool, RecordsMixin, ParallelMixin, ProviMixin, JsonBackend, SqliteBackend) from utils.numpdb import NumPdb, NumAtoms from opm import Opm, OpmInfo, Ppm2 from dowser import DowserRepeat, DowserPlus2 from voronoia import Voronoia, HOLE_NOT_FILLED, HOLE_PARTLY_FILLED from hbexplore import HBexplore from msms import Msms from mpstruc import MpstrucDownload, MpstrucInfo from pdb import PdbInfo from dssp import Dssp DIR, PARENT_DIR, TMPL_DIR = _dir_init(__file__, "mppd") CURATED_INFO = collections.defaultdict( dict, { "": { "backbone_only": True, "no_pdb_entry": True, "representative": "", "related": [], "species": "", "comment": "" }, "2W1B": { "comment": "dowser max_repeats=5" },
from __future__ import division import collections from utils.tool import _, _dir_init, CmdTool from utils import numpdb from utils.numpdb import NumPdb DIR, PARENT_DIR, TMPL_DIR = _dir_init(__file__, "dssp") DSSP_CMD = "mkdssp" ################################################## # http://swift.cmbi.ru.nl/gv/dssp/index.html ################################################## # # COPYRIGHT # W. Kabsch, C. Sander and MPI-MF, 1983, 1985, 1988, 1994 1995 # CMBI version by [email protected] / November 18,2002 # USAGE # dsspcmbi [Options] PDB_File DSSP_File -> Read PDB_File and write DSSP_File # dsspcmbi [Options] -- dssp_file -> Read from stdin and write DSSP_File # dsspcmbi -h -> Display this help screen # OPTIONS # -na Disables the calculation of accessible surface. # -c Classic (old) format. # -w Wide 2002 format (for future use,not the current standard). # -v Verbose. # -- Read from standard input. # -h -? Prints a help message.
import os from utils.tool import _, _dir_init, CmdTool pdbDIR, pdbPARENT_DIR, pdbTMPL_DIR = _dir_init(__file__, "pdb") DIR, PARENT_DIR, TMPL_DIR = _dir_init(__file__, "solvate") solvate_CMD = os.path.join(TMPL_DIR, "solvate") class Solvate(CmdTool): """ SOLVATE is a program to construct an atomic solvent environment model for a given atomic macromolecule model (solute) for use in molecular dynamics simulations. """ args = [ _("pdb_input", type="file", help="specifies the name of the input pdb-/psf-file of the solute. " + "If the -ion option is set, both pdb- and psf-file are required; " + "otherwise only the pdb-file is needed. No extension must be given! " + "The input file name may be omitted, in which case SOLVATE creates " + "a pure spherical water droplet centered at the origin."), _("thick|th", type="float", default=10.0, help= "specifies the minimum water shell thickness in Angstrom (dafult: 10.0)," +
from poster.encode import multipart_encode from poster.streaminghttp import register_openers import numpy as np from numpy.linalg import svd import scipy from utils import memoize_m, try_float from utils.math import norm from utils.tool import _, _dir_init, PyTool, ProviMixin from utils.listing import ListRecord, ListIO import utils.numpdb as numpdb from utils.numpdb import NumPdb, numsele DIR, PARENT_DIR, TMPL_DIR = _dir_init( __file__, "tmdet" ) PDBTM_LOCAL_PATH = os.environ.get("PDBTM_LOCAL_PATH", "") TMDET_URL = "http://tmdet.enzim.hu/" PDBTM_ALPHAHELICAL_URL = "http://pdbtm_data.enzim.hu/pdbtmalpha" PDBTM_ALPHAHELICAL_PATH = os.environ.get("PDBTM_ALPHAHELICAL_PATH", "") def pdbtm_download(): try: url = PDBTM_ALPHAHELICAL_URL return urllib2.urlopen( url ).read() except urllib2.HTTPError: raise Exception("MPstruc url error") def pdbtm( pdbid, db_path=PDBTM_LOCAL_PATH ):
import collections from poster.encode import multipart_encode from poster.streaminghttp import register_openers import numpy as np from utils import memoize_m, try_float, copy_dict, get_index from utils.math import norm from utils.tool import _, _dir_init, PyTool, ProviMixin from utils.listing import ListRecord, ListIO from utils.numpdb import NumPdb from pdb import PdbAssembly DIR, PARENT_DIR, TMPL_DIR = _dir_init(__file__, "opm") OPM_URL = "http://opm.phar.umich.edu/" OPM_PDB_URL = OPM_URL + "pdb/{pdb_id:}.pdb" OPM_LIST_URL = OPM_URL + "superfamilies_dl.php?class={class_id:}" OPM_SEARCH_URL = OPM_URL + "protein.php?search={pdb_id:}" OPM_LOCAL_PATH = os.environ.get("OPM_LOCAL_PATH", "") PPM_URL = "http://sunshine.phar.umich.edu/" def opm_list(class_id): try: url = OPM_LIST_URL.format(class_id=class_id) page = urllib2.urlopen(url).read() except urllib2.HTTPError: raise Exception("Opm_list url error") pdb_ids = re.findall(r"([0-9a-zA-Z]{4})<br />", page)
from __future__ import with_statement from __future__ import division import os import logging from basekit import utils from utils import path, copy_dict from utils.tool import _, _dir_init, CmdTool, PyTool DIR, PARENT_DIR, TMPL_DIR = _dir_init(__file__, "mapman") Mapman_CMD = os.path.join(TMPL_DIR, "lx_mapman") logging.basicConfig() LOG = logging.getLogger('mapman') LOG.setLevel(logging.ERROR) class BrixToMap(PyTool): """A wrapper around the 'Mapman' program to convert a Brix-File into a Map-File.""" args = [ _("brix_input", type="file", help="Input Brix-File "), ] out = [] tmpl_dir = TMPL_DIR def _init(self, *args, **kwargs): self.mapman = Mapman( self.brix_input, "brix", **copy_dict(kwargs, run=False,
from utils import copy_dict, try_float, try_div, flatten from utils.math import point_plane_dist from utils.tool import (_, _dir_init, PyTool, RecordsMixin, ParallelMixin, ProviMixin, JsonBackend, SqliteBackend) from utils.numpdb import NumPdb, NumAtoms from opm import Opm, OpmInfo, Ppm2 from dowser import DowserRepeat from voronoia import Voronoia, HOLE_NOT_FILLED, HOLE_PARTLY_FILLED from hbexplore import HBexplore from msms import Msms from mpstruc import MpstrucInfo from pdb import PdbInfo from dssp import Dssp DIR, PARENT_DIR, TMPL_DIR = _dir_init(__file__, "voronoia") CURATED_INFO = collections.defaultdict( dict, { "": { "backbone_only": True, "no_pdb_entry": True, "representative": "", "related": [], "species": "", "comment": "" }, "2XND": { "representative": "", # from sequence similarity
from __future__ import division import numpy as np import utils.numpdb as numpdb import os import string import shutil import collections import utils from utils import copy_dict, dir_walker, iter_stride from utils.tool import _, _dir_init, CmdTool, ProviMixin from utils.math import hclust import json DIR, PARENT_DIR, TMPL_DIR = _dir_init(__file__, "msms") wfmesh_FILE = os.path.join(TMPL_DIR, "wfmesh.py") MSMS_CMD = "msms" BABEL_CMD = "babel" # newest open babel helps 2.2.3 """ g Surface1 # Number of vertices: 30918 v -51.84846 50.86638 114.37491 # Number of normals: 21610 vn -.076 .994 -.082 # Number of faces: 64556 f 3//3 2//2 1//1
from __future__ import with_statement from __future__ import division import os import re import json import urllib2 import xml.etree.ElementTree from utils.tool import _, _dir_init, PyTool from utils.listing import ListRecord, ListIO DIR, PARENT_DIR, TMPL_DIR = _dir_init(__file__, "mpstruc") MPSTRUC_URL = "http://blanco.biomol.uci.edu/mpstruc/" MPSTRUC_ALPHAHELICAL_URL = MPSTRUC_URL + "listAll/mpstrucAlphaHlxTblXml" MPSTRUC_ALPHAHELICAL_PATH = os.environ.get("MPSTRUC_ALPHAHELICAL_PATH", "") def mpstruc_download(): try: url = MPSTRUC_ALPHAHELICAL_URL return urllib2.urlopen(url).read() except urllib2.HTTPError: raise Exception("MPstruc url error") def mpstruc_tree(xml_file=None): if not xml_file: xml_file = MPSTRUC_ALPHAHELICAL_PATH try: tree = xml.etree.ElementTree.parse(xml_file)
from __future__ import division import os import json import itertools import numpy as np from utils import copy_dict from utils.tool import _, _dir_init, PyTool, CmdTool, ScriptMixin from utils.numpdb import NumPdb from utils.mrc import getMrc from utils.math import rmsd from pdb import *#PdbSplit #from pdb import PdbEdit, NumpdbTest DIR, PARENT_DIR, TMPL_DIR = _dir_init( __file__, "spider" ) SPIDER_CMD = "spider" # 2010 Cryo-EM Modeling Challenge: http://ncmi.bcm.edu/challenge class MrcHeaderPrinter( PyTool ): args = [ _( "mrc_file", type="file", ext="mrc" ) ] def func( self, *args, **kwargs ): header = mrc_header( self.mrc_file ) for name, value in zip(header._fields, header): print "%20s\t%s" % ( name, value )
import scipy.spatial import itertools from cStringIO import StringIO import numpy as np np.seterr( all="raise" ) import utils.numpdb as numpdb from utils import try_int, copy_dict, listify from utils.tool import _, _dir_init, PyTool, ProviMixin, CmdTool from utils.timer import Timer from utils.db import get_pdb_files from utils.listing import ListRecord, ListIO, list_compare, list_join from utils.math import rmatrixu, mag DIR, PARENT_DIR, TMPL_DIR = _dir_init( __file__, "pdb" ) PDB_SEARCH_URL = 'http://www.rcsb.org/pdb/rest/search' PDB_DOWNLOAD_URL = 'http://www.rcsb.org/pdb/files/' PDBE_ASSEMBLY = 'http://www.ebi.ac.uk/pdbe-srv/view/files/{pdb_id:}_1.mmol' # not available anymore ASR 20 May 2014 RCSB_ASSEMBLY = 'http://www.rcsb.org/pdb/files/{pdb_id:}.pdb1.gz' TMPL_DIR_CIONIZE = _dir_init( PARENT_DIR, "cionize" ) cionize_CMD = os.path.join( PARENT_DIR, "cionize" ) # the rotamere lib needs the 'remaining_atoms' data ROTAMERE_LIB_PATH = os.path.join( PARENT_DIR, "data", "bio", "bbind02.May.lib.json" )
from __future__ import with_statement from __future__ import division import os import logging import collections import shutil from basekit import utils import utils.numpdb as numpdb from utils import dir_walker from utils.tool import _, _dir_init, CmdTool DIR, PARENT_DIR, TMPL_DIR = _dir_init(__file__, "superpose") THESEUS_CMD = os.path.join(TMPL_DIR, "theseus") DIR, PARENT_DIR, TMPL_DIR = _dir_init(__file__, "align") MUSCLE_CMD = os.path.join(TMPL_DIR, "muscle3.8.31") logging.basicConfig() LOG = logging.getLogger('align') LOG.setLevel(logging.ERROR) class TheseusMakeFasta(CmdTool): """A wrapper around the 'theseus-align' programm.""" args = [ _("pdb_input", type="str", nargs="+", help="list of pdb-files"), ] out = [] tmpl_dir = TMPL_DIR
import os import urllib2 import collections from poster.encode import multipart_encode from poster.streaminghttp import register_openers import numpy as np np.seterr(all="raise") import utils.path from utils.tool import (_, _dir_init, PyTool, RecordsMixin, ParallelMixin, ProviMixin) from utils.numpdb import NumPdb DIR, PARENT_DIR, TMPL_DIR = _dir_init(__file__, "capture") CAPTURE_URL = "http://capture.caltech.edu/" os.environ["HTTP_PROXY"] = 'proxy.charite.de:8080' def capture_web(pdb_file, output_file): """queries the CaPTURE webservice""" # Register the streaming http handlers with urllib2 register_openers() # use relpath to hide local path with open(os.path.relpath(pdb_file), "r") as fp: # headers contains the necessary Content-Type and Content-Length # datagen is a generator object that yields the encoded parameters datagen, headers = multipart_encode({ "upfile": fp,
http://danger.med.unc.edu/hermans/dowser/Cameron_Mura_DOWSER.html http://www.ks.uiuc.edu/Research/vmd/plugins/dowser/ http://muralab.org/~cmura/DOWSER/ http://www.ks.uiuc.edu/Research/vmd/plugins/dowser/dowser-rna.html """ import os import shutil import auto_parameterization as ap from utils import copy_dict from utils.tool import _, _dir_init, CmdTool, PyTool, ProviMixin from utils.numpdb import NumPdb from shutil import copyfile DIR, PARENT_DIR, TMPL_DIR = _dir_init(__file__, "dowser") DOWSER_CMD = "dowser" DOWSERX_CMD = "dowserx" DOWSER_REPEAT_CMD = "dowser-repeat" DOWSERPLUS2_CMD = "/home/student/Software/Dowser++/callDowser++.sh" DOWSER_ATOMDICT = os.path.join(TMPL_DIR, "atomdict.db") DOWSER_ATOMPARMS = os.path.join(TMPL_DIR, "atomparms.db") class DowserMixin(object): def _pre_exec(self): shutil.copy(self.pdb_file, self.input_file) def _post_exec(self):
import shutil import numpy as np from numpy import * from array import array from basekit import utils from utils import memoize_m, dir_walker, path from utils.tool import _, _dir_init, CmdTool, ProviMixin, ParallelMixin from utils.tool import RecordsMixin, PyTool from utils.listing import merge_dic_list from utils.bio import AA1 from align import Muscle import provi_prep as provi pdbDIR, pdbPARENT_DIR, pdbTMPL_DIR = _dir_init(__file__, "pdb") DIR, PARENT_DIR, TMPL_DIR = _dir_init(__file__, "superpose") THESEUS_CMD = os.path.join(TMPL_DIR, "theseus") logging.basicConfig() LOG = logging.getLogger('superpose') LOG.setLevel(logging.ERROR) class Theseus(CmdTool): """A wrapper around the 'theseus' programm.""" args = [ _("pdb_input", type="str", nargs="+", help=