Skip to content

Commit

Permalink
Merge pull request #23 from glrs/feature/10x-dev
Browse files Browse the repository at this point in the history
Update to interact with YggDB and follow AbstractProject changes
  • Loading branch information
glrs authored Nov 20, 2024
2 parents 88142eb + 27da352 commit 3d68887
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
7 changes: 4 additions & 3 deletions lib/realms/tenx/run_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ def __init__(
self.run_sample_id: str = sample_id
self.lab_samples: List[Any] = lab_samples
self.project_info: Dict[str, Any] = project_info or {}
# TODO: ensure project_id is always available
self.project_id = self.project_info.get("project_id", "")
self.config: Mapping[str, Any] = config or {}
self.ydm: Any = yggdrasil_db_manager

Expand Down Expand Up @@ -93,9 +95,8 @@ def status(self, value: str) -> None:
value (str): The new status value.
"""
self._status = value
# self.ydm.update_sample_status(
# self.project_info.get("project_id", ""), self.id, value
# )
# Update the status in the database
self.ydm.update_sample_status(self.project_id, self.id, value)

def collect_reference_genomes(self) -> Optional[Dict[str, str]]:
"""Collect reference genomes from lab samples and ensure consistency.
Expand Down
7 changes: 5 additions & 2 deletions lib/realms/tenx/tenx_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ def __init__(self, doc: Dict[str, Any], yggdrasil_db_manager: Any) -> None:
self.ydm: Any = yggdrasil_db_manager

# TODO: Might need to check required fields for each different method, if they differ
self.proceed: bool = self._check_required_fields()
self.proceed: bool = self.check_required_fields()

if self.proceed:
self.initialize_project_in_db()
# Extract metadata from project document
self.project_info: Dict[str, Any] = self._extract_project_info()

Expand Down Expand Up @@ -152,7 +153,7 @@ def is_supported_organism(self, organism: str) -> bool:
gex_organisms = reference_mapping.get("gex", {}).keys()
return organism in gex_organisms

def _check_required_fields(self) -> bool:
def check_required_fields(self) -> bool:
"""Check if the document contains all required fields.
Returns:
Expand Down Expand Up @@ -411,6 +412,8 @@ async def launch(self):
logging.warning("No samples found for processing. Returning...")
return

self.add_samples_to_project_in_db()

logging.info(f"Considered samples: {[sample.id for sample in self.samples]}")
logging.info(f"Sample features: {[sample.features for sample in self.samples]}")

Expand Down

0 comments on commit 3d68887

Please sign in to comment.