Skip to content

Commit

Permalink
fix(prepro/nextclade): only one error for failed alignment (#2009)
Browse files Browse the repository at this point in the history
  • Loading branch information
corneliusroemer authored May 22, 2024
1 parent c2de788 commit 73dde00
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions preprocessing/nextclade/src/loculus_preprocessing/prepro.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ def process_single(
"length": len(unprocessed.unalignedNucleotideSequences),
}

alignment_failed = False
for output_field, spec_dict in config.processing_spec.items():
if output_field == "length":
continue
Expand All @@ -248,17 +249,7 @@ def process_single(
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",
)
)
alignment_failed = True
continue
sub_path = input_path[len(nextclade_prefix) :]
input_data[arg_name] = str(
Expand Down Expand Up @@ -295,6 +286,19 @@ def process_single(
)
output_metadata[output_field] = "Not provided"

if alignment_failed:
errors.append(
ProcessingAnnotation(
source=[
AnnotationSource(
name="main",
type=AnnotationSourceType.NUCLEOTIDE_SEQUENCE,
)
],
message="Nucleotide sequence failed to align",
)
)

logging.debug(f"Processed {id}: {output_metadata}")

return ProcessedEntry(
Expand Down

0 comments on commit 73dde00

Please sign in to comment.