Files
brapi-java/docs/dev/03-genotyping/07-variant.md
2026-05-28 15:51:39 +08:00

65 lines
2.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 03 Genotyping - variant 表录入说明
来源:`docs/architecture/03-genotyping-data-flow.md`
## 录入目标
`variant` 表示具体变异位点,例如 SNP、Indel 或结构变异。它是位点定义,不是某个样本的结果;样本上的 genotype 结果写入 `allele_call`
## 上下游关系
| 类型 | 内容 |
| --- | --- |
| 表 | `variant` |
| Java 实体 | `VariantEntity` |
| 前置依赖 | `reference_set``variantset` |
| 下游引用 | `allele_call``marker_position` |
| API | `/brapi/v2/variants` |
## 字段录入
| 字段 | 业务意义 | 录入方式 | 校验规则 |
| --- | --- | --- | --- |
| `id` | variant 主键 | 系统生成;导入时可指定 | 必填、唯一 |
| `auth_user_id` | 数据所属用户 | 登录上下文自动写入 | 不允许前端手填 |
| `variant_name` | 位点名称/marker 名称 | 用户录入/导入 | 建议必填 |
| `variant_type` | 位点类型,如 SNP/INDEL/SV | 下拉/导入 | 可选,建议枚举 |
| `reference_set_id` | 参考集合 | ReferenceSet 选择器 | 可选,若填需存在 |
| `variant_set_id` | 所属 variantset | VariantSet 选择器 | 建议必选,若填需存在 |
| `reference_bases` | 参考碱基 | 文本/导入 | 可选 |
| `variant_start` | 起始位置 | 数字输入/导入 | 可选,非负 |
| `variant_end` | 结束位置 | 数字输入/导入 | 可选,不能小于 start |
| `svlen` | 结构变异长度 | 数字输入/导入 | 可选 |
| `filters_applied` | 是否做过过滤 | 开关/导入 | 可选 |
| `filters_passed` | 是否通过过滤 | 开关/导入 | 可选 |
| `created` | 创建时间 | 系统写入/导入 | 可选 |
| `updated` | 更新时间 | 系统写入/导入 | 可选 |
## 附属集合字段
| 附属表 | 内容 |
| --- | --- |
| `variant_entity_alternate_bases` | alternateBases 列表 |
| `variant_entity_ciend` | CIEND 区间 |
| `variant_entity_cipos` | CIPOS 区间 |
| `variant_entity_filters_failed` | 未通过的 filter 列表 |
## 页面与交互
- Variant 列表页支持按 variantSet、referenceSet、variantName、variantType 查询。
- 详情页展示 allele_call 数量和 marker_position 入口。
- **本版本不做**:单条删除、批量删除、大批量文件导入;放到下一版本实现。
- 本版本仅支持少量位点的表单逐条录入;大批量位点导入下一版本再做。
## 关键校验
1. `variant` 是位点定义,不能把样本 genotype 写在本表。
2. `variant_set_id``reference_set_id` 应与所属 variantset 保持一致。
3. **下一版本再做**:删除 variant 前检查 `allele_call``marker_position` 引用(含单条删除与批量删除)。
## 开发状态
**已完成**2026-05-28列表查询、新增、编辑、详情。
**下一版本**:单条删除、批量删除、大批量文件导入。