Skip to content

Commit e4b41b2

Browse files
committed
CLI: Check that number of mappings for a score set is greater than 0, and return an error if not.
This change also removes a TODO for which there is now a backlog entry.
1 parent c3ade2e commit e4b41b2

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/dcd_mapping/main.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,9 @@ async def map_scoreset(
233233
)
234234
_emit_info(f"Score set mapping output saved to: {final_output}.", silent)
235235
return
236-
# TODO this should be if all values in dict are none. or might not need this at all.
237-
if vrs_results is None or len(vrs_results) == 0:
236+
if not vrs_results or all(
237+
mapping_result is None for mapping_result in vrs_results.values()
238+
):
238239
_emit_info(f"No mapping available for {metadata.urn}", silent, logging.ERROR)
239240
final_output = write_scoreset_mapping_to_json(
240241
metadata.urn,
@@ -260,7 +261,7 @@ async def map_scoreset(
260261
metadata.urn,
261262
vrs_version,
262263
)
263-
except Exception as e: # TODO create AnnotationError class and replace ValueErrors in annotation steps with AnnotationErrors
264+
except Exception as e:
264265
_emit_info(
265266
f"VRS annotation failed for scoreset {metadata.urn}",
266267
silent,
@@ -273,8 +274,9 @@ async def map_scoreset(
273274
)
274275
_emit_info(f"Score set mapping output saved to: {final_output}.", silent)
275276
return
276-
# TODO this should be if all values in dict are none. or might not need this at all.
277-
if annotated_vrs_results is None:
277+
if not annotated_vrs_results or all(
278+
mapping_result is None for mapping_result in annotated_vrs_results.values()
279+
):
278280
_emit_info(f"No annotation available for {metadata.urn}", silent, logging.ERROR)
279281
final_output = write_scoreset_mapping_to_json(
280282
metadata.urn,

0 commit comments

Comments
 (0)