BamTobw bedGraphToBigWig: command not found
0
0
Entering edit mode
8.5 years ago

Hi, I was trying to use bamTobw to convert bam to bigwig file. The bash file had an issue when trying to convert bedgraph into bigwig (first, bash file converts bam into bedGraph, then converted bedGraph into bw files.

...
Convert DP_Jun_trimmed.sorted.bedgraph to DP_Jun_trimmed.sorted.bw
bedGraphToBigWig DP_Jun_trimmed.sorted.bedgraph chrom_sizes.tmp DP_Jun_trimmed.sorted.bw
~/Tool/bamTobw.sh: line 61: bedGraphToBigWig: command not found
...

it seemed that the command bedGraphToBigWig was missing. and I found this command belongs to "UCSC utilities" mentioned in the requirement of bamTobw. so I downloaded from the web, put it in the same directory with bamtobw.sh file make it executable:

chmod +x bedGraphToBigWig

set the PATH of bedGraphToBigWig

PATH=$PATH:$HOME/Tool/bedGraphToBigWig:$PATH

source the .bash_profile still I had the same issue.

Does anyone has any idea what went wrong? Thanks!

software error alignment • 5.5k views
ADD COMMENT
1
Entering edit mode

You could just use bamCoverage from deepTools, it's rather more heavily used and therefore a bit more likely to work.

ADD REPLY
0
Entering edit mode

@Devon Ryan, Thanks! I tried to tweak the code clumsily, but it seems that it did not work out.

function bedgraph_to_bw {
    local bedgraph_file=$1.bedgraph
    local name=$1.bw
    local chrom_sizes=$2
    echo "Convert $bedgraph_file to $name" | tee -a bamTobw.log
    echo "bedGraphToBigWig $bedgraph_file $chrom_sizes $name" | tee -a bamTobw.log
    bedGraphToBigWig $bedgraph_file $chrom_sizes $name
}


function bedgraph_to_bw {
    local bedgraph_file=$1.bedgraph
    local name=$1.bw
    local chrom_sizes=$2
    echo "Convert $bedgraph_file to $name" | tee -a bamTobw.log
    echo "bamCoverage $bedgraph_file $name" | tee -a bamTobw.log
    bamCoverage $bedgraph_file $name
}

I guess I could just use bamCoverage as command to convert the file one by one. but if could you please kindly let me know if minor tweaks could be made in order for the bamTobw.sh to work?

ADD REPLY
0
Entering edit mode

I'd never even heard of bamTobw before you posted it, so I can't comment on what might need to be tweaked.

ADD REPLY
0
Entering edit mode

@Devon Ryan. Thanks for you editing and patient reply! I think I am fine with using bamCoverage as command line at this moment.

ADD REPLY
0
Entering edit mode

@Devon Ryan. I just realized that bamCoverage could DIRECTLLY convert bam into bw. Thanks!

ADD REPLY
0
Entering edit mode

I too never head of it. the pipeline I heard about bigwig generation from bam files involving bedGraphToBigWig involves bedgraph generation with bedtools:

bedtools genomecov -bga -ibam file.bam > file.bedgraph
bedGraphToBigWig file.bedgraph file.bigwig
ADD REPLY

Login before adding your answer.

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