Skip to contents

Advanced clustering analysis with marker optimization and validation. Includes optimal K selection, PCA analysis, and iterative marker selection.

Usage

ihcadvanced(
  data,
  markers,
  id = NULL,
  optimalKMethod = "silhouette",
  kRange = "2:8",
  iterativeClustering = FALSE,
  pcaAnalysis = TRUE,
  consensusClustering = FALSE,
  nBootstrap = 100,
  clusterValidation = TRUE,
  showAdvancedPlots = TRUE,
  parallelProcessing = FALSE,
  randomSeed = 123
)

Arguments

data

the data as a data frame

markers

Select IHC marker variables (e.g., ER, PR, HER2, Ki67, CD markers). Can be categorical scores (0/1+/2+/3+) or continuous values (H-scores, percentages).

id

Case identifier for tracking

optimalKMethod

Method for automatically determining optimal number of clusters

kRange

Range of K values to test (e.g., "2:8" or "2,3,4,5")

iterativeClustering

Perform iterative optimization to select most informative markers

pcaAnalysis

Perform PCA for dimensionality reduction and visualization

consensusClustering

Use bootstrap consensus clustering for stable results

nBootstrap

Number of bootstrap iterations for consensus clustering

clusterValidation

Perform multiple validation metrics (silhouette, connectivity, Dunn index)

showAdvancedPlots

Display PCA, silhouette, and validation plots

parallelProcessing

Enable parallel processing for computationally intensive tasks

randomSeed

Set random seed for reproducible results

Value

A results object containing:

results$instructionsa html
results$assumptionsa html
results$optimalKResultsa table
results$markerOptimizationa table
results$pcaResultsa table
results$pcaLoadingsa table
results$validationMetricsa table
results$consensusResultsa table
results$optimalKPlotan image
results$pcaPlotan image
results$silhouettePlotan image
results$validationPlotan image

Tables can be converted to data frames with asDF or as.data.frame. For example:

results$optimalKResults$asDF

as.data.frame(results$optimalKResults)

Examples