Unconfigured Ad

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

    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
                              From Collection to Sequencing: Why Sample Preparation and Preservation Define Sequencing Data
                              by SEQadmin2


                              Data variability is still an issue in sequencing technologies despite the advances in reproducibility and accuracy of these platforms. But the problem does not originate in the sequencing itself, but in the previous steps, before the sample reaches the sequencer.


                              The first step is collection, followed by preservation and sample preparation for analysis. Most scientists overlook those steps, but not being careful might just be skewing the experiment’s results.
                              ...
                              06-02-2026, 10:05 AM
                            • SEQadmin2
                              Single-Cell Sequencing at an Inflection Point: Early Impacts of New Platforms and Emerging Trends
                              by SEQadmin2


                              With the launch of new single-cell sequencing platforms in 2026, the field stands at an exciting inflection point. This article surveys the most impactful advances in the field and discusses how they’re reshaping research in cancer, immunology, and beyond.


                              Introduction

                              Single-cell sequencing technologies have undergone remarkable advances over the past decade, transitioning from low-throughput experimental approaches to highly scalable platforms capable of...
                              05-22-2026, 06:42 AM
                            • SEQadmin2
                              Environmental Genomics in the Age of NGS: From Microbes to Conservation Strategies
                              by SEQadmin2

                              Studying ecosystems means dealing with complex, multi-species communities that are hard to observe at scale. This complexity, however, hides many important questions to be answered, from how biogeochemical cycles work and how climate change can affect species distribution to how conservation strategies can work best.


                              Genomics, particularly since the expansion of NGS, has transformed ecosystem ecology. By sequencing environmental DNA, we can now assess biodiversity without direct...
                              05-06-2026, 09:04 AM

                            ad_right_rmr

                            Collapse

                            News

                            Collapse

                            Topics Statistics Last Post
                            Started by SEQadmin2, Today, 08:59 AM
                            0 responses
                            9 views
                            0 reactions
                            Last Post SEQadmin2  
                            Started by SEQadmin2, 06-02-2026, 12:03 PM
                            0 responses
                            21 views
                            0 reactions
                            Last Post SEQadmin2  
                            Started by SEQadmin2, 06-02-2026, 11:40 AM
                            0 responses
                            17 views
                            0 reactions
                            Last Post SEQadmin2  
                            Started by SEQadmin2, 05-28-2026, 11:40 AM
                            0 responses
                            30 views
                            0 reactions
                            Last Post SEQadmin2  
                            Working...