Plotting DMRs (Differentially Methylated Regions) using Gviz package in R
0
0
Entering edit mode
4.8 years ago
sinha.puja ▴ 20

Hi All,

I have a file list consisting of Chromosome, Start , End & Methylation Difference in the following format in excel:

Chrom  Start                End                  Meth. Diff
chr1    38565900    38566000    -0.20276818
chr1    38870400    38870500    -0.342342342
chr1    39469400    39469500    -0.250260552
chr1    52013600    52013700    -0.37797619
chr1    52751700    52751800    0.257575758
chr1    75505100    75505200    -0.262847308

I need help in plotting the DMRs using Gviz package in R. I tried a code below but it doesn't turn out correct.

library(Gviz)
library(GenomicRanges)
library(BSgenome)
library(Biostrings)
library(XVector)
library(readxl)
library(BSgenome.Rnorvegicus.UCSC.rn6)
genome <- getBSgenome("BSgenome.Rnorvegicus.UCSC.rn6") 
genome
data1 <- read_excel("DMRs_plots.xlsx")
library(rtracklayer)
track1 <- DataTrack(data = data1, from = "38565900" , to = "75505200", chromosome = Chrom$chr1, name = "DMRs")
plotTracks(track1)

If anyone know how to plot and correct my code including how to add methylation difference values, then that will be of great help.

Thanks.

R gviz • 1.6k views
ADD COMMENT
0
Entering edit mode

Please save your data in plain text format (csv/tsv). Excel does not play well with bioinformatics and has a lot of room for errors that are invisible to the untrained eye.

A few quick questions:

  1. Did you look at the data1 object to ensure it looks accurate?
  2. How are you connecting the genome object to the track you're plotting?
  3. Do you need to load all those packages via library calls? You're only using Gviz, readxl and BSgenome.
ADD REPLY
0
Entering edit mode

Thanks for your suggestion, I will save my data in .csv format. Reply for quick questions as follows:

  1. When I did head (data1), it looks fine to me.
  2. I don't know how to connect that part, may be that was missing while plotting.
  3. Yes, when I try to load Gviz and BS genome, it was asking for all those.

Thanks.

ADD REPLY
0
Entering edit mode

when I try to load Gviz and BS genome, it was asking for all those.

It should automatically load required packages. I'm not sure why or how "it's asking" for those

ADD REPLY
0
Entering edit mode

I think you can save a copy of your data as bedgraph and use it as a datatrack, so there will be a plot under your chromosome track. If you search bedgraph in the following link you can see an example:

https://www.bioconductor.org/packages/devel/bioc/vignettes/Gviz/inst/doc/Gviz.html#8_bioconductor_integration_and_file_support

If you'd like to use a function that processes Grange object you can use this script:
https://rdrr.io/github/davetang/bedr/src/R/bed_to_granges.R

ADD REPLY

Login before adding your answer.

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