Subsetting a data frame generated by topTable() {limma}
2
0
Entering edit mode
@alexander-azarian-16955
Last seen 8 days ago
Armenia

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,]

but I receive a warning:

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?

limma toptable microarray • 405 views
ADD COMMENT
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode
@steve-lianoglou-2771
Last seen 2 days ago
Denali

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.

ADD COMMENT
0
Entering edit mode
@gordon-smyth
Last seen 29 minutes ago
WEHI, Melbourne, Australia

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.

ADD COMMENT

Login before adding your answer.

Traffic: 312 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