Commit acb01034 authored by cmaffeo2's avatar cmaffeo2
Browse files

Updated imports to be compatible with new package structure; updated paths to...

Updated imports to be compatible with new package structure; updated paths to resources to use new get_resource_path() function
parent 16fc597e
include resources
\ No newline at end of file
import os
_RESOURCE_DIR = os.path.join(os.path.dirname(__file__), 'resources')
def get_resource_path(relative_path):
return os.path.join(_RESOURCE_DIR, relative_path)
from .segmentmodel import SegmentModel, SingleStrandedSegment, DoubleStrandedSegment
from .simulate import multiresolution_simulation
import numpy as np
from scipy.optimize import newton
def minimizeRmsd(coordsB, coordsA, weights=None, maxIter=100):
## Going through many iterations wasn't really needed
tol = 1
......
......@@ -2,8 +2,9 @@
import sys
from glob import glob
import re
from cadnano_segments import read_json_file, read_model
from simulate import run_simulation_protocol
from dnarbd.readers import cadnano_reader()
from dnarbd.simulate import run_simulation_protocol
if __name__ == '__main__':
if len(sys.argv) > 1:
......
import json
import numpy as np
import copy
from coords import rotationAboutAxis
from arbdmodel import Group, PointParticle, ParticleType
from ..coords import rotationAboutAxis
from .arbdmodel import Group, PointParticle, ParticleType
from .. import get_resource_path
seqComplement = dict(A='T',G='C')
resnames = dict(A="ADE", G="GUA", C="CYT", T="THY")
......@@ -130,7 +131,7 @@ canonicalNtFwd = dict()
direction = 'fwd'
for seq in seqComplement.keys():
for keystring,suff in zip(("5%s","%s","%s3","5%s3"),("-5prime","","-3prime","-singlet")):
prefix = 'resources/%s-%s%s' % (seq,direction,suff)
prefix = get_resource_path('%s-%s%s' % (seq,direction,suff))
key = keystring % seq
canonicalNtFwd[key] = CanonicalNucleotideFactory( prefix, seq )
......@@ -138,13 +139,13 @@ canonicalNtRev = dict()
direction = 'rev'
for seq in seqComplement.keys():
for keystring,suff in zip(("5%s","%s","%s3","5%s3"),("-5prime","","-3prime","-singlet")):
prefix = 'resources/%s-%s%s' % (seq,direction,suff)
prefix = get_resource_path('%s-%s%s' % (seq,direction,suff))
key = keystring % seq
canonicalNtRev[key] = CanonicalNucleotideFactory( prefix, seq )
with open("resources/enm-template-honeycomb.json") as ch:
with open(get_resource_path("enm-template-honeycomb.json")) as ch:
enmTemplateHC = json.load(ch)
with open("resources/enm-template-square.json") as ch:
with open(get_resource_path("enm-template-square.json")) as ch:
enmTemplateSQ = json.load(ch)
with open("resources/enm-corrections-honecomb.json") as ch:
with open(get_resource_path("enm-corrections-honecomb.json")) as ch:
enmCorrectionsHC = json.load(ch)
from .. import get_resource_path
_m13_path = get_resource_path("cadnano2pdb.seq.m13mp18.dat")
def read_sequence_file(sequenceFile=_m13_path):
seq = []
with open(sequenceFile) as ch:
for l in ch:
l = l.strip().replace(" ", "")
if l[0] in (";","#"): continue
seq.extend([c.upper() for c in l])
return seq
m13 = read_sequence_file()
......@@ -3,7 +3,8 @@ import scipy.optimize as opt
from scipy.interpolate import interp1d
from scipy.signal import savgol_filter as savgol
from nonbonded import NonbondedScheme
from .nonbonded import NonbondedScheme
from .. import get_resource_path
dxParam = -1
......@@ -25,7 +26,7 @@ def maxForce(x,u,maxForce=40):
return u
# d = np.loadtxt("resources/jj-nar-dna-pmf-20Mg-200Na.dat")
d = np.loadtxt("resources/jj-nar-dna-pmf-100Mg.dat")
d = np.loadtxt(get_resource_path("jj-nar-dna-pmf-100Mg.dat"))
x0 = d[:,1] + dxParam
y0 = d[:,0] # kcal/mol for 10bp with 10bp, according to JY
......
from ..segmentmodel import SegmentModel
""" cadnano """
from .cadnano_segments import read_json_file
from .cadnano_segments import read_model as model_from_cadnano_json
""" vHelix """
from .polygon_mesh import parse_maya_file, convert_maya_to_segments
""" Atomic PDB """
from .segmentmodel_from_pdb import SegmentModelFromPdb
## TODO: make module this package conform to a single style for input/output
def read_cadnano(json_file, **model_parameters):
data = read_json_file
return model_from_cadnano_json(data)
def read_vhelix(maya_file, **model_parameters):
data = parse_maya_file(maya_file)
segments, dsSegmentDict = convert_maya_to_segments( data )
return SegmentModel( segments,**model_parameters )
def read_atomic_pdb(pdb_file, **model_parameters):
return SegmentModelFromPdb(pdb_file)
......@@ -5,22 +5,9 @@ import os,sys
from glob import glob
import re
from coords import readArbdCoords, readAvgArbdCoords
from segmentmodel import SegmentModel, SingleStrandedSegment, DoubleStrandedSegment
arbd="/home/cmaffeo2/development/cuda/arbd.dbg/src/arbd" # reduced the mem footprint cause vmd
namd="/home/cmaffeo2/development/namd-bin/NAMD_Git-2017-07-06_Linux-x86_64-multicore-CUDA/namd2"
def readSequenceFile(sequenceFile='resources/cadnano2pdb.seq.m13mp18.dat'):
seq = []
with open(sequenceFile) as ch:
for l in ch:
l = l.strip().replace(" ", "")
if l[0] in (";","#"): continue
seq.extend([c.upper() for c in l])
return seq
m13seq = readSequenceFile(sequenceFile='resources/cadnano2pdb.seq.m13mp18.dat')
from ..coords import readArbdCoords, readAvgArbdCoords
from ..segmentmodel import SegmentModel, SingleStrandedSegment, DoubleStrandedSegment
from ..model.dna_sequence import m13 as m13seq
## TODO: separate SegmentModel from ArbdModel so multiple parts can be combined
## TODO: catch circular strands in "get_5prime" cadnano calls
......
import numpy as np
import sys
import re
from coords import rotationAboutAxis
from ..coords import rotationAboutAxis
from segmentmodel import SegmentModel, SingleStrandedSegment, DoubleStrandedSegment
from ..segmentmodel import SegmentModel, SingleStrandedSegment, DoubleStrandedSegment
class MayaObj():
def __init__(self, maya_lines):
......
......@@ -10,21 +10,8 @@ import MDAnalysis as mda
import MDAnalysis.analysis.align as align
from MDAnalysis.analysis.distances import distance_array
from segmentmodel import SegmentModel, SingleStrandedSegment, DoubleStrandedSegment
arbd="/home/cmaffeo2/development/cuda/arbd.dbg/src/arbd" # reduced the mem footprint cause vmd
namd="/home/cmaffeo2/development/namd-bin/NAMD_Git-2017-07-06_Linux-x86_64-multicore-CUDA/namd2"
def readSequenceFile(sequenceFile='resources/cadnano2pdb.seq.m13mp18.dat'):
seq = []
with open(sequenceFile) as ch:
for l in ch:
l = l.strip().replace(" ", "")
if l[0] in (";","#"): continue
seq.extend([c.upper() for c in l])
return seq
m13seq = readSequenceFile(sequenceFile='resources/cadnano2pdb.seq.m13mp18.dat')
from ..segmentmodel import SegmentModel, SingleStrandedSegment, DoubleStrandedSegment
from .. import get_resource_path
resnames = dict(A='ADE DA DA5 DA3', T='THY DT DT5 DT3',
C='CYT DC DC5 DC3', G='GUA DG DG5 DG3')
......@@ -34,7 +21,7 @@ bases = resnames.keys()
resname_to_key = {n:k for k,v in resnames.items() for n in v.split()}
complement = dict(A='T', C='G', T='A', G='C')
refUnis = {b:mda.Universe("resources/generate-nts/1-w3dna/{}{}.pdb".format(b,complement[b]))
refUnis = {b:mda.Universe(get_resource_path("generate-nts/1-w3dna/{}{}.pdb".format(b,complement[b])))
for b in bases}
stack_text = "not name O5' P O1P O2P OP1 OP2 O3' H*"
......
import pdb
import numpy as np
import random
from arbdmodel import PointParticle, ParticleType, Group, ArbdModel
from coords import rotationAboutAxis, quaternion_from_matrix, quaternion_to_matrix
from nonbonded import *
from .model.arbdmodel import PointParticle, ParticleType, Group, ArbdModel
from .coords import rotationAboutAxis, quaternion_from_matrix, quaternion_to_matrix
from .model.nonbonded import *
from copy import copy, deepcopy
from nbPot import nbDnaScheme
from .model.nbPot import nbDnaScheme
from scipy.special import erf
import scipy.optimize as opt
from scipy import interpolate
from CanonicalNucleotideAtoms import canonicalNtFwd, canonicalNtRev, seqComplement
from CanonicalNucleotideAtoms import enmTemplateHC, enmTemplateSQ, enmCorrectionsHC
from .model.CanonicalNucleotideAtoms import canonicalNtFwd, canonicalNtRev, seqComplement
from .model.CanonicalNucleotideAtoms import enmTemplateHC, enmTemplateSQ, enmCorrectionsHC
# import pdb
"""
......
import os
from coords import readArbdCoords, readAvgArbdCoords
import tempfile
from .coords import readArbdCoords, readAvgArbdCoords
arbd="/home/cmaffeo2/development/cuda/arbd.dbg/src/arbd" # reduced the mem footprint cause vmd
namd="/home/cmaffeo2/development/namd-bin/NAMD_Git-2017-07-06_Linux-x86_64-multicore-CUDA/namd2"
def run_simulation_protocol( output_name, job_id, model,
remove_long_bonds=False,
gpu = 0,
directory=None,
coarse_steps = 5e7+1,
fine_steps = 5e7+1
):
def multiresolution_simulation( output_name, job_id, model,
remove_long_bonds=False,
gpu = 0,
directory=None,
coarse_steps = 5e7+1,
fine_steps = 5e7+1
):
ret = None
d_orig = os.getcwd()
try:
if directory is None:
import tempfile
directory = tempfile.mkdtemp(prefix='origami-%s-' % job_id, dir='/dev/shm/')
elif not os.path.exists(directory):
os.makedirs(directory)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment