Seqanswers Leaderboard Ad

Collapse

Announcement

Collapse
No announcement yet.
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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!

  • #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


    • #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


      • #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


        • #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


          • #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

            • seqadmin
              Strategies for Sequencing Challenging Samples
              by seqadmin


              Despite advancements in sequencing platforms and related sample preparation technologies, certain sample types continue to present significant challenges that can compromise sequencing results. Pedro Echave, Senior Manager of the Global Business Segment at Revvity, explained that the success of a sequencing experiment ultimately depends on the amount and integrity of the nucleic acid template (RNA or DNA) obtained from a sample. “The better the quality of the nucleic acid isolated...
              03-22-2024, 06:39 AM
            • seqadmin
              Techniques and Challenges in Conservation Genomics
              by seqadmin



              The field of conservation genomics centers on applying genomics technologies in support of conservation efforts and the preservation of biodiversity. This article features interviews with two researchers who showcase their innovative work and highlight the current state and future of conservation genomics.

              Avian Conservation
              Matthew DeSaix, a recent doctoral graduate from Kristen Ruegg’s lab at The University of Colorado, shared that most of his research...
              03-08-2024, 10:41 AM

            ad_right_rmr

            Collapse

            News

            Collapse

            Topics Statistics Last Post
            Started by seqadmin, Yesterday, 06:37 PM
            0 responses
            10 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, Yesterday, 06:07 PM
            0 responses
            9 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 03-22-2024, 10:03 AM
            0 responses
            51 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 03-21-2024, 07:32 AM
            0 responses
            67 views
            0 likes
            Last Post seqadmin  
            Working...
            X