Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • j.cappellazzi
    Member
    • Aug 2017
    • 12

    #1

    Qiime Ubuntu Command Line File Name Code?

    After running multiple_join_paired_ends.py on my 600 Illumina MiSeq files, the output leaves each sample in individual folders. The folder has a unique name, but all of the files in each subdirectory have the name "fastqjoin.join.fastq."

    In order to continue with split_libraries.py, I need to have all of the .fastq files in a single folder with unique names to identify the samples.

    Is there a script to rename all of the files in each folder with the name of the folder they are in? This is how my filing system works...

    /home/qiime/desktop/Final_Analysis/join_paired_ends_fastq-join/600 uniquely named folders, within each folder is a single joined .fastq file, but all of the files have the same name of "fastqjoin.join.fastq"

    If each of those files could be renamed to the name of the folder they are in, I could just move them to another directory easily and each would have a unique identifier. Basically, I am trying to avoid individually going in and renaming each of the 600 files.

    Any help would be greatly appreciated!
  • kmcarr
    Senior Member
    • May 2008
    • 1181

    #2
    In this situation you want to use multiple_split_libraries_fastq.py http://qiime.org/scripts/multiple_sp...ies_fastq.html

    From the documentation this script may be invoked on
    a directory containing many directories, where each directory is named on a per-sample basis
    to iteratively run split_libraries_fastq.py on each subdirectory.

    Comment

    • j.cappellazzi
      Member
      • Aug 2017
      • 12

      #3
      Thanks for the quick response kmcarr. I forgot to mention another step in the pipeline in my first post. Before I run multiple_split_libraries_fastq.py, I would like to run count_seqs.py as well as use the fastx_toolkit on those joined reads. In order to do this, the files need to be in a single folder with unique names.

      Is there a way (script) to rename the files with unique names (which they will hold through all of the analyses) that you are aware of. Essentially, is there an answer to my first question, not necessarily for the split libraries script but for sample organization? Thanks.

      Comment

      • neavemj
        Member
        • Feb 2014
        • 58

        #4
        Hi j.cappellazzi,

        I think the below should work for renaming your files if you're sure qiime won't do it for you, or complain later when all the files are renamed. Be careful though - I wouldn't want to mess up all your files! Maybe you could try this on a dummy example first, or backup your files beforehand.

        Change into the base directory

        Code:
        cd /home/qiime/desktop/Final_Analysis/join_paired_ends_fastq-join/
        Loop through each folder and rename it's containing fastq file with the folder name:

        Code:
        for j in */; do mv $j/fastqjoin.join.fastq $j/$(basename $j); done
        Or if you want the renamed files to also end with ".fastq":

        Code:
        for j in */; do mv $j/fastqjoin.join.fastq $j/$(basename $j).fastq; done
        Or if you want all the files in the current directory (rather than in their individual directories):

        Code:
        for j in */; do mv $j/fastqjoin.join.fastq $(basename $j).fastq; done
        Cheers,

        Matt.

        Comment

        • j.cappellazzi
          Member
          • Aug 2017
          • 12

          #5
          Thanks neavemj! That was perfect. All of the files are now renamed. I will keep going on these practice files to make sure all is well, but I think that's exactly what I wanted :-). I need to take a coding class.

          Comment

          • neavemj
            Member
            • Feb 2014
            • 58

            #6
            Excellent!

            I was thinking you could probably also do a copy (cp) rather than renaming the files:

            Code:
            for j in */; do cp $j/fastqjoin.join.fastq $(basename $j).fastq; done
            This would leave the fastqjoin.join.fastq files in their original directory, and make a copy (with the directory name) and put them in the current directory.

            Cheers,

            Matt.

            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
            17 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...