Skip to content

Commit

Permalink
Add variants related models
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorjerse committed Apr 15, 2024
1 parent d57d613 commit 53d75c6
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Unreleased
Added
-----
- Add ``restart`` method to the ``Data`` resource
- Add variants related models


===================
Expand Down
71 changes: 71 additions & 0 deletions src/resdk/resources/variants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
"""Variant resources."""

from .base import BaseResource


class Variant(BaseResource):
"""ResolweBio Variant resource."""

endpoint = "variant"

READ_ONLY_FIELDS = BaseResource.READ_ONLY_FIELDS + (
"species",
"genome_assembly",
"chromosome",
"position",
"reference",
"alternative",
)

def __repr__(self) -> str:
"""Return string representation."""
return (
f"Variant <chr: {self.chromosome}, pos: {self.position}, "
f"ref: {self.reference}, alt: {self.alternative}>"
)


class VariantAnnotation(BaseResource):
"""VariantAnnotation resource."""

endpoint = "variant_annotation"

READ_ONLY_FIELDS = BaseResource.READ_ONLY_FIELDS + (
"variant",
"type",
"annotation",
"annotation_impact",
"gene",
"protein_impact",
"feature_id",
"clinical_diagnosis",
"clinical_significance",
"dbsnp_id",
"clinical_var_id",
"data",
)

def __repr__(self) -> str:
"""Return string representation."""
return f"VariantAnnotation <variant: {self.variant}>"


class VariantCall(BaseResource):
"""VariantCall resource."""

endpoint = "variant_call"

READ_ONLY_FIELDS = BaseResource.READ_ONLY_FIELDS + (
"sample",
"variant",
"experiment",
"quality",
"depth",
"filter",
"genotype",
"data",
)

def __repr__(self) -> str:
"""Return string representation."""
return f"VariantCall <pk: {self.id}>"

0 comments on commit 53d75c6

Please sign in to comment.