Unconfigured Ad

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

    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

            • mylaser
              Reply to Advanced Sequencing Platforms Tackle Neuroscience’s Toughest Genomics Problems
              by mylaser
              Kheloyar – Everything You Need to Know About Kheloyaar Login and Kheoyar Id
              If you are looking for an online gaming platform that offers a user-friendly experience, Kheloyar has become a name that many users search for. Whether you're interested in creating a new account, accessing your dashboard through Kheloyaar Login, or learning how to obtain a Kheoyar Id, understanding the platform's features and account process is essential.
              This guide explains everything you need to know about...
              07-11-2026, 01:13 AM
            • SEQadmin2
              Advanced Sequencing Platforms Tackle Neuroscience’s Toughest Genomics Problems
              by SEQadmin2



              Genomics studies in neuroscience face a special challenge due to the brain’s complexity and scarcity of samples. Mapping changes in cell type and state using conventional next-generation sequencing methods remains challenging. Advances in technologies like single-cell sequencing, spatial transcriptomics, and long-read sequencing have opened the door to deeper studies of the brain and diseases like Alzheimer’s, amyotrophic lateral sclerosis (ALS), and schizophrenia.
              ...
              07-09-2026, 11:10 AM
            • SEQadmin2
              Cancer Drug Resistance: The Lingering Barrier to Rising Survival
              by SEQadmin2



              Cancer survival rates have significantly increased in the last few decades in the United States, reaching a combined 70% 5-year survival rate by 2021. Behind this number, there are years of research to find new therapies, drug targets, and early detection methods. But there is one core challenge that keeps slowing down these advances, and it’s about drug resistance.

              There is no single reason why many patients don’t respond to treatment as expected. Cancer is...
              07-08-2026, 05:17 AM

            ad_right_rmr

            Collapse

            News

            Collapse

            Topics Statistics Last Post
            Started by SEQadmin2, 07-09-2026, 10:04 AM
            0 responses
            22 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 07-08-2026, 10:08 AM
            0 responses
            14 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 07-07-2026, 11:05 AM
            0 responses
            33 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 07-02-2026, 11:08 AM
            0 responses
            31 views
            0 reactions
            Last Post SEQadmin2  
            Working...