Fix #242: expose annotation versions on Gene/Transcript/Exon/Protein#341
Merged
Conversation
…Protein
The transcript_version, gene_version, exon_version, and protein_version
columns were already loaded into the sqlite database from modern Ensembl
GTFs; they were just never surfaced on the Python objects.
Each entity now has a prefixed canonical accessor and a generic alias:
Gene gene_version / versioned_gene_id
version / versioned_id (aliases)
Transcript transcript_version / versioned_transcript_id
version / versioned_id (aliases)
protein -> new Protein view (or None for noncoding)
Exon exon_version / versioned_exon_id
version / versioned_id (aliases)
exon_version is now a constructor kwarg (default None)
Protein protein_id, protein_version (primary)
id, version, versioned_protein_id, versioned_id (aliases)
All version accessors return None when the GTF omits the corresponding
attribute (e.g. TAIR), and versioned_id falls back to the unversioned id
in that case.
Bump version to 2.7.0.
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.
Summary
Closes #242 by surfacing the Ensembl annotation version columns (already loaded into the sqlite DB) on
Gene,Transcript,Exon, and a newProteinview object accessed viaTranscript.protein.Each type has a prefixed canonical accessor plus a generic alias:
Genegene_version,versioned_gene_idversion,versioned_idTranscripttranscript_version,versioned_transcript_idversion,versioned_idExonexon_version,versioned_exon_idversion,versioned_idProtein(viat.protein)protein_id,protein_version,versioned_protein_idid,version,versioned_idExample:
When the GTF omits version attributes (e.g. TAIR), every
*_versionreturnsNoneandversioned_*falls back to the unversioned id.Compatibility
Exon.__init__gains a keyword-onlyexon_version=None(default preserves the old signature for positional callers).Transcript.protein_idandTranscript.protein_sequencestay; the newTranscript.proteinis purely additive..N-stripping of FASTA IDs is unchanged — those strips are needed for sequence lookup and are orthogonal to surfacing the version on the metadata objects.Test plan
tests/test_versions.pycovers Gene/Transcript/Exon/Protein versions on mouse Ensembl 81 partial data (versions present) and on TAIR partial data (versions absent)pytest tests/test_versions.py tests/test_mouse.py tests/test_tair10_complete.py tests/test_serialization.py tests/test_missing_genome_sources.py tests/test_exon_object.py tests/test_locus.py tests/test_shell.py./lint.sh