Commit d3772794 authored by cmaffeo2's avatar cmaffeo2
Browse files

Changed recursive strand-tracing routine into a for loop

parent 81ab7c6d
......@@ -368,6 +368,9 @@ class Segment(ConnectableElement, Group):
self.sequence = None
def __repr__(self):
return "<{} {}[{:d}]>".format( type(self), self.name, self.num_nt )
def _set_splines_from_ends(self):
a = np.array([self.start_position,self.end_position]).T
......@@ -2101,23 +2104,28 @@ class SegmentModel(ArbdModel):
""" Build strands from connectivity of helices """
def _recursively_build_strand(strand, segment, pos, is_fwd, mycounter=0, move_at_least=0.5):
mycounter+=1
if mycounter > 10000:
import pdb
pdb.set_trace()
s,seg = [strand, segment]
#if seg.name == "22-1" and pos > 140:
# if seg.name == "22-2":
# import pdb
# pdb.set_trace()
end_pos, next_seg, next_pos, next_dir, move_at_least = seg.get_strand_segment(pos, is_fwd, move_at_least)
s.add_dna(seg, pos, end_pos, is_fwd)
seg = segment
history = []
while True:
mycounter+=1
if mycounter > 10000:
import pdb
pdb.set_trace()
#if seg.name == "22-1" and pos > 140:
# if seg.name == "22-2":
# import pdb
# pdb.set_trace()
end_pos, next_seg, next_pos, next_dir, move_at_least = seg.get_strand_segment(pos, is_fwd, move_at_least)
strand.add_dna(seg, pos, end_pos, is_fwd)
if next_seg is None:
return
else:
history.append((seg,pos,is_fwd))
seg,pos,is_fwd = (next_seg, next_pos, next_dir)
if next_seg is not None:
# print(" next_dir: {}".format(next_dir))
_recursively_build_strand(s, next_seg, next_pos, next_dir, mycounter, move_at_least)
for seg in self.segments:
locs = seg.get_5prime_locations()
......
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