Hi everybody,
I've been banging my head against the wall for a few hours and finally decided to ask for some help here. What I need to do is relatively straight-forward:
I have a number of bigWig files, which were generated by deepTools and belong to two experiments groups, that I would like to plot using Gviz (Bioconductor).
In order to properly use the grouping feature of Gviz, it seems that I need a single GRanges object for each group with a column for each replicate. Since the intervals in the different samples/replicates are different, they can't simply be merged, or at least I haven't figured out how to do it.
I tried to make a very simple example with two GRanges objects:
df_1 <- data.frame(
chr = 'chr1',
start = c(1,200),
end = c(100,300),
strand = '*',
score = c(10,5)
)
gr_1 <- makeGRangesFromDataFrame(df_1, keep.extra.columns = TRUE)
# GRanges object with 2 ranges and 1 metadata column:
# seqnames ranges strand | score
# <Rle> <IRanges> <Rle> | <numeric>
# [1] chr1 1-100 * | 10
# [2] chr1 200-300 * | 5
# -------
# seqinfo: 1 sequence from an unspecified genome; no seqlengths
df_2 <- data.frame(
chr = 'chr1',
start = c(50,150),
end = c(150,250),
strand = '*',
score = c(2,4)
)
gr_2 <- makeGRangesFromDataFrame(df_2, keep.extra.columns = TRUE)
# GRanges object with 2 ranges and 1 metadata column:
# seqnames ranges strand | score
# <Rle> <IRanges> <Rle> | <numeric>
# [1] chr1 50-150 * | 2
# [2] chr1 150-250 * | 4
# -------
# seqinfo: 1 sequence from an unspecified genome; no seqlengths
The output I would like to have is this:
chr start end score_1 score_2
chr1 1 50 10 0
chr1 50 100 10 2
chr1 100 150 0 2
chr1 150 200 0 4
chr1 200 250 5 4
chr1 250 300 5 0
In words, it is the minimum number of rows that still correctly reflects the "score" for both samples.
Is there a way to do this?
I would appreciate any kind of help or suggestions.
Best, Roman
Thanks for the suggestion, I'll look into that in a bit more detail tomorrow. Perhaps I should mention, however, that I'll be working on at least 16 profiles (in groups of 4), and ideally 108 profiles in total. It's no problem at all to plot them as separate tracks (actually I'm impressed by how fast it's done), but I can't figure out how to group them together. I'll should probably also reach out to the Gviz developer(s) directly to see if they have any suggestion.