Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update zUMIs.sh #285

Merged
merged 1 commit into from
Sep 18, 2021
Merged

Update zUMIs.sh #285

merged 1 commit into from
Sep 18, 2021

Conversation

xaviml
Copy link
Contributor

@xaviml xaviml commented Sep 9, 2021

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.

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.
@cziegenhain cziegenhain merged commit 3a786f8 into sdparekh:main Sep 18, 2021
@cziegenhain
Copy link
Collaborator

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants