Skip to content

Commit

Permalink
Merge branch 'main' into serialize
Browse files Browse the repository at this point in the history
  • Loading branch information
korikuzma committed Jul 18, 2024
2 parents 0469063 + 03425d3 commit 1771675
Show file tree
Hide file tree
Showing 12 changed files with 113 additions and 83 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/python-cqa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ jobs:
SEQREPO_ROOT_DIR: ./tests/data/seqrepo/latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/cache@v2
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Update pip and setuptools
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install pypa/build
Expand All @@ -38,7 +38,7 @@ jobs:
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
Expand All @@ -55,7 +55,7 @@ jobs:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all the dists
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
Expand Down
2 changes: 1 addition & 1 deletion notebooks/getting_started/3_Basic_Models.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.1"
"version": "3.12.2"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.1"
"version": "3.12.2"
}
},
"nbformat": 4,
Expand Down
30 changes: 15 additions & 15 deletions notebooks/getting_started/5_Exploring_the_CnvTranslator.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -170,16 +170,16 @@
"data": {
"text/plain": [
"{'id': 'ga4gh:CX.0M5VkV5v504_laQURFMEsqzZGcOF9YEw',\n",
" 'type': <VrsType.CN_CHANGE: 'CopyNumberChange'>,\n",
" 'type': 'CopyNumberChange',\n",
" 'digest': '0M5VkV5v504_laQURFMEsqzZGcOF9YEw',\n",
" 'location': {'id': 'ga4gh:SL.GSJAEJXFDz7Nq6VlJj5NTEku48MmteUU',\n",
" 'type': <VrsType.SEQ_LOC: 'SequenceLocation'>,\n",
" 'type': 'SequenceLocation',\n",
" 'digest': 'GSJAEJXFDz7Nq6VlJj5NTEku48MmteUU',\n",
" 'sequenceReference': {'type': <VrsType.SEQ_REF: 'SequenceReference'>,\n",
" 'sequenceReference': {'type': 'SequenceReference',\n",
" 'refgetAccession': 'SQ.eK4D2MosgK_ivBkgi6FVPg5UXs1bYESm'},\n",
" 'start': 45002866,\n",
" 'end': 45015056},\n",
" 'copyChange': <CopyChange.EFO_0030067: 'efo:0030067'>}"
" 'copyChange': 'efo:0030067'}"
]
},
"execution_count": 4,
Expand Down Expand Up @@ -225,16 +225,16 @@
"data": {
"text/plain": [
"{'id': 'ga4gh:CX.0BN4vrqPrLPAZYsQEAPnG4IS8AYeBGe1',\n",
" 'type': <VrsType.CN_CHANGE: 'CopyNumberChange'>,\n",
" 'type': 'CopyNumberChange',\n",
" 'digest': '0BN4vrqPrLPAZYsQEAPnG4IS8AYeBGe1',\n",
" 'location': {'id': 'ga4gh:SL.tydo6UFL8Y60L5Me3k8AJfljURO9vYn9',\n",
" 'type': <VrsType.SEQ_LOC: 'SequenceLocation'>,\n",
" 'type': 'SequenceLocation',\n",
" 'digest': 'tydo6UFL8Y60L5Me3k8AJfljURO9vYn9',\n",
" 'sequenceReference': {'type': <VrsType.SEQ_REF: 'SequenceReference'>,\n",
" 'sequenceReference': {'type': 'SequenceReference',\n",
" 'refgetAccession': 'SQ.KEO-4XBcm1cxeo_DIQ8_ofqGUkp4iZhI'},\n",
" 'start': 75502957,\n",
" 'end': 76045032},\n",
" 'copyChange': <CopyChange.EFO_0030070: 'efo:0030070'>}"
" 'copyChange': 'efo:0030070'}"
]
},
"execution_count": 5,
Expand Down Expand Up @@ -292,12 +292,12 @@
"data": {
"text/plain": [
"{'id': 'ga4gh:CN.O_QHImmfErh9jDFkJaypPPvUmnj7EM70',\n",
" 'type': <VrsType.CN_COUNT: 'CopyNumberCount'>,\n",
" 'type': 'CopyNumberCount',\n",
" 'digest': 'O_QHImmfErh9jDFkJaypPPvUmnj7EM70',\n",
" 'location': {'id': 'ga4gh:SL.hBVWalem_rNclxjmUuT9CHbEGCdlqW9L',\n",
" 'type': <VrsType.SEQ_LOC: 'SequenceLocation'>,\n",
" 'type': 'SequenceLocation',\n",
" 'digest': 'hBVWalem_rNclxjmUuT9CHbEGCdlqW9L',\n",
" 'sequenceReference': {'type': <VrsType.SEQ_REF: 'SequenceReference'>,\n",
" 'sequenceReference': {'type': 'SequenceReference',\n",
" 'refgetAccession': 'SQ.HxuclGHh0XCDuF8x6yQrpHUBL7ZntAHc'},\n",
" 'start': 85623,\n",
" 'end': 57073230},\n",
Expand Down Expand Up @@ -346,12 +346,12 @@
"data": {
"text/plain": [
"{'id': 'ga4gh:CN.WDzlT9oUq4IcQrVRWGH0dZnARnFBotCS',\n",
" 'type': <VrsType.CN_COUNT: 'CopyNumberCount'>,\n",
" 'type': 'CopyNumberCount',\n",
" 'digest': 'WDzlT9oUq4IcQrVRWGH0dZnARnFBotCS',\n",
" 'location': {'id': 'ga4gh:SL.H1Zh5xdBqamBjwVE9orWdY_uBkpEMH1V',\n",
" 'type': <VrsType.SEQ_LOC: 'SequenceLocation'>,\n",
" 'type': 'SequenceLocation',\n",
" 'digest': 'H1Zh5xdBqamBjwVE9orWdY_uBkpEMH1V',\n",
" 'sequenceReference': {'type': <VrsType.SEQ_REF: 'SequenceReference'>,\n",
" 'sequenceReference': {'type': 'SequenceReference',\n",
" 'refgetAccession': 'SQ.5ZUqxCmDDgN4xTRbaSjN8LwgZironmB8'},\n",
" 'start': 46111352,\n",
" 'end': 46119948},\n",
Expand Down Expand Up @@ -385,7 +385,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.1"
"version": "3.12.2"
}
},
"nbformat": 4,
Expand Down
46 changes: 22 additions & 24 deletions notebooks/getting_started/6_Upcoming_features.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -146,17 +146,16 @@
"data": {
"text/plain": [
"{'id': 'ga4gh:VA.LK_4rOVxyEwrEpaOVd-BDFV0ocbO5vgV',\n",
" 'type': <VrsType.ALLELE: 'Allele'>,\n",
" 'type': 'Allele',\n",
" 'digest': 'LK_4rOVxyEwrEpaOVd-BDFV0ocbO5vgV',\n",
" 'location': {'id': 'ga4gh:SL.nA5-KovovkH-5p3LF1657nkkeWFwrInI',\n",
" 'type': <VrsType.SEQ_LOC: 'SequenceLocation'>,\n",
" 'type': 'SequenceLocation',\n",
" 'digest': 'nA5-KovovkH-5p3LF1657nkkeWFwrInI',\n",
" 'sequenceReference': {'type': <VrsType.SEQ_REF: 'SequenceReference'>,\n",
" 'sequenceReference': {'type': 'SequenceReference',\n",
" 'refgetAccession': 'SQ.aUiQCzCPZ2d0csHbMSbh2NzInhonSXwI'},\n",
" 'start': 80656509,\n",
" 'end': 80656510},\n",
" 'state': {'type': <VrsType.LIT_SEQ_EXPR: 'LiteralSequenceExpression'>,\n",
" 'sequence': 'TT'}}"
" 'state': {'type': 'LiteralSequenceExpression', 'sequence': 'TT'}}"
]
},
"execution_count": 4,
Expand Down Expand Up @@ -226,9 +225,9 @@
"data": {
"text/plain": [
"{'id': 'ga4gh:SL.nA5-KovovkH-5p3LF1657nkkeWFwrInI',\n",
" 'type': <VrsType.SEQ_LOC: 'SequenceLocation'>,\n",
" 'type': 'SequenceLocation',\n",
" 'digest': 'nA5-KovovkH-5p3LF1657nkkeWFwrInI',\n",
" 'sequenceReference': {'type': <VrsType.SEQ_REF: 'SequenceReference'>,\n",
" 'sequenceReference': {'type': 'SequenceReference',\n",
" 'refgetAccession': 'SQ.aUiQCzCPZ2d0csHbMSbh2NzInhonSXwI'},\n",
" 'start': 80656509,\n",
" 'end': 80656510}"
Expand Down Expand Up @@ -261,7 +260,7 @@
{
"data": {
"text/plain": [
"{'type': <VrsType.SEQ_REF: 'SequenceReference'>,\n",
"{'type': 'SequenceReference',\n",
" 'refgetAccession': 'SQ.aUiQCzCPZ2d0csHbMSbh2NzInhonSXwI'}"
]
},
Expand Down Expand Up @@ -293,7 +292,7 @@
"data": {
"text/plain": [
"{'id': None,\n",
" 'type': <VrsType.SEQ_REF: 'SequenceReference'>,\n",
" 'type': 'SequenceReference',\n",
" 'label': None,\n",
" 'description': None,\n",
" 'alternativeLabels': None,\n",
Expand Down Expand Up @@ -399,9 +398,9 @@
"data": {
"text/plain": [
"{'id': 'refseq:NC_000005.10',\n",
" 'type': <VrsType.SEQ_REF: 'SequenceReference'>,\n",
" 'label': 'GRCh38:chr5',\n",
" 'alternativeLabels': ['GRCh38:5'],\n",
" 'type': 'SequenceReference',\n",
" 'label': 'GRCh38:5',\n",
" 'alternativeLabels': ['GRCh38:chr5'],\n",
" 'refgetAccession': 'SQ.aUiQCzCPZ2d0csHbMSbh2NzInhonSXwI'}"
]
},
Expand Down Expand Up @@ -435,12 +434,12 @@
"data": {
"text/plain": [
"{'id': 'ga4gh:SL.nA5-KovovkH-5p3LF1657nkkeWFwrInI',\n",
" 'type': <VrsType.SEQ_LOC: 'SequenceLocation'>,\n",
" 'type': 'SequenceLocation',\n",
" 'digest': 'nA5-KovovkH-5p3LF1657nkkeWFwrInI',\n",
" 'sequenceReference': {'id': 'refseq:NC_000005.10',\n",
" 'type': <VrsType.SEQ_REF: 'SequenceReference'>,\n",
" 'label': 'GRCh38:chr5',\n",
" 'alternativeLabels': ['GRCh38:5'],\n",
" 'type': 'SequenceReference',\n",
" 'label': 'GRCh38:5',\n",
" 'alternativeLabels': ['GRCh38:chr5'],\n",
" 'refgetAccession': 'SQ.aUiQCzCPZ2d0csHbMSbh2NzInhonSXwI'},\n",
" 'start': 80656509,\n",
" 'end': 80656510}"
Expand All @@ -465,20 +464,19 @@
"data": {
"text/plain": [
"{'id': 'ga4gh:VA.LK_4rOVxyEwrEpaOVd-BDFV0ocbO5vgV',\n",
" 'type': <VrsType.ALLELE: 'Allele'>,\n",
" 'type': 'Allele',\n",
" 'digest': 'LK_4rOVxyEwrEpaOVd-BDFV0ocbO5vgV',\n",
" 'location': {'id': 'ga4gh:SL.nA5-KovovkH-5p3LF1657nkkeWFwrInI',\n",
" 'type': <VrsType.SEQ_LOC: 'SequenceLocation'>,\n",
" 'type': 'SequenceLocation',\n",
" 'digest': 'nA5-KovovkH-5p3LF1657nkkeWFwrInI',\n",
" 'sequenceReference': {'id': 'refseq:NC_000005.10',\n",
" 'type': <VrsType.SEQ_REF: 'SequenceReference'>,\n",
" 'label': 'GRCh38:chr5',\n",
" 'alternativeLabels': ['GRCh38:5'],\n",
" 'type': 'SequenceReference',\n",
" 'label': 'GRCh38:5',\n",
" 'alternativeLabels': ['GRCh38:chr5'],\n",
" 'refgetAccession': 'SQ.aUiQCzCPZ2d0csHbMSbh2NzInhonSXwI'},\n",
" 'start': 80656509,\n",
" 'end': 80656510},\n",
" 'state': {'type': <VrsType.LIT_SEQ_EXPR: 'LiteralSequenceExpression'>,\n",
" 'sequence': 'TT'}}"
" 'state': {'type': 'LiteralSequenceExpression', 'sequence': 'TT'}}"
]
},
"execution_count": 11,
Expand Down Expand Up @@ -507,7 +505,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.1"
"version": "3.12.2"
}
},
"nbformat": 4,
Expand Down
2 changes: 2 additions & 0 deletions src/ga4gh/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from .pydantic import (
is_pydantic_instance, is_curie_type, pydantic_copy
)
from .domain_models import CommonDomainType
from . import entity_models, domain_models

__all__ = [
Expand All @@ -36,6 +37,7 @@
"is_pydantic_instance",
"is_curie_type",
"pydantic_copy",
"CommonDomainType",
"entity_models",
"domain_models"
]
Expand Down
34 changes: 17 additions & 17 deletions src/ga4gh/core/domain_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
* `import ga4gh.core`, and refer to models using the fully-qualified
module name, e.g., `ga4gh.core.domain_models.Gene`
"""
from typing import Literal, Union, List
from enum import Enum
from typing import Literal, Union, List

from pydantic import Field, RootModel

Expand All @@ -33,8 +33,8 @@ class CommonDomainType(str, Enum):
class Phenotype(DomainEntity):
"""An observable characteristic or trait of an organism."""

type: Literal[CommonDomainType.PHENOTYPE] = Field(
CommonDomainType.PHENOTYPE,
type: Literal["Phenotype"] = Field(
CommonDomainType.PHENOTYPE.value,
description=f'MUST be "{CommonDomainType.PHENOTYPE.value}".'
)

Expand All @@ -44,17 +44,17 @@ class Disease(DomainEntity):
of all or part of an organism and is not immediately due to any external injury.
"""

type: Literal[CommonDomainType.DISEASE] = Field(
CommonDomainType.DISEASE,
type: Literal["Disease"] = Field(
CommonDomainType.DISEASE.value,
description=f'MUST be "{CommonDomainType.DISEASE.value}".'
)


class TraitSet(DomainEntity):
"""A set of phenotype and/or disease concepts that together constitute a condition."""

type: Literal[CommonDomainType.TRAIT_SET] = Field(
CommonDomainType.TRAIT_SET,
type: Literal["TraitSet"] = Field(
CommonDomainType.TRAIT_SET.value,
description=f'MUST be "{CommonDomainType.TRAIT_SET.value}".'
)
traits: List[Union[Disease, Phenotype]] = Field(
Expand All @@ -76,26 +76,26 @@ class Condition(RootModel):
class TherapeuticAction(DomainEntity):
"""A therapeutic action taken that is intended to alter or stop a pathologic process."""

type: Literal[CommonDomainType.TR_ACTION] = Field(
CommonDomainType.TR_ACTION,
type: Literal["TherapeuticAction"] = Field(
CommonDomainType.TR_ACTION.value,
description=f'MUST be "{CommonDomainType.TR_ACTION.value}".'
)


class TherapeuticAgent(DomainEntity):
"""An administered therapeutic agent that is intended to alter or stop a pathologic process."""

type: Literal[CommonDomainType.TR_AGENT] = Field(
CommonDomainType.TR_AGENT,
type: Literal["TherapeuticAgent"] = Field(
CommonDomainType.TR_AGENT.value,
description=f'MUST be "{CommonDomainType.TR_AGENT.value}".'
)


class TherapeuticSubstituteGroup(DomainEntity):
"""A group of therapeutic procedures that may be treated as substitutes for one another."""

type: Literal[CommonDomainType.TR_SUB] = Field(
CommonDomainType.TR_SUB,
type: Literal["TherapeuticSubstituteGroup"] = Field(
CommonDomainType.TR_SUB.value,
description=f'MUST be "{CommonDomainType.TR_SUB.value}".'
)
substitutes: List[Union[TherapeuticAction, TherapeuticAgent]] = Field(
Expand All @@ -110,8 +110,8 @@ class CombinationTherapy(DomainEntity):
performed in combination.
"""

type: Literal[CommonDomainType.TR_COMB] = Field(
CommonDomainType.TR_COMB,
type: Literal["CombinationTherapy"] = Field(
CommonDomainType.TR_COMB.value,
description=f'MUST be "{CommonDomainType.TR_COMB.value}".'
)
components: List[Union[TherapeuticSubstituteGroup, TherapeuticAction, TherapeuticAgent]] = Field(
Expand All @@ -136,7 +136,7 @@ class TherapeuticProcedure(RootModel):
class Gene(DomainEntity):
"""A basic physical and functional unit of heredity."""

type: Literal[CommonDomainType.GENE] = Field(
CommonDomainType.GENE,
type: Literal["Gene"] = Field(
CommonDomainType.GENE.value,
description=f'MUST be "{CommonDomainType.GENE.value}".'
)
Loading

0 comments on commit 1771675

Please sign in to comment.