Calculates qvalues on the subset PSMs.

calculate_fdr(df, score_higher = TRUE)

Arguments

df

dataframe with at least 3 columns:

score

score assigned to the peptide to spectrum match (PSM).

subset

TRUE if PSM belongs to the subset in interest, FALSE or otherwise.

decoy

TRUE if decoy PSM, FALSE otherwise.

Additional columns are allowed but ignored. Target and decoy PSMs are assumbed to be from a competitive target decoy database search.

score_higher

TRUE if a higher score means a better PSM.

Value

A data frame containing all columns in ``df''. Following columns are added:

pi_0_cons

conservative estimation of \(\pi_0\).

FDR

estimated subset PSM qvalues calculated according the competitive target decoy approach.

FDR_BH

estimated subset PSM qvalues calculated according the Benjamini Hochbergh procedure. When provided, non-subset decoy PSMs are used to stabilize estimates in small subsets

FDR_stable

estimated subset PSM qvalues calculated with ``pi_0_cons''. When provided, non-subset decoy PSMs are used to stabilize estimates in small subsets

Examples

## Simulate a dataset with 140 correct target subset PSMs, 60 incorrect target subset PSMS, ## 60 decoy subset PSMs and 2000 additional decoy PSMs. set.seed(10) d = sample_dataset(H1_n = 140,H0_n = 60, decoy_n = 60 ,decoy_large_n = 2000) ## calculate the qvalues in the subset target PSMS according the classical target-decoy approach ## and our more stable estimation method. calculate_fdr(d)
#> # A tibble: 2,260 x 8 #> score decoy H0 subset pi_0_cons FDR FDR_BH FDR_stable #> <dbl> <lgl> <lgl> <lgl> <dbl> <dbl> <dbl> <dbl> #> 1 2.752437 TRUE FALSE FALSE 0.305 NA NA NA #> 2 2.726047 TRUE FALSE FALSE 0.305 NA NA NA #> 3 2.571727 TRUE FALSE FALSE 0.305 NA NA NA #> 4 2.672108 TRUE FALSE FALSE 0.305 NA NA NA #> 5 2.788291 TRUE FALSE FALSE 0.305 NA NA NA #> 6 2.800673 TRUE FALSE FALSE 0.305 NA NA NA #> 7 2.592950 TRUE FALSE FALSE 0.305 NA NA NA #> 8 2.702722 TRUE FALSE FALSE 0.305 NA NA NA #> 9 2.538533 TRUE FALSE FALSE 0.305 NA NA NA #> 10 2.716658 TRUE FALSE FALSE 0.305 NA NA NA #> # ... with 2,250 more rows