diff options
author | Hui Lan <lanhui@zjnu.edu.cn> | 2020-03-27 16:15:45 +0800 |
---|---|---|
committer | Hui Lan <lanhui@zjnu.edu.cn> | 2020-03-27 16:15:45 +0800 |
commit | ab76f2010ac3472d1c861df91629727c99b4d5e8 (patch) | |
tree | fbe2e3c384e3387a9d554a5d6be03c20295b9a59 /Code/html_network.py | |
parent | 13db6d20670cc14d8f2b0bfd450f60d125b0ed11 (diff) |
html_network.py: string like 'F3'H' will cause syntax error in JavaScript. json.dumps could not fix that.
Diffstat (limited to 'Code/html_network.py')
-rw-r--r-- | Code/html_network.py | 4 |
1 files changed, 2 insertions, 2 deletions
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
|