Unconfigured Ad

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

    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

            ad_right_rmr

            Collapse

            News

            Collapse

            Topics Statistics Last Post
            Started by SEQadmin2, Yesterday, 08:59 AM
            0 responses
            14 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 06-02-2026, 12:03 PM
            0 responses
            22 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 06-02-2026, 11:40 AM
            0 responses
            19 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 05-28-2026, 11:40 AM
            0 responses
            32 views
            0 reactions
            Last Post SEQadmin2  
            Working...