Commit c746d5f0 authored by Yannick DAYER's avatar Yannick DAYER
Browse files

Merge branch 'scores' into 'master'

Allow reading a mix of old and new format scores

See merge request !258
parents 335937fd a489a074
Pipeline #53080 passed with stage
in 17 minutes and 42 seconds
...@@ -386,6 +386,9 @@ def split(filename, ncolumns=None, sort=False): ...@@ -386,6 +386,9 @@ def split(filename, ncolumns=None, sort=False):
This array contains the list of scores, for which the ``claimed_id`` and This array contains the list of scores, for which the ``claimed_id`` and
the ``real_id`` are identical (see :py:func:`four_column`) the ``real_id`` are identical (see :py:func:`four_column`)
""" """
if iscsv(filename):
return split_csv_scores(filename)
ncolumns = _estimate_score_file_format(filename, ncolumns) ncolumns = _estimate_score_file_format(filename, ncolumns)
if ncolumns == 4: if ncolumns == 4:
neg, pos = split_four_column(filename) neg, pos = split_four_column(filename)
......
...@@ -56,8 +56,7 @@ def metrics(ctx, scores, evaluation, **kwargs): ...@@ -56,8 +56,7 @@ def metrics(ctx, scores, evaluation, **kwargs):
if "criterion" in ctx.meta and ctx.meta["criterion"] == "rr": if "criterion" in ctx.meta and ctx.meta["criterion"] == "rr":
process = bio_figure.Metrics(ctx, scores, evaluation, load.cmc) process = bio_figure.Metrics(ctx, scores, evaluation, load.cmc)
else: else:
func = load.split_csv_scores if iscsv(scores[0]) else load.split process = bio_figure.Metrics(ctx, scores, evaluation, load.split)
process = bio_figure.Metrics(ctx, scores, evaluation, func)
process.run() process.run()
...@@ -65,8 +64,7 @@ def metrics(ctx, scores, evaluation, **kwargs): ...@@ -65,8 +64,7 @@ def metrics(ctx, scores, evaluation, **kwargs):
common_options.ROC_HELP.format(score_format=SCORE_FORMAT, command="bob bio roc") common_options.ROC_HELP.format(score_format=SCORE_FORMAT, command="bob bio roc")
) )
def roc(ctx, scores, evaluation, **kargs): def roc(ctx, scores, evaluation, **kargs):
func = load.split_csv_scores if iscsv(scores[0]) else load.split process = bio_figure.Roc(ctx, scores, evaluation, load.split)
process = bio_figure.Roc(ctx, scores, evaluation, func)
process.run() process.run()
...@@ -74,8 +72,7 @@ def roc(ctx, scores, evaluation, **kargs): ...@@ -74,8 +72,7 @@ def roc(ctx, scores, evaluation, **kargs):
common_options.DET_HELP.format(score_format=SCORE_FORMAT, command="bob bio det") common_options.DET_HELP.format(score_format=SCORE_FORMAT, command="bob bio det")
) )
def det(ctx, scores, evaluation, **kargs): def det(ctx, scores, evaluation, **kargs):
func = load.split_csv_scores if iscsv(scores[0]) else load.split process = bio_figure.Det(ctx, scores, evaluation, load.split)
process = bio_figure.Det(ctx, scores, evaluation, func)
process.run() process.run()
...@@ -83,8 +80,7 @@ def det(ctx, scores, evaluation, **kargs): ...@@ -83,8 +80,7 @@ def det(ctx, scores, evaluation, **kargs):
common_options.EPC_HELP.format(score_format=SCORE_FORMAT, command="bob bio epc") common_options.EPC_HELP.format(score_format=SCORE_FORMAT, command="bob bio epc")
) )
def epc(ctx, scores, **kargs): def epc(ctx, scores, **kargs):
func = load.split_csv_scores if iscsv(scores[0]) else load.split process = measure_figure.Epc(ctx, scores, True, load.split)
process = measure_figure.Epc(ctx, scores, True, func)
process.run() process.run()
...@@ -92,8 +88,7 @@ def epc(ctx, scores, **kargs): ...@@ -92,8 +88,7 @@ def epc(ctx, scores, **kargs):
common_options.HIST_HELP.format(score_format=SCORE_FORMAT, command="bob bio hist") common_options.HIST_HELP.format(score_format=SCORE_FORMAT, command="bob bio hist")
) )
def hist(ctx, scores, evaluation, **kwargs): def hist(ctx, scores, evaluation, **kwargs):
func = load.split_csv_scores if iscsv(scores[0]) else load.split process = bio_figure.Hist(ctx, scores, evaluation, load.split)
process = bio_figure.Hist(ctx, scores, evaluation, func)
process.run() process.run()
...@@ -120,9 +115,8 @@ def evaluate(ctx, scores, evaluation, **kwargs): ...@@ -120,9 +115,8 @@ def evaluate(ctx, scores, evaluation, **kwargs):
criteria=CRITERIA, criteria=CRITERIA,
) )
def multi_metrics(ctx, scores, evaluation, protocols_number, **kwargs): def multi_metrics(ctx, scores, evaluation, protocols_number, **kwargs):
func = load.split_csv_scores if iscsv(scores[0]) else load.split
ctx.meta["min_arg"] = protocols_number * (2 if evaluation else 1) ctx.meta["min_arg"] = protocols_number * (2 if evaluation else 1)
process = bio_figure.MultiMetrics(ctx, scores, evaluation, func) process = bio_figure.MultiMetrics(ctx, scores, evaluation, load.split)
process.run() process.run()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment