当前位置: 首页>>代码示例>>Python>>正文


Python Strand.setOligo方法代码示例

本文整理汇总了Python中cadnano.strand.Strand.setOligo方法的典型用法代码示例。如果您正苦于以下问题:Python Strand.setOligo方法的具体用法?Python Strand.setOligo怎么用?Python Strand.setOligo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cadnano.strand.Strand的用法示例。


在下文中一共展示了Strand.setOligo方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: redo

# 需要导入模块: from cadnano.strand import Strand [as 别名]
# 或者: from cadnano.strand.Strand import setOligo [as 别名]
    def redo(self):
        # Remove the strand
        strand = self._strand
        strandset = self._strandset
        # strandset._removeFromStrandList(strand)
        doc = strandset._doc
        doc.removeStrandFromSelection(strand)
        strandset._strand_list.pop(self._s_set_idx)
        strand5p = self._old_strand5p
        strand3p = self._old_strand3p
        oligo = self._oligo
        olg5p = self._new_oligo5p
        olg3p = self._new_oligo3p

        #oligo.incrementLength(-strand.totalLength())
        oligo.removeFromPart()

        if strand5p is not None:
            strand5p.setConnection3p(None)
        if strand3p is not None:
            strand3p.setConnection5p(None)

        # Clear connections and update oligos
        if strand5p is not None:
            for s5p in oligo.strand5p().generator3pStrand():
                Strand.setOligo(s5p, olg5p)
            olg5p.refreshLength()
            olg5p.addToPart(strandset.part())
            if self._solo:
                part = strandset.part()
                vh = strandset.virtualHelix()
                part.partActiveVirtualHelixChangedSignal.emit(part, vh)
                #strand5p.strandXover5pChangedSignal.emit(strand5p, strand)
            strand5p.strandUpdateSignal.emit(strand5p)
        # end if
        if strand3p is not None:
            if not oligo.isLoop():
                # apply 2nd oligo copy to all 3' downstream strands
                for s3p in strand3p.generator3pStrand():
                    Strand.setOligo(s3p, olg3p)
                olg3p.addToPart(strandset.part())
            if self._solo:
                part = strandset.part()
                vh = strandset.virtualHelix()
                part.partActiveVirtualHelixChangedSignal.emit(part, vh)
                # strand.strandXover5pChangedSignal.emit(strand, strand3p)
            strand3p.strandUpdateSignal.emit(strand3p)
        # end if
        # Emit a signal to notify on completion
        strand.strandRemovedSignal.emit(strand)

        if self.mids[0] is not None:
            strand.part().removeModStrandInstance(strand, strand.lowIdx(), self.mids[0])
            # strand.strandModsRemovedSignal.emit(strand, self.mids[0], strand.lowIdx())
        if self.mids[1] is not None:
            strand.part().removeModStrandInstance(strand, strand.highIdx(), self.mids[1])
            # strand.strandModsRemovedSignal.emit(strand, self.mids[1], strand.highIdx())

        # for updating the Slice View displayed helices
        strandset.part().partStrandChangedSignal.emit(strandset.part(), strandset.virtualHelix())
开发者ID:warmstart,项目名称:cadnano2.5,代码行数:62,代码来源:removestrandcmd.py

示例2: redo

# 需要导入模块: from cadnano.strand import Strand [as 别名]
# 或者: from cadnano.strand.Strand import setOligo [as 别名]
    def redo(self):
        visited = {}
        doc = self._part.document()
        for vh in self._part.getVirtualHelices():
            stap_ss = vh.stapleStrandSet()
            for strand in stap_ss:
                visited[strand] = False
            if self.include_scaffold:
                scap_ss = vh.scaffoldStrandSet()
                for strand in scap_ss:
                    visited[strand] = False

        colors = self.colors
        for strand in list(visited.keys()):
            if visited[strand]:
                continue
            visited[strand] = True
            start_oligo = strand.oligo()

            if colors is not None:
                if strand.isStaple():
                    start_oligo.setColor(colors[1])
                else:
                    start_oligo.setColor(colors[0])

            strand5gen = strand.generator5pStrand()
            # this gets the oligo and burns a strand in the generator
            strand5 = next(strand5gen)
            for strand5 in strand5gen:
                oligo5 = strand5.oligo()
                if oligo5 != start_oligo:
                    oligo5.removeFromPart()
                    Strand.setOligo(strand5, start_oligo)  # emits strandHasNewOligoSignal
                visited[strand5] = True
            # end for
            start_oligo.setStrand5p(strand5)
            # is it a loop?
            if strand.connection3p() == strand5:
                start_oligo.setLoop(True)
            else:
                strand3gen = strand.generator3pStrand()
                strand3 = next(strand3gen)   # burn one
                for strand3 in strand3gen:
                    oligo3 = strand3.oligo()
                    if oligo3 != start_oligo:
                        oligo3.removeFromPart()
                        Strand.setOligo(strand3, start_oligo)  # emits strandHasNewOligoSignal
                    visited[strand3] = True
                # end for
            start_oligo.refreshLength()
        # end for

        for strand in visited.keys():
            strand.strandUpdateSignal.emit(strand)
开发者ID:Rebelofold,项目名称:cadnano2.5,代码行数:56,代码来源:refresholigoscmd.py

示例3: redo

# 需要导入模块: from cadnano.strand import Strand [as 别名]
# 或者: from cadnano.strand.Strand import setOligo [as 别名]
    def redo(self):
        ss = self._s_set
        sL = self._strand_low
        sH = self._strand_high
        oS = self._old_strand
        idx = self._s_set_idx
        olg = self._old_oligo
        doc = ss.document()
        l_olg = self._l_oligo
        h_olg = self._h_oligo
        was_not_loop = l_olg != h_olg

        # Remove old Strand from the s_set
        ss._removeFromStrandList(oS)

        # Add new strands to the s_set (reusing idx, so order matters)
        ss._addToStrandList(sH, idx)
        ss._addToStrandList(sL, idx)

        # update connectivity of strands
        sLcL = sL.connectionLow()
        if sLcL:
            if (oS.isDrawn5to3() and sLcL.isDrawn5to3()) or \
                (not oS.isDrawn5to3() and not sLcL.isDrawn5to3()):
                sLcL.setConnectionHigh(sL)
            else:
                sLcL.setConnectionLow(sL)
        sHcH = sH.connectionHigh()
        if sHcH:
            if (oS.isDrawn5to3() and sHcH.isDrawn5to3()) or \
                (not oS.isDrawn5to3() and not sHcH.isDrawn5to3()):
                sHcH.setConnectionLow(sH)
            else:
                sHcH.setConnectionHigh(sH)

        # Traverse the strands via 3'conns to assign the new oligos
        for strand in l_olg.strand5p().generator3pStrand():
            Strand.setOligo(strand, l_olg)  # emits strandHasNewOligoSignal
        if was_not_loop:  # do the second oligo which is different
            for strand in h_olg.strand5p().generator3pStrand():
                # emits strandHasNewOligoSignal
                Strand.setOligo(strand, h_olg)

        # Add new oligo and remove old oligos from the part
        olg.removeFromPart()
        l_olg.addToPart(sL.part())
        if was_not_loop:
            h_olg.addToPart(sH.part())

        # Emit Signals related to destruction and addition
        oS.strandRemovedSignal.emit(oS)
        ss.strandsetStrandAddedSignal.emit(ss, sH)
        ss.strandsetStrandAddedSignal.emit(ss, sL)
开发者ID:Rebelofold,项目名称:cadnano2.5,代码行数:55,代码来源:splitcmd.py

示例4: undo

# 需要导入模块: from cadnano.strand import Strand [as 别名]
# 或者: from cadnano.strand.Strand import setOligo [as 别名]
    def undo(self):
        ss = self._s_set
        doc = ss._doc
        sL = self._strand_low
        sH = self._strand_high
        nS = self._new_strand
        idx = self._s_set_idx
        olg = self._new_oligo
        l_olg = self._s_low_oligo
        h_olg = self._s_high_oligo
        # Remove the new_strand from the s_set
        ss._removeFromStrandList(nS)
        # Add old strands to the s_set (reusing idx, so order matters)
        ss._addToStrandList(sH, idx)
        ss._addToStrandList(sL, idx)

        # update connectivity of strands
        sLcL = sL.connectionLow()
        if sLcL:
            if (sL.isDrawn5to3() and sLcL.isDrawn5to3()) or \
                (not sL.isDrawn5to3() and not sLcL.isDrawn5to3()):
                sLcL.setConnectionHigh(sL)
            else:
                sLcL.setConnectionLow(sL)
        sHcH = sH.connectionHigh()
        if sHcH:
            if (sH.isDrawn5to3() and sHcH.isDrawn5to3()) or \
                (not sH.isDrawn5to3() and not sHcH.isDrawn5to3()):
                sHcH.setConnectionLow(sH)
            else:
                sHcH.setConnectionHigh(sH)

        # Traverse the strands via 3'conns to assign the old oligo
        for strand in l_olg.strand5p().generator3pStrand():
            Strand.setOligo(strand, l_olg)  # emits strandHasNewOligoSignal
        for strand in h_olg.strand5p().generator3pStrand():
            Strand.setOligo(strand, h_olg)  # emits strandHasNewOligoSignal

        # Remove new oligo and add old oligos
        olg.removeFromPart()
        l_olg.addToPart(sL.part())
        if h_olg != l_olg:
            h_olg.addToPart(sH.part())

        # Emit Signals related to destruction and addition
        nS.strandRemovedSignal.emit(nS)
        ss.strandsetStrandAddedSignal.emit(ss, sL)
        ss.strandsetStrandAddedSignal.emit(ss, sH)
    # end def
# end class
开发者ID:Rebelofold,项目名称:cadnano2.5,代码行数:52,代码来源:mergecmd.py

示例5: undo

# 需要导入模块: from cadnano.strand import Strand [as 别名]
# 或者: from cadnano.strand.Strand import setOligo [as 别名]
    def undo(self):
        ss = self._s_set
        sL = self._strand_low
        sH = self._strand_high
        oS = self._old_strand
        idx = self._s_set_idx
        olg = self._old_oligo
        doc = ss.document()
        l_olg = self._l_oligo
        h_olg = self._h_oligo
        was_not_loop = l_olg != h_olg

        # Remove new strands from the s_set (reusing idx, so order matters)
        ss._removeFromStrandList(sL)
        ss._removeFromStrandList(sH)
        # Add the old strand to the s_set
        ss._addToStrandList(oS, idx)

        # update connectivity of strands
        oScL = oS.connectionLow()
        if oScL:
            if (oS.isDrawn5to3() and oScL.isDrawn5to3()) or \
                (not oS.isDrawn5to3() and not oScL.isDrawn5to3()):
                oScL.setConnectionHigh(oS)
            else:
                oScL.setConnectionLow(oS)
        oScH = oS.connectionHigh()
        if oScH:
            if (oS.isDrawn5to3() and oScH.isDrawn5to3()) or \
                (not oS.isDrawn5to3() and not oScH.isDrawn5to3()):
                oScH.setConnectionLow(oS)
            else:
                oScH.setConnectionHigh(oS)

        # Traverse the strands via 3'conns to assign the old oligo
        for strand in olg.strand5p().generator3pStrand():
            Strand.setOligo(strand, olg)
        # Add old oligo and remove new oligos from the part
        olg.addToPart(ss.part())
        l_olg.removeFromPart()
        if was_not_loop:
            h_olg.removeFromPart()

        # Emit Signals related to destruction and addition
        sL.strandRemovedSignal.emit(sL)
        sH.strandRemovedSignal.emit(sH)
        ss.strandsetStrandAddedSignal.emit(ss, oS)
    # end def
# end class
开发者ID:Rebelofold,项目名称:cadnano2.5,代码行数:51,代码来源:splitcmd.py

示例6: redo

# 需要导入模块: from cadnano.strand import Strand [as 别名]
# 或者: from cadnano.strand.Strand import setOligo [as 别名]
    def redo(self):
        ss = self._s_set
        doc = ss._doc
        sL = self._strand_low
        sH = self._strand_high
        nS = self._new_strand
        idx = self._s_set_idx
        olg = self._new_oligo
        l_olg = sL.oligo()
        h_olg = sH.oligo()

        # Remove old strands from the s_set (reusing idx, so order matters)
        ss._removeFromStrandList(sL)
        ss._removeFromStrandList(sH)
        # Add the new_strand to the s_set
        ss._addToStrandList(nS, idx)

        # update connectivity of strands
        nScL = nS.connectionLow()
        if nScL:
            if (nS.isDrawn5to3() and nScL.isDrawn5to3()) or \
                (not nS.isDrawn5to3() and not nScL.isDrawn5to3()):
                nScL.setConnectionHigh(nS)
            else:
                nScL.setConnectionLow(nS)
        nScH = nS.connectionHigh()
        if nScH:
            if (nS.isDrawn5to3() and nScH.isDrawn5to3()) or \
                (not nS.isDrawn5to3() and not nScH.isDrawn5to3()):
                nScH.setConnectionLow(nS)
            else:
                nScH.setConnectionHigh(nS)

        # Traverse the strands via 3'conns to assign the new oligo
        for strand in olg.strand5p().generator3pStrand():
            Strand.setOligo(strand, olg)  # emits strandHasNewOligoSignal

        # Add new oligo and remove old oligos
        olg.addToPart(ss.part())
        l_olg.removeFromPart()
        if h_olg != l_olg:  # check if a loop was created
            h_olg.removeFromPart()

        # Emit Signals related to destruction and addition
        sL.strandRemovedSignal.emit(sL)
        sH.strandRemovedSignal.emit(sH)
        ss.strandsetStrandAddedSignal.emit(ss, nS)
开发者ID:Rebelofold,项目名称:cadnano2.5,代码行数:49,代码来源:mergecmd.py

示例7: redo

# 需要导入模块: from cadnano.strand import Strand [as 别名]
# 或者: from cadnano.strand.Strand import setOligo [as 别名]
    def redo(self):
        part = self._part
        strand5p = self._strand5p
        strand5p_idx = self._strand5p_idx
        strand3p = self._strand3p
        strand3p_idx = self._strand3p_idx
        olg5p = strand5p.oligo()
        old_olg3p = self._old_oligo3p

        # 0. Deselect the involved strands
        doc = strand5p.document()
        doc.removeStrandFromSelection(strand5p)
        doc.removeStrandFromSelection(strand3p)

        if self._update_oligo:
            # Test for Loopiness
            if olg5p == strand3p.oligo():
                olg5p.setLoop(True)
            else:
                # 1. update preserved oligo length
                olg5p.incrementLength(old_olg3p.length())
                # 2. Remove the old oligo and apply the 5' oligo to the 3' strand
                old_olg3p.removeFromPart()
                for strand in strand3p.generator3pStrand():
                    # emits strandHasNewOligoSignal
                    Strand.setOligo(strand, olg5p)

        # 3. install the Xover
        strand5p.setConnection3p(strand3p)
        strand3p.setConnection5p(strand5p)
        #print('strand5p = %s, connection3p = %s'%(strand5p._name, strand3p._name))

        ss5 = strand5p.strandSet()
        vh5p = ss5.virtualHelix()
        st5p = ss5.strandType()
        ss3 = strand3p.strandSet()
        vh3p = ss3.virtualHelix()
        st3p = ss3.strandType()

        part.partActiveVirtualHelixChangedSignal.emit(part, vh5p)
        # strand5p.strandXover5pChangedSignal.emit(strand5p, strand3p)
        # if self._update_oligo and not getBatch():
        if self._update_oligo:
            strand5p.strandUpdateSignal.emit(strand5p)
            strand3p.strandUpdateSignal.emit(strand3p)
开发者ID:amylittleyang,项目名称:OtraCAD,代码行数:47,代码来源:xovercmds.py

示例8: undo

# 需要导入模块: from cadnano.strand import Strand [as 别名]
# 或者: from cadnano.strand.Strand import setOligo [as 别名]
    def undo(self):
        part = self._part
        strand5p = self._strand5p
        strand5p_idx = self._strand5p_idx
        strand3p = self._strand3p
        strand3p_idx = self._strand3p_idx
        olg5p = strand5p.oligo()
        new_olg3p = self._new_oligo3p

        # 0. Deselect the involved strands
        doc = strand5p.document()
        doc.removeStrandFromSelection(strand5p)
        doc.removeStrandFromSelection(strand3p)

        if self._isLoop:
            olg5p.setLoop(True)
            # No need to restore whatever the old Oligo._strand5p was
        else:
            # 1. update preserved oligo length
            olg5p.incrementLength(new_olg3p.length())
            # 2. Remove the old oligo and apply the 5' oligo to the 3' strand
            new_olg3p.removeFromPart()
            for strand in strand3p.generator3pStrand():
                # emits strandHasNewOligoSignal
                Strand.setOligo(strand, olg5p)
        # end else

        # 3. install the Xover
        strand5p.setConnection3p(strand3p)
        strand3p.setConnection5p(strand5p)

        ss5 = strand5p.strandSet()
        vh5p = ss5.virtualHelix()
        st5p = ss5.strandType()
        ss3 = strand3p.strandSet()
        vh3p = ss3.virtualHelix()
        st3p = ss3.strandType()

        part.partActiveVirtualHelixChangedSignal.emit(part, vh5p)
        # strand5p.strandXover5pChangedSignal.emit(strand5p, strand3p)
        strand5p.strandUpdateSignal.emit(strand5p)
        strand3p.strandUpdateSignal.emit(strand3p)
    # end def
# end class
开发者ID:Rebelofold,项目名称:cadnano2.5,代码行数:46,代码来源:xovercmds.py

示例9: undo

# 需要导入模块: from cadnano.strand import Strand [as 别名]
# 或者: from cadnano.strand.Strand import setOligo [as 别名]
    def undo(self):
        # Restore the strand
        strand = self._strand
        strandset = self._strandset
        doc = strandset._doc
        # Add the new_strand to the s_set
        strandset._addToStrandList(strand, self._s_set_idx)
        # strandset._strand_list.insert(self._s_set_idx, strand)
        strand5p = self._old_strand5p
        strand3p = self._old_strand3p
        oligo = self._oligo
        olg5p = self._new_oligo5p
        olg3p = self._new_oligo3p

        # Restore connections to this strand
        if strand5p is not None:
            strand5p.setConnection3p(strand)

        if strand3p is not None:
            strand3p.setConnection5p(strand)

        # oligo.decrementLength(strand.totalLength())
        
        # Restore the oligo
        oligo.addToPart(strandset.part())
        if olg5p:
            olg5p.removeFromPart()
        if olg3p:
            olg3p.removeFromPart()
        for s5p in oligo.strand5p().generator3pStrand():
            Strand.setOligo(s5p, oligo)
        # end for

        # Emit a signal to notify on completion
        strandset.strandsetStrandAddedSignal.emit(strandset, strand)

        if self.mids[0] is not None:
            strand.part().addModStrandInstance(strand, strand.lowIdx(), self.mids[0])
            strand.strandModsAddedSignal.emit(strand, self.mids[0], strand.lowIdx())
        if self.mids[1] is not None:
            strand.part().addModStrandInstance(strand, strand.highIdx(), self.mids[1])
            strand.strandModsAddedSignal.emit(strand, self.mids[1], strand.highIdx())

        # for updating the Slice View displayed helices
        strandset.part().partStrandChangedSignal.emit(strandset.part(), strandset.virtualHelix())

        # Restore connections to this strand
        if strand5p is not None:
            if self._solo:
                part = strandset.part()
                vh = strandset.virtualHelix()
                part.partActiveVirtualHelixChangedSignal.emit(part, vh)
                # strand5p.strandXover5pChangedSignal.emit(
                #                                        strand5p, strand)
            strand5p.strandUpdateSignal.emit(strand5p)
            strand.strandUpdateSignal.emit(strand)

        if strand3p is not None:
            if self._solo:
                part = strandset.part()
                vh = strandset.virtualHelix()
                part.partActiveVirtualHelixChangedSignal.emit(part, vh)
                # strand.strandXover5pChangedSignal.emit(strand, strand3p)
            strand3p.strandUpdateSignal.emit(strand3p)
            strand.strandUpdateSignal.emit(strand)
    # end def
# end class
开发者ID:warmstart,项目名称:cadnano2.5,代码行数:69,代码来源:removestrandcmd.py


注:本文中的cadnano.strand.Strand.setOligo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。