# GRIN2 2.1.0

## New features

- Added exon-level target-size modeling to `grin.stats()` for user-selected lesion types through the new `exons.annotation`, `exon.chrom.size`, and `exon_level` arguments. Lesion types not selected for exon-level modeling continue to use conventional gene- and chromosome-level target sizes, allowing both approaches to be used in the same analysis.
- Added `grin.logRank()` for gene-level association analyses between genomic lesion groups and time-to-event outcomes using gene-by-subject lesion-group matrices, such as those generated by `prep.lsn.type.matrix()`. This function complements the existing `grin.assoc.lsn.outcome()` workflow for binary gene-lesion matrices generated by `prep.binary.lsn.mtx()` to evaluate associations with binary and time-to-event outcomes through logistic regression and Cox proportional hazards models, respectively.
- Added `grin.assoc.expr.outcome()` for gene-level association analyses between gene expression and clinical outcomes. The function fits Cox proportional hazards models for time-to-event outcomes and logistic regression models for binary outcomes, with optional covariate adjustment.

## Improvements

- Updated the `grin.stats()` pipeline so that selected lesion types can be modeled using the annotated exon target size of each gene together with the total annotated exonic target size of the corresponding chromosome. This approach is especially useful when analyses are restricted to protein-altering exonic variants, such as missense, nonsense, and coding frameshift variants, and for studies based on whole-exome sequencing. Other lesion types can continue to use conventional gene- and chromosome-level target sizes within the same analysis.
- Updated `get.ensembl.annotation()` to retrieve versioned, pre-generated GRCh38 Ensembl annotation bundles containing gene, exon, and regulatory-element annotations. Downloaded resources can be cached locally, are verified using MD5 checksums, and are reused when valid, reducing dependence on live Ensembl BioMart availability and improving reproducibility.
- Updated `lsn.transcripts.plot()` to support flexible gene-centered and user-defined regional plots, transcript selection and labeling, improved rendering of point-like and interval-like lesions, refined track layout and alignment, customizable lesion colors, and expanded plotting controls.
- Updated `onco.print.props()` to preserve user-specified color palettes.
- Updated `grin.oncoprint.mtx()` to use Ensembl gene IDs when gene symbols are unavailable, preserve user-specified gene order, and ensure unique gene labels in OncoPrint matrices.
- Updated `write.grin.xlsx()` to exclude the `gene.lsn.data` worksheet, reducing workbook size and improving export performance.
- Standardized and clarified the `expr.mtx` documentation across expression-analysis functions, including the expected gene-by-subject orientation, identifier requirements, and numeric expression-value requirements.

## Data and annotations

- Added the package data objects `grin.results`, `example_exon_annotation`, and `hg38_exon_chrom_size` to support examples of transcript visualization and exon-level GRIN analysis.

## Bug fixes

- Improved the constellation-analysis workflow by updating `p.order()` to handle single-column inputs correctly, preventing errors when a lesion dataset contains only one lesion type.

# GRIN2 2.0.0

## Major updates

- Significant improvements to the `prob.hits()` function, greatly enhancing the performance and speed of probability convolution calculations for measuring statistical significance of lesion frequencies.
- Removed the `row.bern.conv()` function and introduced `pbc()` and `rpbc()`, which compute the probability that a series of independent Bernoulli trials yields *x* or more successes.
- Improved compatibility with the Human GRCh38 (hg38) genome assembly.
- Some packages that handle Human GRCh37 (hg19) assembly annotations are either outdated or have platform compatibility issues. Therefore, the support for hg19 has been discontinued in `get.ensembl.annotation()` and `lsn.transcripts.plot()`. These functions now exclusively support hg38, and users are encouraged to convert their lesion data coordinates to hg38 before running GRIN2 analyses.

## New features

- Enhanced error handling with informative messages for missing annotations or data inputs.
- Added a new vignette, `GRIN2`, which demonstrates the package's preprocessing, analysis, and plotting capabilities.

## Data and Annotation

- Included bundled datasets for GRCh38: `lesion_data`, `expr_data`, `hg38_gene_annotation`, `hg38_chrom_size`, and `hg38_cytoband`.
- Ensembl and regulatory annotations are retrieved directly from Ensembl BioMart v110 with graceful fallback mechanisms.

## Bug fixes and improvements

- Improved Roxygen documentation for better CRAN compliance.
- `get.ensembl.annotation()` and `get.chrom.length()` now handle database connection issues with informative error messages.
- Fixed minor bugs in `genomewide.lsn.plot()`, specifically regarding color assignment for lesion groups when not automatically specified by `default.grin.colors()`.
