Folioevanzhou.org
← 返回 Tessera
原样9.2 万 行 × 12 列12.9 MB3 列有缺失数据 2026-04-17

gene_ref_human

Ensembl gene annotation for human, mapping gene IDs to symbols, biotypes and genomic positions.

One row represents one gene, repeated when it maps to several Entrez IDs.

Ensembl · 收录于 2026-04-17

下载 CSV · 12.9 MB
数据预览前 6 行
ensembl_idsymbolentrez_idgene_typechromosomestartendstranddescriptionspeciesensembl_versiondownload_date
ENSG00000210049MT-TFNAMt_tRNAMT5776471mitochondrially encoded tRNA-Phe (UUU/C) [Source:HGNC Symbol;Acc:HGNC:7481]human1152026-04-17
ENSG00000211459MT-RNR1NAMt_rRNAMT6481,6011mitochondrially encoded 12S rRNA [Source:HGNC Symbol;Acc:HGNC:7470]human1152026-04-17
ENSG00000210077MT-TVNAMt_tRNAMT1,6021,6701mitochondrially encoded tRNA-Val (GUN) [Source:HGNC Symbol;Acc:HGNC:7500]human1152026-04-17
ENSG00000210082MT-RNR2NAMt_rRNAMT1,6713,2291mitochondrially encoded 16S rRNA [Source:HGNC Symbol;Acc:HGNC:7471]human1152026-04-17
ENSG00000209082MT-TL1NAMt_tRNAMT3,2303,3041mitochondrially encoded tRNA-Leu (UUA/G) 1 [Source:HGNC Symbol;Acc:HGNC:7490]human1152026-04-17
ENSG00000198888MT-ND14,535protein_codingMT3,3074,2621mitochondrially encoded NADH:ubiquinone oxidoreductase core subunit 1 [Source:HGNC Symbol;Acc:HGNC:7455]human1152026-04-17
变量12 列
字符型7整数5
类型
#变量类型缺失统计
1ensembl_idEnsembl gene ID.字符型—不同值 86369ENSG00000274917 · ENSG00000276700 · ENSG00000275215 · ENSG00000278189 · ENSG00000278233 · ENSG00000288387 · ENSG00000288326 · ENSG00000273730
2symbolkeyHGNC gene symbol.字符型40268不同值 41365RNA5-8SN3 · RNA5-8SN1 · RNA5-8SN5 · RNA5-8SN4 · RNA5-8SN2 · RNA5S3 · RNA5S1 · RNA5S2
3entrez_idNCBI Entrez gene ID.整数54923min 1q1 —中位 146,058均值 3.8e+7q3 —max 1.4e+8
4gene_typeEnsembl biotype.字符型—不同值 38lncRNA · protein_coding · processed_pseudogene · rRNA · unprocessed_pseudogene · misc_RNA · snRNA · miRNA
5chromosomeChromosome name, scaffolds included, stored as text.字符型—不同值 5281 · 2 · 6 · 11 · 3 · 5 · 7 · 17
6startGene start position in base pairs.整数—min 1q1 —中位 5.3e+7均值 6.8e+7q3 —max 2.5e+8
7endGene end position in base pairs.整数—min 107.0q1 —中位 5.3e+7均值 6.8e+7q3 —max 2.5e+8
8strand1 is forward. -1 is reverse.整数—min -1q1 —中位 1均值 0.0122q3 —max 1
9descriptionEnsembl gene description.字符型854不同值 51314novel transcript · Y RNA [Source:RFAM;Acc:RF00019] · TEC · 5.8S ribosomal RNA [Source:RFAM;Acc:RF00002] · novel protein · RNA, 5.8S ribosomal N3 [Source:HGNC Symbol;Acc:HGNC:53525] · RNA, 5.8S ribosomal N1 [Source:HGNC Symbol;Acc:HGNC:53517] · novel pseudogene
10speciesEnsembl species key.字符型—不同值 1human
11ensembl_versionEnsembl release this snapshot came from.整数—min 115.0q1 —中位 115.0均值 115.0q3 —max 115.0
12download_dateDate this snapshot was fetched.字符型—不同值 12026-04-17
载入已写好列类型
library(readr)

gene_ref_human <- read_csv(
  "https://assets.evanzhou.org/tessera/csv/gene_ref_human.csv",
  col_types = cols(
    ensembl_id      = col_character(),
    symbol          = col_character(),
    entrez_id       = col_integer(),
    gene_type       = col_character(),
    chromosome      = col_character(),
    start           = col_integer(),
    end             = col_integer(),
    strand          = col_integer(),
    description     = col_character(),
    species         = col_character(),
    ensembl_version = col_integer(),
    download_date   = col_character()
  )
)
URLhttps://assets.evanzhou.org/tessera/csv/gene_ref_human.csv

Source

Ensembl 的人类基因注释,用 evanverse::download_gene_ref("human") 导出,脚本只做两件事:核对十二个列都在,然后按固定顺序写出 CSV。所以这份数据的口径完全等于 Ensembl release 115 的口径。

ensembl_id 不是唯一键。 91703 行里只有 86369 个不同的 ID——5334 行是扇出来的,原因只有一个:同一个 Ensembl 基因映射到多个 Entrez ID(除 entrez_id 外其余列完全相同)。拿它做 join 会静默地把左表放大,而且不报错。只要 Entrez 那一列,就先 distinct(ensembl_id, .keep_all = TRUE);要保留全部映射,就明确知道自己在做一对多。

symbol 缺 40268 个。 四成多的条目没有基因符号——大量 lncRNA、假基因、TEC 条目在 Ensembl 里只有 ID 没有 symbol。拿 symbol 做 ID 转换会静默丢掉这四成,这是这份数据最大的坑。做映射前先看有效行数。entrez_id 缺得更多,六成——Ensembl 到 Entrez 的映射本来就不是满射,别指望 join 得上。

chromosome 有 528 个不同值。 不是 25 个——除了 1–22、X、Y、MT,还有几百条 scaffold(KI270728.1 那种)。这一列也因此是字符型不是整数,排序时 "10" 会排在 "2" 前面。

species / ensembl_version / download_date 三列是常量,join 时无用,但留着能让人知道这份快照的来路。

Use cases

它主要是查表用的,能画的图不多但有几个很典型:

  • 排序条形图:gene_type 的构成,38 类,protein_coding 只占一小部分
  • 染色体密度图:按 chromosome 分组、用 start 定位的基因密度
  • 直方图:基因长度(end − start)的分布,跨度极大,要取对数

按染色体作图前必须先筛掉 scaffold,否则 x 轴会长出几百个刻度。gene_type 的 38 类也超出任何一套定性配色的容量——画之前先合并成几大类(编码 / 假基因 / 非编码 RNA / 其他),否则颜色不够用,图也读不了。

生成脚本R · 47 行
# 产物写到 ../csv/gene_ref_human.csv —— 脚本和 CSV 是 content/tessera/data/ 下固定的兄弟目录,
# 所以按脚本自身定位,不依赖你在哪个目录敲这条命令。csv/ 不进仓库(见 .gitignore)。
#
# Rscript 时路径在 --file= 里,source() 时在 sys.frame()$ofile 里,两种都要认:
# 只取其中一种的话,另一种跑法会静默地把 CSV 写到当前目录去。
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", "gene_ref_human.csv")
dir.create(dirname(out_csv), recursive = TRUE, showWarnings = FALSE)

# Generate the human gene reference dataset for Tessera.
# Rscript content/tessera/data/script/gene_ref_human.R



gene_ref <- evanverse::download_gene_ref("human")

expected_cols <- c(
  "ensembl_id",
  "symbol",
  "entrez_id",
  "gene_type",
  "chromosome",
  "start",
  "end",
  "strand",
  "description",
  "species",
  "ensembl_version",
  "download_date"
)

missing_cols <- setdiff(expected_cols, names(gene_ref))
if (length(missing_cols) > 0L) {
  stop(
    "download_gene_ref() output is missing columns: ",
    paste(missing_cols, collapse = ", ")
  )
}

gene_ref <- gene_ref[, expected_cols]
utils::write.csv(gene_ref, out_csv, row.names = FALSE, na = "")

message("Wrote ", out_csv, " with ", nrow(gene_ref), " rows and ", ncol(gene_ref), " columns.")

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