Problem with limma's topTable lfc filter when more than 1 contrast is output
1
0
Entering edit mode
@gordon-smyth
Last seen 1 hour ago
WEHI, Melbourne, Australia
Dear Vladimir, You are correct that topTable() has been ignoring the lfc argument when the ranking is by F-statistic, i.e., when ranking by several contrasts simultaneously. Alex is correct as to the reason for this -- it was just ambiguous what should be done. However the behaviour should have been explained more fully in the documentation. I now have committed an update to the topTable() function so that the lfc cutoff will now be applied to the minimum absolute logFC for the contrasts being tested when ranking by F-statistic. The behaviour is now analogous to decideTests(). Genes will be kept in the table if any contrast satisfies the cutoff. I committed this change to the developmental version of limma a few days ago. I committed the change to the official release version of limma just a few minutes ago, so it should be able for download from Bioconductor in a day or so. Normally decideTests() mimics the behavour of topTable() applied to individual contrasts. However you can recover the same genes that appear in an F-statistic topTable() ranking by using: result <- decideTests(fit, method="nestedF", ...) which.genes <- apply(result, 1, any) The effects of p-value and lfc cutoffs should now be the same in both topTable() and decideTests(). Best wishes Gordon > Date: Sat, 21 Jan 2012 04:52:10 +0000 > From: Vladimir Zhurov <vzhurov2 at="" uwo.ca=""> > To: <bioconductor at="" stat.math.ethz.ch=""> > Subject: Re: [BioC] Problem with limma's topTable lfc filter when more > than 1 contrast is in output > > Alex Gutteridge <alexg at="" ...=""> writes: > >> >> On 20.01.2012 05:11, Vladimir Zhurov wrote: >>>> ... >>> >>> Dear Bioconductors, >>> >>> I am having the following problem which can be due to a >>> misunderstanding, or an actual problem with topTable function in limma >>> package. >>> >>> As far as I understand lfc and p filters should work together in >>> filtering topTable results. Am I correct in this regard? >>> >>> If it is an intended situation then the problem is the following: when >>> more than one contrasts is reported lfc filter does not affect the >>> output. Which is shown in the sample R session below. >>> >>> I would appreciate you help. >>> >>> Regards. >>> >>> Vladimir. >>> >> >> Hi Vladimir, >> >> I think the issue maybe that it is not clear (to me anyway!) what >> result one would expect with a lfc filter on a table with multiple >> contrasts. Should rows where all contrasts are above the cutoff be >> reported? Or where any are? It doesn't seem to be explicit in the docs, >> but my assumption is that to avoid confusion topTable ignores lfc= in >> the case you describe. >> >> Perhaps decideTests() is what you are really looking for? You can then >> index a topTable generated data.frame with the results of decideTests. >> E.g (pseudo-code not tested!) >> >> tt = topTable(fit,p.value=1,number=Inf,sort.by="none") >> dt = decideTests(fit,p.value=0.05,lfc=1) >> >> tt[dt[,1] != 0 & dt[,2] != 0 & dt[,3] !=0,] #Gives rows where all >> contrasts pass filter (assuming 3 contrasts) >> tt[dt[,1] != 0 | dt[,2] != 0 | dt[,3] !=0,] #Gives rows where any >> contrast passes filter >> > > Alex, > > Thank you for your input. I was considering decideTests but wanted to check > whether there is something that can be done with topTable. I think that it would > be nice at very least to explain intended behavior in more details in the manual > for a case of multiple contrasts comparison. > > Anyway, I ended up with the following workaround (lets say lfc=1, p=0.05 and no > adjustment of p value): > > tt.all<-topTable(fit.eb, sort.by="none", number=Inf, adjust.method="none") > dt<-decideTests(fit.eb, lfc=1, p=0.05, adjust.method="none", method="separate") > rs<-rowSums(abs(dt)) > tt<-tt.all[rs >= 1,] # a single contrast above lfc will be sufficient > > One may think that you are done at this point. However, decideTests with > method="separate" recapitulates topTable performed on individual contrasts. As a > result there are extra probes which will be reported and will have p value above > cut-off when topTable is done across multiple comparisons. They need to be > further filtered out. > > tt.filt<-tt[tt$adj.P.Val < 0.05,] > > Regards. > > Vladimir. ______________________________________________________________________ The information in this email is confidential and intend...{{dropped:4}}
limma limma • 1.8k views
ADD COMMENT
0
Entering edit mode
@vladimir-zhurov-4990
Last seen 9.6 years ago
Dear Gordon, Thank you very much. I have update to the latest release version over the weekend and now everything is nicely non-ambiguous. Regards. Vladimir. On Sat, Jan 21, 2012 at 7:34 PM, Gordon K Smyth <smyth@wehi.edu.au> wrote: > Dear Vladimir, > > You are correct that topTable() has been ignoring the lfc argument when > the ranking is by F-statistic, i.e., when ranking by several contrasts > simultaneously. > > Alex is correct as to the reason for this -- it was just ambiguous what > should be done. However the behaviour should have been explained more > fully in the documentation. > > I now have committed an update to the topTable() function so that the lfc > cutoff will now be applied to the minimum absolute logFC for the contrasts > being tested when ranking by F-statistic. The behaviour is now analogous > to decideTests(). Genes will be kept in the table if any contrast > satisfies the cutoff. > > I committed this change to the developmental version of limma a few days > ago. I committed the change to the official release version of limma just > a few minutes ago, so it should be able for download from Bioconductor in a > day or so. > > Normally decideTests() mimics the behavour of topTable() applied to > individual contrasts. However you can recover the same genes that appear > in an F-statistic topTable() ranking by using: > > result <- decideTests(fit, method="nestedF", ...) > which.genes <- apply(result, 1, any) > > The effects of p-value and lfc cutoffs should now be the same in both > topTable() and decideTests(). > > Best wishes > Gordon > > > Date: Sat, 21 Jan 2012 04:52:10 +0000 >> From: Vladimir Zhurov <vzhurov2@uwo.ca> >> To: <bioconductor@stat.math.ethz.**ch <bioconductor@stat.math.ethz.ch="">> >> Subject: Re: [BioC] Problem with limma's topTable lfc filter when more >> than 1 contrast is in output >> >> Alex Gutteridge <alexg@...> writes: >> >> >>> On 20.01.2012 05:11, Vladimir Zhurov wrote: >>> >>>> ... >>>>> >>>> >>>> Dear Bioconductors, >>>> >>>> I am having the following problem which can be due to a >>>> misunderstanding, or an actual problem with topTable function in limma >>>> package. >>>> >>>> As far as I understand lfc and p filters should work together in >>>> filtering topTable results. Am I correct in this regard? >>>> >>>> If it is an intended situation then the problem is the following: when >>>> more than one contrasts is reported lfc filter does not affect the output. >>>> Which is shown in the sample R session below. >>>> >>>> I would appreciate you help. >>>> >>>> Regards. >>>> >>>> Vladimir. >>>> >>>> >>> Hi Vladimir, >>> >>> I think the issue maybe that it is not clear (to me anyway!) what >>> result one would expect with a lfc filter on a table with multiple >>> contrasts. Should rows where all contrasts are above the cutoff be >>> reported? Or where any are? It doesn't seem to be explicit in the docs, >>> but my assumption is that to avoid confusion topTable ignores lfc= in >>> the case you describe. >>> >>> Perhaps decideTests() is what you are really looking for? You can then >>> index a topTable generated data.frame with the results of decideTests. >>> E.g (pseudo-code not tested!) >>> >>> tt = topTable(fit,p.value=1,number=**Inf,sort.by="none") >>> dt = decideTests(fit,p.value=0.05,**lfc=1) >>> >>> tt[dt[,1] != 0 & dt[,2] != 0 & dt[,3] !=0,] #Gives rows where all >>> contrasts pass filter (assuming 3 contrasts) >>> tt[dt[,1] != 0 | dt[,2] != 0 | dt[,3] !=0,] #Gives rows where any >>> contrast passes filter >>> >>> >> Alex, >> >> Thank you for your input. I was considering decideTests but wanted to >> check >> whether there is something that can be done with topTable. I think that >> it would >> be nice at very least to explain intended behavior in more details in the >> manual >> for a case of multiple contrasts comparison. >> >> Anyway, I ended up with the following workaround (lets say lfc=1, p=0.05 >> and no >> adjustment of p value): >> >> tt.all<-topTable(fit.eb, sort.by="none", number=Inf, >> adjust.method="none") >> dt<-decideTests(fit.eb, lfc=1, p=0.05, adjust.method="none", >> method="separate") >> rs<-rowSums(abs(dt)) >> tt<-tt.all[rs >= 1,] # a single contrast above lfc will be sufficient >> >> One may think that you are done at this point. However, decideTests with >> method="separate" recapitulates topTable performed on individual >> contrasts. As a >> result there are extra probes which will be reported and will have p >> value above >> cut-off when topTable is done across multiple comparisons. They need to be >> further filtered out. >> >> tt.filt<-tt[tt$adj.P.Val < 0.05,] >> >> Regards. >> >> Vladimir. >> > > ______________________________**______________________________**____ ______ > The information in this email is confidential and inte...{{dropped:10}}
ADD COMMENT

Login before adding your answer.

Traffic: 773 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6