aboutsummaryrefslogtreecommitdiff
path: root/gn2/base
diff options
context:
space:
mode:
Diffstat (limited to 'gn2/base')
-rw-r--r--gn2/base/trait.py31
-rw-r--r--gn2/base/webqtlConfig.py2
2 files changed, 33 insertions, 0 deletions
diff --git a/gn2/base/trait.py b/gn2/base/trait.py
index 701958d7..24288ba1 100644
--- a/gn2/base/trait.py
+++ b/gn2/base/trait.py
@@ -611,3 +611,34 @@ def retrieve_trait_info(trait, dataset, get_qtl_info=False):
f"{repr(trait.name)} information is not found in the database "
f"for dataset '{dataset.name}' with id '{dataset.id}'.")
return trait
+
+def fetch_symbols(trait_db_list):
+ """
+ Fetch list of trait symbols
+
+ From a list of traits and datasets (where each item has
+ the trait and dataset name separated by a colon), return
+
+ """
+
+ trimmed_trait_list = [trait_db for trait_db in trait_db_list
+ if 'Publish' not in trait_db and 'Geno' not in trait_db.split(":")[1]]
+
+ symbol_list = []
+ with database_connection(get_setting("SQL_URI")) as conn, conn.cursor() as cursor:
+ for trait_db in trimmed_trait_list:
+ symbol_query = """
+ SELECT ps.Symbol
+ FROM ProbeSet as ps
+ INNER JOIN ProbeSetXRef psx ON psx.ProbeSetId = ps.Id
+ INNER JOIN ProbeSetFreeze psf ON psx.ProbeSetFreezeId = psf.Id
+ WHERE
+ ps.Name = %(trait_name)s AND
+ psf.Name = %(db_name)s
+ """
+
+ cursor.execute(symbol_query, {'trait_name': trait_db.split(":")[0],
+ 'db_name': trait_db.split(":")[1]})
+ symbol_list.append(cursor.fetchone()[0])
+
+ return "+".join(symbol_list) \ No newline at end of file
diff --git a/gn2/base/webqtlConfig.py b/gn2/base/webqtlConfig.py
index 998c0efc..8018bf40 100644
--- a/gn2/base/webqtlConfig.py
+++ b/gn2/base/webqtlConfig.py
@@ -68,6 +68,8 @@ RGD_URL = "https://rgd.mcw.edu/rgdweb/elasticResults.html?term=%s&category=Gene&
PHENOGEN_URL = "https://phenogen.org/gene.jsp?speciesCB=Rn&auto=Y&geneTxt=%s&genomeVer=rn7&section=geneEQTL"
RRID_MOUSE_URL = "https://www.jax.org/strain/%s"
RRID_RAT_URL = "https://rgd.mcw.edu/rgdweb/report/strain/main.html?id=%s"
+GENE_CUP_URL = "https://genecup.org/progress?type=GWAS&type=addiction&type=drug&type=brain&type=stress&type=psychiatric&type=cell&type=function&query=%s"
+
# Temporary storage (note that this TMPDIR can be set as an
# environment variable - use utility.tools.TEMPDIR when you