about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBonfaceKilz2021-07-09 16:50:28 +0300
committerBonfaceKilz2021-07-10 09:09:00 +0300
commitd5c0cdec01ce1888946d09c0df72ea42ad2d2c17 (patch)
tree57c0b82e817edf6ccdd6ba65b3e55201186b7849
parentd6715cff2e5a1771b22bb2ce7680347cad501841 (diff)
downloadgenenetwork3-d5c0cdec01ce1888946d09c0df72ea42ad2d2c17.tar.gz
db: phenotypes: Add Probeset data structures
* gn3/db/phenotypes.py (Probeset): New dataclass.
(probeset_mapping): New dict.
* gn3/db/__init__.py: Add probeset_mapping and Probeset.
-rw-r--r--gn3/db/__init__.py15
-rw-r--r--gn3/db/phenotypes.py59
2 files changed, 69 insertions, 5 deletions
diff --git a/gn3/db/__init__.py b/gn3/db/__init__.py
index 34a0236..9b1b36a 100644
--- a/gn3/db/__init__.py
+++ b/gn3/db/__init__.py
@@ -6,27 +6,32 @@ from typing_extensions import Protocol
 
 from gn3.db.metadata_audit import MetadataAudit
 from gn3.db.phenotypes import Phenotype
-from gn3.db.phenotypes import PublishXRef
+from gn3.db.phenotypes import Probeset
 from gn3.db.phenotypes import Publication
+from gn3.db.phenotypes import PublishXRef
+
 
 from gn3.db.metadata_audit import metadata_audit_mapping
 from gn3.db.phenotypes import phenotype_mapping
+from gn3.db.phenotypes import probeset_mapping
 from gn3.db.phenotypes import publication_mapping
 from gn3.db.phenotypes import publish_x_ref_mapping
 
 
 TABLEMAP = {
-    "metadata_audit": metadata_audit_mapping,
     "Phenotype": phenotype_mapping,
-    "PublishXRef": publish_x_ref_mapping,
+    "ProbeSet": probeset_mapping,
     "Publication": publication_mapping,
+    "PublishXRef": publish_x_ref_mapping,
+    "metadata_audit": metadata_audit_mapping,
 }
 
 DATACLASSMAP = {
-    "metadata_audit": MetadataAudit,
     "Phenotype": Phenotype,
-    "PublishXRef": PublishXRef,
+    "ProbeSet": Probeset,
     "Publication": Publication,
+    "PublishXRef": PublishXRef,
+    "metadata_audit": MetadataAudit,
 }
 
 
diff --git a/gn3/db/phenotypes.py b/gn3/db/phenotypes.py
index 2b93c85..147cbf3 100644
--- a/gn3/db/phenotypes.py
+++ b/gn3/db/phenotypes.py
@@ -99,3 +99,62 @@ publication_mapping = {
     "month": "Month",
     "year": "Year",
 }
+
+
+@dataclass(frozen=True)
+class Probeset:
+    """Data Type that represents a Probeset"""
+    id_: Optional[int] = None
+    name: Optional[str] = None
+    symbol: Optional[str] = None
+    description: Optional[str] = None
+    probe_target_description: Optional[str] = None
+    chr_: Optional[str] = None
+    mb: Optional[float] = None
+    alias: Optional[str] = None
+    geneid: Optional[str] = None
+    homologeneid: Optional[str] = None
+    unigeneid: Optional[str] = None
+    omim: Optional[str] = None
+    refseq_transcriptid: Optional[str] = None
+    blatseq: Optional[str] = None
+    targetseq: Optional[str] = None
+    strand_probe: Optional[str] = None
+    probe_set_target_region: Optional[str] = None
+    probe_set_specificity: Optional[float] = None
+    probe_set_blat_score: Optional[float] = None
+    probe_set_blat_mb_start: Optional[float] = None
+    probe_set_blat_mb_end: Optional[float] = None
+    probe_set_strand: Optional[str] = None
+    probe_set_note_by_rw: Optional[str] = None
+    flag: Optional[str] = None
+
+
+# Mapping from the Phenotype dataclass to the actual column names in the
+# database
+probeset_mapping = {
+    "id_": "Id",
+    "name": "Name",
+    "symbol": "symbol",
+    "description": "description",
+    "probe_target_description": "Probe_Target_Description",
+    "chr_": "Chr",
+    "mb": "Mb",
+    "alias": "alias",
+    "geneid": "GeneId",
+    "homologeneid": "HomoloGeneID",
+    "unigeneid": "UniGeneId",
+    "omim": "OMIM",
+    "refseq_transcriptid": "RefSeq_TranscriptId",
+    "blatseq": "BlatSeq",
+    "targetseq": "TargetSeq",
+    "strand_probe": "Strand_Probe",
+    "probe_set_target_region": "Probe_set_target_region",
+    "probe_set_specificity": "Probe_set_specificity",
+    "probe_set_blat_score": "Probe_set_BLAT_score",
+    "probe_set_blat_mb_start": "Probe_set_Blat_Mb_start",
+    "probe_set_blat_mb_end": "Probe_set_Blat_Mb_end",
+    "probe_set_strand": "Probe_set_strand",
+    "probe_set_note_by_rw": "Probe_set_Note_by_RW",
+    "flag": "flag"
+}