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


Python Util.isNtSequence方法代码示例

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


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

示例1: handle_data

# 需要导入模块: from hgu import Util [as 别名]
# 或者: from hgu.Util import isNtSequence [as 别名]
    def handle_data(self, data):
        """
        Called when text is encountered in the page.  This includes text
        between start and end tags.
        """
        if self.__state == IN_FASTA:
            # Data is in fasta format, showing first the forward sequence,
            # and then the reverse sequence.
            lines = data.split()

            forwardSequence = ""
            reverseSequence = ""
            fullInsertSequence = ""
            for line in lines:
                # print "line:", line
                # print "Start state:", self.__state
                if line[0:2] == ">f":
                    # print "In >f"
                    # Start of forward sequence
                    if self.__state == IN_FASTA:
                        # print "In >f, IN_FASTA"
                        self.__nibbXdbClone.setForwardSequenceFastaHeader(line)
                        self.__state = IN_FORWARD_SEQUENCE
                    else:
                        self.__fatalError(line)

                elif line[0:2] == ">r":
                    # print "In >r"
                    # Start of reverse sequence
                    if self.__state == IN_FORWARD_SEQUENCE:
                        # print "In >r", self.__state
                        self.__nibbXdbClone.setReverseSequenceFastaHeader(line)
                        self.__state = IN_REVERSE_SEQUENCE
                    else:
                        self.__fatalError(line)

                elif line[0:2] == ">i":
                    # print "In >i"
                    # Start of full insert sequence
                    if self.__state == IN_REVERSE_SEQUENCE:
                        # print "In >i,", self.__state
                        self.__nibbXdbClone.setFullInsertSequenceFastaHeader(line)
                        self.__state = IN_FULL_INSERT_SEQUENCE
                    else:
                        self.__fatalError(line)

                elif self.__state == IN_FORWARD_SEQUENCE:
                    #print "IN_FORWARD_SEQUENCE"
                    if Util.isNtSequence(line):
                        #print "IN_FORWARD_SEQUENCE and is sequence"
                        forwardSequence += " " + line
                    else:
                        self.__fatalError(line)

                elif self.__state == IN_REVERSE_SEQUENCE:
                    #print "IN_REVERSE_SEQUENCE"
                    if Util.isNtSequence(line):
                        #print self.__state, "and is sequence"
                        reverseSequence += " " + line
                    else:
                        self.__fatalError(line)

                elif self.__state == IN_FULL_INSERT_SEQUENCE:
                    #print self.__state
                    if Util.isNtSequence(line):
                        #print self.__state, "and is sequence"
                        fullInsertSequence += " " + line
                    else:
                        self.__fatalError(line)
                else:
                    self.__fatalError(line)

                #print "End state:", self.__state
                #print

            if self.__state in [IN_REVERSE_SEQUENCE, IN_FULL_INSERT_SEQUENCE]:
                self.__nibbXdbClone.setForwardSequence(forwardSequence.strip())
                self.__nibbXdbClone.setReverseSequence(reverseSequence.strip())
            else:
                self.__fatalError(
                    "Sequence data did not end with expected sequence.")

            if self.__state == IN_FULL_INSERT_SEQUENCE:
                self.__nibbXdbClone.setFullInsertSequence(fullInsertSequence.strip())

        return
开发者ID:ma-tech,项目名称:Anatomy,代码行数:88,代码来源:NibbXdbClone.py


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