Skip to content

Commit

Permalink
digest_unanalyzed consolidation
Browse files Browse the repository at this point in the history
  • Loading branch information
paulstretenowich committed Feb 15, 2024
1 parent 9893372 commit 9037375
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions project_tracking/db_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -1242,15 +1242,18 @@ def digest_unanalyzed(project_id: str, digest_data, session=None):
run_id = digest_data["run_id"]
run_name = digest_data["run_name"]
if run_name:
run_id = name_to_id("Run", run_name)[0]
try:
run_id = name_to_id("Run", run_name)[0]
except:
raise DidNotFindError(f"'Run' with 'name' '{run_name}' doesn't exist on database")
experiment_nucleic_acid_type = digest_data["experiment_nucleic_acid_type"]
location_endpoint = digest_data["location_endpoint"]

if sample_name_flag:
stmt = select(Sample.name)
stmt = select(Sample.name).join(Sample.readsets)
key = "sample_name"
elif sample_id_flag:
stmt = select(Sample.id)
stmt = select(Sample.id).join(Sample.readsets)
key = "sample_id"
elif readset_name_flag:
stmt = select(Readset.name)
Expand All @@ -1260,9 +1263,8 @@ def digest_unanalyzed(project_id: str, digest_data, session=None):
key = "readset_id"

stmt = (
stmt.join(Sample.readsets)
.join(Readset.operations)
.where(Operation.name.ilike(f"%genpipes%"))
stmt.join(Readset.operations)
.where(Operation.name.notilike("%genpipes%"))
.join(Sample.patient)
.join(Patient.project)
.where(Project.id.in_(project_id))
Expand All @@ -1274,6 +1276,7 @@ def digest_unanalyzed(project_id: str, digest_data, session=None):
.join(Readset.run)
)
if experiment_nucleic_acid_type:
logger.debug(f"run_name: {run_name}")
stmt = (
stmt.where(Experiment.nucleic_acid_type == experiment_nucleic_acid_type)
.join(Readset.experiment)
Expand Down

0 comments on commit 9037375

Please sign in to comment.