← 返回 Tessera
模拟648 行 × 534 KB1 列有缺失数据 2026-09-02

expression_heatmap

Simulated log-expression for 36 genes across 18 normal and tumour samples, with three pathway-level response patterns.

One row represents one gene measured in one sample.

Tessera · 收录于 2026-09-02

下载 CSV · 34 KB
数据预览6
genesampleexpressionpathwaytype
CC_G01Sample016.19Cell cycleNormal
CC_G01Sample02NACell cycleNormal
CC_G01Sample035.28Cell cycleNormal
CC_G01Sample046.71Cell cycleNormal
CC_G01Sample056.55Cell cycleNormal
CC_G01Sample066.27Cell cycleNormal
变量5
字符型4双精度1
类型
#变量类型缺失统计
1geneSynthetic gene identifier; prefixes identify the simulated pathway family.字符型不同值 36CC_G01 · CC_G02 · CC_G03 · CC_G04 · CC_G05 · CC_G06 · CC_G07 · CC_G08
2sampleSynthetic sample identifier.字符型不同值 18Sample01 · Sample02 · Sample03 · Sample04 · Sample05 · Sample06 · Sample07 · Sample08
3expressionkeySimulated log-expression value. Six fixed cells are missing.双精度6min 2.46q1 中位 6.38均值 6.31q3 max 10.1
4pathwaySimulated pathway assigned to the gene.字符型不同值 3Cell cycle · Immune response · Lipid metabolism
5typeSample type; Normal or Tumor.字符型不同值 2Normal · Tumor
载入已写好列类型
library(readr)

expression_heatmap <- read_csv(
  "https://assets.evanzhou.org/tessera/csv/expression_heatmap.csv",
  col_types = cols(
    gene       = col_character(),
    sample     = col_character(),
    expression = col_double(),
    pathway    = col_character(),
    type       = col_character()
  )
)
URLhttps://assets.evanzhou.org/tessera/csv/expression_heatmap.csv

Source

为表达矩阵热图生成的模拟数据。36 个模拟基因在 18 个样本中形成 648 行长表;Normal 与 Tumor 各 9 个样本。基因分属 Cell cycle、Immune response 和 Lipid metabolism 三条模拟通路。

数据包含基因基线、样本偏移和观测噪声。Tumor 样本中的 Cell cycle 整体升高、Immune response 中度升高、Lipid metabolism 整体降低,同时保留基因和样本之间的差异。所有数值均为模拟值,不对应真实基因或生物学分析。

六个固定位置设为缺失,用于演示热图中的 NA。绘图时可将长表转换为 gene × sample 矩阵,并按基因进行 z-score;原始 CSV 保留模拟的 log-expression。

Use cases

  • 基因 × 样本表达矩阵热图
  • 行列聚类及通路、样本类型注释
  • 按 pathway 和 type 分块
  • 比较原始表达量与逐基因 z-score 色阶
生成脚本R · 63
# Generate the expression-matrix toy data used by heatmap recipes.
script_dir <- local({
  arg <- grep("^--file=", commandArgs(trailingOnly = FALSE), value = TRUE)
  path <- if (length(arg)) sub("^--file=", "", arg[[1L]]) else sys.frame(1)$ofile
  dirname(normalizePath(path, mustWork = TRUE))
})
out_csv <- file.path(script_dir, "..", "csv", "expression_heatmap.csv")
dir.create(dirname(out_csv), recursive = TRUE, showWarnings = FALSE)

set.seed(20260902)

pathways <- data.frame(
  prefix = c("CC", "IR", "LM"),
  pathway = c("Cell cycle", "Immune response", "Lipid metabolism"),
  tumor_effect = c(1.60, 0.90, -1.30)
)

genes <- do.call(rbind, lapply(seq_len(nrow(pathways)), function(i) {
  data.frame(
    gene = sprintf("%s_G%02d", pathways$prefix[i], seq_len(12L)),
    pathway = pathways$pathway[i],
    gene_baseline = rnorm(12L, mean = 6, sd = 0.65),
    tumor_effect = pathways$tumor_effect[i] + rnorm(12L, 0, 0.18)
  )
}))

samples <- data.frame(
  sample = sprintf("Sample%02d", seq_len(18L)),
  type = rep(c("Normal", "Tumor"), each = 9L),
  sample_offset = rnorm(18L, mean = 0, sd = 0.28)
)

expression_heatmap <- merge(
  genes[, c("gene", "pathway", "gene_baseline", "tumor_effect")],
  samples,
  by = NULL
)

# Three coherent pathway blocks, with gene-, sample-, and observation-level
# variation. The values are synthetic log-expression, not biological results.
expression_heatmap$expression <- with(
  expression_heatmap,
  gene_baseline + sample_offset +
    ifelse(type == "Tumor", tumor_effect, 0) +
    rnorm(nrow(expression_heatmap), mean = 0, sd = 0.45)
)

# Fixed missing cells make NA rendering reproducible without weakening any
# entire gene or sample enough to prevent clustering.
missing_cells <- c(37L, 146L, 255L, 364L, 473L, 582L)
expression_heatmap$expression[missing_cells] <- NA_real_

expression_heatmap <- expression_heatmap[, c(
  "gene", "sample", "expression", "pathway", "type"
)]
expression_heatmap <- expression_heatmap[order(
  match(expression_heatmap$gene, genes$gene),
  match(expression_heatmap$sample, samples$sample)
), ]
expression_heatmap$expression <- round(expression_heatmap$expression, 4)
rownames(expression_heatmap) <- NULL

write.csv(expression_heatmap, out_csv, row.names = FALSE, na = "NA")

表中统计由 scripts/profile_dataset.py 于 2026-09-02 数出。