{"id":51891483,"url":"https://github.com/rainoffallingstar/seq2mat","last_synced_at":"2026-07-26T04:30:40.341Z","repository":{"id":371808449,"uuid":"1163128121","full_name":"rainoffallingstar/seq2mat","owner":"rainoffallingstar","description":null,"archived":false,"fork":false,"pushed_at":"2026-07-25T12:14:49.000Z","size":7220,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-07-25T14:06:34.541Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rainoffallingstar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-21T06:10:17.000Z","updated_at":"2026-07-25T12:14:56.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/rainoffallingstar/seq2mat","commit_stats":null,"previous_names":["rainoffallingstar/htseq2matrix-go","rainoffallingstar/seq2mat"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/rainoffallingstar/seq2mat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rainoffallingstar%2Fseq2mat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rainoffallingstar%2Fseq2mat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rainoffallingstar%2Fseq2mat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rainoffallingstar%2Fseq2mat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rainoffallingstar","download_url":"https://codeload.github.com/rainoffallingstar/seq2mat/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rainoffallingstar%2Fseq2mat/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35901460,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"online","status_checked_at":"2026-07-26T02:00:06.503Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-07-26T04:30:39.179Z","updated_at":"2026-07-26T04:30:40.335Z","avatar_url":"https://github.com/rainoffallingstar.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# seq2mat\n\nGo实现的高性能HTSeq表达矩阵转换工具，将HTSeq输出文件转换为基因表达矩阵。\n\n## 功能特点\n\n- **单文件分发** - 基因数据库内嵌于二进制文件中，无需外部依赖\n- **无R依赖** - 纯Go实现，无需CGO\n- **高性能** - 比R版本快5-10倍\n- **跨平台** - 支持Windows/Linux/macOS交叉编译\n\n## 快速开始\n\n### 下载使用\n\n下载对应平台的二进制文件后直接运行：\n\n```bash\n# 人类数据\nseq2mat --htseq_dir /path/to/htseq --output_dir /path/to/output\n\n# 小鼠数据\nseq2mat --htseq_dir /path/to/htseq --postfix \"_mouse.txt\" --output_dir /path/to/output\n```\n\n### 从源码构建\n\n```bash\n# 1. 准备CSV基因映射文件（仅需首次）\ncp /path/to/seq2mat/data/*.rda data/\nRscript convert_rda_to_csv.R\ncp data/gene_mapping_*.csv internal/database/\n\n# 2. 编译（数据库将自动嵌入）\ngo build -o seq2mat ./cmd/seq2mat\n```\n\n## 命令行参数\n\n| 参数 | 必需 | 默认值 | 说明 |\n|------|------|--------|------|\n| `--htseq_dir` | 是 | - | HTSeq文件所在目录 |\n| `--postfix` | 否 | `_human.txt` | 文件后缀模式（小鼠数据使用 `_mouse.txt`） |\n| `--output_dir` | 是 | - | 输出目录 |\n\n## 输出文件\n\n- `matrix_count.txt` - 原始计数矩阵\n- `matrix_norm.txt` - log2标准化矩阵 (log2(x+1))\n- `matrix_manifest.json` - 矩阵生成参数、基因映射来源和转换统计\n\n两个矩阵文件均为TSV格式，首列为基因符号，其余列为样本。manifest 使用 seq2mat\n自有 schema：顶层为 `seq2mat.matrix/1.0.0`，其中 `mapping` 字段为\n`seq2mat.mapping/1.0.0`。这些标识不是外部 HTSeq 标准；HTSeq 在本文中仅指输入格式。\n旧产品 schema 不再生成，也不提供兼容路径。\n\n## 数据处理流程\n\n1. 读取HTSeq文件（匹配后缀模式）\n2. 合并样本（按Gene ID左连接）\n3. 基因ID转换（人类：ENSEMBL→SYMBOL，小鼠：UNIPROT→SYMBOL）\n4. 聚合重复（取每个基因符号的最大值）\n5. 过滤无效行（移除零/NA/-Inf行）\n6. 标准化（应用log2(x+1)转换）\n\n## 交叉编译\n\n```bash\n# Linux\nGOOS=linux GOARCH=amd64 go build -o seq2mat-linux ./cmd/seq2mat\n\n# Windows\nGOOS=windows GOARCH=amd64 go build -o seq2mat.exe ./cmd/seq2mat\n\n# macOS Intel\nGOOS=darwin GOARCH=amd64 go build -o seq2mat-mac-intel ./cmd/seq2mat\n\n# macOS Apple Silicon\nGOOS=darwin GOARCH=arm64 go build -o seq2mat-mac-arm64 ./cmd/seq2mat\n```\n\n## 数据库模式\n\n程序支持两种数据库模式：\n\n### 内嵌数据库（默认）\n\n基因数据库编译时嵌入二进制文件，实现单文件分发。\n\n运行时显示：\n```\nUsing embedded gene database\nNote: Using embedded gene database (built into binary)\n```\n\n### 外部CSV文件（开发/自定义）\n\n开发或需要自定义数据库时，在 `data/` 目录放置CSV文件：\n```\ndata/\n├── gene_mapping_human.csv\n└── gene_mapping_mouse.csv\n```\n\n## 项目结构\n\n```\nseq2mat/\n├── cmd/seq2mat/main.go       # 入口\n├── internal/\n│   ├── htseq/                    # HTSeq文件读取\n│   ├── processor/                 # 数据处理流程\n│   ├── database/                 # 基因数据库（含内嵌CSV）\n│   └── output/                   # 输出写入\n├── pkg/dataframe/                # DataFrame操作\n├── convert_rda_to_csv.R          # RDA转CSV脚本\n└── README.md\n```\n\n## 与R版本差异\n\n- 无RDS输出（仅TSV格式，R可通过 `read.delim()` 读取）\n- 单文件分发（无需安装R或依赖）\n- 纯Go实现（无CGO依赖）\n\n## 性能对比\n\n| 操作 | R版本 | Go版本 |\n|------|-------|--------|\n| 15个样本 | ~45秒 | ~5-8秒 |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frainoffallingstar%2Fseq2mat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frainoffallingstar%2Fseq2mat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frainoffallingstar%2Fseq2mat/lists"}