||
简单的一个if语句的排列,seq运行截然不同的结果,程序需要逻辑:
程序段1:
fIn=open(fastaFile, 'r')
for line in fIn:
lineNum += 1
if lineNum == 1:
tmp = line.replace('n', '').split('/')
if len(tmp) == 3:
if tmp[2].split('_')[0] == "0":
length = int(tmp[2].split('_')[1])
else:
print "begin coord in seq header is wrong for pacbio fasta file."
return 0
else:
print "seq header format is wrong for pacbio fasta file."
return 0
if line[0] == '>' and lineNum > 1:
print length, len(seq)
if length == len(seq):
return 1
else:
print "end coord in seq header is wrong for pacbio fasta file."
return 0
else:
seq += line.replace('n', '')
fIn.close()
程序段2:
fIn=open(fastaFile, 'r')
for line in fIn:
lineNum += 1
if lineNum == 1:
tmp = line.replace('n', '').split('/')
if len(tmp) == 3:
if tmp[2].split('_')[0] == "0":
length = int(tmp[2].split('_')[1])
else:
print "begin coord in seq header is wrong for pacbio fasta file."
return 0
else:
print "seq header format is wrong for pacbio fasta file."
return 0
if line[0] == '>':
if lineNum > 1:
print length, len(seq)
if length == len(seq):
return 1
else:
print "end coord in seq header is wrong for pacbio fasta file."
return 0
else:
seq += line.replace('n', '')
fIn.close()
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-4-27 05:25
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社