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
              Multiomic Liquid Biopsy: What DNA/RNA Panels Reveal That DNA Alone Can’t
              by SEQadmin2



              Tumors contain complex mixtures of cell populations that evolve in response to treatment and host-specific factors. Tissue biopsies provide only static snapshots of a tumor’s state. But what if we could follow that evolution over time using a minimally invasive technique?

              Liquid biopsies can detect tumor-derived material circulating in the bloodstream, providing a way to study treatment response, detect emerging resistance, and discover new biomarkers. Circulating
              ...
              10-14-2026, 09:55 AM
            • SEQadmin2
              New Genomics Technologies Take Aim at Long-Standing Limits
              by SEQadmin2


              Researchers using sequencing and genomics tools often have to make trade-offs. They can choose between speed or scale, short reads or long-range information, or targeted panels or a view of the whole transcriptome. New technologies that have been released this year are built to address those tough choices.

              We asked six companies the same four questions to learn about their latest products. The new technologies bring a lot to the table, including rethinking sequencing
              ...
              09-28-2026, 10:25 AM

            ad_right_rmr

            Collapse

            News

            Collapse

            Topics Statistics Last Post
            Started by SEQadmin2, Yesterday, 11:13 AM
            0 responses
            19 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, Yesterday, 10:48 AM
            0 responses
            18 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 10-15-2026, 10:52 AM
            0 responses
            36 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 10-14-2026, 05:39 AM
            0 responses
            42 views
            0 reactions
            Last Post SEQadmin2  
            Working...