_images/Logo.png

Filter a CASAVA-generated fastq file

Note

Required OS:OS x or Linux. Windows users, please contact Saranga Wijeratne
Software:Illumina CASAVA-1.8 FASTQ Filter
Purpose:This document provides instructions about how to remove Passing Filter (PF) failed reads from a Fastq file
More:Read more about PF here: and here
Author:This document was created by Saranga Wijeratne

Software installation

Note

If you are runing this on MCBL mcic-ender-svr, please skip the installation. Following command will load the software module to your environment.

1
$ module load fasq_filter/0.1

On your own server,

Warning

If you don’t have administrator privileges on the machine, you wouldn’t be able run sudo (last command in the following code block) commands.

1
2
3
4
5
$ wget http://cancan.cshl.edu/labmembers/gordon/fastq_illumina_filter/fastq_illumina_filter-0.1.tar.gz
$ tar -xzf fastq_illumina_filter-0.1.tar.gz
$ cd fastq_illumina_filter-0.1
$ make
$ sudo cp fastq_illumina_filter /usr/local/bin

Tip

Put your executables in ~/bin or full-path to executables in $PATH in the absence of sudo privilages.

Filter a fastq file

Input File:C8EC8ANXX_s2_1_illumina12index_1_SL143785.fastq.gz
Output File:C8EC8ANXX_s2_1_illumina12index_1_SL143785.filtered.fastq.gz
1
$ zcat C8EC8ANXX_s2_1_illumina12index_1_SL143785.fastq.gz | fastq_illumina_filter -vvN | gzip > C8EC8ANXX_s2_1_illumina12index_1_SL143785.filtered.fastq.gz

Filter multiple fastq files

Input File:Fastq_filenames.txt
Output Files:Individual Fastq files
  1. Create a Fastq_filenames.txt file with your Fastq filenames in seperate lines as follows:

    #Content of Samples.txt
    C6V7FANXX_s8_0_TruseqHTDual_D712-TruseqHTDual_D508_SL104628.fastq.gz
    C6V7FANXX_s3_0_TruseqHTDual_D703-TruseqHTDual_D501_SL104549.fastq.gz
    C6V7FANXX_s5_0_TruseqHTDual_D709-TruseqHTDual_D506_SL104602.fastq.gz
    C6V7FANXX_s8_0_TruseqHTDual_D705-TruseqHTDual_D501_SL104565.fastq.gz
    
  2. Save the above file in the same folder with your Fastq files.

  3. Use the Terminal and navigate to the location where Fastq_filenames.txt is saved.

    1
    2
    #If your Fastq_filenames.txt is saved under ~/Downloads
    $ cd ~/Downloads
    
  4. Type in the following command to filter Fastqs in the Fastq_filenames.txt.

    1
    $ for f in $(cat Fastq_filenames.txt); do zcat $f | fastq_illumina_filter -vvN | gzip > ${f%.*.fastq.gz}.filtered.fastq.gz;done