Seqanswers Leaderboard Ad

Collapse

Announcement

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

  • How to make all files joined?

    Basically I have 28 files of r1 and r2 data which I want merged. I am planning on using ea-utils fastq-join but am wondering if anyone knows of a way to make a program go through each pair of files joining them and then moving onto the next automatically?

    I have heard of for loops and was thinking of trying to write one but know very little so is it possible to get something like this working:

    for Library$_read1 and Library$_read2

    do fastq-join -p 1 -o Library$_merged

    done


    That way it could work its way through all the pairs of files using $ so it goes Library1, Library2 etc

    Any help would be greatly appreciated.

    Thanks,
    Tom

  • #2
    Tom: Following will need adjustment based on the exact file names you have but example below works for tcshell.

    Code:
    $ ls -1 *.fq
    test1_r1.fq
    test1_r2.fq
    test2_r1.fq
    test2_r2.fq
    test3_r1.fq
    test3_r2.fq
    
    $ foreach i ( `ls -1 *r1* | cut -d"_" -f1` )
    foreach? fastq-join $i\_r1.fq $i\_r2.fq -o $i\_merged.fq
    foreach? end
    For Bash (assuming the same file names above):

    Code:
    $ for A in `ls -1 *r1*`; do fastq-join "${A%%_*}"_r1.fq "${A%%_*}"_r2.fq -o "${A%%_*}"_combined.fq ;done
    Last edited by GenoMax; 04-30-2014, 05:08 AM. Reason: added example for bash shell

    Comment


    • #3
      i quite like xargs:
      Code:
      ls -1 *fq | cut -d _ -f 1 | sort | uniq | xargs -I '{}' -P 4 sh -c "echo processing '{}'; fastq-join '{}'_r1.fq '{}'_r2.fq -o '{}'_merged.fq"
      .. will run four commands in parallel.

      Comment


      • #4
        I am not sure if I understood your question completely, but if you are doing end to end joining you can simply use Unix cat like below:

        cat file1 file2 file3 > combined-files.fastq

        Comment


        • #5
          Originally posted by rnaeye View Post
          I am not sure if I understood your question completely, but if you are doing end to end joining you can simply use Unix cat like below:

          cat file1 file2 file3 > combined-files.fastq
          thh32 wants to use "fastq-join" utility from ea-utils that merges R1/R2 reads using the overlapping ends.

          Comment


          • #6
            Thanks GenoMax. It seems to be a useful tool to have. Best,

            Comment

            Latest Articles

            Collapse

            • seqadmin
              Essential Discoveries and Tools in Epitranscriptomics
              by seqadmin




              The field of epigenetics has traditionally concentrated more on DNA and how changes like methylation and phosphorylation of histones impact gene expression and regulation. However, our increased understanding of RNA modifications and their importance in cellular processes has led to a rise in epitranscriptomics research. “Epitranscriptomics brings together the concepts of epigenetics and gene expression,” explained Adrien Leger, PhD, Principal Research Scientist...
              04-22-2024, 07:01 AM
            • seqadmin
              Current Approaches to Protein Sequencing
              by seqadmin


              Proteins are often described as the workhorses of the cell, and identifying their sequences is key to understanding their role in biological processes and disease. Currently, the most common technique used to determine protein sequences is mass spectrometry. While still a valuable tool, mass spectrometry faces several limitations and requires a highly experienced scientist familiar with the equipment to operate it. Additionally, other proteomic methods, like affinity assays, are constrained...
              04-04-2024, 04:25 PM

            ad_right_rmr

            Collapse

            News

            Collapse

            Topics Statistics Last Post
            Started by seqadmin, Yesterday, 08:47 AM
            0 responses
            15 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 04-11-2024, 12:08 PM
            0 responses
            60 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 04-10-2024, 10:19 PM
            0 responses
            60 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 04-10-2024, 09:21 AM
            0 responses
            54 views
            0 likes
            Last Post seqadmin  
            Working...
            X