Are there any options for converting bedGraph files to bigwig?
I have a multi-step pipe that takes a bam file, does several operations in a pipe, and currently outputs a bedGraph file. The only option I know of to get from a bed/bedGraph is to UCSC's bedGraphToBigWig
However, this is not compatible with piping so I currently have to save large bedGraph files just to convert them to bigwig in the next step.
Does anyone know how a command that can take bed/bedGraph files and convert to bigwig that also functions in a pipe?
Note: the awk command is simplified for the example, but the steps done are necessary for my purposes so I can't simply go from bam to bigwig.
bedtools bamtobed -i "myfile.bam" \
| awk ' { PRINT } ' \
| bedtools sort -g mygenome.fa.fai \
| bedtools genomecov -i stdin -bg -g mygenome.fa.fai > "myfile.bedGraph"
bedGraphToBigWig myfile.bedGraph chrom.sizes myfile.bigwig
Not sure but I think you can use the keyWord 'stdin' instead of a filename.
I found a post saying that STDIN cannot me used with bedGraphToBigWig, and I got errors when attempting to pipe into it.
The awk is useless
I mentioned in my post that the awk command is simplified for the example. I only wanted to show that I am using awk to modify a bed file to illustrate that I cannot simply convert bam to bigwig.