Redirecting the output of a command related to another command
1
0
Entering edit mode
13 months ago

I want to get a .txt file showing the computer's performance of gtime command related to another command: bwa mem. Bwa is a genome aligner tool. Below the code I've used:

 { gtime -v bwa mem -t 4 -R @RG\tID:$FQ\tSM:$FQ\tPL:ILLUMINA\tLB:$FQ -o 03.align/$FQ.align.sam $REF 02.trim/$FQ.R1.trim.fq.gz 02.trim/$FQ.R2.trim.fq.gz ; } > 03.align/$FQ.BWA_MEM.txt

I rightly get the sam file (18 GBytes) but an empty txt file; I'm sure there is a syntax error. I've tried without curly brackets or to change the position of txt file output but the same results.

Some suggestions?

Thanks in advance,
FS

unix time • 639 views
ADD COMMENT
1
Entering edit mode

I think that's off-topic here, see https://stackoverflow.com/questions/13356628/how-to-redirect-the-output-of-the-time-command-to-a-file-in-linux and man time. I assume you refer of time and use a macOS so it becomes gtime.

ADD REPLY
0
Entering edit mode

I think when someone is running a bioinformatics command, and the answer is very simple is more productive to answer this question even though technically it may be a UNIX "topic"- it is simpler and more friendly - timing commands are commonly used bioinformatics task after all - we may all learn something more when people try to answer here

ADD REPLY
0
Entering edit mode

Thanks for the suggestion.

ADD REPLY
0
Entering edit mode
13 months ago

The original answer may be that you need to redirect to the standard error with 2> rather than just >

But

I have been running lots of timing commands with gtime recently and I found that using the -o flag is a much better way to get what I want.

gtime -o logfile.txt yourcommandhere

Then you don't have to putter around with neither redirect nor curly braces.

ADD COMMENT

Login before adding your answer.

Traffic: 2465 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