Thanks Aaron for your great explanation. However, I need to know more how to define two matrix of Gene_Expression (A=before & B=after). this is not a variable "after" and "before" in the file. these are two GE matrix contain 1000 genes (Normalized_FPKM).
I wrote the following script for this analysis. as I said I want to find gene_expression digfferential for individuals who have hypertension and not-hypertension adjusted for GE profile before surgery and other covariates. Could you please have a look to the following script and correct it for this analyses or let me know how to correct it. Thank you!
library(limma)
GE_A=read.delim("GeneExpress_Before_Surgery_Normalized.txt", header=T,row.names=1)
GE_B=read.delim("GeneExpress_After_Surgery_Normalized.txt", header=T,row.names=1)
pheno=read.delim("clinicalDB.txt", header=T)
Hypertension=factor(pheno$Hypertension, levels=c("Yes","No"))
design=model.matrix(~age+sex+GE_A+Hypertension)
pheno=pheno[which(pheno$SampleID %in% names(GE_B)),]
cbind(as.data.frame(names(GE_B)), pheno$SampleID)
fit <- lmFit(GE_B,design)
fit.de <- eBayes(fit, robust=TRUE)
topTablefit.de, coef=ncol(design), n=Inf, sort.by="P")
You make the before/after variable yourself:
Your current design won't work because you're putting
GE_A
indesign
. limma requires that the same design matrix be used for all genes - this means that you can't use gene-specific expression as a covariate.