本文整理汇总了Python中cadnano.strand.Strand.isForward方法的典型用法代码示例。如果您正苦于以下问题:Python Strand.isForward方法的具体用法?Python Strand.isForward怎么用?Python Strand.isForward使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cadnano.strand.Strand
的用法示例。
在下文中一共展示了Strand.isForward方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _strandMergeUpdate
# 需要导入模块: from cadnano.strand import Strand [as 别名]
# 或者: from cadnano.strand.Strand import isForward [as 别名]
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
示例2: __init__
# 需要导入模块: from cadnano.strand import Strand [as 别名]
# 或者: from cadnano.strand.Strand import isForward [as 别名]
def __init__(self, strand: Strand, base_idx: int, update_sequence: bool = True):
super(SplitCommand, self).__init__("split strand")
# Store inputs
self._old_strand = strand
# TODO possibly implement selection preserving
# doc = strand.document()
# self.was_selected = was_selected = doc.isModelStrandSelected(strand)
# if was_selected:
# self.select_values = doc.getSelectedStrandValue(strand)
# else:
# self.select_values = (None, None)
old_sequence = strand._sequence
is5to3 = strand.isForward()
self._s_set = strand.strandSet()
self._old_oligo = oligo = strand.oligo()
# Create copies
self.strand_low = strand_low = strand.shallowCopy()
self.strand_high = strand_high = strand.shallowCopy()
if oligo.isCircular():
self._l_oligo = self._h_oligo = l_oligo = h_oligo = oligo.shallowCopy()
else:
self._l_oligo = l_oligo = oligo.shallowCopy()
self._h_oligo = h_oligo = oligo.shallowCopy()
color_list = pathstyles.STAP_COLORS
# Determine oligo retention based on strand priority
if is5to3: # strand_low has priority
i_new_low = base_idx
color_low = oligo.getColor()
color_high = random.choice(color_list)
olg5p, olg3p = l_oligo, h_oligo
std5p, std3p = strand_low, strand_high
else: # strand_high has priority
i_new_low = base_idx - 1
color_low = random.choice(color_list)
color_high = oligo.getColor()
olg5p, olg3p = h_oligo, l_oligo
std5p, std3p = strand_high, strand_low
# this is for updating a connected xover view object
# there is only ever one xover a strand is in charge of
self._strand3p = std3p
self._strand5p = std5p
# Update strand connectivity
strand_low.setConnectionHigh(None)
strand_high.setConnectionLow(None)
# Resize strands and update decorators
strand_low.setIdxs((strand.lowIdx(), i_new_low))
strand_high.setIdxs((i_new_low + 1, strand.highIdx()))
# Update the oligo for things like its 5prime end and isCircular
olg5p._strandSplitUpdate(std5p, std3p, olg3p, strand)
if not oligo.isCircular():
# Update the oligo color if necessary
l_oligo._setColor(color_low)
h_oligo._setColor(color_high)
# settle the oligo length
length = 0
for strand in std3p.generator3pStrand():
length += strand.totalLength()
# end for
olg5p._setLength(olg5p.length() - length, emit_signals=True)
olg3p._setLength(length, emit_signals=True)
# end if
if update_sequence and old_sequence:
if is5to3: # strand_low has priority
tL = strand_low.totalLength()
strand_low._sequence = old_sequence[0:tL]
strand_high._sequence = old_sequence[tL:]
else:
tH = strand_high.totalLength()
strand_high._sequence = old_sequence[0:tH]
strand_low._sequence = old_sequence[tH:]