Contents

1 Installation

Install the package from the Bioconductor release compatible with your R installation:

if (!require("BiocManager", quietly = TRUE)) install.packages("BiocManager")
BiocManager::install("BreastSubtypeR")

Bioconductor release, Bioconductor devel, and GitHub are separate distribution channels. GitHub may contain newer development changes that are not yet available through Bioconductor. Consult the official release package page and devel package page for available versions and their R requirements. Use the R version compatible with your selected Bioconductor release or devel environment; the package’s minimum R requirement does not replace that channel’s requirements. After installing from any channel, check your installed version with packageVersion("BreastSubtypeR").

Use a separate R library and the R version required by Bioconductor devel when choosing the development channel:

BiocManager::install(version = "devel")
BiocManager::install("BreastSubtypeR")

Alternatively, install the development source from GitHub and inspect the installed package version:

if (!require("remotes", quietly = TRUE)) install.packages("remotes")
remotes::install_github("JohanHartmanGroupBioteam/BreastSubtypeR")
packageVersion("BreastSubtypeR")

2 Citing BreastSubtypeR

If you use BreastSubtypeR, please cite:

For BibTeX/LaTeX, run in R:

citation("BreastSubtypeR")

3 Brief description

Breast cancer (BC) is a biologically heterogeneous disease with intrinsic molecular subtypes (e.g., Luminal A, Luminal B, HER2-enriched, Basal-like, Normal-like) that inform biological interpretation and clinical decision-making. While clinical assays such as Prosigna provide standardized subtyping in the clinic, research implementations have proliferated and diverge in pre-processing, gene mapping, and algorithmic assumptions—reducing reproducibility and complicating cross-cohort analyses.

BreastSubtypeR consolidates multiple published gene-expression signature classifiers into a unified, assumption-aware Bioconductor package with: - a unified multi-method API (run many classifiers in one call), - AUTO mode for cohort-aware method selection, - standardized, method-specific pre-processing for multiple input types (raw counts, log2-normalized RNA-seq expression, log2-processed arrays), - Entrez ID–based probe/gene mapping, - and a local Shiny app (iBreastSubtypeR) for non-programmers.

3.1 Features

  • Unified interface for published methods: consolidates PAM50 variants, AIMS, ssBC/sspbc, and others under one consistent API.
  • Run multiple methods at once (BS_Multi): execute several classifiers in a single call and compare results side by side.
  • AUTO (cohort-aware selection): checks ER/HER2 distribution, subtype purity, and subgroup sizes; disables incompatible classifiers.
  • Method-specific pre-processing: routes raw RNA-seq counts, or log2-normalized RNA-seq/microarray/nCounter expression with RawCounts = FALSE.
  • Robust mapping: Entrez ID–based gene mapping with conflict resolution.
  • Local Shiny app (iBreastSubtypeR): point-and-click analysis; data stay on your machine.
  • Reproducibility: Bioconductor distribution, unit tests, vignettes, and SummarizedExperiment compatibility.

3.2 Implemented approaches

The package includes implementations of commonly used subtyping methods (NC-based and SSP-based):

Method id Short description Group Reference
parker.original Original PAM50 by Parker et al., 2009 NC-based Parker et al., 2009
genefu.scale PAM50 implementation as in the genefu R package (scaled version) NC-based Gendoo et al., 2016
genefu.robust PAM50 implementation as in the genefu R package (robust version) NC-based Gendoo et al., 2016
cIHC Conventional ER-balancing using immunohistochemistry (IHC) NC-based Ciriello et al., 2015
cIHC.itr Iterative version of cIHC NC-based Curtis et al., 2012
PCAPAM50 Selects IHC-defined ER subsets, then uses Principal Component Analysis (PCA) to create ESR1 expression-based ER-balancing NC-based Raj-Kumar et al., 2019
ssBC Subgroup-specific gene-centering PAM50 NC-based Zhao et al., 2015
ssBC.v2 Updated subgroup-specific gene-centering PAM50 with refined quantiles NC-based Fernandez-Martinez et al., 2020
AIMS Absolute Intrinsic Molecular Subtyping (AIMS) method SSP-based Paquet & Hallett, 2015
sspbc Single-Sample Predictors for Breast Cancer (AIMS adaptation) SSP-based Staaf et al., 2022

4 Quick start

The examples below use small example datasets shipped with the package. For your own data, provide a SummarizedExperiment with clinical metadata in colData (e.g., PatientID, ER/HER2; for ROR: TSIZE, NODE).

library(BreastSubtypeR)

# Example data
data("BreastSubtypeRobj")
data("OSLO2EMIT0obj")

1) Map & prepare (method-specific pre-processing + mapping)

# Pre-processing: automatically apply tailored normalization, map probes/IDs to Entrez,
# and (optionally) impute missing values
data_input <- Mapping(
    OSLO2EMIT0obj$se_obj,
    method = "max", # mapping strategy (example)
    RawCounts = FALSE,
    impute = TRUE,
    verbose = FALSE
)

Notes

2) Multi-method run (user-defined)

methods <- c("parker.original", "PCAPAM50", "sspbc")

res <- BS_Multi(
    data_input = data_input,
    methods = methods,
    Subtype = FALSE,
    hasClinical = FALSE
)

# Per-sample calls (rows = samples; columns = methods and entropy)
head(res$res_subtypes, 5)
#>                parker.original PCAPAM50  sspbc   entropy
#> OSLO2EMIT0.001            LumA     LumA   LumB 0.9182958
#> OSLO2EMIT0.002           Basal    Basal  Basal 0.0000000
#> OSLO2EMIT0.003            LumA     LumA   LumA 0.0000000
#> OSLO2EMIT0.004            LumA     LumA   LumA 0.0000000
#> OSLO2EMIT0.005          Normal     LumA Normal 0.9182958

3) AUTO mode (cohort-aware selection) + visualize

AUTO evaluates cohort diagnostics (for example, ER/HER2 distribution, subtype purity, and subgroup sizes) and selects methods compatible with the cohort. It disables classifiers whose distributional assumptions would likely be violated.

res_auto <- BS_Multi(
    data_input = data_input,
    methods = "AUTO",
    Subtype = FALSE,
    hasClinical = FALSE
)

# visualize multi-method output and concordance
Vis_Multi(res_auto$res_subtypes)

AUTO logic (clarifications)

Notes. Thresholds are selection gates for method eligibility; they do not force a consensus call.

Provenance & future updates. The ER+ (15) and ER− (18) cohort minimums are simulation-based defaults. ER/HER2 subgroup thresholds (approx. half of each ER total) are heuristic and may be updated as additional simulation studies are completed. For TNBC, we currently use the ER− minimum (18) as the cohort cutoff; TN-specific thresholds may likewise refined in future releases.

4) Single-method run

PAM50 (NC-based)

res_pam <- BS_parker(
    se_obj = data_input$se_NC, # object prepared for NC-based methods
    calibration = "Internal",
    internal = "medianCtr",
    Subtype = FALSE,
    hasClinical = FALSE
)

AIMS (SSP-based)

res_aims <- BS_AIMS(data_input$se_SSP)

AIMS also accepts one sample. Map that sample and retain its identifiers:

one_sample <- Mapping(OSLO2EMIT0obj$se_obj[, 1], RawCounts = FALSE)
aims_one <- BS_AIMS(one_sample$se_SSP)
aims_one$cl
#>                20    
#> OSLO2EMIT0.001 "LumB"
stopifnot(
    identical(dim(aims_one$cl), c(1L, 1L)),
    identical(rownames(aims_one$cl), colnames(one_sample$se_SSP)),
    identical(dim(aims_one$prob), c(1L, 1L)),
    identical(dim(aims_one$all.probs[["20"]]), c(1L, 5L))
)

The cl component contains subtype calls and prob contains the probabilities of those assigned calls. Both are sample-by-one matrices with sample IDs as row names; all.probs[["20"]] has one row per sample and five subtype columns. These dimensions are preserved for one or many samples.

4.1 Iterative cIHC and ER balancing

BS_cIHC.itr() defaults to 100 iterations and er_subsample = "target". Its ratio = 54 / 64 is the target number of ER-positive samples per ER-negative sample, not the ER-positive fraction used by AUTO. The ratio must be one finite, strictly positive number. Values above 1 are allowed in target mode. Write 54 / 64, not the R sequence 54:64.

Each iteration subsamples the group over-represented relative to the target, without replacement, to ceiling(ratio * n_ERneg) ER+ samples or ceiling(n_ERpos / ratio) ER- samples, retaining the other group. A cohort already at the target within this rounding is used in full. For example, the default target gives 34 ER+ : 40 ER- from 100 ER+ : 40 ER-, and 40 ER+ : 48 ER- from 40 ER+ : 100 ER-.

# Ten iterations keep this example quick; the function default is 100.
res_itr <- BS_cIHC.itr(
    se_obj = data_input$se_NC,
    iteration = 10,
    ratio = 54 / 64,
    er_subsample = "target",
    Subtype = FALSE,
    hasClinical = FALSE
)
head(res_itr$BS.all)
#>                     PatientID    BS
#> OSLO2EMIT0.001 OSLO2EMIT0.001  LumA
#> OSLO2EMIT0.002 OSLO2EMIT0.002 Basal
#> OSLO2EMIT0.003 OSLO2EMIT0.003  LumA
#> OSLO2EMIT0.004 OSLO2EMIT0.004  LumA
#> OSLO2EMIT0.005 OSLO2EMIT0.005  LumA
#> OSLO2EMIT0.006 OSLO2EMIT0.006  LumA

For reproduction of BreastSubtypeR 1.5.5 and earlier, er_subsample = "larger" subsamples the numerically larger ER group to ceiling(ratio * n_smaller), retaining the smaller group. In that legacy mode, the ratio cannot exceed n_larger / n_smaller. With the default ratio and otherwise identical inputs, seed and settings, target and legacy modes agree when ER+ samples are at least as numerous as ER- samples. This equivalence is not guaranteed for other ratios. BS_Multi(er_subsample = "larger") passes the legacy choice to cIHC.itr only; AUTO selection is unchanged.

4.2 Four- versus five-class results and ROR

NC methods retain their five-class calls and add a four-class call when Subtype = TRUE. BS_Multi() likewise always returns the five-class table res_subtypes; Subtype = TRUE adds res_subtypes.Subtype. Both tables have sample IDs as row names, one column per method and an entropy column. AIMS is a five-class predictor with no four-class model: its Normal calls are set to NA only in the four-class multi-method summary. The original AIMS calls are retained in the five-class summary and per-method results. SSPBC uses its four-class ssp.subtype model for the four-class summary.

NC methods return ROR-S and ROR-P scores and risk groups in score.ROR without requiring clinical covariates. Setting hasClinical = TRUE adds ROR-C/ROR-PC outputs using numeric TSIZE (0 for at most 2 cm, 1 for more than 2 cm) and NODE (0 for no positive nodes, otherwise the number of positive nodes) in colData. Method-specific return components are documented in their help pages. These are research-use outputs, not a clinical assay result.

5 Guidance & best practices

5.1 Input types

  • Provide one of the following as input:
    • raw counts plus gene lengths (for internal calculation of CPM/FPKM),
    • log2-normalized RNA-seq expression (for example, log2(FPKM+1)),
    • log2-processed microarray/nCounter matrices (e.g., RMA).
  • Set RawCounts = TRUE for raw RNA-seq counts with gene lengths in the Length annotation column. With RawCounts = FALSE, supply log2-normalized expression: it is used directly for NC methods and back-transformed with 2^x for SSP methods. This setting does not detect or log-transform a supplied linear FPKM/TPM matrix.
  • Include probe and ENTREZID in rowData, and sample identifiers in colData$PatientID matching the assay columns. Receptor fields are required by AUTO and methods that use them; see ?Mapping for their accepted coding.
  • BreastSubtypeR routes the supplied input to the appropriate, method-specific pre-processing pipeline — see ?Mapping, ?BS_Multi and Methods (Section 2.3) in the paper for details.

5.2 When to use AUTO

  • Use methods = "AUTO" (i.e. BS_Multi(methods = "AUTO", ...)) for exploratory datasets or cohorts of unknown / skewed composition.
  • Use AUTO when you want the package to select only classifiers compatible with the cohort (it disables methods whose assumptions appear violated).
  • For validation against a single published method or a clinical assay (e.g., Prosigna®), run the corresponding single-method implementation directly (e.g., BS_parker()).

5.3 Interpretation

  • AUTO is designed to avoid misapplication of NC-based classifiers when cohort assumptions are violated; it does not produce a forced consensus label.

6 Shiny app

For users new to R, we offer an intuitive Shiny app for interactive molecular subtyping.

6.1 Launch the local Shiny app

BreastSubtypeR::iBreastSubtypeR() # interactive GUI (local)

If needed, install UI dependencies and re-run:

install.packages(c("shiny", "bslib"))

The app runs locally; no data leave your machine.

What you can do:
- Upload expression, clinical, and feature-annotation tables (clinical lives in colData).
- Run single methods, or run multiple classifiers at once with BS_Multi and AUTO enabled for cohort-aware selection.
- Choose 5-class (incl. Normal-like) or 4-class (AIMS is 5-class only).
- Inspect per-sample concordance (entropy), heatmap and pie summaries.
- Export current Calls-only results, or Full metrics for supported single NC methods. AUTO, AIMS and sspbc provide Calls-only exports. NC Full metrics include ROR-S/ROR-P; enabling Use clinical variables (ROR) with valid numeric TSIZE/NODE adds clinical ROR-C/ROR-PC outputs. AUTO exports calls and entropy with clinical ROR disabled.

6.2 Preprocessing, prediction and downloads

Upload all three tables: expression with feature IDs in the first column and sample IDs as column names, clinical metadata with PatientID, and annotation with probe and ENTREZID. The application aligns overlapping sample and feature identifiers. Choose normalized log2 expression or raw RNA-seq counts; raw-count annotation must also contain gene lengths in Length (bp). Alternatively, load the bundled example below. Click Preprocess & map, select a method and its settings, then run subtyping.

Replacing any expression, clinical or annotation file, reloading the example, or changing the data type clears the mapped inputs, predictions, plots and downloads. Preprocess and run again. Changes to relevant prediction settings clear old predictions, plots and downloads but retain valid mapped inputs when no remapping is needed. A failed prediction also clears previous results.

Before a current successful prediction exists, the app asks you to run subtyping and offers no active download control. A successful run restores its plots and supported export choices. Unsupported Full metrics exports are identified explicitly. Server-side checks also reject direct requests to old download URLs after invalidation; an intentional HTTP 500 rejection from such a URL does not mean the Shiny session has disconnected.

For Shiny cIHC.itr, the ratio follows target-mode semantics above. Iterations default to 100, with a minimum of 10 and a control step of 10. Any whole number from 10 through 2147483647 is accepted, including 11; the step is not a multiple-of-ten requirement. Missing, nonnumeric, nonfinite, fractional or out-of-range iterations, and missing, nonnumeric, nonfinite or nonpositive ratios, produce an actionable error without disconnecting the session. Correct the setting and rerun without reloading the page or remapping valid inputs. These Shiny input checks do not change the underlying R API or its default settings.

6.3 Example data (for Shiny & scripts)

The Shiny UI provides a “Load example data…” button that preloads a small demo cohort (expression, clinical, annotation). After loading, click Preprocess & map (Step 1), then proceed to analyses (Step 2).

Programmatic access to the same files:

exdir <- system.file("RshinyTest", package = "BreastSubtypeR")
gex <- file.path(exdir, "OSLO2EMIT0_GEX_log2.FPKM.txt")
clin <- file.path(exdir, "OSLO2EMIT0_clinical.txt")
anno <- file.path(exdir, "OSLO2EMIT0_anno.txt")
file.exists(gex)
file.exists(clin)
file.exists(anno)

7 Limitations

BreastSubtypeR harmonises many published, signature-based classifiers but has known limitations:

8 Appendix

8.2 References

  • Yang Q., Hartman J., Sifakis E.G. (2025). BreastSubtypeR: a unified R/Bioconductor package for intrinsic molecular subtyping in breast cancer research. NAR Genomics and Bioinformatics, 7(4):lqaf131. https://doi.org/10.1093/nargab/lqaf131

  • Parker JS, Mullins M, Cheang MCU, Leung S, Voduc D, Vickery T, et al. (2009). Supervised risk predictor of breast cancer based on intrinsic subtypes. J Clin Oncol, 27(8):1160–1167. https://doi.org/10.1200/JCO.2008.18.1370

  • Gendoo DMA, Ratanasirigulchai N, Schröder MS, Pare L, Parker JS, Prat A, Haibe-Kains B. (2016). Genefu: an R/Bioconductor package for computation of gene expression-based signatures in breast cancer. Bioinformatics, 32(7):1097–1099. https://doi.org/10.1093/bioinformatics/btv693

  • Ciriello G, Gatza ML, Beck AH, Wilkerson MD, Rhie SK, Pastore A, et al. (2015). Comprehensive molecular portraits of invasive lobular breast cancer. Cell, 163(2):506–519. https://doi.org/10.1016/j.cell.2015.09.033

  • Curtis C, Shah SP, Chin S-F, Turashvili G, Rueda OM, Dunning MJ, et al. (2012). The genomic and transcriptomic architecture of 2,000 breast tumors reveals novel subgroups. Nature, 486:346–352. https://doi.org/10.1038/nature10983

  • Raj-Kumar PK, Liu J, Hooke JA, Kovatich AJ, Kvecher L, Shriver CD, Hu H. (2019). PCA-PAM50 improves subtype assignment in ER-positive breast cancer. Sci Rep, 9:14386. https://doi.org/10.1038/s41598-019-44339-4

  • Zhao X, Rodland EA, Tibshirani R, Edvardsen H, Sauer T, Hovig E. (2015). Systematic evaluation of subtype prediction using gene expression profiles and intrinsic subtyping methods. Breast Cancer Res, 17:55. https://doi.org/10.1186/s13058-015-0520-4

  • Fernandez-Martinez A, Krop IE, Hillman DW, Polley M-YC, Parker JS, Huebner L, et al. (2020). Survival, pathologic response, and PAM50 subtype in stage II–III HER2-positive breast cancer treated with neoadjuvant chemotherapy and trastuzumab ± lapatinib. J Clin Oncol, 38(19):2140–2150. https://doi.org/10.1200/JCO.20.01276

  • Paquet ER, Hallett MT. (2015). Absolute assignment of breast cancer intrinsic molecular subtype. J Natl Cancer Inst, 107(1):357. https://doi.org/10.1093/jnci/dju357

  • Staaf J, Ringnér M, Vallon-Christersson J. (2022). Simple single-sample predictors for breast cancer subtype identification using gene expression data. npj Breast Cancer, 8:104. https://doi.org/10.1038/s41523-022-00465-3

8.3 Session information

sessionInfo()
#> R version 4.6.1 (2026-06-24)
#> Platform: x86_64-pc-linux-gnu
#> Running under: Ubuntu 24.04.5 LTS
#> 
#> Matrix products: default
#> BLAS:   /home/biocbuild/bbs-3.24-bioc/R/lib/libRblas.so 
#> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.12.0  LAPACK version 3.12.0
#> 
#> locale:
#>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=en_GB              LC_COLLATE=C              
#>  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
#>  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
#> 
#> time zone: America/New_York
#> tzcode source: system (glibc)
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] BreastSubtypeR_1.5.7 BiocStyle_2.41.0    
#> 
#> loaded via a namespace (and not attached):
#>  [1] SummarizedExperiment_1.43.0 gtable_0.3.6               
#>  [3] impute_1.87.0               circlize_0.4.18            
#>  [5] shape_1.4.6.1               rjson_0.2.23               
#>  [7] xfun_0.62                   bslib_0.12.0               
#>  [9] ggplot2_4.0.3               GlobalOptions_0.1.4        
#> [11] ggrepel_0.9.8               Biobase_2.73.2             
#> [13] lattice_0.23-1              Cairo_1.7-0                
#> [15] vctrs_0.7.3                 tools_4.6.1                
#> [17] generics_0.1.4              stats4_4.6.1               
#> [19] parallel_4.6.1              proxy_0.4-29               
#> [21] tibble_3.3.1                cluster_2.1.8.3            
#> [23] pkgconfig_2.0.3             Matrix_1.7-6               
#> [25] data.table_1.18.6.1         RColorBrewer_1.1-3         
#> [27] S7_0.2.2                    S4Vectors_0.51.10          
#> [29] lifecycle_1.0.5             compiler_4.6.1             
#> [31] farver_2.1.2                stringr_1.6.0              
#> [33] tinytex_0.61                Seqinfo_1.3.2              
#> [35] codetools_0.2-20            ComplexHeatmap_2.29.0      
#> [37] clue_0.3-68                 class_7.3-24               
#> [39] htmltools_0.5.9             sass_0.4.10                
#> [41] yaml_2.3.12                 pillar_1.11.1              
#> [43] crayon_1.5.3                jquerylib_0.1.4            
#> [45] cachem_1.1.0                DelayedArray_0.39.8        
#> [47] magick_2.9.1                iterators_1.0.14           
#> [49] abind_1.4-8                 foreach_1.5.2              
#> [51] tidyselect_1.2.1            digest_0.6.39              
#> [53] stringi_1.8.9               dplyr_1.2.1                
#> [55] bookdown_0.48               fastmap_1.2.0              
#> [57] grid_4.6.1                  SparseArray_1.13.4         
#> [59] colorspace_2.1-4            cli_3.6.6                  
#> [61] magrittr_2.0.5              S4Arrays_1.13.2            
#> [63] dichromat_2.0-1             e1071_1.7-17               
#> [65] withr_3.0.3                 scales_1.4.0               
#> [67] XVector_0.53.0              rmarkdown_2.32             
#> [69] matrixStats_1.5.0           otel_0.2.0                 
#> [71] png_0.1-9                   GetoptLong_1.1.1           
#> [73] evaluate_1.0.5              knitr_1.52                 
#> [75] GenomicRanges_1.65.4        IRanges_2.47.5             
#> [77] doParallel_1.0.17           rlang_1.3.0                
#> [79] Rcpp_1.1.2                  glue_1.8.1                 
#> [81] BiocManager_1.30.27         BiocGenerics_0.59.12       
#> [83] jsonlite_2.0.0              R6_2.6.1                   
#> [85] MatrixGenerics_1.25.0