Question: Differential Methylation Analysis using continuous outcome
0
gravatar for daniellemo
4 weeks ago by
daniellemo0
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(**?????**,
                       levels=design)
fit2 <- contrasts.fit(fit, contMatrix)
fit2 <- eBayes(fit2)
summary(decideTests(fit2))
ann450kSub <- ann450k[match(rownames(mVals),ann450k$Name),
                  c(1:4,12:19,24:ncol(ann450k))]
DMPs <- topTable(fit2, coef=NULL, adjust.method="fdr", p.value=0.05, genelist=ann450kSub)

Thank you in advance.

ADD COMMENTlink modified 28 days ago by Charles Warden6.1k • written 4 weeks ago by daniellemo0
2
gravatar for Kevin Blighe
4 weeks ago by
Kevin Blighe37k
Republic of Ireland
Kevin Blighe37k 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')

c(stats::symnum(input,
  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

Kevin

ADD COMMENTlink modified 4 weeks ago • written 4 weeks ago by Kevin Blighe37k
1
gravatar for Charles Warden
28 days ago by
Charles Warden6.1k
Duarte, CA
Charles Warden6.1k 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 COHCAP.site() and COHCAP.avg.by.island() 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 COHCAP.site() function, but the smaller functions used various analyses are towards the top: https://github.com/cwarden45/COHCAP/blob/master/R/COHCAP.site.R

ADD COMMENTlink modified 28 days ago • written 28 days ago by Charles Warden6.1k
Please log in to add an answer.

Help
Access

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