-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e464d15
commit 6355dea
Showing
2 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
"""Variant resources.""" | ||
|
||
import logging | ||
from typing import TYPE_CHECKING, Optional, Union | ||
|
||
from ..utils.decorators import assert_object_exists | ||
from .base import BaseResource | ||
from .sample import Sample | ||
from .utils import parse_resolwe_datetime | ||
|
||
if TYPE_CHECKING: | ||
from resdk.resolwe import Resolwe | ||
|
||
|
||
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 <path: {self.field.group.name}.{self.field.name}, value: '{self.value}'>" |