aboutsummaryrefslogtreecommitdiff
path: root/gn3/api/correlation.py
diff options
context:
space:
mode:
Diffstat (limited to 'gn3/api/correlation.py')
-rw-r--r--gn3/api/correlation.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/gn3/api/correlation.py b/gn3/api/correlation.py
index 14c029c..f2ac4d7 100644
--- a/gn3/api/correlation.py
+++ b/gn3/api/correlation.py
@@ -68,17 +68,15 @@ def compute_lit_corr(species=None, gene_id=None):
might be needed for actual computing of the correlation results
"""
- conn, _cursor_object = database_connector()
- target_traits_gene_ids = request.get_json()
- target_trait_gene_list = list(target_traits_gene_ids.items())
+ with database_connector() as conn:
+ target_traits_gene_ids = request.get_json()
+ target_trait_gene_list = list(target_traits_gene_ids.items())
- lit_corr_results = compute_all_lit_correlation(
- conn=conn, trait_lists=target_trait_gene_list,
- species=species, gene_id=gene_id)
+ lit_corr_results = compute_all_lit_correlation(
+ conn=conn, trait_lists=target_trait_gene_list,
+ species=species, gene_id=gene_id)
- conn.close()
-
- return jsonify(lit_corr_results)
+ return jsonify(lit_corr_results)
@correlation.route("/tissue_corr/<string:corr_method>", methods=["POST"])