knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
This vignette shows how to plinkr example files were created.
library(plinkr)
To demonstrate how the plinkr example files were created,
these are re-created in a temporary folder,
and then compared to the existing files
in the plinkr
inst/extdata
folder
Determine the name of the temporary folder:
folder_name <- plinkr::get_plinkr_tempfilename() folder_name
demo_assoc
Simulate data:
# Create the example files in the inst/extdata folder set.seed(314) assoc_data <- create_demo_assoc_data()
Glance at the data:
knitr::kable(assoc_data$data$map_table)
knitr::kable(assoc_data$data$ped_table)
Should be the same:
testthat::expect_equal( assoc_data$data$map_table, read_plink_map_file(get_plinkr_filename("demo_assoc.map")) )
testthat::expect_equal( assoc_data$data$ped_table, read_plink_ped_file(get_plinkr_filename("demo_assoc.ped")) )
demo_assoc_qt
set.seed(314) assoc_qt_data <- create_demo_assoc_qt_data()
Glance at the data:
knitr::kable(assoc_qt_data$data$map_table)
knitr::kable(assoc_qt_data$data$ped_table)
knitr::kable(assoc_qt_data$phenotype_data$phe_table)
Should be equal:
testthat::expect_equal( assoc_qt_data$data$map_table, read_plink_map_file(get_plinkr_filename("demo_assoc_qt.map")) )
testthat::expect_equal( assoc_qt_data$data$ped_table, read_plink_ped_file(get_plinkr_filename("demo_assoc_qt.ped")) )
if (1 == 2) { plinkr::save_phe_table( phe_table = assoc_qt_params$phe_table, phe_filename = get_plinkr_filename("demo_assoc_qt.phe") ) testthat::expect_equal( assoc_qt_params$phe_table, read_plink_phe_file(get_plinkr_filename("demo_assoc_qt.phe")) ) }
if (1 == 2) { make_bed( base_input_filename = file.path( system.file("extdata", package = "plinkr"), "demo_assoc_qt" ), base_output_filename = file.path( system.file("extdata", package = "plinkr"), "demo_assoc_qt" ) ) make_bed( base_input_filename = file.path( system.file("extdata", package = "plinkr"), "demo_assoc" ), base_output_filename = file.path( system.file("extdata", package = "plinkr"), "demo_assoc" ) ) }
unlink(folder_name)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.