How to save BamUtil stats result as text file
1
0
Entering edit mode
5.6 years ago
ttsutsui1028 ▴ 20

Dear all,

I am in trouble to export BamUtil stats result as text file. Could anyone suggest me to solve this problem?

I have tried following

Path/to/bamutil stats --basic --in my.bam > stats.txt
Path/to/bamutil stats --basic --in my.bam | echo > stats.txt

Both couldn't write statistics in text file.

Thank you for your answer,

BamUtil • 1.9k views
ADD COMMENT
0
Entering edit mode

Both couldn't write statistics in text file.

What happens then? Please be as informative as possible since we cannot see what happens on your screen.

ADD REPLY
0
Entering edit mode

Even I have experienced the same problem but then you can always use 'nohup' to get output appended in 'nohup.out'.

i.e you can use below command:

nohup Path/to/bamutil stats --basic --in my.bam

And you can find the stats written in nohup.out file

ADD REPLY
0
Entering edit mode

try @ ttsutsui1028 :

$ bamutil/bam stats --basic --in my.bam |& tee >stats.txt

or

$ bamutil/bam stats --basic --in my.bam 2>&1| tee >stats.txt
ADD REPLY
3
Entering edit mode
5.6 years ago
h.mon 35k

bamUtil redirects --stats (also --phred and --qual) to sdterr, not to stdout. So if you want to redirect those stats to a file, you have to redirect stderr with 2>stats.txt:

bam stats --basic --in my.bam 2>stats.txt
ADD COMMENT
0
Entering edit mode

I would say , learn and understand the difference between stderr and stdout. Check out this link and never get messed up

https://www.jstorimer.com/blogs/workingwithcode/7766119-when-to-use-stderr-instead-of-stdout

ADD REPLY

Login before adding your answer.

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