Learn R Programming

polyRAD (version 1.1)

MergeTaxaDepth: Combine Read Depths from Multiple Taxa into One Taxon

Description

This function should be used in situations where data that were imported as separate taxa should be merged into a single taxon. The function should be used before any of the pipeline functions for genotype calling. Read depths are summed across duplicate taxa and output as a single taxon.

Usage

MergeTaxaDepth(object, ...)

# S3 method for RADdata MergeTaxaDepth(object, taxa, …)

Arguments

object

A RADdata object.

taxa

A character vector indicating taxa to be merged. The first taxon in the vector will be used to name the combined taxon in the output.

Additional arguments (none implemented).

Value

A RADdata object derived from object. The alleleDepth, antiAlleleDepth, locDepth, depthRatio, and depthSamplingPermutation slots, and "taxa" and "nTaxa" attributes, have been changed accordingly to reflect the merge.

Details

Examples of reasons to use this function:

  • Duplicate samples across different libraries were given different names so that preliminary analysis could confirm that they were truly the same (i.e. no mix-ups) before combining them.

  • Typos in the key file for the SNP mining software (TASSEL, Stacks, etc.) caused duplicate samples to have different names when they really should have had the same name.

To merge multiple sets of taxa into multiple combined taxa, this function can be run multiple times or in a loop.

See Also

SubsetByTaxon

Examples

Run this code
# NOT RUN {
# dataset for this example
data(exampleRAD)

# merge the first three taxa into one
exampleRADm <- MergeTaxaDepth(exampleRAD, c("sample001", "sample002", "sample003"))

# inspect read depth
exampleRAD$alleleDepth[1:3,]
exampleRADm$alleleDepth[1:3,]
# }

Run the code above in your browser using DataLab