Skip to content

Commit 8266a0d

Browse files
committed
Merge branch 'dev'
2 parents 4f36fb2 + 5c702ae commit 8266a0d

File tree

12 files changed

+129
-14
lines changed

12 files changed

+129
-14
lines changed

cravat/admin_util.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -921,6 +921,8 @@ def get_system_conf(file_only=False):
921921
conf[constants.user_email_key] = constants.default_user_email
922922
if constants.user_email_opt_out_key not in conf:
923923
conf[constants.user_email_opt_out_key] = constants.default_user_email_opt_out
924+
if constants.user_survey_key not in conf:
925+
conf[constants.user_survey_key] = constants.default_user_survey
924926
if "custom_system_conf" in globals():
925927
global custom_system_conf
926928
for k, v in custom_system_conf.items():

cravat/constants.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@
133133
default_user_email = ''
134134
default_user_email_opt_out = False
135135

136+
# user survey
137+
user_survey_key = 'show_user_survey'
138+
default_user_survey = True
139+
136140
# liftover
137141
liftover_chains_dir = os.path.join(packagedir, "liftover")
138142
liftover_chain_paths = {

cravat/cravat_web.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ def check_local_update(interval):
559559
except requests.exceptions.ConnectionError:
560560
pass
561561
print(
562-
"""
562+
r"""
563563
____ __________ ___ _ _____ ______
564564
/ __ \____ ___ ____ / ____/ __ \/ | | / / |/_ __/
565565
/ / / / __ \/ _ \/ __ \/ / / /_/ / /| | | / / /| | / /

cravat/util.py

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,24 @@
1818
import math
1919

2020

21+
def discretize_scalar(score, cutoffs):
22+
"""Locate the location of `score` in a list[tuple(float, str)] of
23+
`cutoffs`, where the float cutoff is the maximum value, inclusive
24+
of the value, for that label. The last tuple should typically have
25+
`float("inf")` as the cutoff, otherwise the function may retun
26+
`None`
27+
28+
The cutoffs must be sorted in increasing value.
29+
"""
30+
prev_cutoff = None
31+
for cutoff, label in cutoffs:
32+
if score <= cutoff:
33+
return label
34+
if prev_cutoff is not None and prev_cutoff > cutoff:
35+
raise ValueError("cutoffs are not sorted")
36+
prev_cutoff = cutoff
37+
38+
2139
def get_ucsc_bins(start, stop=None):
2240
if stop is None:
2341
stop = start + 1
@@ -141,12 +159,12 @@ def aa_abbv_to_let(abbvs):
141159

142160

143161
tmap_re = re.compile(
144-
"\*?(?P<transcript>[A-Z_]+\d+\.\d+):"
145-
+ "(?P<ref>[A-Z_\*]+)"
146-
+ "(?P<pos>\d+|NA)"
147-
+ "(?P<alt>[A-Z_\*]+)"
148-
+ "\((?P<so>\w+)\)"
149-
+ "\((?P<hugo>\w+)\)"
162+
r"\*?(?P<transcript>[A-Z_]+\d+\.\d+):"
163+
+ r"(?P<ref>[A-Z_\*]+)"
164+
+ r"(?P<pos>\d+|NA)"
165+
+ r"(?P<alt>[A-Z_\*]+)"
166+
+ r"\((?P<so>\w+)\)"
167+
+ r"\((?P<hugo>\w+)\)"
150168
)
151169

152170
codon_table = {
@@ -473,6 +491,7 @@ def humanize_bytes(num, binary=False):
473491
quot_str = quot_str.rstrip("0").rstrip(".")
474492
return "{quotient} {unit}".format(quotient=quot_str, unit=unit)
475493

494+
476495
def write_log_msg(logger, e):
477496
if hasattr(e, "msg"):
478497
if type(e.msg) == list:
@@ -485,4 +504,3 @@ def write_log_msg(logger, e):
485504
else:
486505
logger.info(e)
487506
print(e)
488-

cravat/webresult/webresult.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ async def get_status (request):
268268
job_id, dbpath = await get_jobid_dbpath(request)
269269
conn = await get_db_conn(dbpath)
270270
cursor = await conn.cursor()
271-
q = 'select * from info where colkey not like "\_%" escape "\\"'
271+
q = r'select * from info where colkey not like "\_%" escape "\\"'
272272
await cursor.execute(q)
273273
content = {}
274274
for row in await cursor.fetchall():
@@ -418,7 +418,7 @@ async def get_jobid_dbpath (request):
418418
else:
419419
dbpath = ''
420420
if dbpath == '':
421-
if 'job_id' != '':
421+
if job_id != '':
422422
global wu
423423
dbpath = await wu.filerouter.job_db(request, job_id, given_username=given_username)
424424
else:

cravat/webstore/nocache/webstore.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,9 +1355,13 @@ function onClickModuleDetailUpdateButton(evt) {
13551355
var btn = evt.target;
13561356
var btnModuleName = btn.getAttribute('module');
13571357
var installSize = OC.updates[btnModuleName].size;
1358+
btn.disabled = true;
13581359
$.ajax({
13591360
url: '/store/freemodulesspace',
13601361
ajax: true,
1362+
always: function (response) {
1363+
btn.disabled = false;
1364+
},
13611365
success: function(response) {
13621366
var freeSpace = response;
13631367
var noSpace = false;
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading

cravat/websubmit/nocache/index.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@
4242
<div id='admindiv_tabhead' class='tabhead' value='admindiv' disabled='t' style='display: none;'>
4343
ADMIN
4444
</div>
45+
<a href="https://docs.google.com/forms/d/1xK1nJre7d_d85QScVFFhdUri3rj9Bs_M0VIhHR8398o" target="_blank" id="survey-button-link" title="User Survey">
46+
<div id='survey-button' >
47+
<div id='survey-button-icon' class='button-icon' title='User Survey' ></div>
48+
User Survey
49+
</div>
50+
</a>
4551
</div>
4652
<div id='header-right'>
4753
<div id='top-menu'>

cravat/websubmit/nocache/moduleinfo.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ function getModuleDetailInstallButton(moduleName, td, buttonDiv) {
291291
} else {
292292
buttonText = 'Install';
293293
button.style.backgroundColor = '#beeaff';
294-
button.addEventListener('click', () => OC.mediator.publish('moduleinfo.install'));
294+
button.addEventListener('click', (evt) => OC.mediator.publish('moduleinfo.install', evt));
295295
}
296296
button.textContent = buttonText;
297297
button.style.padding = '8px';
@@ -321,7 +321,7 @@ function getModuleDetailUpdateButton(moduleName) {
321321
var titleText = 'Update blocked by: ' + blockString + '. Uninstall blocking modules to update.';
322322
button.setAttribute('title', titleText);
323323
}
324-
button.addEventListener('click', () => OC.mediator.publish('moduleinfo.update'));
324+
button.addEventListener('click', (evt) => OC.mediator.publish('moduleinfo.update', evt));
325325
return button;
326326
}
327327

@@ -408,6 +408,7 @@ function makeModuleDetailDialog(moduleName, moduleListName, moduleListPos) {
408408
sdiv.style.marginTop = '10px';
409409
sdiv.style.fontSize = '12px';
410410
if (OC.installInfo[moduleName] != undefined) {
411+
button.disabled = true;
411412
sdiv.textContent = OC.installInfo[moduleName]['msg'];
412413
}
413414
addEl(td, sdiv);
@@ -619,6 +620,9 @@ function makeModuleDetailDialog(moduleName, moduleListName, moduleListPos) {
619620
addEl(d, span);
620621
var button = getModuleDetailUpdateButton(moduleName);
621622
addEl(buttonDiv, button);
623+
if (OC.installInfo[moduleName] !== undefined) {
624+
button.disabled = true;
625+
}
622626
}
623627
}
624628
}

0 commit comments

Comments
 (0)