Question: "mask" values in a bedgraph
0
Entering edit mode

I am trying to plot average conservation in a list of genomic features, and so far managed to do it successfully using a combination of the phastCons bigwig files (hg19.100way.phastCons.bw) and deepTools. However, as extra step, I want to re-do my analysis but this time by removing, or masking, the conservation values in the exons.

My first step, and the easiest, was to remove all features that overlap with exons, using bedtools intersect. This worked, bit seems like a crude way of doing it. So I am now trying to convert all phastCons values in exons to zero.

The question is: how to do it? Consider that I want a nice bigwig at end to input to deepTools. Initially I converted the phastCons bigwig to bedgrap, because it thought map from bedtools would work. It did not, so I am a bit out of ideas now.

2
Entering edit mode
  1. Load the bigWig into R (see the import() function in rtracklayer).
  2. Load annotation GFF/GTF into R (see above).
  3. Use findOverlaps() to find which rows in your bedGraph overlap a feature (just prefilter the file) in the annotation file.
  4. Set the score of those features to 0.
  5. Export the results back as a bigWig file.

BTW, I'm interpreting your "I am not trying" as "I am now trying", since there's actually no way to mask values in these formats other than simply removing the associated positions.

ADD COMMENTlink 5.6 years ago Devon Ryan 90k
Entering edit mode
0

"I am now trying" is indeed correct :) I will edit the question. Thanks for the help.

ADD REPLYlink 5.6 years ago
A. Domingues
♦ 2.1k

Login before adding your answer.

Powered by the version 1.8