read_strata | R Documentation |
Read a strata object or file. The strata file contains thes individual's metadata, the stratification: e.g. the population id and/or the sampling sites (see details). Used internally in radiator and might be of interest for users.
read_strata(
strata,
pop.id = FALSE,
pop.levels = NULL,
pop.labels = NULL,
pop.select = NULL,
blacklist.id = NULL,
keep.two = TRUE,
path.folder = NULL,
filename = NULL,
verbose = FALSE
)
strata |
(path or object) The strata file or object.
Additional documentation is available in |
pop.id |
(logical) When |
pop.levels |
(optional, string) This refers to the levels in a factor. In this
case, the id of the pop.
Use this argument to have the pop ordered your way instead of the default
alphabetical or numerical order. e.g. |
pop.labels |
(optional, string) Use this argument to rename/relabel
your pop or combine your pop. e.g. To combine |
pop.select |
(optional, string) Selected list of populations for
the analysis. e.g. |
blacklist.id |
(optional, path or object) A blacklist file in the working directory
or object in the global environment. The data frame
as 1 column (named |
keep.two |
(optional, logical) The output is limited to 2 columns:
|
path.folder |
(optional, path)
If |
filename |
(optional, character) If |
verbose |
(optional, logical) When |
The strata file used in radiator is a tab delimited file with
a minimum of 2 columns headers (3 for DArT data users):
INDIVIDUALS
and STRATA
.
If a strata
file is specified with all file formats that don't
require it, the strata argument will have precedence on the population
groupings used internally in those file formats. For file formats without
population/strata groupings (e.g. vcf, haplotype files) if no strata file is
provided, 1 pop/strata grouping will automatically be created.
For vcf and haplotypes file, the strata can also be used as a whitelist of id.
Samples not in the strata file will be discarded from the data set.
The STRATA
column can be any hierarchical grouping.
To create a strata file see individuals2strata
.
If you have already run
stacks on your data,
the strata file is similar to a stacks population map file,
make sure you
have the required column names (INDIVIDUALS
and STRATA
).
The strata column is cleaned of a white spaces that interfere with some
packages or codes: space is changed to an underscore _
.
For DArT data see read_dart
A list with several components:
$strata
$pop.levels
$pop.labels
$pop.select
$blacklist.id
VCF file users, not sure about the sample id inside your file ?
See the example in extract_individuals_vcf
DArT file users, not sure about the sample id inside your file ?
See the example in extract_dart_target_id
summary_strata
,
individuals2strata
, change_pop_names
,
join_strata
, generate_strata
## Not run:
strata.info <- radiator::read_strata(strata)
# the return object is a list with 5 objects:
names(strata.info)
# to get the strata
new.strata <- strata.info$strata
# if naything is changed from the original strata, a new strata file is
# generated automatically:
new.strata <- radiator::read_strata(
strata = strata,
blacklist.id = "blacklisted.ids.tsv"
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.