about summary refs log tree commit diff
path: root/gn2/wqflask/correlation/exceptions.py
diff options
context:
space:
mode:
authorArun Isaac2023-12-29 18:55:37 +0000
committerArun Isaac2023-12-29 19:01:46 +0000
commit204a308be0f741726b9a620d88fbc22b22124c81 (patch)
treeb3cf66906674020b530c844c2bb4982c8a0e2d39 /gn2/wqflask/correlation/exceptions.py
parent83062c75442160427b50420161bfcae2c5c34c84 (diff)
downloadgenenetwork2-204a308be0f741726b9a620d88fbc22b22124c81.tar.gz
Namespace all modules under gn2.
We move all modules under a gn2 directory. This is important for
"correct" packaging and deployment as a Guix service.
Diffstat (limited to 'gn2/wqflask/correlation/exceptions.py')
-rw-r--r--gn2/wqflask/correlation/exceptions.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/gn2/wqflask/correlation/exceptions.py b/gn2/wqflask/correlation/exceptions.py
new file mode 100644
index 00000000..f4e2b72b
--- /dev/null
+++ b/gn2/wqflask/correlation/exceptions.py
@@ -0,0 +1,16 @@
+"""Correlation-Specific Exceptions"""
+
+class WrongCorrelationType(Exception):
+    """Raised when a correlation is requested for incompatible datasets."""
+
+    def __init__(self, trait, target_dataset, corr_method):
+        corr_method = {
+            "lit": "Literature",
+            "tissue": "Tissue"
+        }[corr_method]
+        message = (
+            f"It is not possible to compute the '{corr_method}' correlations "
+            f"between trait '{trait.name}' and the data in the "
+            f"'{target_dataset.fullname}' dataset. "
+            "Please try again after selecting another type of correlation.")
+        super().__init__(message)