diff options
author | Alexander_Kabui | 2022-08-18 23:36:56 +0300 |
---|---|---|
committer | Alexander_Kabui | 2022-08-18 23:36:56 +0300 |
commit | 7d089d58d9e62fba6d61f17f93148054cf7e6730 (patch) | |
tree | a49f856e1842a71b838e7f3b6ffc03c8afc2d732 /wqflask | |
parent | d9b8dec4f8bd9f1f08bb1d1c55c4036b047f9051 (diff) | |
download | genenetwork2-7d089d58d9e62fba6d61f17f93148054cf7e6730.tar.gz |
bulk fetch n number of traits type probeset
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/correlation/rust_correlation.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/wqflask/wqflask/correlation/rust_correlation.py b/wqflask/wqflask/correlation/rust_correlation.py index 5c22efbf..fc8ab508 100644 --- a/wqflask/wqflask/correlation/rust_correlation.py +++ b/wqflask/wqflask/correlation/rust_correlation.py @@ -15,6 +15,34 @@ from gn3.computations.rust_correlation import parse_tissue_corr_data from gn3.db_utils import database_connector +def query_probes_metadata(dataset, results): + + """query traits metadata in bulk for probeset""" + + with database_connector() as conn: + with conn.cursor() as cursor: + + query = """ + SELECT ProbeSet.Name,ProbeSet.Chr,ProbeSet.Mb, + Symbol,mean,description,additive,LRS,Geno.Chr, Geno.Mb + from Geno, Species,ProbeSet,ProbeSetXRef,ProbeSetFreeze + where ProbeSet.Name in ({}) and + Species.Name = %s and + Geno.Name = ProbeSetXRef.Locus and + Geno.SpeciesId = Species.Id and + ProbeSet.Id=ProbeSetXRef.ProbeSetId and + ProbeSetFreeze.Id = ProbeSetXRef.ProbeSetFreezeId and + ProbeSetFreeze.Name = %s + """.format(", ".join(["%s"] * len(trait_list))) + + cursor.execute(query, + (tuple(trait_list) + + (dataset.group.species,) + (dataset.name,)) + ) + + return cursor.fetchall() + + def chunk_dataset(dataset, steps, name): results = [] |