def _strandMergeUpdate(self, old_strand_low: Strand, old_strand_high: Strand, new_strand: Strand): """This method sets the isCircular status of the oligo and the oligo's 5' strand. """ # check loop status if old_strand_low.oligo() == old_strand_high.oligo(): self._is_circular = True self._strand5p = new_strand return # leave the _strand5p as is? # end if # Now get correct 5p end to oligo if old_strand_low.isForward(): if old_strand_low.connection5p() is not None: self._strand5p = old_strand_low.oligo()._strand5p else: self._strand5p = new_strand else: if old_strand_high.connection5p() is not None: self._strand5p = old_strand_high.oligo()._strand5p else: self._strand5p = new_strand
def __init__(self, strandset: StrandSetT, strand: Strand, solo: bool = True): super(RemoveStrandCommand, self).__init__("remove strands") self._strandset = strandset self._strand = strand self._solo = solo self._old_strand5p = strand.connection5p() self._old_strand3p = strand.connection3p() self._oligo = olg = strand.oligo() part = strand.part() # idxs = strand.idxs() self.mids = (part.getModID(strand, strand.lowIdx()), part.getModID(strand, strand.highIdx())) # only create a new 5p oligo if there is a 3' connection self._new_oligo5p = olg.shallowCopy() if self._old_strand5p else None if olg.isCircular() or self._old_strand3p is None: self._new_oligo3p = olg3p = None if self._new_oligo5p: self._new_oligo5p._setLoop(False) else: self._new_oligo3p = olg3p = olg.shallowCopy() olg3p.setStrand5p(self._old_strand3p) # color_list = styles.STAP_COLORS if strandset.isStaple() else prefs.SCAF_COLORS color_list = pathstyles.STAP_COLORS color = random.choice(color_list) olg3p._setColor(color) olg3p.refreshLength(emit_signals=True)
def _strandSplitUpdate(self, new_strand5p: Strand, new_strand3p: Strand, oligo3p: OligoT, old_merged_strand: Strand): """If the oligo is a loop, splitting the strand does nothing. If the oligo isn't a loop, a new oligo must be created and assigned to the new_strand and everything connected to it downstream. """ # if you split it can't be a loop self._is_circular = False if old_merged_strand.oligo().isCircular(): self._strand5p = new_strand3p return else: if old_merged_strand.connection5p() is None: self._strand5p = new_strand5p else: self._strand5p = old_merged_strand.oligo()._strand5p oligo3p._strand5p = new_strand3p