BedGraph to bigwig inside Pipe?
1
0
Entering edit mode
8 months ago
vanbelj ▴ 40

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
bigwig bedGraph pipe • 877 views
ADD COMMENT
0
Entering edit mode

Not sure but I think you can use the keyWord 'stdin' instead of a filename.

ADD REPLY
0
Entering edit mode

I found a post saying that STDIN cannot me used with bedGraphToBigWig, and I got errors when attempting to pipe into it.

ADD REPLY
0
Entering edit mode

The awk is useless

ADD REPLY
0
Entering edit mode

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.

ADD REPLY
3
Entering edit mode
8 months ago
LChart 3.9k

bedgraphToBigWig performs seek operations on the input file -- so the file must be stored on disk. Nothing you can do with pipes or fifos will get around the fact that these filetypes don't support .seek and will lead to the same error.

If there's some obscure pipe that implements .seek that i don't know about -- use that.

ADD COMMENT

Login before adding your answer.

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