cg 83.20.2__py3-none-any.whl → 84.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
cg/__init__.py CHANGED
@@ -1,2 +1,2 @@
1
1
  __title__ = "cg"
2
- __version__ = "83.20.2"
2
+ __version__ = "84.0.0"
@@ -19,20 +19,22 @@ class PacbioSmrtCellMetricsDTO(BaseModel):
19
19
  p2_percent: float
20
20
  percent_reads_passing_q30: float
21
21
  plate: int
22
- run_name: str
22
+ run_id: str
23
23
  started_at: datetime
24
24
  well: str
25
25
 
26
26
 
27
27
  class PacbioSmrtCellMetricsResponse(BaseModel):
28
- runs: list[PacbioSmrtCellMetricsDTO]
28
+ metrics: list[PacbioSmrtCellMetricsDTO]
29
29
 
30
30
 
31
31
  class PacbioSequencingRunDTO(BaseModel):
32
32
  id: int
33
- run_name: str
34
33
  comment: str
35
34
  processed: bool
35
+ run_id: str
36
+ run_name: str | None
37
+ unique_id: str | None
36
38
 
37
39
 
38
40
  class PacbioSequencingRunResponse(BaseModel):
@@ -11,10 +11,10 @@ PACBIO_SMRT_CELL_METRICS_BLUEPRINT = Blueprint(
11
11
  PACBIO_SMRT_CELL_METRICS_BLUEPRINT.before_request(before_request)
12
12
 
13
13
 
14
- @PACBIO_SMRT_CELL_METRICS_BLUEPRINT.route("/<run_name>", methods=["GET"])
14
+ @PACBIO_SMRT_CELL_METRICS_BLUEPRINT.route("/<run_id>", methods=["GET"])
15
15
  @handle_missing_entries
16
- def get_smrt_cell_metrics(run_name: str):
16
+ def get_smrt_cell_metrics(run_id: str):
17
17
  response: PacbioSmrtCellMetricsResponse = (
18
- pacbio_sequencing_runs_service.get_sequencing_runs_by_name(run_name)
18
+ pacbio_sequencing_runs_service.get_sequencing_runs_by_run_id(run_id)
19
19
  )
20
20
  return jsonify(response.model_dump())
@@ -13,17 +13,17 @@ class PacbioSequencingRunsService:
13
13
  def __init__(self, store: Store):
14
14
  self.store = store
15
15
 
16
- def get_sequencing_runs_by_name(self, run_name: str) -> PacbioSmrtCellMetricsResponse:
16
+ def get_sequencing_runs_by_run_id(self, run_id: str) -> PacbioSmrtCellMetricsResponse:
17
17
  metrics: list[PacbioSmrtCellMetricsDTO] = []
18
18
  db_smrt_cell_metrics: list[PacbioSMRTCellMetrics] = (
19
- self.store.get_pacbio_smrt_cell_metrics_by_run_id(run_name)
19
+ self.store.get_pacbio_smrt_cell_metrics_by_run_id(run_id)
20
20
  )
21
21
  for metric in db_smrt_cell_metrics:
22
22
  metric_dict = metric.to_dict()
23
23
  metric_dict["internal_id"] = metric.device.internal_id
24
- metric_dict["run_name"] = metric.run_id
24
+ metric_dict["run_id"] = metric.run_id
25
25
  metrics.append(PacbioSmrtCellMetricsDTO.model_validate(metric_dict))
26
- return PacbioSmrtCellMetricsResponse(runs=metrics)
26
+ return PacbioSmrtCellMetricsResponse(metrics=metrics)
27
27
 
28
28
  def get_sequencing_runs(self, page: int = 0, page_size: int = 0) -> PacbioSequencingRunResponse:
29
29
  db_runs, total_count = self.store.get_pacbio_sequencing_runs(page=page, page_size=page_size)
@@ -31,9 +31,11 @@ class PacbioSequencingRunsService:
31
31
  for db_run in db_runs:
32
32
  run = PacbioSequencingRunDTO(
33
33
  id=db_run.id,
34
- run_name=db_run.run_id,
34
+ run_id=db_run.run_id,
35
+ run_name=db_run.run_name,
35
36
  comment=db_run.comment,
36
37
  processed=db_run.processed,
38
+ unique_id=db_run.unique_id,
37
39
  )
38
40
  runs.append(run)
39
41
  return PacbioSequencingRunResponse(pacbio_sequencing_runs=runs, total_count=total_count)
@@ -63,9 +63,6 @@ def express_sample_has_enough_reads(sample: Sample) -> bool:
63
63
  Checks if given express sample has enough reads. Gets the threshold from the sample's
64
64
  application version.
65
65
  """
66
- if sample.is_external:
67
- LOG.info(f"Sample {sample.internal_id} is external, skipping check.")
68
- return True
69
66
  express_reads_threshold: int = get_express_reads_threshold_for_sample(sample)
70
67
  enough_reads: bool = sample.reads >= express_reads_threshold
71
68
  if not enough_reads:
@@ -74,9 +71,6 @@ def express_sample_has_enough_reads(sample: Sample) -> bool:
74
71
 
75
72
 
76
73
  def express_sample_has_enough_yield(sample: Sample) -> bool:
77
- if sample.is_external:
78
- LOG.info(f"Sample {sample.internal_id} is external, skipping check.")
79
- return True
80
74
  if not sample.hifi_yield:
81
75
  LOG.debug(f"Sample {sample.internal_id} has no hifi yield.")
82
76
  return False
@@ -142,34 +136,26 @@ def any_sample_in_case_has_reads(case: Case) -> bool:
142
136
  def raw_data_case_pass_qc(case: Case) -> bool:
143
137
  if is_case_ready_made_library(case):
144
138
  return ready_made_library_case_pass_sequencing_qc(case)
145
- if is_any_processed_sample_yield_based(case):
139
+ if is_first_sample_yield_based_and_processed(case):
146
140
  return all(sample_has_enough_hifi_yield(sample) for sample in case.samples)
147
- elif is_any_processed_sample_read_based(case):
141
+ elif is_first_sample_reads_based_and_processed(case):
148
142
  return all(sample_has_enough_reads(sample) for sample in case.samples)
149
- elif are_all_samples_external(case):
150
- LOG.info(f"All samples in case {case.internal_id} are external, QC passes.")
151
- return True
152
143
  LOG.warning(f"Not all samples for case {case.internal_id} have been post-processed.")
153
144
  return False
154
145
 
155
146
 
156
- def is_any_processed_sample_yield_based(case: Case) -> bool:
157
- """Returns True if any sample has any sample sequencing metrics of Pacbio type."""
158
- return any(
159
- any(metric.type == DeviceType.PACBIO for metric in sample.sample_run_metrics)
160
- for sample in case.samples
161
- )
162
-
163
-
164
- def is_any_processed_sample_read_based(case: Case) -> bool:
165
- return any(
166
- any(metric.type == DeviceType.ILLUMINA for metric in sample.sample_run_metrics)
167
- for sample in case.samples
168
- )
147
+ def is_first_sample_yield_based_and_processed(case: Case) -> bool:
148
+ sample: Sample = case.samples[0]
149
+ if metrics := sample.sample_run_metrics:
150
+ return metrics[0].type == DeviceType.PACBIO
151
+ return False
169
152
 
170
153
 
171
- def are_all_samples_external(case: Case) -> bool:
172
- return all(sample.is_external for sample in case.samples)
154
+ def is_first_sample_reads_based_and_processed(case: Case) -> bool:
155
+ sample: Sample = case.samples[0]
156
+ if metrics := sample.sample_run_metrics:
157
+ return metrics[0].type == DeviceType.ILLUMINA
158
+ return False
173
159
 
174
160
 
175
161
  def is_case_express_priority(case: Case) -> bool:
@@ -219,9 +205,6 @@ def sample_has_enough_reads(sample: Sample) -> bool:
219
205
  """
220
206
  Check if the sample has more or equal reads than the expected reads for the sample.
221
207
  """
222
- if sample.is_external:
223
- LOG.info(f"Sample {sample.internal_id} is external, skipping check.")
224
- return True
225
208
  enough_reads: bool = sample.reads >= sample.expected_reads_for_sample
226
209
  if not enough_reads:
227
210
  LOG.warning(f"Sample {sample.internal_id} has too few reads.")
@@ -235,12 +218,7 @@ def sample_has_enough_hifi_yield(sample: Sample) -> bool:
235
218
  Raises:
236
219
  ApplicationDoesNotHaveHiFiYieldError if the sample doesn't have expected HiFi yield.
237
220
  """
238
- if sample.is_external:
239
- # An external sample will have None as yield in StatusDB
240
- LOG.info(f"Sample {sample.internal_id} is external, skipping check.")
241
- return True
242
-
243
- if sample.expected_hifi_yield is None:
221
+ if not sample.expected_hifi_yield:
244
222
  raise ApplicationDoesNotHaveHiFiYieldError(
245
223
  f"Application for sample {sample.internal_id} does not have target HiFi yield."
246
224
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cg
3
- Version: 83.20.2
3
+ Version: 84.0.0
4
4
  Summary: Clinical Genomics command center
5
5
  Requires-Python: >=3.11,<3.13
6
6
  Classifier: Programming Language :: Python
@@ -1,4 +1,4 @@
1
- cg/__init__.py,sha256=BeY80I67U51q6aLgK7vrT1Z-paSugKRtXMtbF02Y5OY,41
1
+ cg/__init__.py,sha256=-0zb_Vkke33twQaAco0uQC7O2Ll3XJ-mQnXVj4OaNnc,40
2
2
  cg/apps/__init__.py,sha256=pYf0vxo4iYQqURzFRYzqpOCdV8Cm9MWx0GHvJOz0EMg,315
3
3
  cg/apps/coverage/__init__.py,sha256=dJtsmNf8tODE2-VEomMIoYA7ugLYZAk_upsfOQCZeF8,27
4
4
  cg/apps/coverage/api.py,sha256=e_ozC3QeNKoEfpjjMaL-XjeBLtz-JySWccrtw0E9mLM,2940
@@ -497,9 +497,9 @@ cg/server/endpoints/sequencing_metrics/dtos.py,sha256=DXh9xFLrS0RQIxHrkAZa71AkcL
497
497
  cg/server/endpoints/sequencing_metrics/error_handler.py,sha256=rVASP7uk1qSA5qu__-JcSZ6vXpBy3s7n4GdBVg0zAUA,758
498
498
  cg/server/endpoints/sequencing_metrics/illumina_sequencing_metrics.py,sha256=IvXMH2KIeOH98lJkaFLPFIRj7j6uW3oBaJZozQ5Tva0,810
499
499
  cg/server/endpoints/sequencing_metrics/pacbio_sequencing_metrics.py,sha256=iglo2cOYSPuK4HAWH4XPGLgbZOst2spdB7A6mQ8th8g,1218
500
- cg/server/endpoints/sequencing_run/dtos.py,sha256=ezs1TW0XyKO8gYyRreq6iQsFwLtgV8tzO96fzXT6kWg,1023
500
+ cg/server/endpoints/sequencing_run/dtos.py,sha256=o2al0uUnGbZdMRvOZ5z9zb67peJmBM7EyBSA7xizv3Y,1073
501
501
  cg/server/endpoints/sequencing_run/pacbio_sequencing_run.py,sha256=HvV7EPwrh_xe5ZjerQYoBK-bIdKLBZ1nk16whGSDAmw,1524
502
- cg/server/endpoints/sequencing_run/pacbio_smrt_cell_metrics.py,sha256=FVETf-KUghGbb7KGO2sDYWISp3Z9gnublo-9ekQHUuk,819
502
+ cg/server/endpoints/sequencing_run/pacbio_smrt_cell_metrics.py,sha256=0cV6wybrsLmYMuW3noM6RHy8Sb7RunavMEpWMSJtiAo,815
503
503
  cg/server/endpoints/users.py,sha256=48z9Si2EuJ6wcN8jBIr0yvmtgygozYgUIytyFuTzFao,696
504
504
  cg/server/endpoints/utils.py,sha256=RjhrcBqY3Mfg_hZIeXr6SfmCTu4FMpan-n5UNDjOeMg,2251
505
505
  cg/server/ext.py,sha256=rQIv4qKS_N5whB158SGa2FZp-JuGDaUydCBjGhAxaOE,3923
@@ -842,7 +842,7 @@ cg/services/run_devices/pacbio/run_data_generator/run_data.py,sha256=h0TfMtHwyXl
842
842
  cg/services/run_devices/pacbio/run_file_manager/models.py,sha256=C6kycBPx6YKNq2oFJOIhdrcPloi3QIBOrlbaAgeYzgs,192
843
843
  cg/services/run_devices/pacbio/run_file_manager/run_file_manager.py,sha256=QDJKvMTwHNlP9ovU5wgqA8FbTx6xI0zdc26A1RY4W1M,5440
844
844
  cg/services/run_devices/pacbio/run_validator/pacbio_run_validator.py,sha256=d8fvmJcByEFPMnwqOe6mQsXXIO87WkXwfK9L_Bx7whg,3037
845
- cg/services/run_devices/pacbio/sequencing_runs_service.py,sha256=n_noNrPfOAUGizgTpE5n1ezZA0O92XAB9o_FYIzcus8,2145
845
+ cg/services/run_devices/pacbio/sequencing_runs_service.py,sha256=VLc5EicDpD2fb-fz_x7G5j3qcHRl75N5cCaky5DriNQ,2228
846
846
  cg/services/run_devices/run_names/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
847
847
  cg/services/run_devices/run_names/pacbio.py,sha256=4l-fCejTMMgAnVQ2RqIyQaqMtVbs_SeDEm6JJ4Dg36U,678
848
848
  cg/services/run_devices/run_names/service.py,sha256=d6-paeXsENHlU59eo4FcSXBAhoz50oL6bSglscRo2rQ,293
@@ -853,7 +853,7 @@ cg/services/sample_run_metrics_service/sample_run_metrics_service.py,sha256=aQvO
853
853
  cg/services/sample_run_metrics_service/utils.py,sha256=BwICxptnhGg8oBghCLhzHaMNu0LuEV40cSYz1e8mB0A,829
854
854
  cg/services/sequencing_qc_service/__init__.py,sha256=OaL9dyyI6B8uRjopTIoD1zcX_H-SbGj46ZM-V-aoq6w,88
855
855
  cg/services/sequencing_qc_service/quality_checks/checks.py,sha256=qdcHRwZD7uxrOmacyiAG4-EN6nG5z-r4rLxcReU5kSI,2593
856
- cg/services/sequencing_qc_service/quality_checks/utils.py,sha256=MkFUyQQz1RFHbgD9cyqEuOkYe0NYQlbkJkyy9BkOWQw,9844
856
+ cg/services/sequencing_qc_service/quality_checks/utils.py,sha256=2WN7S4kYsN_9iYPx7d4coAYcWHeueQWrPP2pJ8ztMMc,8969
857
857
  cg/services/sequencing_qc_service/sequencing_qc_service.py,sha256=QQHShCiq-OAobzHnTKQ1buQVyDIqGbVEPyPM4WEV9B0,2257
858
858
  cg/services/sequencing_qc_service/utils.py,sha256=5WHJltBICfRODEzFVPFTdCbGNaMKCaVeOswHgIOGgFc,199
859
859
  cg/services/slurm_service/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -922,7 +922,7 @@ cg/utils/flask/enum.py,sha256=xwNVtFPkSzoloJctLHu7obRyxcng1GJrhkeYkqwf9tw,1052
922
922
  cg/utils/mapping.py,sha256=oZpZW2kgsbtAP2FZ7RtRPELiEE1zZk_nAGisHGtCOUo,491
923
923
  cg/utils/time.py,sha256=_VOglhrFEZ5cwHK1U1g36SdwzB7UvV-Nvlt4ymuZUho,1501
924
924
  cg/utils/utils.py,sha256=RciI_UhWcnG_pMZrmQZ1ZYb-O1N0DweTYMmhE0SIRgQ,1410
925
- cg-83.20.2.dist-info/METADATA,sha256=UdpEj8WSTQ1TsybITznTSh8ak0oewz9hSw1rF31ijEA,4940
926
- cg-83.20.2.dist-info/WHEEL,sha256=kJCRJT_g0adfAJzTx2GUMmS80rTJIVHRCfG0DQgLq3o,88
927
- cg-83.20.2.dist-info/entry_points.txt,sha256=q5f47YQQGltzK_xnIq1mDopRXXEItr85Xe1BCtG-Wts,39
928
- cg-83.20.2.dist-info/RECORD,,
925
+ cg-84.0.0.dist-info/METADATA,sha256=CBtOiLTIEUPklgHRGi26_vu_dZqtde_Iq8sj4FiPcEE,4939
926
+ cg-84.0.0.dist-info/WHEEL,sha256=kJCRJT_g0adfAJzTx2GUMmS80rTJIVHRCfG0DQgLq3o,88
927
+ cg-84.0.0.dist-info/entry_points.txt,sha256=q5f47YQQGltzK_xnIq1mDopRXXEItr85Xe1BCtG-Wts,39
928
+ cg-84.0.0.dist-info/RECORD,,
File without changes