From ab76f2010ac3472d1c861df91629727c99b4d5e8 Mon Sep 17 00:00:00 2001 From: Hui Lan Date: Fri, 27 Mar 2020 16:15:45 +0800 Subject: html_network.py: string like 'F3'H' will cause syntax error in JavaScript. json.dumps could not fix that. --- Code/html_network.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Code/html_network.py') diff --git a/Code/html_network.py b/Code/html_network.py index dea1456..56296ab 100644 --- a/Code/html_network.py +++ b/Code/html_network.py @@ -20,7 +20,7 @@ from datetime import datetime import collections, re, glob from geneid2name import make_gene_name_AGI_map_dict from param4net import make_global_param_dict -import json +import re ## Global variables REGENERATE_ALL_EDGE_FILES = 'YES' @@ -55,7 +55,7 @@ def get_name(s, agi2name_dict): if s in agi2name_dict: name = agi2name_dict[s] lst = name.split(';') - return json.dumps(lst[0]) # use json.dumps to escape prime character in 'F3'H'. Something like {genename:'F3'H'} is invalid in JavaScript. + return re.escape(lst[0]) # use json.dumps to escape prime character in 'F3'H'. Something like {genename:'F3'H'} is invalid in JavaScript. else: return s -- cgit v1.2.1