Skip to content

Commit

Permalink
1) fix bug in validate_round2 code, 2) added Inf check (together with…
Browse files Browse the repository at this point in the history
… NaN check) for validation
  • Loading branch information
EC2 Default User committed Aug 8, 2019
1 parent 49ca4f4 commit de6a613
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions score_leaderboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,8 @@ def score_submission(submission, status, args, syn,
log.info('Scored: {}, {}, {}, {}'.format(
submission.id, submission.teamId, k, r))
for m in r:
if math.isnan(m):
raise Exception('NaN found in score {}'.format(r))
if math.isnan(m) or m == float('inf') or m == float('-inf'):
raise Exception('NaN or +-Inf found in score {}'.format(r))
score_outputs.append((k, r))

# score to be shown on wiki (first bootstrap score)
Expand Down
7 changes: 5 additions & 2 deletions validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,21 +93,24 @@ def validate(bw_file, window_size=25):
print(msg)
all_msg += msg + '\n'
valid = False
break
if end > s:
msg = 'Invalid end interval in chromosome {}. '\
'End must be equal to or smaller than chrom size. '
'End must be equal to or smaller than chrom size. '\
'start: {}, end: {}, value: {}, chrsz: {}'.format(
c, start, end, v, s)
print(msg)
all_msg += msg + '\n'
valid = False
break
if math.isnan(v) or v == float('inf') or v == float('-inf'):
msg = 'Found NaN or Inf. '\
msg = 'Found NaN or Inf in chromosome {}. '\
'start: {}, end: {}, value: {}, chrsz: {}'.format(
c, start, end, v, s)
print(msg)
all_msg += msg + '\n'
valid = False
break

except Exception as e:
st = StringIO()
Expand Down
10 changes: 6 additions & 4 deletions validate_round2.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import multiprocessing
from validate import validate
from io import StringIO
from rank import get_team_name, parse_team_name_tsv
from score import parse_submission_filename
from score_leaderboard import mkdir_p, send_message
from score_leaderboard import WIKI_TEMPLATE_SUBMISSION_STATUS, RE_PATTERN_SUBMISSION_FNAME
from logger import log
Expand Down Expand Up @@ -133,7 +135,7 @@ def parse_arguments():
p_syn.add_argument('--project-id', default='syn17083203',
help='Synapse project ID.')
p_syn.add_argument('--round2-wiki-id',
default='submission_status:594309',
default='submission_status:594312',
help='Comma-delimited Synapse wiki ID for round2.')
p_syn.add_argument('--submission-dir', default='./submissions',
help='Download submissions here.')
Expand Down Expand Up @@ -190,6 +192,7 @@ def validate_submission(submission, status, args, syn):
status['status'] = 'VALIDATED'
subject = 'Successfully validated submission %s %s %s:\n' % (
submission.name, submission.id, submission.teamId)
message += '\nSuccess!\n'
else:
subject = 'Invalid submission %s %s %s:\n' % (
submission.name, submission.id, submission.teamId)
Expand Down Expand Up @@ -255,16 +258,15 @@ def main():
for submission, status in syn.getSubmissionBundles(evaluation, status='RECEIVED'):
ret_vals.append(
pool.apply_async(validate_submission,
(submission, status, args, syn,
gene_annotations, enh_annotations)))
(submission, status, args, syn)))
# gather
for r in ret_vals:
r.get(BIG_INT)

pool.close()
pool.join()

update_wiki(syn, team_name_dict, args)
update_wiki_for_round2(syn, team_name_dict, args)

except Exception as ex1:
st = StringIO()
Expand Down

0 comments on commit de6a613

Please sign in to comment.