Question: Limma making contrasts
0
gravatar for matina
14 months ago by
matina0
matina0 wrote:

Hi,

I have data from 3 different conditions (normal, breast cancer, endometrial cancer) and different cell types (cd163_positive or negative) for each condition. I am interested in differentially expressed genes between conditions (e.g Breast_cancer vs Endometrial_cancer) but also between cell populations within the same condition but also across conditions (e.g Breast_cancercd163_positive-Breast_cancercd163_negative). Below is the pheno table and the code for making the contrasts. 

  1.  I am not sure how to make the (simple) contrasts :  Breast_cancer vs Endometrial_cancer , Breast_cancer vs Normal, Endometrial_cancer vs Normal using the model below.
  2.  Is the model below correct for the population comparisons ?

pData

Condition Population
Normal cd163_positive
Normal cd163_negative
Normal cd163_positive
Normal cd163_negative
Normal cd163_positive
Normal cd163_negative
Normal cd163_positive
Normal cd163_negative
Normal cd163_positive
Normal cd163_negative
Breast_cancer cd163_positive
Breast_cancer cd163_negative
Breast_cancer cd163_positive
Breast_cancer cd163_negative
Breast_cancer cd163_positive
Breast_cancer cd163_positive
Breast_cancer cd163_negative
Breast_cancer cd163_positive
Breast_cancer cd163_negative
Endometrial_cancer cd163_positive
Endometrial_cancer cd163_negative
Endometrial_cancer cd163_positive
Endometrial_cancer cd163_negative
Endometrial_cancer cd163_positive
Endometrial_cancer cd163_negative
Endometrial_cancer cd163_positive
Endometrial_cancer cd163_negative
Endometrial_cancer cd163_positive
Endometrial_cancer cd163_negative
f <- paste(pData$Condition,pData$:Population,sep="")
f <- factor(f)
design <- model.matrix(~0+f)
colnames(design) <- levels(f)
> colnames(design)
[1] "Breast_cancercd163_negative"      "Breast_cancercd163_positive"      "Endometrial_cancercd163_negative" "Endometrial_cancercd163_positive"
[5] "Normalcd163_negative"             "Normalcd163_positive"   


cont.matrix = makeContrasts(
  BRC_posVsBRC_neg = Breast_cancercd163_positive-Breast_cancercd163_negative, 
  Norm_posVsNorm_neg = Normalcd163_positive-Normalcd163_negative,            
  END_posVsEND_neg = Endometrial_cancercd163_positive-Endometrial_cancercd163_negative, 
  BRC_posVsNorm_pos = Breast_cancercd163_positive-Normalcd163_positive,       
  BRC_posVsEND_pos = Breast_cancercd163_positive-Endometrial_cancercd163_positive, 
  END_posVsNorm_pos  = Endometrial_cancercd163_positive-Normalcd163_positive,     
  BRC_negVsNorm_neg  = Breast_cancercd163_negative-Normalcd163_negative, 
  BRC_negVsEND_neg = Breast_cancercd163_negative-Endometrial_cancercd163_negative, 
  END_negVsNorm_neg = Endometrial_cancercd163_negative-Normalcd163_negative, 
  levels=design)

v=voomWithQualityWeights(d, design = design,plot = TRUE)
vfit <- lmFit(v, design)
vfit <- contrasts.fit(vfit, contrasts=cont.matrix)
efit <- eBayes(vfit)

 

I know this is fairly simple but I am a bit confused.  Thank you very much!

Matina

ADD COMMENTlink modified 14 months ago • written 14 months ago by matina0
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 16.09
Traffic: 318 users visited in the last hour