SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to merge two vcf files. cardillox Bioinformatics 3 11-27-2019 09:25 PM
How to keep the raw .fastq.gz files for RNASeq data shirley0818 RNA Sequencing 5 03-25-2014 09:15 AM
how to merge fastq files sazz Bioinformatics 7 07-03-2013 03:58 AM
Merge two gff3 files? BobFreemanMA Bioinformatics 3 02-05-2013 04:53 AM
Can we merge 2 csfasta files ? tdm SOLiD 9 12-10-2010 09:10 AM

Reply
 
Thread Tools
Old 04-15-2014, 04:20 AM   #1
shis
Member
 
Location: USA

Join Date: Apr 2014
Posts: 16
Default 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?
shis is offline   Reply With Quote
Old 04-15-2014, 04:26 AM   #2
dpryan
Devon Ryan
 
Location: Freiburg, Germany

Join Date: Jul 2011
Posts: 3,480
Default

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").
dpryan is offline   Reply With Quote
Old 04-15-2014, 04:32 AM   #3
GenoMax
Senior Member
 
Location: East Coast USA

Join Date: Feb 2008
Posts: 7,049
Default

@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.
GenoMax is offline   Reply With Quote
Old 04-15-2014, 04:36 AM   #4
shis
Member
 
Location: USA

Join Date: Apr 2014
Posts: 16
Default

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
shis is offline   Reply With Quote
Old 04-15-2014, 04:45 AM   #5
GenoMax
Senior Member
 
Location: East Coast USA

Join Date: Feb 2008
Posts: 7,049
Default

Quote:
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
GenoMax is offline   Reply With Quote
Old 04-15-2014, 04:54 AM   #6
shis
Member
 
Location: USA

Join Date: Apr 2014
Posts: 16
Default

@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.
shis is offline   Reply With Quote
Old 04-15-2014, 04:57 AM   #7
dpryan
Devon Ryan
 
Location: Freiburg, Germany

Join Date: Jul 2011
Posts: 3,480
Default

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.
dpryan is offline   Reply With Quote
Old 04-15-2014, 05:02 AM   #8
bruce01
Senior Member
 
Location: .

Join Date: Mar 2011
Posts: 157
Default

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>){
...
}
bruce01 is offline   Reply With Quote
Old 04-15-2014, 05:03 AM   #9
GenoMax
Senior Member
 
Location: East Coast USA

Join Date: Feb 2008
Posts: 7,049
Default

Quote:
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.
GenoMax is offline   Reply With Quote
Old 04-15-2014, 05:34 AM   #10
shis
Member
 
Location: USA

Join Date: Apr 2014
Posts: 16
Default

@GenoMax:

$ ls -l lane1r2_subset.fq.gz

-rw-r--r-- 1 me me 2888777 Apr 14 14:14 lane1r2_subset.fq.gz
shis is offline   Reply With Quote
Old 04-15-2014, 06:07 AM   #11
GenoMax
Senior Member
 
Location: East Coast USA

Join Date: Feb 2008
Posts: 7,049
Default

Quote:
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.
GenoMax is offline   Reply With Quote
Old 04-15-2014, 07:01 AM   #12
crazyhottommy
Senior Member
 
Location: Gainesville

Join Date: Apr 2012
Posts: 140
Default

zcat *fq.gz | gzip > merged.fq.gz
crazyhottommy is offline   Reply With Quote
Old 04-15-2014, 07:33 AM   #13
lindenb
Senior Member
 
Location: France

Join Date: Apr 2010
Posts: 143
Default

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
lindenb is offline   Reply With Quote
Old 04-15-2014, 07:34 AM   #14
GenoMax
Senior Member
 
Location: East Coast USA

Join Date: Feb 2008
Posts: 7,049
Default

Quote:
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).
GenoMax is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off




All times are GMT -8. The time now is 06:23 PM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO