make_read_primer_table: Make data frame of primer info for reads

View source: R/primers.R

make_read_primer_tableR Documentation

Make data frame of primer info for reads

Description

make_read_primer_table take read sequences and per-locus primer information and produces a data frame of matching information for each read. Mismatches are allowed, but not indels. The rows in the output data frame will correspond exactly to the read vector given.

Usage

make_read_primer_table(
  seqs,
  locus_attrs,
  max_mismatches = cfg("max_mismatches"),
  primer_action = cfg("primer_action"),
  primer_action_fwd = cfg("primer_action_fwd"),
  primer_action_rev = cfg("primer_action_rev"),
  max_mismatches_fwd = cfg("max_mismatches_fwd"),
  max_mismatches_rev = cfg("max_mismatches_rev"),
  use_reverse_primers = cfg("use_reverse_primers"),
  reverse_primer_r1 = cfg("reverse_primer_r1")
)

Arguments

seqs

character vector of read sequences

locus_attrs

data frame of locus attributes

max_mismatches

integer number of mismatches allowed when checking primers against reads

primer_action

how should reads be modified based on matched primers? Can be "none", "keep" (trim sequences to the primers but keep the primers as-is), "replace" (trim sequences and replace the matched primer region with the sequence from locus_attrs), or "remove" (trim sequences to exclude the primer region).

primer_action_fwd

a primer_action value for the forward primer

primer_action_rev

a primer_action value for the reverse primer

max_mismatches_fwd

a max_mismatches value for the forward primer

max_mismatches_rev

a max_mismatches value for the reverse primer

use_reverse_primers

use reverse primers, or just forward?

reverse_primer_r1

is each reverse primer in locus_attrs given in its orientation on the forward read? This is used to determine how the primers and reads should be reverse complemented before comparing.

Details

Output Columns:

  • SeqOrig: Original read sequence

  • FwdStart: start position of forward primer match

  • Fwdstop: end position of forward primer match

  • FwdMismatches: number of mismatches for the forward primer

  • FwdLocus: name of the Locus whose forward primer matched

  • RevStart: start position of reverse primer match

  • RevStop: end position of reverse primer match

  • RevMismatches: number of mismatches in the reverse primer

  • RevLocus: name of the Locus whose reverse primer matched

  • MatchingLocus: name of Locus matching in forward or both (if use_reverse_primers) directions

  • Seq: modified sequence based on primer_action argument(s), if applicable

Optionally reads can be modified based on the matched primer sequences in one or both directions; see the primer_action arguments for those options. All positions in the returned data frame are indexed from 1 and are oriented in the same direction as the unmodified reads.

The comparison of reads to primers is not exhaustive. This method gathers exact matches first and searches the remaining reads for inexact matches in order of decreasing abundance of exact matches, taking the first sufficiently-similar match for each read. For max_mismatches values well below the similarity between any two primer sequences (as will typically be the case) this should result in the best-matching primer being reported for each read, but is much faster than doing an exhaustive all-to-all comparison.

Value

data frame of matched primer information, one row for each input sequence


ShawHahnLab/microsat documentation built on Aug. 25, 2023, 11:16 p.m.