Skip to contents

Bootstrap motifbreakR results. Takes motifbreakR results as a tibble (from mb_to_tibble), draws boots random samples of ngenes genes, and returns as a list (1) a wide tibble with results for each bootstrap, and (2) another tibble with the distribution of each metric in a listcol. See examples.

Usage

mb_bootstrap(mbtibble, ngenes, boots = 100, key_col = "gene_id")

Arguments

mbtibble

A tibble of motifbreakR results from mb_to_tibble.

ngenes

The number of genes to sample with each bootstrap resample.

boots

The number of bootstrap resamples.

key_col

The name of the column used to key the txdb. Default gene_id. May be transcript_id or otherwise if you use a different value of level in get_upstream_snps.

Value

A list of two tibbles. See description and examples.

Details

Typically, you want to run this function on a full set of all genes to create an empirical null distribution. You should run motifbreakR once on all genes, save this as an RData object, and read it in during bootstrap resampling. See vignettes.

Examples

data(vignettedata)
vignettedata$mball
#> # A tibble: 12,689 × 10
#>    gene_id   SNP_id      tf    pctRef pctAlt scoreRef scoreAlt effect alleleDiff
#>    <chr>     <chr>       <chr>  <dbl>  <dbl>    <dbl>    <dbl> <chr>       <dbl>
#>  1 100315917 chr33:5706… ARG80  0.979  0.749     4.23     3.24 strong     -0.993
#>  2 100315917 chr33:5706… ARG81  0.991  0.825     5.89     4.90 strong     -0.982
#>  3 100315917 chr33:5703… ARGFX  0.781  0.889     5.06     5.74 weak        0.677
#>  4 100315917 chr33:5706… ARR1   0.634  0.880     2.53     3.42 strong      0.892
#>  5 100315917 chr33:5707… AT1G…  0.882  0.779     7.60     6.73 strong     -0.861
#>  6 100315917 chr33:5704… AT3G…  0.784  0.892     5.13     5.79 weak        0.666
#>  7 100315917 chr33:5706… ATHB…  0.781  0.890     4.12     4.67 weak        0.552
#>  8 100315917 chr33:5706… ATHB…  0.721  0.868     4.98     5.98 strong      0.993
#>  9 100315917 chr33:5706… ATHB…  0.813  0.966     5.32     6.32 strong      0.998
#> 10 100315917 chr33:5706… ATHB…  0.778  0.931     4.98     5.94 strong      0.963
#> # ℹ 12,679 more rows
#> # ℹ 1 more variable: alleleEffectSize <dbl>
mb_bootstrap(vignettedata$mball, ngenes=5, boots=5)
#> $bootwide
#> # A tibble: 5 × 9
#>    boot genes            ngenes nsnps nstrong alleleDiffAbsMean alleleDiffAbsSum
#>   <int> <chr>             <int> <int>   <int>             <dbl>            <dbl>
#> 1     1 374124;395303;4…      5   986     687             0.796             784.
#> 2     2 429035;407779;3…      5  1178     915             0.831             979.
#> 3     3 395772;429501;1…      5  1533    1131             0.806            1235.
#> 4     4 374124;408041;3…      5  1370     978             0.802            1098.
#> 5     5 395711;426887;7…      5   916     653             0.805             737.
#> # ℹ 2 more variables: alleleEffectSizeAbsMean <dbl>,
#> #   alleleEffectSizeAbsSum <dbl>
#> 
#> $bootdist
#> # A tibble: 6 × 2
#>   metric                  bootdist 
#>   <chr>                   <list>   
#> 1 alleleDiffAbsMean       <dbl [5]>
#> 2 alleleDiffAbsSum        <dbl [5]>
#> 3 alleleEffectSizeAbsMean <dbl [5]>
#> 4 alleleEffectSizeAbsSum  <dbl [5]>
#> 5 nsnps                   <dbl [5]>
#> 6 nstrong                 <dbl [5]>
#>