Skip to content

Commit

Permalink
Changed sample_id verification order
Browse files Browse the repository at this point in the history
  • Loading branch information
Shettland committed Oct 25, 2024
1 parent 825abe7 commit 0b28e31
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions relecov_tools/read_lab_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,19 +405,19 @@ def read_metadata_file(self):
property_row = {}
try:
sample_id = str(row[sample_id_col]).strip()
included_sample_ids.append(sample_id)
except KeyError:
self.logsum.add_error(entry=f"No {sample_id_col} found in excel file")
continue
if sample_id in included_sample_ids:
log_text = f"Skipped duplicated sample {sample_id} in row {row_number}. Sequencing sample id must be unique"
self.logsum.add_warning(entry=log_text)
continue
if not row[sample_id_col] or "Not Provided" in sample_id:
log_text = f"{sample_id_col} not provided in row {row_number}. Skipped"
self.logsum.add_warning(entry=log_text)
stderr.print(f"[red]{log_text}")
continue
if sample_id in included_sample_ids:
log_text = f"Skipped duplicated sample {sample_id} in row {row_number}. Sequencing sample id must be unique"
self.logsum.add_warning(entry=log_text)
continue
included_sample_ids.append(sample_id)
for key in row.keys():
# skip the first column of the Metadata lab file
if header_flag in key:
Expand Down Expand Up @@ -495,7 +495,7 @@ def create_metadata_json(self):
completed_metadata = self.adding_ontology_to_enum(extended_metadata)
if not completed_metadata:
stderr.print("Metadata was completely empty. No output file generated")
sys.exit(1)
sys.exit(0)
file_code = "lab_metadata_" + self.lab_code + "_"
file_name = file_code + self.date + ".json"
stderr.print("[blue]Writting output json file")
Expand Down

0 comments on commit 0b28e31

Please sign in to comment.