Good morning
I have a question regarding the function removeBatchEffect
from limma
package.
This is my experimental design
ID Patient Metastasis
S1 A NO
S2 A YES
S3 B NO
S4 B YES
S5 C NO
S6 C YES
S7 D NO
S8 D YES
S9 E NO
S10 E YES
From the same patient we have tumor tissue and metastatic tissue samples.
I have a vst
transformed gene expression matrix from which I would like to regress out the Patient
effect.
I have already obtained DEG with DESEq2
using the formula
dds <- DESeqDataSetFromTximport(txi_rsem, colData, ~ Patient + Metastasis)
Now I need the "batch effect removed" matrix for downstream analysis, but when I am doing
mydesign <- model.matrix(~ Patient + Metastasis, data = colData)
vstmatnoBatch <- limma::removeBatchEffect(vstmatBatch, batch = colData$Patient, design = mydesign)
Then I get
Coefficients not estimable: batch1 batch2 batch3 batch4 Warning message: Partial NA coefficients for 32653 probe(s)
I do not understand why I am getting it.
Then searching in the Bioc support site I found this https://support.bioconductor.org/p/76837/ and saw that in the design matrix the batch factor was not included. So I tried to do the same
mydesign <- model.matrix(~ Metastasis, data = colData)
vstmatnoBatch <- limma::removeBatchEffect(vstmatBatch, batch = colData$Patient, design = mydesign)
And obtained no warnings/errors and wonderful results. Do not know what is going on here. Thanks
Yes I read the help of the function but it does not help with my problem. In the Examples of the function the
design
argument is not included, but in thedesign
argument description it saysThat is why I have included at the first try, but with no success. Then I found other threads where the
design
matrix is not included or it does not include thebatch
effect. In particular I do not understand the latter case.So your first try was this:
Where your design matrix includes the batch effect you want to remove. And the help page specifically says the design matrix shouldn't include the batch effect.
And when you did what the help page indicates you should do, it worked. So which part of that do you not understand?
You are right, my poor command of english and hours in front of the computer let me interpret the expression "other than" with an italian "oltre a" that means roughly "together with". Thanks for the help, you can close the thread.
Ah, makes sense. Being a native English speaker, I use the English version of R. Way back in the day Brian Ripley did a bunch of work to make R multi-lingual. Is the Italian version not good? I sort of assumed, given BDR's track record, that the multi-lingual versions would be good, and that a native Italian speaker would tend to use the Italian language version.
I use R in Portuguese but my OS in Spanish. Eventually, all words transcend any particular language and are interpreted equally. It's interesting observing how the brain adapts to a new language.
Or not, in my case. Approximately 99% of my junior high Spanish has successfully fled my brain.
I have generated an R philology/etimology/psychology discussion =)