select_snps | R Documentation |
Select SNPs
select_snps(
data,
snp_selector,
base_output_filename = plinkr::get_plinkr_tempfilename(),
plink_options = plinkr::create_plink_options(),
verbose = FALSE
)
data |
the data source, which can be:
|
snp_selector |
a SNP selector, a way to select one or more SNPs. See create_snps_selector for all SNP selectors. |
base_output_filename |
the base of the filenames that are
used as output for |
plink_options |
options to run PLINK, as created by create_plink_options |
verbose |
the verbosity of a function. Set to TRUE for more output. Use check_verbose to detect if this argument is valid. |
a plink_bin_data
(see check_plink_bin_data)
Richèl J.C. Bilderbeek
To select samples/individuals, use select_samples
There are multiple SNP selector checking functions, see create_snps_selector for an overview
if (is_plink_installed()) {
# Use PLINK files
plink_bin_filenames <- create_plink_bin_filenames(
bed_filename = get_plinkr_filename("select_snps.bed"),
bim_filename = get_plinkr_filename("select_snps.bim"),
fam_filename = get_plinkr_filename("select_snps.fam")
)
# Select a single SNP
single_snp_selector <- create_single_snp_selector(
snp = "snp_4"
)
plink_bin_data <- select_snps(
data = plink_bin_filenames,
snp_selector = single_snp_selector
)
# Select 2 random SNPs
random_snps_selector <- create_random_snps_selector(
n_snps = 3
)
plink_bin_data <- select_snps(
data = plink_bin_filenames,
snp_selector = random_snps_selector
)
# Select a SNP range
snp_range_selector <- create_snp_range_selector(
snp_from = "snp_2",
snp_to = "snp_7"
)
plink_bin_data <- select_snps(
data = plink_bin_filenames,
snp_selector = snp_range_selector
)
# Seleect a window around a SNP: 3 SNPs, with 'snp_5' in the middle
snp_window_selector <- create_snp_window_selector(
snp = "snp_5",
window_kb = 0.003
)
plink_bin_data <- select_snps(
data = plink_bin_filenames,
snp_selector = snp_window_selector
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.