I need help to read fastq file on my server virtual machine im using the following python code
def readFastq(filename):
sequences = []
qualities = []
with open(filename) as fh:
while True:
fh.readline()
seq = fh.readline().rstrip()
fh.readline()
qual = fh.readline().rstrip()
if len(seq) == 0:
break
sequences.append(seq)
qualities.append(qual)
return sequences, qualities
seqs, quals = readFastq('sample-seqs.fastq')
print (seqs)
giving me the following
syntax error: invalid syntax (pointing to the line before the last line)
thank you
If it's pointing to the line before the last line, is your input filename/path correct?
You code runs for me, though the output only returns
[+], [+], [+]
- so some of your.readline()
logic is off too.