【发布时间】:2023-01-04 14:32:56
【问题描述】:
这里的目的是从 FASTQ 文件中的一组字符串(读取)构建一个图形。但首先,我们实现以下获取读取的函数。我们从每行的末尾删除换行符(使用 str.strip()),并且为了约定,我们将读取中的所有字符转换为大写(使用 str.upper())。 代码:
def get_reads(filePath):
reads = list() # The list of strings that will store the reads (the DNA strings) in the FASTQ file at filePath
fastqFile = open(filePath, 'r')
fastqLines = fastqFile.readlines()
fastqFile.close()
for lineIndex in range(1, len(fastqLines), 4): # I want this explained
line = fastqLines[lineIndex]
reads.append(line.strip().upper())
return reads
我的问题是:请解释 lineIndex in range(1, len(fastqLines), 4) 这一行的用途是什么?
【问题讨论】:
标签: python database string graph fastq