From 991f3901cdd25b56bad447b0b1bb6d4131e43e36 Mon Sep 17 00:00:00 2001 From: kvnjng Date: Thu, 17 Sep 2020 13:42:54 -0600 Subject: [PATCH] fix svg export --- LDlink/LDlink-4.2.0.js | 4 ++-- LDlink/LDproxy.py | 2 +- LDlink/LDproxy_plot_sub.py | 12 +++++++----- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/LDlink/LDlink-4.2.0.js b/LDlink/LDlink-4.2.0.js index a62bb00c..f85475e3 100755 --- a/LDlink/LDlink-4.2.0.js +++ b/LDlink/LDlink-4.2.0.js @@ -2828,7 +2828,7 @@ function updateLDproxy() { var $btn = $('#' + id).button('loading'); var population = getPopulationCodes(id+'-population-codes'); var r2_d; - var window = $("#" + id + "-bp-window").val().replace(/\,/g, ''); + var windowSize = $("#" + id + "-bp-window").val().replace(/\,/g, ''); if($('#proxy_color_r2').hasClass('active')) { r2_d='r2'; // i.e. R2 @@ -2845,7 +2845,7 @@ function updateLDproxy() { pop : population.join("+"), reference : Math.floor(Math.random() * (99999 - 10000 + 1)), r2_d : r2_d, - window: window + window: windowSize }; updateHistoryURL(id, ldproxyInputs); diff --git a/LDlink/LDproxy.py b/LDlink/LDproxy.py index d19bc03f..21c459e1 100755 --- a/LDlink/LDproxy.py +++ b/LDlink/LDproxy.py @@ -832,7 +832,7 @@ def get_output(process): # Generate high quality images only if accessed via web instance if web: # Open thread for high quality image exports - command = "python3 LDproxy_plot_sub.py " + snp + " " + pop + " " + request + " " + r2_d + command = "python3 LDproxy_plot_sub.py " + snp + " " + pop + " " + request + " " + r2_d + " " + str(window) subprocess.Popen(command, shell=True, stdout=subprocess.PIPE) ########################### diff --git a/LDlink/LDproxy_plot_sub.py b/LDlink/LDproxy_plot_sub.py index 724884a3..8c3b934b 100644 --- a/LDlink/LDproxy_plot_sub.py +++ b/LDlink/LDproxy_plot_sub.py @@ -15,7 +15,7 @@ # LDproxy subprocess to export bokeh to high quality images in the background -def calculate_proxy_svg(snp, pop, request, r2_d="r2"): +def calculate_proxy_svg(snp, pop, request, r2_d="r2", window=500000): # Set data directories using config.yml with open('config.yml', 'r') as f: @@ -172,7 +172,7 @@ def replace_coord_rsid(db, snp): return None # Define window of interest around query SNP - window = 500000 + # window = 500000 coord1 = int(snp_coord['position']) - window if coord1 < 0: coord1 = 0 @@ -607,21 +607,23 @@ def get_output(process): def main(): # Import LDproxy options - if len(sys.argv) == 4: + if len(sys.argv) == 5: snp = sys.argv[1] pop = sys.argv[2] request = False r2_d = "r2" - elif len(sys.argv) == 5: + window = sys.argv[5] + elif len(sys.argv) == 6: snp = sys.argv[1] pop = sys.argv[2] request = sys.argv[3] r2_d = sys.argv[4] + window = sys.argv[5] else: sys.exit() # Run function - calculate_proxy_svg(snp, pop, request, r2_d) + calculate_proxy_svg(snp, pop, request, r2_d, int(window)) if __name__ == "__main__":