sdparekh / zUMIs

zUMIs: A fast and flexible pipeline to process RNA sequencing data with UMIs
GNU General Public License v3.0
271 stars 67 forks source link

Update zUMIs.sh #285

Closed xaviml closed 2 years ago

xaviml commented 2 years ago

This is a small optimization suggestion. There is no need to use cat to pipe head since head can read the file and stop when reaching the number of lines.

I tested this with a 24GB file, and this are the results:

$ time head -n 4000000 file.fastq > tmp.fastq
real    0m0.388s
user    0m0.252s
sys 0m0.136s
$ time cat file.fastq | head -n 4000000 > tmp2.fastq
real    0m0.426s
user    0m0.240s
sys 0m0.361s
$ diff tmp.fastq tmp2.fastq

At the same time this avoids using pipe and throwing a cat: write error: Broken pipe error.

cziegenhain commented 2 years ago

Thanks.