Conversation
…nheritance - Added mapping of HGNC gene symbols into VariationDescriptor.gene_context - Added zygosity → GA4GH GENO allelicState mapping - Added inheritance parsing (stored in Genotype dataclass, reserved for future use) - Updated DefaultMapper._add_genotype_interpretations to use new Genotype.to_variation_descriptor(), ensuring expressions + VRS JSON description + allelicState + geneContext are emitted in phenopackets - Preserved previous behavior for phenotype/disease/measurement/biosample
…or construction
- Replaced `except Exception:` with explicit attribute checks (`hasattr`, `getattr`)
to comply with Ruff BLE001 and avoid masking unrelated runtime errors.
- In `to_variation_descriptor`:
- Guarded `molecule_context` assignment with `hasattr` instead of try/except.
- Guarded stable ID assignment with `if g_expr` check.
- In `_add_hgvs_expression`:
- Use `getattr(type(expr), "HGVS", None)` instead of try/except.
- In `_attempt_pyphetools_normalize`:
- Removed redundant try/except; explicitly return `None` until a stable
pyphetools API exists.
… for VariationDescriptor construction - Replaced `except Exception:` blocks with explicit `hasattr` / `getattr` checks to comply with Ruff BLE001 and avoid masking unrelated errors. - In `Genotype.to_variation_descriptor`: - Guarded `gene_context` and `allelic_state` assignments with explicit checks. - Rewrote allele JSON description building without try/except. - Added molecule_context assignment only when supported. - Generated stable IDs using an explicit guard instead of catching failures. - In `_add_hgvs_expression`, probed for `HGVS` enum explicitly instead of relying on try/except. - In `_attempt_pyphetools_normalize`, removed no-op try/except; return `None` until a stable API emerges. - In `__main__.py`, replaced CopyFrom fallback try/except with feature detection (`getattr` + callable check).
- Introduced `vv_lookup.py` module to query VariantValidator’s REST API for transcript and gene cross-references. - Provides `get_gene_xrefs_vv()` helper to return HGNC ID, Ensembl gene ID, and RefSeq transcripts for a given HGNC gene symbol. - Handles API rate limits (1 request/sec) and provides robust error handling via custom `VVLookupError`. - Designed to integrate with Genotype → VariationDescriptor pipeline as an optional enrichment step when P6_ENRICH_GENE_XREFS is enabled.
… retries
- New module `vv_lookup.py` to enrich gene_context with HGNC/Ensembl IDs and
canonical transcript accessions using VariantValidator.
- Prefer v2 `gene2transcripts_v2` endpoint; fallback to v1 when needed.
- Normalize variable VV payloads into a compact dict:
{hgnc_id, ensembl_gene_id, refseq_transcripts, ensembl_transcripts}.
- Add small retry/backoff and a custom VVLookupError for clean failure handling.
- Thorough docstrings and comments explaining the high-level P6 flow.
… enrichment - Clear sectioned comments/docstrings describing P6’s high-level flow. - Narrow overly broad exception handlers to satisfy linting and improve safety. - Optional enrichment via `vv_lookup.get_gene_xrefs_vv` behind P6_ENRICH_GENE_XREFS. - Keep P6_SKIP_VV escape hatch; maintain robust local fallback descriptor path. - Ensure normalized g. expression and allelic_state are always present.
… satisfy C901 - Extract _should_skip_vv, _try_build_descriptor_via_vv, _enrich_descriptor_common, and _maybe_enrich_gene_xrefs helpers. - Try to keep exact behavior and error handling; just reduce branching in the main method.
… docstrings. Ruff check and format as well
Add the Variant field using VariationDescriptor, implement the VariantValidator lookup from PyPheTools, and lint/refactor some code
Latest transformation of Tony's Excel genotype/phenotype records into Phenopackets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull latest changes into main