subset_genepop: Genepop subset loci and populations

View source: R/subset_genepop.R

subset_genepopR Documentation

Genepop subset loci and populations

Description

Function to subset loci and populations

Usage

subset_genepop(genepop, subs = NULL, keep = TRUE, spop = NULL, path)

Arguments

genepop

the genepop data to be manipulated. This can be either a file path or a dataframe read in with tab separation, header=FALSE , quote="", and stringsAsFactors=FALSE. This will be the standard genepop format with the first n+1 rows corresponding to the n loci names, or a single comma delimited row of loci names followed by the locus data. Populations are separated by "Pop". Each individual ID is linked to the locus data by " , " (space,space space) and is read in as as a single row (character).

subs

the loci names of interest or a vector which corresponds to the order of which they appear in the genepop file. These can be either the order by which they occur or the exact name of the loci e.g. subs <-c(1,2,3,4) would return the first 4 loci & subs <- c("190_56","145_21",456_12") would return loci with defined names.

keep

logical vector which defines whether you want to remove the loci or keep them. The default is to keep them keep <- TRUE assuming you are removing neutral markers and only keeping the subs.

spop

is the populations of interest. Note these are specified in the order which they appear in the original genepop file. i.e. first pop = 1 second pop = 2 Examples: numeric - spop <- c(1,3,4,7) or the population ID (alpha-numeric code before the underscore). Here we assume conventional naming of "Population_sample#" e.g. (Aqua01_05: population Aqua01 & sample #5). text- spop <- c("Aqua01", "GRR","GHR","TRS").

path

the filepath and filename of output.


rystanley/genepopedit documentation built on June 27, 2023, 11:33 p.m.