FASTX Trimming First and Last X Bases
Entering edit mode
4.8 years ago
gtasource ▴ 60

I'm looking to use FASTX to trim off 15 bases at 3’ end of read 1 and 15 bases at 5’ of read 2. But when I look at the FASTX command, it's not entirely clear to me on how to go about it. The two options that would be used are:

[-f N]       = First base to keep. Default is 1 (=first base).
[-l N]       = Last base to keep. Default is entire read.

Is there a way to tell FASTQ with the -l option to remove the last 15 bases for read one? And for read 2, I would just use -f 16, correct? As this would start with the 16th base pair.


FASTQ FASTX Trimming • 2.6k views
Entering edit mode
4.8 years ago
ATpoint 84k

I suggest to use seqtk with -b and -e

Usage:   seqtk trimfq [options] <in.fq>

Options: -q FLOAT    error rate threshold (disabled by -b/-e) [0.05]
         -l INT      maximally trim down to INT bp (disabled by -b/-e) [30]
         -b INT      trim INT bp from left (non-zero to disable -q/-l) [0]
         -e INT      trim INT bp from right (non-zero to disable -q/-l) [0]
         -L INT      retain at most INT bp from the 5'-end (non-zero to disable -q/-l) [0]
         -Q          force FASTQ output

Obviously you would need to run it independently for each file.

Entering edit mode

Thanks! That's exactly what I was looking for. Cheers! :)

Entering edit mode
4.8 years ago
GenoMax 144k

You could also use from BBMap suite. You will need to trim R1/R2 files independently. Options you need:

forcetrimleft=0     (ftl) If positive, trim bases to the left of this position
                    (exclusive, 0-based).
forcetrimright=0    (ftr) If positive, trim bases to the right of this position
                    (exclusive, 0-based).
forcetrimright2=0   (ftr2) If positive, trim this many bases on the right end.

If reads are all identical length then you will use first two options. If not, with R1 you will need to use forcetrimright2=15.


Login before adding your answer.

Traffic: 2580 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6