subset_genepop_rename: Genepop subset and rename populations

View source: R/subset_genepop_rename.R

subset_genepop_renameR Documentation

Genepop subset and rename populations

Description

Function for the manipulation of genopop format SNP datasets and renaming of populations

Usage

subset_genepop_rename(genepop, nameframe, renumber = FALSE,
  meta = "Pop", 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).

nameframe

a dataframe or path to a csv and is required for this function. The first column of the dataframe defines the original value and the second corresponds to the change. If populations (default: meta="populations") are the metadata to be changed the names should match the individual IDs (e.g. BON_01 , 110110 120120 = 'BON'). The next column has the new names that you want to change or rename. If you don't want to change the name then just repeat from column one in that row. This function assumes that each population will have a unique name. Names in this case are comprised of alpha characters and not numbers. (e.g. Pop01_01 and Pop02_01 would each be considered 'Pop' for the population name) e.g. data.frame(Opop=c("BON","BRA","EDN","CRA","MAL","TRY"),Rename=c("BON","BON","EDN","CRA","BON","CRA")).

renumber

is a logical (default=FALSE) defining whether you want to change the sample unique identity i.e. sample number - BON_01 where 01 is the unique qauntity. If multiple populations are combined this will prevent two samples from having the same name.

meta

which metadata will be renamed with nameframe. Default is "Pop" for populations, alternative is "Ind" for individuals.

path

the filepath and filename of output.


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