This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Producing the Reverse-complement of each sequence in fastq files

I want to produce the reverse-complement of each sequence in fastq files. I tried fastx_reverse_complement in FASTX-Toolkit. But following an error message were obtained. fastx_reverse_complement: Invalid quality score value (char '#' ord 35 quality value -29) on line 4

Are there any problems ? Are there any software producing the reverse-complement of each sequence in fastq files?

sequence

I think you can write your script to get the reverse complement using biopython.

Maybe your version of FASTX-Toolkit is too old ?

$ cat toto.fq 
@test
AAACCTGG
+
III#IIEE

$ fastx_reverse_complement -i toto.fq 
@test
CCAGGTTT
+
EEII#III

$ fastx_reverse_complement -h
usage: fastx_reverse_complement [-h] [-r] [-z] [-v] [-i INFILE] [-o OUTFILE]
Part of FASTX Toolkit 0.0.14 by A. Gordon (assafgordon@gmail.com)

Edit: link to the commit that deprecated -Q33.

Can you explain to me why you are after the reverse complement of the FASTQ sequences please? Thanks.

2 answers

You may try seqkit (v0.4.5 or later, run seqkit version to check version), which provides executable binary files for Linux/Windows/OS X. Just download, decompress and immediately use.

$ seqkit seq t.fq.gz 
@K00137:236:H7NLVBBXX:6:1126:29721:23241 1:N:0
TGGTAGGGAGTTGAGTAGCATGGGTATAGTATAGTGTCATGATGCCAGATTTTAAAAAAAATACTGGAGA
+
```eeiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii

$ seqkit seq -r -p  t.fq.gz 
@K00137:236:H7NLVBBXX:6:1126:29721:23241 1:N:0
TCTCCAGTATTTTTTTTAAAATCTGGCATCATGACACTATACTATACCCATGCTACTCAACTCCCTACCA
+
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiee```

All in one:

seqkit seq -r -p t.fq.gz | gzip -c  > new.fq.gz  # faster

or

seqkit seq -r -p t.fq.gz -o new.fq.gz

But, it seems nobody reverses complement FASTQ sequences.

Best solution, and it worked.

Thanks shenwei356 for your answer! You said, "nobody reverses complement FASTQ sequences," but I'm wondering: do you think it makes sense to reverse complement if you have mate-pair reads in a reverse-forward orientation that you want to feed into an assembler that normally accepts reads in a forward-reverse orientation? That's what is done in https://thegenomefactory.blogspot.com/2012/09/using-velvet-with-mate-pair-sequences.html.

The error says you have an invalid quality score so perhaps you can't have negative quality score values such as -29 in the example you provided. Hope this helps.

Log in to answer this question.