Traits (Step 1 of gkm_scv_condition_proc)¶
Overview¶
Step 1 of the clinvar_ingest.gkm_scv_condition_proc procedure builds GKS-compliant trait records from ClinVar's normalized trait table. Each output record includes a primary coding (MedGen when available), cross-reference mappings to external ontologies (OMIM, MONDO, HPO, Orphanet, MeSH, EFO), and ClinVar-specific extensions. The resulting temp_gkm_trait table serves as the lookup for the Condition Sets step (Step 15), which joins it with condition mapping results to build the final condition structures.
Workflow¶
The procedure executes as a single query with two CTEs within a loop over the target schema(s) identified by the on_date parameter.
Step 1: Extract Traits¶
The traits CTE selects distinct trait records from the trait table, extracting:
- Trait
id,type, andname(see Condition name) - Alternate names concatenated into a comma-separated
synonymsstring - Cross-references parsed from the raw
xrefsfield via theclinvar_ingest.parseXRefItemsUDF
Step 2: Build Trait Cross-References¶
The trait_xrefs CTE unnests each trait's parsed xrefs and builds a coding struct for each cross-reference. Each coding includes:
- The database name (
system) and identifier (code) - An array of IRIs — an identifiers.org canonical IRI and a secondary browsable URL
Cross-references are filtered to include only:
- Non-Gene databases (Gene xrefs are excluded)
- Records with no
ref_field(inline xrefs only) - Primary type xrefs (or xrefs with no type specified)
Step 3: Aggregate into temp_gkm_trait¶
The final query joins traits with their cross-references and aggregates into one row per trait:
primaryCoding— the MedGen coding, selected as the first non-null MedGen xref. The MedGen coding includes the trait name in itsnamefieldmappings— all non-MedGen codings wrapped with arelatedMatchrelationaliases— an array of alternate names/synonyms (present only when synonyms exist)extensions— an array containing:clinvarTraitId— the ClinVar trait IDclinvarTraitType— the trait type (e.g., Disease, Finding, PhenotypeInstruction)
Output: temp_gkm_trait — one row per trait with structured codings, mappings, and extensions. Internal
Condition name¶
Every condition gets a name from ClinVar. No name is made up. The name is the first of these that ClinVar
supplies:
- The trait's Preferred name from the
traittable. Most traits have one. - The Preferred name in the RCV's TraitSet (
rcv_mapping.trait_set_content), for a trait whosetraitrow has no Preferred name. Only the RCV trait sets that contain such a trait are parsed. - The trait's Alternate name, the first one alphabetically, when ClinVar gives the trait no Preferred name
anywhere. That name also stays in
aliases, so a condition named this way has itsnameinaliasestoo.
In the 1.1.0 data (2026-10-11 release), 58 conditions need a fallback:
Source of name |
Conditions | Example |
|---|---|---|
| RCV TraitSet Preferred name | 7 | clinvar.trait:78166 → not provided |
| Alternate name | 51 | clinvar.trait:9800 → Apolipoprotein c-ii variants, molecular defect unknown |
The 7 RCV-named traits have an empty trait row: no name, xrefs or content. ClinVar's RCV TraitSet names each
of them not provided. Before 1.1.0, all 58 had neither name nor primaryCoding and failed MappableConcept
validation.
conceptType Mapping (ClinVar → GKS)¶
Each trait's ClinVar type is mapped to a standardized GKS conceptType — the value carried on the emitted condition's MappableConcept and used to distinguish diseases, phenotypes, and other traits. The mapping is applied in Step 1 (gkm_scv_condition_proc) and yields one of four conceptType values: Disease, Phenotype, Trait, or Condition.
ClinVar trait type |
GKS conceptType |
Notes |
|---|---|---|
Disease |
Disease |
A named disease. |
Finding |
Phenotype |
Clinical findings are surfaced as phenotypes. |
DrugResponse |
Condition |
Drug-response traits are generic conditions. |
BloodGroup |
Trait |
Non-disease heritable trait. |
NamedProteinVariant |
Trait |
Non-disease heritable trait. |
PhenotypeInstruction |
Trait |
Non-disease heritable trait. |
| (any other type) | Condition |
Fallback when the ClinVar type is unrecognized. |
conceptType is descriptive, not a schema discriminator: every condition is a GKS MappableConcept regardless of its conceptType. Downstream, the four values let consumers filter diseases (Disease) from phenotypes (Phenotype) and other heritable traits (Trait) without parsing the underlying ontology namespace.
IRI Mapping Reference¶
Each supported database maps to a pair of IRIs — a canonical identifiers.org IRI and a secondary browsable URL:
| Database | identifiers.org Pattern | Secondary URL |
|---|---|---|
| MedGen | https://identifiers.org/medgen:{id} |
https://www.ncbi.nlm.nih.gov/medgen/{id} |
| OMIM | https://identifiers.org/mim:{id} |
https://www.ncbi.nlm.nih.gov/medgen/{id} |
| Human Phenotype Ontology | https://identifiers.org/{id} |
https://hpo.jax.org/browse/term/{id} |
| MONDO | https://identifiers.org/mondo:{digits} |
http://purl.obolibrary.org/obo/MONDO_{digits} |
| Orphanet | https://identifiers.org/orphanet.ordo:Orphanet_{id} |
http://www.orpha.net/ORDO/Orphanet_{id} |
| MeSH | https://identifiers.org/mesh:{id} |
https://www.ncbi.nlm.nih.gov/mesh/?term={id} |
| EFO | https://identifiers.org/efo:{id} |
http://www.ebi.ac.uk/efo/EFO_{id} |
MONDO IDs are normalized by extracting the numeric portion — MONDO:0000001 becomes 0000001 in both IRI patterns.
Output Tables¶
| Table | Description | Role |
|---|---|---|
temp_gkm_trait |
GKS-compliant trait records with primary coding, cross-reference mappings, and extensions | Internal |
Dependencies¶
- UDFs:
clinvar_ingest.parseXRefItems - Source Tables:
trait - Upstream Steps: None — operates on base ClinVar ingest tables
- Downstream Steps: Step 15 (Condition Sets)