Identify the non-conforming sample or control PCR replicates in the PCRs table from a metabarlist object. Process numerous reiterations to compare distance densities within PCR replicates and between PCR replicates.

pcr_outlier(
  metabarlist,
  FUN = bray_function,
  groups = metabarlist$pcrs$sample_id,
  graphics = FALSE
)

filter_replicat(sub_matrix, threshold)

coa_function(reads)

bray_function(reads)

Arguments

metabarlist

a metabarlist object

FUN

a function returning a distance matrix. The distance matrix should be a `dist` object which has the same dimensions as the number of rows in the `reads`table, i.e number of PCRs.

groups

a vector containing the replicate identifier. The vector must have the same dimensions as the `PCRs` table from a metabarlist object. Default = metabarlist$pcrs$sample_id

graphics

a boolean value to plot the distance densities for each iteration. Default = FALSE

sub_matrix

a distance matrix for replicates comparisons

threshold

a threshold below which a pcr is considered as outlier

reads

a reads table from a metabarlist object

Value

a data frame with the replicate groups and a `replicating`column. If not possible, the function will terminate and return an error message.

Details

This function identifies non-conforming sample or control replicates.

The parameter `groups` defines groups of replicates. The vector should be arranged following the format of a `PCRs` table from the metabarlist. Note: If the distance within replicates is higher than the distance between replicates, the function cannot return any result because all replicates are removed. The parameter `FUN` defines the function used to compute the distance matrix. The function will return an object of class `dist` with the same length as the input table. The default function use the `decostand` and `vegdist` functions from the `vegan` package to perform a correspondance analysis of the `reads` table from the metabarlist, and returns a distance matrix. Default function detail: bray_function <- function(reads) distance_matrix <- vegdist(decostand(reads, method = 'total'), method='bray') return(distance_matrix)

When the `graphics` parameter is defined as True, a graphic is plotted with the density of distance within replicate and between replicate. The threshold is also plotted as a vertical line at the intersection of the two densities.

Note: In the circumstance where numerous sequencing projects have been pooled and analysed on the the same PCR plates, the function must be processed individually for each project, to avoid calculating distances which are meaningless.

Functions

  • pcr_outlier: Identifying the non-replicating samples or controls in the table PCRs from a metabarlist object.

  • filter_replicat: recursive function to find the non replicating samples or controls

  • coa_function: distance function with ade4 package and coa analysis

  • bray_function: distance function with vegan package and Bray-Curtis distance

Author

Frédéric Boyer & Clément Lionnet

Examples

if (FALSE) {
data(soil_euk)

sample_subset <- subset_metabarlist(soil_euk, "pcrs",
                                    soil_euk$pcrs$type == "sample")
filter_replicat(sample_subset)
}