Module phc.easy.omics.options.genomic_copy_number_variant

Expand source code
from enum import Enum
from typing import List, Optional

from phc.easy.omics.options.copy_number_status import CopyNumberStatus
from phc.easy.omics.options.common import GenomicVariantInclude
from phc.easy.abstract.paging_api_item import PagingApiOptions
from pydantic import Field

MAPPINGS = {
    "variant_set_ids": "copyNumberSetIds",
    "in_ckb": "drugAssociations",
    "effect": "status",
}


class GenomicCopyNumberVariantOptions(PagingApiOptions):
    """Options to pass to `/v1/genomics/copy-numbers`"""

    variant_set_ids: List[str] = Field(..., min_length=1)
    include: List[GenomicVariantInclude] = []
    gene: List[str] = []
    interpretation: List[str] = []
    effect: List[CopyNumberStatus] = []
    in_ckb: Optional[bool] = None

    @staticmethod
    def transform(key, value):
        if isinstance(value, list):
            value = ",".join(
                [elem if isinstance(elem, str) else str(elem) for elem in value]
            )
        elif isinstance(value, bool):
            value = "true" if value else None

        return (MAPPINGS.get(key, key), value)

Classes

class GenomicCopyNumberVariantOptions (**data: Any)

Options to pass to /v1/genomics/copy-numbers

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Expand source code
class GenomicCopyNumberVariantOptions(PagingApiOptions):
    """Options to pass to `/v1/genomics/copy-numbers`"""

    variant_set_ids: List[str] = Field(..., min_length=1)
    include: List[GenomicVariantInclude] = []
    gene: List[str] = []
    interpretation: List[str] = []
    effect: List[CopyNumberStatus] = []
    in_ckb: Optional[bool] = None

    @staticmethod
    def transform(key, value):
        if isinstance(value, list):
            value = ",".join(
                [elem if isinstance(elem, str) else str(elem) for elem in value]
            )
        elif isinstance(value, bool):
            value = "true" if value else None

        return (MAPPINGS.get(key, key), value)

Ancestors

Class variables

var effect : List[CopyNumberStatus]
var gene : List[str]
var in_ckb : Optional[bool]
var include : List[GenomicVariantInclude]
var interpretation : List[str]
var model_config
var variant_set_ids : List[str]

Static methods

def transform(key, value)
Expand source code
@staticmethod
def transform(key, value):
    if isinstance(value, list):
        value = ",".join(
            [elem if isinstance(elem, str) else str(elem) for elem in value]
        )
    elif isinstance(value, bool):
        value = "true" if value else None

    return (MAPPINGS.get(key, key), value)

Methods

def model_dump(self)

Inherited from: PagingApiOptions.model_dump