Skip to content

Commit

Permalink
Merge pull request #27 from glrs/feature/ss3-dev
Browse files Browse the repository at this point in the history
Feature/ss3 dev - Safeguarding against aborted sample irregularities
  • Loading branch information
glrs authored Nov 29, 2024
2 parents 1033855 + 47e5418 commit 580b379
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
4 changes: 4 additions & 0 deletions lib/realms/smartseq3/ss3_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ def extract_samples(self):
samples = []

for sample_id, sample_data in self.doc.get("samples", {}).items():
sample_status = sample_data.get("details", {}).get("status_(manual)", "")
if sample_status.lower() == "aborted":
logging.info(f"Skipping aborted sample '{sample_id}'.")
continue # Skip this sample
sample = SS3Sample(
sample_id, sample_data, self.project_info, self.config, self.ydm
)
Expand Down
18 changes: 12 additions & 6 deletions lib/realms/smartseq3/ss3_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,18 @@ def get_barcode(self):
Returns:
str: The barcode of the sample.
"""
barcode = self.sample_data["library_prep"]["A"].get("barcode", None)
if barcode:
return barcode.split("-")[-1]
else:
logging.warning(f"No barcode found in StatusDB for sample {self.id}.")
return None # Or handle more appropriately based on your application's requirements
try:
library_prep = self.sample_data.get("library_prep", {})
prep_A = library_prep.get("A", {})
barcode = prep_A.get("barcode", None)
if barcode:
return barcode.split("-")[-1]
else:
logging.warning(f"No barcode found for sample {self.id}.")
return None # Or handle more appropriately based on your application's requirements
except Exception as e:
logging.error(f"Error extracting barcode for sample {self.id}: {e}")
return None

def _collect_yaml_metadata(self):
"""
Expand Down

0 comments on commit 580b379

Please sign in to comment.