View source: R/select_samples.R
select_samples | R Documentation |
Select samples/individuals from data
select_samples(
data,
sample_selector,
sample_ids_filename = plinkr::get_plinkr_tempfilename(pattern = "sample_ids_",
fileext = ".txt"),
base_output_filename = plinkr::get_plinkr_tempfilename(),
plink_options = plinkr::create_plink_options(),
verbose = FALSE
)
data |
the data source, which can be:
|
sample_selector |
a sample/individual selector, a way to select one or more samples/individuals. See create_samples_selector for all sample selectors. |
sample_ids_filename |
name of a file to store |
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. |
If data
is a plink_bin_data
(see check_plink_bin_data),
a plink_bin_data
If data
is a assoc_qt_data
(see check_assoc_qt_data),
a assoc_qt_data
Richèl J.C. Bilderbeek
To select SNPs, use select_snps
There are multiple sample selector checking functions, see create_samples_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 sample
single_sample_selector <- create_single_sample_selector(
fid = "C",
iid = "1"
)
plink_bin_data <- select_samples(
data = plink_bin_filenames,
sample_selector = single_sample_selector
)
# Select 2 random samples
random_samples_selector <- create_random_samples_selector(
n_samples = 2
)
plink_bin_data <- select_samples(
data = plink_bin_filenames,
sample_selector = random_samples_selector
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.