Can STAR work with compressed .gz FASTQ input?
1
3
Entering edit mode
7.8 years ago
biomagician ▴ 410

Dear all,

I would like to align some reads to a reference using STAR. The following command works perfectly:

STAR --genomeDir output/spiking/index/star --readFilesIn reads.fastq --outFileNamePrefix outputFolder --runThreadN 8 > message.txt

However, the following command does not work:

STAR --genomeDir output/spiking/index/star --readFilesIn reads.fastq.gz --outFileNamePrefix outputFolder --runThreadN 8 > message.txt

Error: the read ID should start with @ or >

Presumably, STAR expects a FASTQ file and not a fastq.gz file. Does anybody know how to get round this in an efficient way?

Thanks.

C.

star fastq compressed gz alignment • 33k views
ADD COMMENT
18
Entering edit mode
7.8 years ago

add --readFilesCommand zcat in your commandline

ADD COMMENT
3
Entering edit mode

Thanks. That didn't work for me probably because I am on Mac OSX. But I've found this and 'gunzip -c' instead of 'zcat' worked. https://groups.google.com/forum/#!topic/rna-star/NY56kU3mC64

ADD REPLY
4
Entering edit mode

Actually, you can use the bash shell hack <(gunzip -c filename.gz) to pass the gzipped file (or similarly, any other kind of zip file), which doesn't have a built-in mechanism to read the zipped files directly (STAR is awesome in providing the built-in mechanism :). It uses a trick of shell called Process Substitution. In essence, the command inside () is run inside a subshell, and the output of the command is passed as a input to the main command (which is your main program).

ADD REPLY
0
Entering edit mode

Hi Santosh, Thanks for the reply. I am afraid this sounds a bit too technical for me. Do you know how the whole command would look like using this bash shell hack? C.

ADD REPLY
4
Entering edit mode

Suppose STAR was not supporting the gzipped file (reads.fastq.gz), then you would have run STAR like this: STAR --genomeDir output/spiking/index/star --readFilesIn <(gunzip -c reads.fastq.gz) --outFileNamePrefix outputFolder --runThreadN 8 > message.txt . Essentially, you need to put the zipped-file with the unzipping commands inside <()

The same mechanism for any other program which doesn't support zipped file natively.

ADD REPLY
0
Entering edit mode

Thanks, I didn't know about this!

ADD REPLY

Login before adding your answer.

Traffic: 1558 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6