How to convert 0 based genomic ranges found in CEEHRC bedgraph files into 1 based genomic ranges used in R?
0
0
Entering edit mode
@helimelanie-15780
Last seen 6.0 years ago

​Hi,

I am using WGBS methylation data from CEEHRC project through DeppBlueR package and visualise it using Gviz. First track is a HM450 probes. Second track is obviously the bases sequence of the genome. Third track is WGBS . 

When plotting these data at high resolution I can see that the methylation data are 1 base left of where it should be (aligned with GC instead of the following CG), as I understand the data and as I can see in UCSC genome browser:

 

I guess that this is because bedgraph data uses 0 based genomic coordinates while R uses 1 based ranges. 

Can I convert CEEHRC 0 based into 1 based coordinates easily so the data align properly to the genome?

Thanks

Mel

PS: I also know that my HM450 probe should also align with only one base... work in progress...  

 

 

library(Gviz)
library(DeepBlueR)
library(FDb.InfiniumMethylation.hg19)
library(BSgenome.Hsapiens.UCSC.hg19)

# HM450 methylation assay probes from FDb.InfiniumMethylation.hg19 package
hm450 <- get450k() 
probenames <- "cg23699648"
probes <- hm450[probenames]
HM450 <- AnnotationTrack(probes,
                         chromosome = "chr6", genome = "hg19", name = "HM450",
                         strand = c("*"),
                         id = 1, cex.title = 0.5, min.width = 2, fill = "darkblue", col = NULL, rotation.title = 0, 
                         fontcolor.feature = "darkblue", background.title="darkgrey")

# WGBS (Methylation) for Breast Luminal progenitors from CEEHRC project track with DeepBlueR package
query_id <- deepblue_select_experiments(
  experiment_name= c("A34409.3_lanes_dupsFlagged.q5.f0.5mC.CpG.fractional.bedgraph"),
  chromosome="chr6", 
  start=121756532, 
  end=121756593
)
request_id <- deepblue_get_regions(query_id=query_id, 
                                   output_format="CHROMOSOME,START,END,VALUE,@BIOSOURCE,@SAMPLE_ID,@NAME,@PROJECT")
regions <-  deepblue_download_request_data(request_id=request_id)
genome(regions) <- "hg19"
regions@elementMetadata[["@CELL_TYPE"]] <-  t(samples[match(regions@elementMetadata[,"@SAMPLE_ID"], samples[[1]]),"cell_type"])
df <- data.frame(iranges = regions)
MethylationProg <- DataTrack(regions, name = "Prog", 
                             genome="hg19", type = "h",  ylim = c(0,100), background.title = "darkgray", cex.title = 0.5, cex.axis = 0.5, col = "#c49d60", lwd.title = 1)

# strack from BSgenome.Hsapiens.UCSC.hg19 package
strack <- SequenceTrack(Hsapiens, chromosome = "chr6", cex = 0.5)

# Plot the track with Gviz package
plotTracks(list(HM450, strack, MethylationProg),
           from = 121756532, to = 121756593, 
           main = "Probe 3", cex.main = 0.9)

 

 

deepbluer gziv • 878 views
ADD COMMENT
0
Entering edit mode

Hi Melanie,

A workaround could be to use the shift function of IRanges, i.e. shift(regions, 1)

Does this help? In any case it would be nice if you could add a bug report to our github page: https://github.com/MPIIComputationalEpigenetics/DeepBlueR/issues 

Best,

Markus

 

 

 

ADD REPLY
0
Entering edit mode

Hi,

Thanks, for the easy workaround! 

I reported the bug. Here it is:

https://github.com/MPIIComputationalEpigenetics/DeepBlueR/issues/46

Thanks again

Mel

 

 

ADD REPLY

Login before adding your answer.

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