From d87f0e63159ffc6e56e0c596eccca4a158522c4d Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Tue, 13 Apr 2021 16:53:39 +0300 Subject: Add webqtlCaseData DS to keep track of case data in one trait --- gn3/db/traits.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'gn3/db') diff --git a/gn3/db/traits.py b/gn3/db/traits.py index d315eb9..8ba8a53 100644 --- a/gn3/db/traits.py +++ b/gn3/db/traits.py @@ -2,6 +2,7 @@ to the published database""" from typing import Any, Dict, Optional from dataclasses import dataclass +from typing import Optional @dataclass(frozen=True) @@ -14,6 +15,24 @@ BXD r_id: int +@dataclass(frozen=True) +class webqtlCaseData: + """Class for keeping track of one case data in one trait""" + value: Optional[float] = None + variance: Optional[float] = None + count: Optional[int] = None # Number of Individuals + + def __str__(self): + _str = "" + if self.value: + _str += f"value={self.value:.3f}" + if self.variance: + _str += f" variance={self.variance:.3f}" + if self.count: + _str += " n_data={self.count}" + return _str + + def get_riset(data_type: str, name: str, conn: Any): query, _name, _id = None, None, None if data_type == "Publish": -- cgit v1.2.3