Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • NRiddiford
    Junior Member
    • Jul 2012
    • 6

    #1

    fastq_quality_trimmer script

    Hi guys,

    I've got a load of RNA-Seq .txt files that I need to trim and filter. The files are very large (>12GB) and I have a lot of different controls etc, and I was wondering if there was a simple script that someone could help me with to perform the same action on multiple files and specify a unique output name.

    I imagine a for loop saying 'for every file ending in .txt run fastq_quality_trimmer and save as a .fastq file' would do this, but I'm not too sure how to go about writing it.

    Any help would be appreciated,

    Thanks a lot,

    Nick
  • cormicp
    Junior Member
    • Jul 2009
    • 5

    #2
    Hi Nick,

    Below is a small perl script that should do what you want. Obviously you can change the parameters selected for fastq_quality_trimmer to the correct ones that you want to use.

    Hope this is what you were looking for.

    open (FILES, "ls *.txt |");
    while (<FILES>) {
    @split = split(/\s+/, $_);
    $file = $split[0];
    print "\n\nParsing $file...";


    system ("fastq_quality_trimmer -t 15 -i $file -o $file.fastq);

    }
    Last edited by cormicp; 07-23-2012, 05:32 AM.

    Comment

    • NRiddiford
      Junior Member
      • Jul 2012
      • 6

      #3
      Awesome - thanks.

      So I just have to replace the $file with the -i/-o locations?

      Would it be possible for you to give me a brief explanation of the script (i.e what each line does?)

      Thanks a lot,

      Nick

      Comment

      • Rocketknight
        Member
        • Sep 2011
        • 86

        #4
        If you're running Linux/OSX, you can also do the whole thing at the command line like this:

        Code:
        $ for i in `ls *.txt`; do fastq_quality_trimmer -i $i -o $i.fastq; done
        This may seem very confusing but it's actually quite simple. Here it is broken down:

        Code:
        for i in `ls *.txt`;
        This bit runs `ls *.txt` and stores a list of the filenames. It then loops once for each file. In each loop, the name of the file is put in the variable $i. Note that `ls.txt` is in backticks (top left corner of your keyboard if you're in the US/UK), not single quotes.

        Code:
        do fastq_quality_trimmer -i $i -o $i.fastq;
        This command will run once every loop, with a different value of $i each time. So if you only have two files, A.txt and B.txt, what will happen is the following commands will run:

        fastq_quality_trimmer -i A.txt -o A.txt.fastq
        fastq_quality_trimmer -i B.txt -o B.txt.fastq

        As you can see, this is a simple but powerful way to run the same command on multiple files at once. If you wish to run fastq_quality_trimmer with other command-line options, just edit the line as required to insert those options.

        Code:
        done
        This indicates that you're not putting any more commands inside the loop. The loop will now run and with any luck you'll get your .txt.fastq output files.

        Word of warning: If you make a mistake while doing this, it's possible to specify both the input and output to be $i, which may cause the output to overwrite the input file, leading to much chaos. Having a backup of your files before you try this for the first time is recommended, but once you're comfortable with it you'll find it's really handy to have.

        Comment

        • NRiddiford
          Junior Member
          • Jul 2012
          • 6

          #5
          Thanks guys, really helpful solutions!

          Cheers,

          Nick

          Comment

          • simonandrews
            Simon Andrews
            • May 2009
            • 870

            #6
            Originally posted by Rocketknight View Post

            Code:
            $ for i in `ls *.txt`;
            Just for the record you don't need the ls part of this command.

            Code:
            $ for i in *.txt; ...
            ..works just fine.

            Comment

            Latest Articles

            Collapse

            • SEQadmin2
              Beyond CRISPR/Cas9: Understand, Choose, and Use the Right Genome Editing Tool
              by SEQadmin2



              CRISPR/Cas9 sparked the gene editing revolution for both research and therapeutics.1 But this system still showed severe issues that limited its applications. The most prominent were the heavy reliance on PAM sequences, delivery limitations, double-stranded breaks that prompt unintended edits and cell death, and editing inefficiency (both in targeting and in knock-in reliability).

              Despite this, “CRISPR helped turn genome editing from a specialized technique into
              ...
              07-31-2026, 11:01 AM
            • SEQadmin2
              Proteomic Platforms: How to Choose the Right Analytical Strategy to Improve Detection and Clinical Applications
              by SEQadmin2


              Proteomics platforms are evolving rapidly, with advances in mass spectrometry and affinity-based approaches expanding what researchers can detect and at what scale. As the field moves toward deeper proteome coverage and clinical applications, scientists face an increasingly complex landscape of tools. This article will explore how researchers are navigating these choices to find the right platform for their work.

              The systematic characterization of the human proteome has
              ...
              07-20-2026, 11:48 AM

            ad_right_rmr

            Collapse

            News

            Collapse

            Topics Statistics Last Post
            Started by SEQadmin2, 08-13-2026, 12:22 PM
            0 responses
            31 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 08-11-2026, 10:35 AM
            0 responses
            24 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 08-06-2026, 07:41 AM
            0 responses
            38 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 08-03-2026, 10:13 AM
            0 responses
            51 views
            0 reactions
            Last Post SEQadmin2  
            Working...