Commit 0d3cc3e8 authored by cmaffeo2's avatar cmaffeo2
Browse files

Too many beads were being placed in a given contour length

parent 7e1b4ef0
...@@ -859,11 +859,11 @@ class Segment(ConnectableElement, Group): ...@@ -859,11 +859,11 @@ class Segment(ConnectableElement, Group):
if len(existing_beads) == 0 or existing_beads[0].get_nt_position(self) > 0.5: if len(existing_beads) == 0 or existing_beads[0].get_nt_position(self) > 0.5:
# if len(existing_beads) > 0: # if len(existing_beads) > 0:
# assert(existing_beads[0].get_nt_position(self) >= 0.5) # assert(existing_beads[0].get_nt_position(self) >= 0.5)
b = self._generate_one_bead(0, 0) b = self._generate_one_bead( self.nt_pos_to_contour(0), 0)
existing_beads = [b] + existing_beads existing_beads = [b] + existing_beads
if existing_beads[-1].get_nt_position(self)-(self.num_nts-1) < -0.5: if existing_beads[-1].get_nt_position(self)-(self.num_nts-1) < -0.5:
b = self._generate_one_bead(1, 0) b = self._generate_one_bead( self.nt_pos_to_contour(self.num_nts-1), 0)
existing_beads.append(b) existing_beads.append(b)
assert(len(existing_beads) > 1) assert(len(existing_beads) > 1)
...@@ -1028,7 +1028,8 @@ class DoubleStrandedSegment(Segment): ...@@ -1028,7 +1028,8 @@ class DoubleStrandedSegment(Segment):
else: else:
end2.container._connect( end1.container, Connection( end2, end1, type_=type_ ), in_3prime_direction=True ) end2.container._connect( end1.container, Connection( end2, end1, type_=type_ ), in_3prime_direction=True )
def _get_num_beads(self, contour, max_basepairs_per_bead, max_nucleotides_per_bead): def _get_num_beads(self, contour, max_basepairs_per_bead, max_nucleotides_per_bead):
return int(contour*self.num_nts // max_basepairs_per_bead) # return int(contour*self.num_nts // max_basepairs_per_bead)
return int(contour*(self.num_nts**2/(self.num_nts+1)) // max_basepairs_per_bead)
def _generate_one_bead(self, contour_position, nts): def _generate_one_bead(self, contour_position, nts):
pos = self.contour_to_position(contour_position) pos = self.contour_to_position(contour_position)
...@@ -1146,7 +1147,8 @@ class SingleStrandedSegment(Segment): ...@@ -1146,7 +1147,8 @@ class SingleStrandedSegment(Segment):
other._connect(self, Connection( other_loc, loc, type_="sscrossover" ), in_3prime_direction=True ) other._connect(self, Connection( other_loc, loc, type_="sscrossover" ), in_3prime_direction=True )
def _get_num_beads(self, contour, max_basepairs_per_bead, max_nucleotides_per_bead): def _get_num_beads(self, contour, max_basepairs_per_bead, max_nucleotides_per_bead):
return int(contour*self.num_nts // max_nucleotides_per_bead) return int(contour*(self.num_nts**2/(self.num_nts+1)) // max_basepairs_per_bead)
# return int(contour*self.num_nts // max_nucleotides_per_bead)
def _generate_one_bead(self, contour_position, nts): def _generate_one_bead(self, contour_position, nts):
pos = self.contour_to_position(contour_position) pos = self.contour_to_position(contour_position)
......
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