Question: Differential Methylation Analysis using continuous outcome
gravatar for daniellemo
22 months ago by
Queen's University
daniellemo0 wrote:

Hi there,

I am trying to do a differential methylation analysis of probes in R using "days to death" as my clinical factor. I have values ranging from 9 to 3258 days and need to make contrasts between these values, but there are too many values to do this manually. Is there a automatic way to contrast a wide range of continuous values? If not, can I specify ranges (i.e. 0-500, 501-1000 days, etc.) and input this into the "makecontrasts" function (not sure how to go about doing this). Below is the code I am using.

outcome <- factor(targets$days_to_death)
design <- model.matrix(~0+outcome, data=targets)
colnames(design) <- c(levels(outcome))
fit <- lmFit(MVals_d2d, design)
contMatrix <- makeContrasts(**?????**,
fit2 <-, contMatrix)
fit2 <- eBayes(fit2)
ann450kSub <- ann450k[match(rownames(mVals),ann450k$Name),
DMPs <- topTable(fit2, coef=NULL, adjust.method="fdr", p.value=0.05, genelist=ann450kSub)

Thank you in advance.

ADD COMMENTlink modified 22 months ago by Charles Warden7.9k • written 22 months ago by daniellemo0
gravatar for Kevin Blighe
22 months ago by
Kevin Blighe67k
Republic of Ireland
Kevin Blighe67k wrote:

You could encode targets$days_to_death as a categorical variable with 500 (0-500), 1000 (501-1000), 1500 (1001-1500), et cetera, and then your contrasts would be, for example:

makeContrasts(1000-500, levels=design)
makeContrasts(1500-500, levels=design)
*et cetera*

If you need help to categorise your targets$days_to_death, then use symnum() (stats):

input <- c(0,1,2,3,4,5,6,7,8,9,10)
cuts <- c(0, 2.5, 5, 7.5, 10)
encoding <- c('<=2.5', '<=5', '<=7.5', '<=10')

  corr = FALSE,
  na = FALSE,
  cutpoints = cuts,
  symbols = encoding))

 [1] <=2.5 <=2.5 <=2.5 <=5   <=5   <=5   <=7.5 <=7.5 <=10  <=10  <=10


ADD COMMENTlink modified 22 months ago • written 22 months ago by Kevin Blighe67k
gravatar for Charles Warden
22 months ago by
Charles Warden7.9k
Duarte, CA
Charles Warden7.9k wrote:

It looks like you are fairly familiar with R, which is great!

If you already have a solution, I wouldn't worry too much about this answer.

If not, here are a couple pointers:

1) You can do continuous variable analysis in COHCAP (with the and functions) by setting ref="continuous"

The delta-beta (or delta percent methylation) threshold is a little tricker to define in this situation, but you can play around with the lower.cont.quantile and upper.cont.quantile values.

I think I've only tested it with one or two projects, but setting alt.pvalue = "RcppArmadillo.fastLmPure" should noticeably speed up the analysis.

2) Even if you don't use COHCAP directly, you can use the COHCAP code to see how this analysis is performed.

For example, the code is fairly long for the function, but the smaller functions used various analyses are towards the top:

ADD COMMENTlink modified 22 months ago • written 22 months ago by Charles Warden7.9k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2282 users visited in the last hour