I have paired samples from cancer patients who were obese or not obese (labelled 'healthy'). Using 3.5 in edgeR to compare within and between samples.
I am able to compare within a condition i.e. comparing tumour to control in healthy patients or comparing tumour to control in obese patients. I am running into an error where I can't compare between healthy and obese samples.
I am trying to find 3 things:
- DE genes in healthy individuals
- DE genes in obese individuals
- DE genes between healthy and obese individuals
Sample of my edgeR code, I reduced the number of samples for readability.
type <- as.factor(c('benign', 'tumour', 'benign', 'tumour','benign', 'tumour','benign', 'tumour')) y$samples$type <- type patient <- factor(c(1,1,2,2,3,3,4,4)) y$samples$patient <- patient condition <- as.factor(c('healthy','healthy','healthy','healthy', 'obese', 'obese','obese', 'obese')) y$samples$condition <- condition design <- model.matrix(~0+patient) rownames(design) <- colnames(y) Healthy.Tumour <- condition=="healthy" & type=="tumour" Obese.Tumour <- condition=="obese" & type=="tumour" design <- cbind(design, Healthy.Tumour, Obese.Tumour) keep <- filterByExpr(y, design) y <- y[keep,] table(keep) y <- calcNormFactors(y, method = "TMM") y <- estimateDisp(y,design) fit <- glmQLFit(y,design) qlf_H <- glmQLFTest(fit, coef="Healthy.Tumour") qlf_O <- glmQLFTest(fit, coef="Obese.Tumour") qlf_O_vs_L <- glmQLFit(fit, contrast=c(0,0,0,0,-1,1))
This is the error code I get when running
qlf_O_vs_L <- glmQLFit(fit, contrast=c(0,0,0,0,-1,1)).
Error in dimnames(x$coefficients) <- value : attempt to set an attribute on NULL
I am following the vignette, and I can see that there is no x$coefficients and I don't know how to get that attribute. In the vignette it references a
target dataframe and this may be the issue.
There is a
$coefficients which sits in
fit$coefficients, however adding that (as with below) it doesn't work.
qlf_O_vs_L <- glmQLFit(fit$coefficients, contrast=c(0,0,0,0,-1,1))