Learn R Programming

TmCalculator (version 1.1.0)

.gc_vec: Vectorized GC percent over a character vector of sequences

Description

Mirrors gc_content() exactly, including its ambiguity apportioning and its GC/(A+C+G+T) denominator, but counts every base in a single compiled pass per sequence (cpp_base_counts()) instead of splitting each sequence into a character vector with s2c() and scanning it five times. The apportioning arithmetic stays here, vectorised over the count matrix, so the published formula remains the readable one.

Usage

.gc_vec(input_seq, ambiguous = FALSE)

Value

Numeric vector of GC percentages, NA where a sequence is

NA or contains no countable base.

Arguments

input_seq

Character vector of sequences.

ambiguous

Logical; apportion ambiguous IUPAC codes as gc_content() does.