map_to_best_asv: Replace unmapped raw reads with the nearest ASV

Description Usage Arguments Details Value

Description

Replace unmapped raw reads with the nearest ASV

Usage

1
map_to_best_asv(asvs, raw, maxdist = 10)

Arguments

asvs

(character vector) ASV sequences mapped to a set of reads. Should be NA_character_ for reads which did not map to an ASV.

raw

(character vector) Raw read sequences for the same set of reads as asvs. May be NA_character_

maxdist

(numeric scalar) Maximum Levenshtein distance between a raw read and an ASV for the read to be mapped to the ASV.

Details

The value for element i of the result is determined as follows:

  1. asvs[i] is non-NA: the value from asvs is used.

  2. asvs[i] and raw[i] are both NA: NA_character_

  3. asvs[i] is NA, raw[i] is non-NA:

    1. raw[i] is less than maxdist in edit distance from at least one of the non-NA sequences in asvs: the value from asvs which has the smallest edit distance from raw[i] is used.

    2. raw[i] is not less than maxdist in edit distance from at least one of the non-NA sequences in asvs: NA_character_

Value

a character vector the same length as asvs, which has the closest ASV for each read.


brendanf/tzara documentation built on March 11, 2021, 5:40 a.m.