Commit a5651d9d authored by cmaffeo2's avatar cmaffeo2
Browse files

Added some convenience routines for pulling infomration from strands

parent 0d46571b
......@@ -1649,6 +1649,35 @@ class Strand(Group):
nt = seg._generate_oxdna_nucleotide( c, s.is_fwd, seq )
self.oxdna_nt.append(nt)
def get_sequence(self):
return ''.join([''.join(s.get_sequence()) for s in self.strand_segments])
def get_nt_positions_orientations(self, bp_offset = (5,0,0)):
## TODO: remove duplicate code
rs = []
os = []
for s in self.strand_segments:
seg = s.segment
contour = s.get_contour_points()
assert( s.num_nt == 1 or (np.linalg.norm( seg.contour_to_position(contour[-1]) - seg.contour_to_position(contour[0]) ) > 0.1) )
DefaultOrientation = rotationAboutAxis([0,0,1], 90)
if s.is_fwd:
DefaultOrientation = rotationAboutAxis([1,0,0], 180).dot(DefaultOrientation)
for c,seq in zip(contour,s.get_sequence()):
r = seg.contour_to_position(c)
o = seg.contour_to_orientation(c)
o = o.dot(DefaultOrientation)
if isinstance(seg, SingleStrandedSegment):
r = r
else:
r = r - o.dot(np.array(bp_offset))
rs.append(r)
os.append(quaternion_from_matrix(o))
return np.array(rs), np.array(os)
class SegmentModel(ArbdModel):
......
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