Question: How to append two fastq files ?
0
gravatar for debitboro
7 months ago by
debitboro180
Belgium
debitboro180 wrote:

Dear Biostars,

How can I append sequences of two fastq files ?

Suppose we have two fastq files:

 **file1.fastq**

@HEADER
CTCAGNTTGG
+
AAAAA#EEEE
@HEADER
GTGAGTTTAG
+
AA<AA#EE<E

**file2.fastq**

@HEADER
CTTTA
+
#EEEA
@HEADER
GTGAG
+
A#E<E

**result.fastq = append file2.fastq to file1.fastq**

@HEADER
CTTTACTCAGNTTGG
+
#EEEAAAAAA#EEEE
@HEADER
GTGAGGTGAGTTTAG
+
A#E<EAA<AA#EE<E

How can I do that ?

rna-seq merge append fastq • 289 views
ADD COMMENTlink written 7 months ago by debitboro180
1

Why do you need to do this?

To do:

cat file1.fastq file2.fastq > file.fastq
ADD REPLYlink written 7 months ago by h.mon30k

Thank you for your answer, but that is not what I'm looking for. I think the question is clearly formulated: I need to prefix the reads of the first file with the reads of the second file.

ADD REPLYlink written 7 months ago by debitboro180

Ah, I see, sorry.

But then, my question is even more pertinent: why do you need to do this?

For a quick and dirty concatenation:

paste -d "" file1.fastq file2.fastq > file.fastq
ADD REPLYlink modified 7 months ago • written 7 months ago by h.mon30k

I want to concatenate only the read sequences and quality sequences not all the components of a record. I need to do that to adapt my file as an input for in-house script for UMI deduplication.

ADD REPLYlink written 7 months ago by debitboro180

Then you should script yourself a solution with awk, perl or python, it shouldn't be too difficult.

ADD REPLYlink written 7 months ago by h.mon30k
1
gravatar for debitboro
7 months ago by
debitboro180
Belgium
debitboro180 wrote:

I got it, simply:

paste -d '\n' file2.fastq file1.fastq | sed -n 'p;n;n;N;s/\n//p' > result.fastq

Thank you h.mon for you help

ADD COMMENTlink written 7 months ago by debitboro180
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1000 users visited in the last hour