subset_genepop_aggregate: Genepop subset, combine, and reorder populations

View source: R/subset_genepop_aggregate.R

subset_genepop_aggregateR Documentation

Genepop subset, combine, and reorder populations

Description

Function to cluster populations together and remove specific loci

Usage

subset_genepop_aggregate(genepop, subs = NULL, keep = TRUE, agpopframe,
  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 subs <- c("190-56","145_21",456_12") would return loci with these 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

agpopframe

a dataframe or path to a csv. This dataframe contains two columns: Column 1 corresponds to the population names. Here we consider the alpha-numeric characters before the first underscore '_' to be the population name. so that IDs are "Population_sample#" (e.g. Aqua23_04 = Population Aqua23, individual 4). These names can be obtained using the genepop_detective function. The next column has grouping variables. If you don't want to change the grouping just repeat original name. If the input is a dataframe object from the workspace it must be a data.frame object and therefore will have headers. e.g. data.frame(Opop=c("AAA","BBB","CCC","DDD","EEE","FFF","GGG"),AgPop=c("Pop1","Pop2","CCC","Pop2","EEE","Pop2","GGG")) In this case AAA/BBB & DDD/FFF would be clustered together between population flags in genepop.

path

to the output .txt file.


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