Body: <p>i try to implement LIMMA for paired samples in order to compare gene expression before/after treatment. But...i'm not confident in my results since every single gene expression seems to be significantly associeted with the treatment!</p>
  <p>Here is my methodology:</p>
  <p><code>mat&lt;-t(df)</code></p>
  <p>where df is a dataframe with:
  -1000 columns for different gene expression
  -+ 1 column 'id' (10 different id, repeated 2 times)
  -+ 1 column 'ttt' (0=before, 1=after treatment)
  -20 rows of observations (10 patients observed twice)</p>
  <p>So once I get my matrix:</p>
  <p><code>subject_id&lt;-df$id</code> A vector with 10 different id repeated 2 times</p>
  <p><code>ttt&lt;-as.factor(df$ttt)</code> A vector with the treatment status (before/after)</p>
  <p>Here is my design matrix:</p>
  <p><code>design&lt;-model.matrix(~ 0+ttt)</code></p>
  <p><code>colnames(design) &lt;- levels(ttt)</code></p>
  <p>As asked in limma() description i specify the correlations:</p>
  <p><code>corfit &lt;- duplicateCorrelation(mat,design,block=subject_id)</code></p>
  <p>Fiting of the model:</p>
  <p><code>fit&lt;-lmFit(mat,design,block =subject_id,correlation = corfit$consensus)</code></p>
  <p><code>fit2&lt;-eBayes(fit)</code></p>
  <p>Getting adjusted pvalues for every gene comparison before/after treatment:</p>
  <p><code>topTable(fit2, adjust.method='BH',number=1000)</code></p>
  <p>But every single gene expression seems to be relevant, so i'm very doubtful about my methodology
  Any idea?
  Many thanks!</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-12-04T22:56:40.447Z
Comments.Text: what do you actually have, RNAseq or microarray data? I suspect you have RNAseq data and you need to normalize it
Comments.UserDisplayName: StupidWolf
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-12-05T18:28:01.750Z
Comments.Text: Hello, thank you for your response. I have transcriptomic responses, with logarithmic transformation (one value per gene expression).
Comments.UserDisplayName: Gwénolé
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-12-06T02:13:45.053Z
Comments.Text: What u have above should be ok. Just note that for the last step u are testing all coefficients to be zero. Not sure if that is what u want
Comments.UserDisplayName: StupidWolf
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-12-06T02:15:04.043Z
Comments.Text: But if you specify treatment and groups correctly. It should be ok. Without more info, hard to tell
Comments.UserDisplayName: StupidWolf
Tags: <gene-expression><limma>
Title: Troubles implementing LIMMA for paired samples (before/after treatment) comparaisons
ThreadText: # Troubles implementing LIMMA for paired samples (before/after treatment) comparaisons
  
  (Asked by: username_0 on 2020-12-03)
  
  i try to implement LIMMA for paired samples in order to compare gene expression before/after treatment. But...i'm not confident in my results since every single gene expression seems to be significantly associeted with the treatment!
  
  Here is my methodology:
  
  `mat<-t(df)`
  
  where df is a dataframe with:
  -1000 columns for different gene expression
  -+ 1 column 'id' (10 different id, repeated 2 times)
  -+ 1 column 'ttt' (0=before, 1=after treatment)
  -20 rows of observations (10 patients observed twice)
  
  So once I get my matrix:
  
  `subject_id<-df$id` A vector with 10 different id repeated 2 times
  
  `ttt<-as.factor(df$ttt)` A vector with the treatment status (before/after)
  
  Here is my design matrix:
  
  `design<-model.matrix(~ 0+ttt)`
  
  `colnames(design) <- levels(ttt)`
  
  As asked in limma() description i specify the correlations:
  
  `corfit <- duplicateCorrelation(mat,design,block=subject_id)`
  
  Fiting of the model:
  
  `fit<-lmFit(mat,design,block =subject_id,correlation = corfit$consensus)`
  
  `fit2<-eBayes(fit)`
  
  Getting adjusted pvalues for every gene comparison before/after treatment:
  
  `topTable(fit2, adjust.method='BH',number=1000)`
  
  But every single gene expression seems to be relevant, so i'm very doubtful about my methodology
  Any idea?
  Many thanks!
  
  **Tags:** gene-expression, limma
  
  > **Comments:**
  > **username_1**: what do you actually have, RNAseq or microarray data? I suspect you have RNAseq data and you need to normalize it  
  > **username_0**: Hello, thank you for your response. I have transcriptomic responses, with logarithmic transformation (one value per gene expression).  
  > **username_1**: What u have above should be ok. Just note that for the last step u are testing all coefficients to be zero. Not sure if that is what u want  
  > **username_1**: But if you specify treatment and groups correctly. It should be ok. Without more info, hard to tell  
  
  ---
  
  ## 0 answers
  
  