aboutsummaryrefslogtreecommitdiff
path: root/gn3/db/traits.py
diff options
context:
space:
mode:
authorBonfaceKilz2021-04-13 16:53:39 +0300
committerBonfaceKilz2021-05-08 19:19:47 +0300
commitd87f0e63159ffc6e56e0c596eccca4a158522c4d (patch)
treebebad1736f36234d202cfd11826de0bdbf5a6b22 /gn3/db/traits.py
parentafcbd3d249cbe5f309f0a297dcc422427784fcfd (diff)
downloadgenenetwork3-d87f0e63159ffc6e56e0c596eccca4a158522c4d.tar.gz
Add webqtlCaseData DS to keep track of case data in one trait
Diffstat (limited to 'gn3/db/traits.py')
-rw-r--r--gn3/db/traits.py19
1 files changed, 19 insertions, 0 deletions
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":