aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzsloan2019-05-07 15:44:11 -0500
committerzsloan2019-05-07 15:44:11 -0500
commitff4514b3d51455bd592e038faa8cdb7516469a99 (patch)
treefe8466c18ee68f1dc30c76bd92966ba69e9e44c2
parent7c18b532d2c15ca1e7b9fa49358b862f66ffb79c (diff)
downloadgenenetwork2-ff4514b3d51455bd592e038faa8cdb7516469a99.tar.gz
Fixed issue where, if the user searched for a location range in the SNP Browser, it often wouldn't correctly identify when markers were on genes
-rw-r--r--wqflask/wqflask/snp_browser/snp_browser.py26
1 files changed, 23 insertions, 3 deletions
diff --git a/wqflask/wqflask/snp_browser/snp_browser.py b/wqflask/wqflask/snp_browser/snp_browser.py
index 360e6b28..9a980cb1 100644
--- a/wqflask/wqflask/snp_browser/snp_browser.py
+++ b/wqflask/wqflask/snp_browser/snp_browser.py
@@ -300,7 +300,7 @@ class SnpBrowser(object):
gene_id = get_gene_id(self.species_id, self.gene_name)
gene = [gene_id, self.gene_name]
else:
- gene = ""
+ gene = check_if_in_gene(species_id, chr, mb)
transcript = exon = function = function_details = ''
if self.redundant == "false" or last_mb != mb: # filter redundant
if self.include_record(domain, function, snp_source, conservation_score):
@@ -444,8 +444,8 @@ class SnpBrowser(object):
if domain:
domain_1 = domain[0]
domain_2 = domain[1]
- if domain_1 == "Intergenic" and self.gene_name != "":
- domain_1 = self.gene_name
+ if domain_1 == "Intergenic" and gene != "":
+ domain_1 = gene_name
else:
if domain_1 == "Exon":
domain_1 = domain_1 + " " + exon
@@ -874,3 +874,23 @@ def get_gene_id_name_dict(species_id, gene_name_list):
pass
return gene_id_name_dict
+
+def check_if_in_gene(species_id, chr, mb):
+ if species_id != 0: #ZS: Check if this is necessary
+ query = """SELECT geneId, geneSymbol
+ FROM GeneList
+ WHERE SpeciesId = {0} AND chromosome = '{1}' AND
+ (txStart < {2} AND txEnd > {2}); """.format(species_id, chr, mb)
+ else:
+ query = """SELECT geneId,geneSymbol
+ FROM GeneList
+ WHERE chromosome = '{0}' AND
+ (txStart < {1} AND txEnd > {1}); """.format(species_id, chr, mb)
+
+ result = g.db.execute(query).fetchone()
+
+ if result:
+ return [result[0], result[1]]
+ else:
+ return ""
+