Question: How to save BamUtil stats result as text file
0
gravatar for ttsutsui1028
23 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 • 612 views
ADD COMMENTlink modified 23 months ago by h.mon31k • written 23 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 23 months ago by WouterDeCoster44k

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 23 months ago by toralmanvar900

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 23 months ago • written 23 months ago by cpad011214k
3
gravatar for h.mon
23 months ago by
h.mon31k
Brazil
h.mon31k 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 23 months ago by h.mon31k

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 23 months ago by lakhujanivijay5.2k
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: 930 users visited in the last hour