This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Redirecting the output of a command related to another command

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

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

1 answer

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.

Log in to answer this question.