Skip to contents

Given a vector of vertex indices vertices and a samples-by-features matrix X, compute for each feature (column of X) the number k and proportion p of supplied vertices for which X[vertex, feature] > eps.

This is a vertex-set analogue of basin.feature.carriers(), intended for situations where the region of interest is provided directly as an index vector rather than looked up from a basin in a gfc.flow object.

Usage

# S3 method for class 'feature.carriers'
vertices(
  object,
  X,
  eps = 0,
  match.by = c("index", "rownames"),
  drop.missing = TRUE,
  unique = TRUE,
  sort = TRUE,
  vertices = object,
  ...
)

Arguments

object

Integer or numeric vector identifying the vertices/samples to include. Interpretation depends on match.by.

X

A numeric matrix (or data.frame coercible to a numeric matrix) with samples/vertices in rows and features in columns.

eps

A non-negative numeric threshold. A feature is considered present in a vertex if X > eps. Default is 0.

match.by

Character string controlling how vertices are mapped to rows of X. One of:

  • "index" (default): treat vertices as 1-based row indices into X

  • "rownames": treat vertices as row names of X (requires rownames)

drop.missing

Logical; only relevant for match.by="rownames". If TRUE (default), silently drop vertices not found in rownames(X). If FALSE, error if any are missing.

unique

Logical; if TRUE (default), unique the resolved vertex set.

sort

Logical; if TRUE (default), sort the resolved vertex set (after uniquing).

vertices

Backward-compatible alias for object.

...

Additional arguments (currently ignored).

Value

A data.frame with columns:

  • k: integer counts of vertices with X > eps

  • p: numeric proportions k / n.vertices.mapped

Row names correspond to colnames(X).

Examples

if (FALSE) { # \dontrun{
## Using row indices
v <- c(10, 25, 30, 31)
res <- vertices.feature.carriers(v, X.rel, eps = 0)

## Using rownames(X) as vertex IDs (character)
v.ids <- c("30-00544-05", "30-00603-05")
res2 <- vertices.feature.carriers(v.ids, X.rel, match.by = "rownames")
} # }