Skip to content

Commit

Permalink
fix svg export
Browse files Browse the repository at this point in the history
  • Loading branch information
kvnjng committed Sep 17, 2020
1 parent b633916 commit 991f390
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions LDlink/LDlink-4.2.0.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion LDlink/LDproxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

###########################
Expand Down
12 changes: 7 additions & 5 deletions LDlink/LDproxy_plot_sub.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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__":
Expand Down

0 comments on commit 991f390

Please sign in to comment.