Skip to contents

Identifies significant feature cells using Grad-CAM data either with visualization (gating mode) or as a lightweight operation using pre-converted images (base mode).

Usage

inverseGradCAM(
  x = NULL,
  results = NULL,
  feature_matrix,
  mode = c("gating", "base"),
  percentile = 0.9,
  n_resolution = 100,
  transpose = TRUE,
  filename = NULL,
  ncol = 2,
  nrow = 2
)

Arguments

x

TockyPrepData object (required for "gating" mode)

results

convert_to_image output (required for "base" mode)

feature_matrix

Feature intensity matrix from Grad-CAM analysis

mode

Operation mode ("gating" for visualization, "base" for lightweight analysis)

percentile

Significance threshold percentile (0-1). If NULL, grad-CAM values will be returned, instead of feature cell designation.

n_resolution

Binning resolution (for "gating" mode only)

transpose

Logical Whether to tranpose feature_matrix input. Note that TockyConvNetPy output Grad-CAM matrix for feature_matrix typically needs to be transposed. The default is TRUE.

filename

Optional PDF output path (for "gating" mode only)

ncol

The number of the columns for the output plot

nrow

The number of the rows for the output plot

Value

A binary numeric vector (1/0) for feature and other cells. If `percentile = NULL`, grad-CAM values are returned as a numeric vector.

Examples

if (FALSE) { # \dontrun{
# Gating mode with visualization
out <- inverseGradCAM(mode = "gating", x = prep_data,
                         feature_matrix = cam_matrix, filename = "output.pdf")

# Base mode with pre-converted results
img_data <- convert_to_image(merged_data)
out <- inverseGradCAM(mode = "base", results = img_data,
                         feature_matrix = cam_matrix)
} # }