Question: Subsetting a data frame generated by topTable() {limma}
0
5 weeks ago by
Armenia
Alexander Az.20 wrote:

I am trying to set certain criteria of choice for picking DE genes, after using limma workflow. I want to select genes that have adjusted p-value < 0.05 and absolute value of log2 fold change > 0.5. The code I used is:

significant <- topTable_result[which(topTable_result$adj.P.Val<0.05) & abs(topTable_result$logFC)>0.5,]


Warning message:
In which(topTable_result$adj.P.Val < 0.05) & abs(topTable_result$logFC) >  :
longer object length is not a multiple of shorter object length


What could I do to tackle this burden?

microarray limma toptable • 82 views
modified 5 weeks ago by Gordon Smyth38k • written 5 weeks ago by Alexander Az.20

PS: It is now a matter of giving wrong naming in the abs( ) function. The underscore is just a typo in this section

Answer: Subsetting a data frame generated by topTable() {limma}
0
5 weeks ago by
Denali
Steve Lianoglou12k wrote:

Let’s assume ttr is the result from topTable, you can do:

ttr.sub <- subset(ttr, adj.P.Val < 0.05 & abs(logFC) > 0.5)


As an aside, consider looking at the limma::treat() if you want to test against a logFC threshold.

Answer: Subsetting a data frame generated by topTable() {limma}
0
5 weeks ago by
Gordon Smyth38k
Walter and Eliza Hall Institute of Medical Research, Melbourne, Australia
Gordon Smyth38k wrote:

This is just an error in the use of R and doesn't really have anything to do with limma. Just remove the which and the code would work:

significant <- topTable_result[(topTable_result$adj.P.Val<0.05) & abs(topTable_result$logFC)>0.5,]


You could have asked topTable to do the same subsetting for you automatically, which would have avoided the need to make your own code.

However, if you read the ?topTable help page you will see that the subseting on logFC is not recommended. I would question whether you really need the logFC filter but, if you do want to prioritize to large logFC values, you could try treat as Steve has referred you to.