【发布时间】:2020-09-10 18:46:16
【问题描述】:
我有一个 fastq 文件,其中包含我的所有序列,这是双端测序的结果。我需要将它们分成两个文件,所有反向序列都在一个文件中,而前向序列在第二个文件中。因此,我需要读取前四行并将它们写入文件“R”,然后读取接下来的四行并将它们写入文件“F”。之后,我需要以相同的方式阅读并保存以下几行。 我想过这样的事情(下),但没有奏效。有什么帮助吗?请。
R = open("R.fastq","w+")
F = open("F.fastq","w+")
x = raw_input('type the name of the file you wanna split: ')
with open (x, 'rt') as myfile:
for line in myfile:
R.write (line)
R.write (line)
R.write (line)
R.write (line)
F.write (line)
F.write (line)
F.write (line)
F.write (line)
R.close()
F.close()
【问题讨论】:
标签: python printing fastq write