---
title: "Gene Report"
format:
  html:
    toc: true
    toc-expand: 2
    toc-location: left
    code-fold: true
    code-summary: "Show code"
params:
  gene: "CD70"
vignette: >
  %\VignetteIndexEntry{Gene Report}
  %\VignetteEngine{quarto::html}
  %\VignetteEncoding{UTF-8}
---

```{r setup, include = FALSE}
#| echo: false
#| results: asis
in_pkgdown <- nzchar(Sys.getenv("IN_PKGDOWN"))
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  eval = TRUE,
  message = FALSE,
  warning = FALSE,
  fig.width = 8,
  fig.height = 6
)
if (!in_pkgdown) library(targets)

# Shared vignette utilities (safe_tar_read, show_target, render helpers)
utils_path <- system.file("vignette_utils.R", package = "coMMpass")
if (utils_path == "") {
  utils_path <- if (file.exists("../inst/vignette_utils.R")) "../inst/vignette_utils.R"
  else if (file.exists("inst/vignette_utils.R")) "inst/vignette_utils.R"
  else stop("Cannot find vignette_utils.R")
}
source(utils_path, local = TRUE)

gene <- "CD70"
```

```{r pkgdown-banner}
#| results: asis
#| eval: !expr in_pkgdown
#| echo: false
cat("::: {.callout-note}\n## Online documentation\nThis vignette displays pre-computed results for the default gene (CD70). Run the targets pipeline locally for interactive gene-specific analysis.\n:::\n")
```

## `r gene` — Single Gene Characterization

This report provides a multi-faceted characterization of **`r gene`** across
the CoMMpass cohort: expression distribution, survival stratification,
cytogenetic context, and co-expression correlations.

> Generated with `gene_report("`r gene`")`. See `?gene_report` for usage.

## Expression Distribution

VST-normalized expression values across all samples, showing the distribution shape and central tendency.

```{r expression-dist.")}
#| echo: false
#| results: asis
show_target("vig_gene_expression_dist")
```

## Survival by Expression

Patients split at median `r gene` expression into High/Low groups.

```{r km-expression}
#| echo: false
#| results: asis
show_target("vig_gene_km_expression")
```

## Expression by Cytogenetic Subtype

Boxplots comparing expression levels across FISH-defined cytogenetic marker groups (t(4;14), t(14;16), del(17p)).

```{r expr-subtype}
#| echo: false
#| results: asis
show_target("vig_gene_expr_subtype")
```

## Gene-Gene Correlations

Top correlated genes with `r gene` (Pearson, VST expression).

```{r correlations}
#| echo: false
#| results: asis
show_target("vig_gene_correlations")
```

```{r top-correlation-plot}
#| echo: false
#| results: asis
show_target("vig_gene_correlation_plot")
```

## Data Sources

Results in this vignette are derived from the
[MMRF CoMMpass study](https://portal.gdc.cancer.gov/projects/MMRF-COMMPASS)
(MMRF-COMMPASS, ~1,143 patients), downloaded via
[TCGAbiolinks](https://bioconductor.org/packages/TCGAbiolinks/).
The pipeline runs with a configurable `sample_limit` (default 200; CI uses 20).

For full citations, data access tiers, and the distinction between
pipeline data and synthetic test data, see the
[Data Sources](data-sources.html) vignette.

## Recent Changes

Recent project commits with lines added, files changed, and change categories.

```{r changelog}
#| echo: false
#| results: asis
show_target("vig_git_changelog")
```

## Reproducibility

<details>
<summary>Session Info (click to expand)</summary>

```{r session-info, eval=TRUE}
sessionInfo()
```

</details>
