本文整理匯總了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