Skip to content
Snippets Groups Projects
Commit 07ed55e0 authored by cmaffeo2's avatar cmaffeo2
Browse files

Fixed issue with quaternion orientations in segmentmodel_from_lists

parent cc4a7dd4
No related branches found
No related tags found
No related merge requests found
......@@ -88,11 +88,15 @@ def set_splines(seg, coordinates, hid, hmap, hrank, fwd, orientation=None):
for rank in range(int(maxrank)+1):
ids = np.where((hmap == hid) * (hrank == rank))[0]
coords.append(np.mean( [coordinates[r,:] for r in ids ], axis=0 ))
contours.append( float(rank)/maxrank )
contours.append( float(rank+0.5)/(maxrank+1) )
last_q = None
if orientation is not None:
ids = np.where((hmap == hid) * (hrank == rank) * fwd)[0]
assert(len(ids) == 1)
quats.append( quaternion_from_matrix( orientation[ids[0]] ) )
q = quaternion_from_matrix( orientation[ids[0]] )
if last_q is not None and last_q[1:].dot(q[1:]) < 0:
q = -1*q
quats.append(q)
## TODO: average quaterion with reverse direction
coords = np.array(coords)
......@@ -153,7 +157,7 @@ def model_from_basepair_stack_3prime(coordinates, basepair, stack, three_prime,
hmap,hrank,fwd = basepairs_and_stacks_to_helixmap(bps,stack)
double_stranded_helices = np.unique(hmap[hmap >= 0])
strands = _three_prime_list_to_strands(three_prime)
""" Add ssDNA to hmap """
hid = double_stranded_helices[-1]+1
ss_residues = hmap < 0
......
......@@ -258,8 +258,6 @@ def SegmentModelFromPdb(*args,**kwargs):
bps = find_basepairs(u, centers, transforms)
stacks = find_stacks(u, centers, transforms)
# pdb.set_trace()
## Find three-prime ends
three_prime = -np.ones(bps.shape, dtype=np.int)
for s in u.segments:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment