Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shis
    Member
    • Apr 2014
    • 16

    #1

    Merge two raw data files.fq.gz into one

    Hi,
    I am a new perl user. I would like to merge two raw data files.fq.gz into one file.fq.gz using perl script. I made this command line:

    ~/software/Test_perlscripts/mergeGZFastqFiles.pl lane1r2_subset.fq.gz lane1r1_subset.fq.gz 11.r2r1_subset.fq.gz

    After writing the above command and hit enter, it says Permission denied


    bash: /home/software/Test_perlscripts/mergeGZFastqFiles.pl: Permission denied

    Can anyone advice me why this error message came in and how I can fix it?
  • dpryan
    Devon Ryan
    • Jul 2011
    • 3478

    #2
    Code:
    chmod a+x ~/software/Test_perlscripts/mergeGZFastqFiles.pl
    Also, make sure you have the appropriate shebang at the beginning of the perl file (i.e., something like "#!/usr/bin/env perl").

    Comment

    • GenoMax
      Senior Member
      • Feb 2008
      • 7142

      #3
      @shis: Unless you are trying to interleave the reads with the perl script, you could also just "cat" them together to make a single file.

      Comment

      • shis
        Member
        • Apr 2014
        • 16

        #4
        I have changed according file permission: chmod a+x and execute the command again. Now it says:

        Can't open gzip file lane1r2_subset.fq.gz

        Comment

        • GenoMax
          Senior Member
          • Feb 2008
          • 7142

          #5
          Originally posted by shis View Post
          I have changed according file permission: chmod a+x and execute the command again. Now it says:

          Can't open gzip file lane1r2_subset.fq.gz
          That sounds like a read permission error (as long as the file is in the local directory).

          What exactly are you trying to do with the perl script?

          Post output for
          Code:
          $ ls -l *.fq.gz

          Comment

          • shis
            Member
            • Apr 2014
            • 16

            #6
            @GenoMax: Actually I would like to merge two reads, read1 (Forward) and read2 (reverse) of lane 1 and lane 2 using perl script. For the begining I am trying to test the perl script I have with a subset of lane1 read2 and lane1 read1.

            Comment

            • dpryan
              Devon Ryan
              • Jul 2011
              • 3478

              #7
              If you want to merge them based on an overlap (as opposed to just appending one sequence to the other) then you might want to just use Flash.

              Comment

              • bruce01
                Senior Member
                • Mar 2011
                • 160

                #8
                How is perl reading in the files? You might use a construct like:

                Code:
                open(IN, "gunzip -c $ARGV[0] |");
                while(<IN>){
                ...
                }
                It pipes the gunzip call into perl. You can also do same for BAM files eg:

                Code:
                open(IN, "samtools view $bam |");
                while(<IN>){
                ...
                }

                Comment

                • GenoMax
                  Senior Member
                  • Feb 2008
                  • 7142

                  #9
                  Originally posted by shis View Post
                  @GenoMax: Actually I would like to merge two reads, read1 (Forward) and read2 (reverse) of lane 1 and lane 2 using perl script. For the begining I am trying to test the perl script I have with a subset of lane1 read2 and lane1 read1.
                  Perhaps there is something simple that is wrong with your perl script. If you want someone to help you debug the script then you can post it here.

                  We are assuming that file permissions on the two subset files allow reading by user account that is running the perl script.

                  It may just be simple to use the program Devon suggested.

                  Comment

                  • shis
                    Member
                    • Apr 2014
                    • 16

                    #10
                    @GenoMax:

                    $ ls -l lane1r2_subset.fq.gz

                    -rw-r--r-- 1 me me 2888777 Apr 14 14:14 lane1r2_subset.fq.gz

                    Comment

                    • GenoMax
                      Senior Member
                      • Feb 2008
                      • 7142

                      #11
                      Originally posted by shis View Post
                      @GenoMax:

                      $ ls -l lane1r2_subset.fq.gz

                      -rw-r--r-- 1 me me 2888777 Apr 14 14:14 lane1r2_subset.fq.gz
                      Read permission is not the problem. It must be something in your code.

                      Comment

                      • crazyhottommy
                        Senior Member
                        • Apr 2012
                        • 187

                        #12
                        zcat *fq.gz | gzip > merged.fq.gz

                        Comment

                        • lindenb
                          Senior Member
                          • Apr 2010
                          • 143

                          #13
                          You don't have to gunzip/gzip. You can just concatenate gz files ( http://stackoverflow.com/questions/8005114 )

                          Code:
                          cat f1.gz f2.gz > merged.gz

                          Comment

                          • GenoMax
                            Senior Member
                            • Feb 2008
                            • 7142

                            #14
                            Originally posted by crazyhottommy View Post
                            zcat *fq.gz | gzip > merged.fq.gz
                            @shis (post # 6) does not want to merge the files but the R1/R2 reads (overlap them).

                            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, 10:52 AM
                            0 responses
                            9 views
                            0 reactions
                            Last Post SEQadmin2  
                            Started by SEQadmin2, 10-14-2026, 05:39 AM
                            0 responses
                            19 views
                            0 reactions
                            Last Post SEQadmin2  
                            Started by SEQadmin2, 10-13-2026, 09:56 AM
                            0 responses
                            16 views
                            0 reactions
                            Last Post SEQadmin2  
                            Started by SEQadmin2, 10-09-2026, 11:14 AM
                            0 responses
                            27 views
                            0 reactions
                            Last Post SEQadmin2  
                            Working...