diff --git a/preprocessing/nextclade/src/loculus_preprocessing/prepro.py b/preprocessing/nextclade/src/loculus_preprocessing/prepro.py index 18a41b7ff3..39ea0e767a 100644 --- a/preprocessing/nextclade/src/loculus_preprocessing/prepro.py +++ b/preprocessing/nextclade/src/loculus_preprocessing/prepro.py @@ -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 @@ -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( @@ -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(