diff --git a/mrdna/segmentmodel.py b/mrdna/segmentmodel.py index 3e1c069c700534420eb6047a8223b8252d75977a..b6d4a6c2e56f3a7fd4ca80f5d7a06fd24573644e 100644 --- a/mrdna/segmentmodel.py +++ b/mrdna/segmentmodel.py @@ -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):