Skip to content

Commit

Permalink
fix(prepro): only one error message if alignment fails
Browse files Browse the repository at this point in the history
  • Loading branch information
corneliusroemer committed May 22, 2024
1 parent b15738b commit c09cfa2
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions preprocessing/nextclade/src/loculus_preprocessing/prepro.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,24 +241,15 @@ def process_single(
args=spec_dict.get("args", {}),
)
input_data: InputMetadata = {}
nextclade_failed = False
for arg_name, input_path in spec.inputs.items():
input_data[arg_name] = None
# If field starts with "nextclade.", take from nextclade metadata
nextclade_prefix = "nextclade."
if input_path.startswith(nextclade_prefix):
# Remove "nextclade." prefix
if unprocessed.nextcladeMetadata is None:
errors.append(
ProcessingAnnotation(
source=[
AnnotationSource(
name="main",
type=AnnotationSourceType.NUCLEOTIDE_SEQUENCE,
)
],
message="Nucleotide sequence failed to align",
)
)
nextclade_failed = True
continue
sub_path = input_path[len(nextclade_prefix) :]
input_data[arg_name] = str(
Expand All @@ -282,6 +273,18 @@ def process_single(
# )
continue
input_data[arg_name] = unprocessed.inputMetadata[input_path]
if nextclade_failed:
errors.append(
ProcessingAnnotation(
source=[
AnnotationSource(
name="main",
type=AnnotationSourceType.NUCLEOTIDE_SEQUENCE,
)
],
message="Nucleotide sequence failed to align",
)
)
processing_result = ProcessingFunctions.call_function(
spec.function, spec.args, input_data, output_field
)
Expand Down

0 comments on commit c09cfa2

Please sign in to comment.