Question: How to save BamUtil stats result as text file
0
gravatar for ttsutsui1028
6 months ago by
ttsutsui102820
ttsutsui102820 wrote:

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 • 241 views
ADD COMMENTlink modified 6 months ago by h.mon24k • written 6 months ago by ttsutsui102820

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 REPLYlink written 6 months ago by WouterDeCoster38k

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 REPLYlink written 6 months ago by toralmanvar750

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 REPLYlink modified 6 months ago • written 6 months ago by cpad011211k
3
gravatar for h.mon
6 months ago by
h.mon24k
Brazil
h.mon24k wrote:

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 COMMENTlink written 6 months ago by h.mon24k

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 REPLYlink written 6 months ago by Vijay Lakhujani4.0k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 764 users visited in the last hour