Commit 79ef8189 authored by cmaffeo2's avatar cmaffeo2
Browse files

Improved placement of atomistic nts, reduced exclusions for hexagonal lattice push bonds

parent cc547bea
......@@ -19,7 +19,8 @@ def stringToIntTuples(string, tupleLen, offset):
class CanonicalNucleotide():
# DefaultOrientation = rotationAboutAxis([0,0,1], 68)
DefaultOrientation = rotationAboutAxis([0,0,1], 68+180)
def __init__(self, prefix):
def __init__(self, prefix, seq):
self.sequence = seq
d = np.loadtxt("%s.dat" % prefix, dtype='i4,S4,S4,f4,f4,f4,f4,f4')
......@@ -57,12 +58,14 @@ class CanonicalNucleotide():
## Find transformation
R = CanonicalNucleotide.DefaultOrientation.dot( orientation )
## Find offset of nt (shift for ssDNA)
center = np.array((0,0,0))
if singleStranded:
i0 = self.index("C3'")
i0 = self.index("C3'")-1
center = np.array([c.props[k][i0] for k in ('x','y','z')])
## Apply transformation
for i in range(len(c)):
rvec = np.array([c.props[k][i] for k in ('x','y','z')]) - center
......@@ -71,13 +74,27 @@ class CanonicalNucleotide():
c.props[k][i] = r + o
if scale != 1:
i0 = self.index("C3'")
r0 = np.array([c.props[k][i0] for k in ('x','y','z')])
for i in range(len(c)):
rvec = np.array([c.props[k][i] for k in ('x','y','z')])
rvec = scale*(rvec-r0) + r0
for k,r in zip(('x','y','z'), rvec):
c.props[k][i] = r
if singleStranded:
i0 = self.index("C3'")-1
r0 = np.array([c.props[k][i0] for k in ('x','y','z')])
for i in range(len(c)):
rvec = np.array([c.props[k][i] for k in ('x','y','z')])
rvec = scale*(rvec-r0) + r0
for k,r in zip(('x','y','z'), rvec):
c.props[k][i] = r
else:
if self.sequence in ("A","G"):
i0 = self.index("N9")-1
else:
i0 = self.index("N1")-1
r0 = np.array([c.props[k][i0] for k in ('x','y','z')])
for i in range(len(c)):
if c.props['name'][i][-1] in ("'","P","T"):
rvec = np.array([c.props[k][i] for k in ('x','y','z')])
rvec = scale*(rvec-r0) + r0
for k,r in zip(('x','y','z'), rvec):
c.props[k][i] = r
return c
# def __iter__(self):
......@@ -105,7 +122,7 @@ 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)
key = keystring % seq
canonicalNtFwd[key] = CanonicalNucleotide( prefix )
canonicalNtFwd[key] = CanonicalNucleotide( prefix, seq )
# canonicalNtFwd[seq] = CanonicalNucleotide( prefix )
# canonicalNtFwd3[seq] = CanonicalNucleotide( prefix+"3prime" )
# canonicalNtFwd5[seq] = CanonicalNucleotide( prefix+"5prime" )
......@@ -116,7 +133,7 @@ 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)
key = keystring % seq
canonicalNtRev[key] = CanonicalNucleotide( prefix )
canonicalNtRev[key] = CanonicalNucleotide( prefix, seq )
# for seq in seqComplement.keys():
# prefix = 'resources/%s_%s' % (seq,direction)
......
......@@ -571,7 +571,15 @@ class atomicModel():
# assert( np.linalg.norm((b.position-r0).dot(R)) < 100 )
b.position = (b.position - r0).dot(R) + simplerModelCoords[cgi]
b.orientation = b.orientation.dot( R )
for i in range(len(nts)):
b = nts[i]
if b.basepair is not None:
assert( np.all( b.orientation == b.basepair.orientation ) )
# bpVec = (b.position - b.basepair.position)
# zVec = np.array((0,0,1)).dot(b.orientation)
# assert( np.dot( bpVec, zVec ) < 0.05 * np.linalg.norm(bpVec) )
def _pairBases(self, n1,n2):
assert(n1.basepair is None and n2.basepair is None)
n1.basepair = n2
......@@ -971,7 +979,8 @@ class atomicModel():
neighborHelices = atomicModel._getNeighborHelixDict(self.part)
if self.latticeType == 'honeycomb':
minDist = 8 # TODO: test against server
# minDist = 8 # TODO: test against server
minDist = 7 # TODO: test against server
elif self.latticeType == 'square':
minDist = 11
......
Supports Markdown
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