aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruditgulati2021-03-06 16:47:26 -0600
committerBonfaceKilz2021-05-10 12:23:57 +0300
commit8c8cec89a03b642b671f191ce8a6079883fe5500 (patch)
tree70b7564baae1356352fb27e9f4c400e9f44ae067
parenta9fb861de6834f7a3351c08bf2bde00810921ac7 (diff)
downloadgenenetwork2-8c8cec89a03b642b671f191ce8a6079883fe5500.tar.gz
move geno chr, mb to gsearch main query for phenotype search
-rw-r--r--wqflask/wqflask/gsearch.py47
1 files changed, 30 insertions, 17 deletions
diff --git a/wqflask/wqflask/gsearch.py b/wqflask/wqflask/gsearch.py
index 262ba3c2..44a8f7f7 100644
--- a/wqflask/wqflask/gsearch.py
+++ b/wqflask/wqflask/gsearch.py
@@ -169,16 +169,23 @@ class GSearch:
PublishXRef.`LRS`,
PublishXRef.`additive`,
InbredSet.`InbredSetCode`,
- PublishXRef.`mean`
- FROM Species,InbredSet,PublishFreeze,PublishXRef,Phenotype,Publication
- WHERE PublishXRef.`InbredSetId`=InbredSet.`Id`
- AND PublishFreeze.`InbredSetId`=InbredSet.`Id`
- AND InbredSet.`SpeciesId`=Species.`Id`
+ PublishXRef.`mean`,
+ PublishFreeze.Id,
+ Geno.Chr as geno_chr,
+ Geno.Mb as geno_mb
+ FROM Species
+ INNER JOIN InbredSet ON InbredSet.`SpeciesId`=Species.`Id`
+ INNER JOIN PublishFreeze ON PublishFreeze.`InbredSetId`=InbredSet.`Id`
+ INNER JOIN PublishXRef ON PublishXRef.`InbredSetId`=InbredSet.`Id`
+ INNER JOIN Phenotype ON PublishXRef.`PhenotypeId`=Phenotype.`Id`
+ INNER JOIN Publication ON PublishXRef.`PublicationId`=Publication.`Id`
+ LEFT JOIN Geno ON PublishXRef.Locus = Geno.Name AND Geno.SpeciesId = Species.Id
+ WHERE
+ (
+ (MATCH (Phenotype.Post_publication_description, Phenotype.Pre_publication_description, Phenotype.Pre_publication_abbreviation, Phenotype.Post_publication_abbreviation, Phenotype.Lab_code) AGAINST ('{1}' IN BOOLEAN MODE) )
+ OR (MATCH (Publication.Abstract, Publication.Title, Publication.Authors) AGAINST ('{1}' IN BOOLEAN MODE) )
+ )
{0}
- AND PublishXRef.`PhenotypeId`=Phenotype.`Id`
- AND PublishXRef.`PublicationId`=Publication.`Id`
- AND (MATCH (Phenotype.Post_publication_description, Phenotype.Pre_publication_description, Phenotype.Pre_publication_abbreviation, Phenotype.Post_publication_abbreviation, Phenotype.Lab_code) AGAINST ('{1}' IN BOOLEAN MODE) )
- AND (MATCH (Publication.Abstract, Publication.Title, Publication.Authors) AGAINST ('{1}' IN BOOLEAN MODE) )
ORDER BY Species.`Name`, InbredSet.`Name`, PublishXRef.`Id`
LIMIT 6000
""".format(group_clause, search_term)
@@ -213,6 +220,9 @@ class GSearch:
this_trait['mean'] = f"{line[13]:.3f}"
else:
this_trait['mean'] = "N/A"
+ this_trait['dataset_id'] = line[14]
+ this_trait['locus_chr'] = line[15]
+ this_trait['locus_mb'] = line[16]
this_trait['authors'] = line[7]
this_trait['year'] = line[8]
if this_trait['year'].isdigit():
@@ -233,17 +243,20 @@ class GSearch:
if line[11] != "" and line[11] != None:
this_trait['additive'] = '%.3f' % line[11]
+ dataset_ob = SimpleNamespace(id=this_trait["dataset_id"], type="Publish", species=this_trait["species"])
+ permissions = check_resource_availability(dataset_ob, this_trait['name'])
+ if type(permissions['data']) is list:
+ if "view" not in permissions['data']:
+ continue
+ else:
+ if permissions['data'] == 'no-access':
+ continue
+
this_trait['max_lrs_text'] = "N/A"
- trait_ob = create_trait(
- dataset_name=this_trait['dataset'], name=this_trait['name'], get_qtl_info=True, get_sample_info=False)
- if not trait_ob:
- continue
if this_trait['dataset'] == this_trait['group'] + "Publish":
try:
- if trait_ob.locus_chr != "" and trait_ob.locus_mb != "":
- this_trait['max_lrs_text'] = "Chr" + \
- str(trait_ob.locus_chr) + \
- ": " + str(trait_ob.locus_mb)
+ if this_trait['locus_chr'] != None and this_trait['locus_mb'] != None:
+ this_trait['max_lrs_text'] = "Chr" + str(this_trait['locus_chr']) + ": " + str(this_trait['locus_mb'])
except:
this_trait['max_lrs_text'] = "N/A"