This is a test version of Biostars. For the public version, visit https://www.biostars.org.
how to set threshold of fdr and p values

i want to identify and retrieve all DEGs from the data and set the p value<0.05 and fdr<0.01 how can i set the values for p and fdr value using R on linux suse platform? i am using the code given below but it is not showing FDR value coloumn in result and i dnt knw how to set the threshold of fdr which i want to set 0.01 .

> gse <- gse[[1]]
> fData(gse) <- fData(gse)[,c(1,2,10:12)]
> grp <- factor(sapply(strsplit(as.character(pData(gse)[,1]), " "), "[", 1))
> grp
 [1] A_set  A_set  AS_set AS_set AS_set F_set  F_set  S_set  S_set  S_set
Levels: A_set AS_set F_set S_set
> design <- model.matrix(~grp)
> fit <- lmFit(gse, design)
> fit2 <- eBayes(fit)
**> tt<- topTable(fit2, coef = 2, adjust = "fdr",n = 50)**
> UP <- subset(tt, tt$logFC > 0)
> DOWN <- subset(tt, tt$logFC < 0)
> head(DOWN)
                       ID   GB_ACC
210004_at       210004_at AF035776
236646_at       236646_at BE301029
1560477_a_at 1560477_a_at AK054643
                                                            Gene.Title
210004_at    oxidized low density lipoprotein (lectin-like) receptor 1
236646_at                                    transmembrane protein 52B
1560477_a_at                  sterile alpha motif domain containing 11
             Gene.Symbol ENTREZ_GENE_ID     logFC  AveExpr         t
210004_at           OLR1           4973 -2.495755 3.516644 -14.90119
236646_at        TMEM52B         120939 -1.991936 3.200324 -12.37906
1560477_a_at      SAMD11         148398 -1.385055 5.790050 -11.81502
                  P.Value  adj.P.Val        B
210004_at    3.134046e-07 0.01713540 3.500307
236646_at    1.353597e-06 0.03551374 3.055998
1560477_a_at 1.948628e-06 0.03551374 2.926959
limma deg

You don't need FDR if you use adj.P.val (P-value adjusted for multiple testing). It's not the same as FDR, but it has the same purpose. It's quite equivalent in usage.

It's simple just use order function of subset the data from of top table with for less than 0.01 and then select degs based on direction. Your selection of degs should be first on for threshold followed by logFC.

2 answers

In limma, you make use of adjusted p-values. By default it is using FDR's (Benjamini Hochberg's) method for adjustment. This is not the same as FDR itself. Please read what Gordon Smyth says about it here:

https://support.bioconductor.org/p/49864/

but if we are using LIMMA so how can we know that what is the value of FDR which is used by LIMMA

You'll have to calculate it yourself.

I reckon OP wants to use the adjust.p filters. If you want to use the real FDR method then b.nota is correct. You will have to intact select genes from tt object you have based on logFC and avgexp and then recalculate the FDR of those genes against the background. Then you will be able to have a new column with FDR values

no it's not working.

If you're only interested in the AS_set result the adjusted P-value is also known as the Q-value.

My concerned is to set fdr score if you know how to set the cutoff value of fdr so kindly tell me that for eg: fdr<0.01 how can i set this value using R code.

degs.fdr<- subset(tt, tt$adj.P.Val < 0.05)

This is how you set, here adjust.P.Val is what you need. Now if you want to regenerate again new FDR values then its different

Log in to answer this question.