Skip to contents

Filters markers or genes/transcripts based on a threshold applied to their GWAS or DE score, and log2(fold-change) (if applicable). For a set of candidate genes, simply returns the list. Note that markers or genes with a missing score or log2(fold-change) will be removed from the dataset.

Usage

apply_threshold(x, score_thr = 0, log2fc_thr = 0)

# S3 method for class 'GWAS_data'
apply_threshold(x, score_thr = 0, log2fc_thr = 0)

# S3 method for class 'DE_data'
apply_threshold(x, score_thr = 0, log2fc_thr = 0)

# S3 method for class 'CAN_data'
apply_threshold(x, score_thr = 0, log2fc_thr = 0)

# S3 method for class 'CUSTOM_data'
apply_threshold(x, score_thr = 0, log2fc_thr = 0)

# Default S3 method
apply_threshold(x, score_thr = 0, log2fc_thr = 0)

Arguments

x

Either a GWAS_data, DE_data, CAN_data or CUSTOM_data object.

score_thr

Numeric, threshold to use on markers' or genes/transcripts' score. Only markers or genes with a score equal to or higher than this threshold will be retained. Default value is 0. Ignored for CAN_data.

log2fc_thr

Numeric, threshold to use on the absolute value of genes/ transcripts' log2(fold-change). Only genes/transcripts with an absolute log2(fold-change) equal to or higher than this threshold will be retained. Ignored for GWAS_data, CAN_data and CUSTOM_data.

Value

A filtered tibble (of class GWAS_data_thr, DE_data_thr, CAN_data_thr or CUSTOM_data_thr).

Examples

x <- get_example_data()

## For GWAS results
apply_threshold(GWAS_data(x[["GWAS"]]), score_thr = 4)
#> # A tibble: 37 × 4
#>    id                  chromosome position score
#>    <chr>               <chr>         <dbl> <dbl>
#>  1 ST4.03ch00_22680252 ST4.03ch00 22680252  4.41
#>  2 ST4.03ch01_6317643  ST4.03ch01  6317643  4.15
#>  3 ST4.03ch01_7671100  ST4.03ch01  7671100  4.43
#>  4 ST4.03ch01_8653747  ST4.03ch01  8653747  4.69
#>  5 ST4.03ch01_12842648 ST4.03ch01 12842648  6.85
#>  6 ST4.03ch01_13334335 ST4.03ch01 13334335  5.24
#>  7 ST4.03ch01_13544786 ST4.03ch01 13544786  4.00
#>  8 ST4.03ch01_42743974 ST4.03ch01 42743974  4.00
#>  9 ST4.03ch01_42949112 ST4.03ch01 42949112  4.18
#> 10 ST4.03ch01_52529264 ST4.03ch01 52529264  4.85
#> # ℹ 27 more rows

## For DE results - in second line, no threshold is applied
## on the log2(fold-change)
apply_threshold(DE_data(x[["DE"]]), score_thr = -log10(0.05), log2fc_thr = 1)
#> # A tibble: 5 × 9
#>   gene       chromosome   padj log2FoldChange  start    end label score position
#>   <chr>      <chr>       <dbl>          <dbl>  <dbl>  <dbl> <chr> <dbl>    <dbl>
#> 1 PGSC0003D… ST4.03ch01 0.0488           1.61 8.15e7 8.15e7 Gene…  1.31   8.15e7
#> 2 PGSC0003D… ST4.03ch03 0.0488           1.14 3.49e7 3.49e7 Gene…  1.31   3.49e7
#> 3 PGSC0003D… ST4.03ch03 0.0184           3.06 5.99e7 5.99e7 Phos…  1.73   5.99e7
#> 4 PGSC0003D… ST4.03ch05 0.0414           1.10 3.47e6 3.47e6 Cons…  1.38   3.47e6
#> 5 PGSC0003D… ST4.03ch09 0.0328           1.51 5.40e7 5.40e7 Vici…  1.48   5.40e7
apply_threshold(DE_data(x[["DE"]]), score_thr = -log10(0.05), log2fc_thr = 0)
#> # A tibble: 57 × 9
#>    gene     chromosome    padj log2FoldChange  start    end label score position
#>    <chr>    <chr>        <dbl>          <dbl>  <dbl>  <dbl> <chr> <dbl>    <dbl>
#>  1 PGSC000… ST4.03ch00 0.0488           0.838 3.80e7 3.80e7 Pept…  1.31   3.80e7
#>  2 PGSC000… ST4.03ch01 0.0362          -0.181 5.83e7 5.83e7 Cons…  1.44   5.83e7
#>  3 PGSC000… ST4.03ch01 0.0488           1.61  8.15e7 8.15e7 Gene…  1.31   8.15e7
#>  4 PGSC000… ST4.03ch01 0.00465          0.438 8.45e7 8.45e7 Phi-2  2.33   8.45e7
#>  5 PGSC000… ST4.03ch02 0.0488           0.325 2.26e7 2.26e7 Cons…  1.31   2.26e7
#>  6 PGSC000… ST4.03ch02 0.0266           0.768 3.32e7 3.32e7 Leuc…  1.58   3.32e7
#>  7 PGSC000… ST4.03ch02 0.0488           0.381 4.14e7 4.14e7 Cons…  1.31   4.14e7
#>  8 PGSC000… ST4.03ch02 0.0314           0.663 4.23e7 4.23e7 Home…  1.50   4.23e7
#>  9 PGSC000… ST4.03ch03 0.0488          -0.804 5.33e5 5.41e5 SNF2…  1.31   5.37e5
#> 10 PGSC000… ST4.03ch03 0.0493          -0.345 9.26e6 9.26e6 Dihy…  1.31   9.26e6
#> # ℹ 47 more rows

## No effect on the Candidate genes
apply_threshold(CAN_data(x[["CAN"]]))
#> # A tibble: 32 × 7
#>    id                    chromosome    start      end name    gene_name position
#>    <chr>                 <chr>         <dbl>    <dbl> <chr>   <chr>        <dbl>
#>  1 PGSC0003DMG400003155  ST4.03ch03 46757152 46762127 4CL     4-coumar…   4.68e7
#>  2 PGSC0003DMG400014223  ST4.03ch03 57466692 57469946 4CL2    4-coumar…   5.75e7
#>  3 PGSC0003DMG400011189  ST4.03ch07  1001854  1006278 HQT     HQT         1.00e6
#>  4 PGSC0003DMG400005492  ST4.03ch05 36342746 36347409 PAL     phenylal…   3.63e7
#>  5 PGSC0003DMG400005279  ST4.03ch05 42523943 42525912 peroxi… peroxida…   4.25e7
#>  6 PGSC0003DMG400007782  ST4.03ch03 38537202 38540209 PHO1A   PHO1A       3.85e7
#>  7 PGSC0003DMG400023182  ST4.03ch02 10091564 10093164 LIPIII… LipIII27    1.01e7
#>  8 PGSC0003DMG400029576  ST4.03ch08 45676042 45677832 PPOs    Polyphen…   4.57e7
#>  9 PGSC0003DMG400018924  ST4.03ch08 45778567 45780333 NA      Polyphen…   4.58e7
#> 10 PGSC0003DMG400018919  ST4.03ch08 45793661 45794229 NA      Polyphen…   4.58e7
#> # ℹ 22 more rows