R/strata.R
change_pop_names.Rd
Transform into a factor the STRATA column, change names and reorder the levels.
change_pop_names(data, pop.levels = NULL, pop.labels = NULL)
14 options for input (diploid data only): VCFs (SNPs or Haplotypes,
to make the vcf population ready),
plink (tped, bed), stacks haplotype file, genind (library(adegenet)),
genlight (library(adegenet)), gtypes (library(strataG)), genepop, DArT,
and a data frame in long/tidy or wide format. To verify that radiator detect
your file format use detect_genomic_format
(see example below).
Documented in Input genomic datasets of tidy_genomic_data
.
DArT and VCF data: radiator was not meant to generate alleles and genotypes if you are using a VCF file with no genotype (only genotype likelihood: GL or PL). Neither is radiator able to magically generate a genind object from a SilicoDArT dataset. Please look at the first few lines of your dataset to understand it's limit before asking raditor to convert or filter your dataset.
(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.levels = c("QUE", "ONT", "ALB")
instead of the default pop.levels = c("ALB", "ONT", "QUE")
.
White spaces in population names are replaced by underscore.
Default: pop.levels = NULL
.
(optional, string) Use this argument to rename/relabel
your pop or combine your pop. e.g. To combine "QUE"
and "ONT"
into a new pop called "NEW"
:
(1) First, define the levels for your pop with pop.levels
argument:
pop.levels = c("QUE", "ONT", "ALB")
.
(2) then, use pop.labels
argument:
pop.labels = c("NEW", "NEW", "ALB")
.
To rename "QUE"
to "TAS"
:
pop.labels = c("TAS", "ONT", "ALB")
.
Default: pop.labels = NULL
. If you find this too complicated,
there is also the strata
argument that can do the same thing,
see below.
White spaces in population names are replaced by underscore.