poolne_estim_output: Merge 'poolne_estim' outputs

View source: R/poolne_estim_output.R

poolne_estim_outputR Documentation

Merge poolne_estim outputs

Description

Searches a user specified directory for summary_pi.out or summary_ne_eps.out files, which are the output files from poolne_estim containing estimates of population allele frequencies and effective pool size (respectively), merging these outputs into a single data.table.

Usage

poolne_estim_output(stat=c('pi', 'ne'), datDir=NA, lociDir=NA)

Arguments

stat

Character: One of 'pi' (population allele frequency estimates) or 'ne' (effective pool size estimates). Default = NA.

datDir

Character: A directory to search for summary_pi.out or summary_ne_eps.out files. Default = NA. If unspecified, function assumes files are in the current working directory.

lociDir

Character: A directory to search for Loci.txt files. Default = NA. If unspecified, function assumes files are in the current working directory. You do not need to specify this if stat = 'pi'.

Details

If merging summary_pi.out files, Loci.txt files are also required, which have the names of the loci in the same order as the rows in the summary_pi.out file. The Loci.txt files are produced by the function poolne_estim_input.

Files are expected to follow the naming convention: [runID]_[poolID]_summary_pi.out, [runID]_[poolID]_summary_ne_eps.out and [runID]_[poolID]_Loci.txt. The [runID] [poolID] portion is used to assign run ID and the population pool ID, respectively.

Value

If stat = 'pi', a data.table with the following columns is returned:

  1. $MRK = The marker number, as used in poolne_estim.

  2. $PI = The poolne_estim posterior mean of the population Ref allele frequency, pi.

  3. $SD = The poolne_estim estimate of the standard deviation in PI.

  4. $POOL = The population pool ID.

  5. $RUN = The run ID.

  6. $CHROM = The chromosome ID.

  7. $LOCUS = The locus ID.


If stat = 'ne', a data.table with the following columns is returned:

  1. $POOL = The population pool ID.

  2. $RUN = The run ID.

  3. $SAMPLE = The replicate sample ID, as used in poolne_estim.

  4. $NEuntr = The untruncated poolne_estim posterior mean effective pool-size, ne.

  5. $SD.NEuntr = The standard deviation of NEraw.

  6. $NE = The truncated poolne_estim posterior mean effective pool-size, ne.

  7. $SD.NE = The standard deviation of NE.

  8. $E = The poolne_estim posterior mean of the experimental error, epsilon.

  9. $SD.E = The standard deviation of E.

  10. $PER = Percent acceptance.

  11. $ACCRATE = The acceptance rate of the chain.

Examples

# Create a link to raw external datasets in genomalicious
genomaliciousExtData <- paste0(find.package('genomalicious'), '/extdata')

# Use list.files() to show the summary_pi.out, Loci.txt and
# summary_ne_eps.out text files
list.files(genomaliciousExtData, pattern='summary_pi.out')
list.files(genomaliciousExtData, pattern='Loci.txt')
list.files(genomaliciousExtData, pattern='summary_ne_eps.out')

# Merge the outputs
pi.data <- poolne_estim_output(stat='pi', datDir=genomaliciousExtData, lociDir=genomaliciousExtData)
ne.data <- poolne_estim_output(stat='ne', datDir=genomaliciousExtData)


j-a-thia/genomalicious documentation built on Oct. 19, 2024, 7:51 p.m.