Commit 9e20fee1 authored by cmaffeo2's avatar cmaffeo2
Browse files

Added position scaling and beta to atoms; centered ssDNA

parent 9c8f8c76
......@@ -48,7 +48,8 @@ class CanonicalNucleotideFactory(Group):
mass = d['f4'][i])
p = PointParticle( type_ = atomic_types[tn],
position = [xs[i],ys[i],zs[i]],
name = names[i].decode('UTF-8') )
name = names[i].decode('UTF-8'),
beta = 1)
self.children.append( p )
atoms = self.children
......
......@@ -348,7 +348,7 @@ class Segment(ConnectableElement, Group):
def _generate_one_bead(self, contour_position, nts):
raise NotImplementedError
def _generate_atomic_nucleotide(self, contour_position, is_fwd, seq):
def _generate_atomic_nucleotide(self, contour_position, is_fwd, seq, scale):
""" Seq should include modifications like 5T, T3 Tsinglet; direction matters too """
# print("Generating nucleotide at {}".format(contour_position))
......@@ -365,7 +365,7 @@ class Segment(ConnectableElement, Group):
angleVec = angleVec/np.linalg.norm(angleVec)
y = np.cross(axis,angleVec)
orientation = np.array([angleVec,y,axis]).T
## TODOTODO: improve placement of ssDNA
## TODO: improve placement of ssDNA
# rot = rotationAboutAxis( axis, contour_position*self.twist_per_nt*self.num_nts, normalizeAxis=True )
# orientation = rot.dot(orientation)
else:
......@@ -387,9 +387,24 @@ class Segment(ConnectableElement, Group):
atoms = nt_dict[ key ].generate() # TODO: clone?
atoms.orientation = orientation.dot(atoms.orientation)
atoms.position = pos
if isinstance(self, SingleStrandedSegment):
if scale is not None and scale != 1:
for a in atoms:
a.position = scale*a.position
a.beta = 0
atoms.position = pos - atoms.atoms_by_name["C1'"].collapsed_position()
else:
if scale is not None and scale != 1:
if atoms.sequence in ("A","G"):
r0 = atoms.atoms_by_name["N9"].position
else:
r0 = atoms.atoms_by_name["N1"].position
for a in atoms:
if a.name[-1] in ("'","P","T"):
a.position = scale*(a.position-r0) + r0
a.beta = 0
atoms.position = pos
## TODOTODO: scale positions, set beta
return atoms
def add_location(self, nt, type_, on_fwd_strand=True):
......@@ -939,7 +954,7 @@ class Strand(Group):
# assert( len(ret) == self.num_nts )
# return ret
def generate_atomic_model(self):
def generate_atomic_model(self,scale):
last = None
resid = 1
strand_segment_count = 0
......@@ -955,7 +970,7 @@ class Strand(Group):
if strand_segment_count == len(s.strand_segments) and c == 1:
seq = seq+"3"
nt = seg._generate_atomic_nucleotide( c, s.is_fwd, seq )
nt = seg._generate_atomic_nucleotide( c, s.is_fwd, seq, scale )
# if s.is_fwd:
# else:
# nt = seg._generate_atomic_nucleotide( c, s.is_fwd, "A" )
......@@ -1770,10 +1785,10 @@ class SegmentModel(ArbdModel):
s.update_atomic_orientations(orientation)
def _generate_atomic_model(self):
def _generate_atomic_model(self, scale=1):
self.children = self.strands
for s in self.strands:
s.generate_atomic_model()
s.generate_atomic_model(scale)
return
## Angle optimization
......
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