我修改了我的代码,但又出现了另一个错误:
fin=open("ah_d_01_CGATGT_L003_R1_001.fastq","r")
fout=open("ah_d_01_CGATGT_L003_R1_001.filt.fastq","w")
maxN=4
contatutte=containcl=0
seq=("")
for line in fin:
seq +=fin.read()
ctrl=fin.read()
qual=fin.read()
countN=seq.count("N" ,0, len(seq))
if maxN>countN:
fout.write(line) # +"\n"
fout.write(seq)
fout.write(ctrl)
fout.write(qual)
containcl+=1
fin.close
fout.close
print contatutte,containcl
错误:
File "filtraN.py", line 7, in <module>
seq +=fin.read()
ValueError: Mixing iteration and read methods would lose data