def __init__(self, strandset, base_idx_low, base_idx_high, strandset_idx): super(CreateStrandCommand, self).__init__("create strand") self._strandset = strandset self._s_set_idx = strandset_idx doc = strandset.document() self._strand = Strand(strandset, base_idx_low, base_idx_high) colorList = prefs.STAP_COLORS if strandset.isStaple( ) else prefs.SCAF_COLORS color = random.choice(colorList).name() self._new_oligo = Oligo(None, color) # redo will set part self._new_oligo.setLength(self._strand.totalLength())
def __init__(self, strandset, base_idx_low, base_idx_high, color, update_segments=True): """ TODO: Now that parts have a UUID this could be instantiated via a document, uuid, id_num, is_fwd, base_idx_low, ... instead of an object to be independent of parts keeping strandsets live """ super(CreateStrandCommand, self).__init__("create strand") self._strandset = strandset doc = strandset.document() self._strand = Strand(strandset, base_idx_low, base_idx_high) self._new_oligo = Oligo(None, color, length=self._strand.totalLength()) # redo will set part self.update_segments = update_segments