cg 83.20.1__py3-none-any.whl → 83.20.2__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.1"
2
+ __version__ = "83.20.2"
@@ -63,6 +63,9 @@ 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
66
69
  express_reads_threshold: int = get_express_reads_threshold_for_sample(sample)
67
70
  enough_reads: bool = sample.reads >= express_reads_threshold
68
71
  if not enough_reads:
@@ -71,6 +74,9 @@ def express_sample_has_enough_reads(sample: Sample) -> bool:
71
74
 
72
75
 
73
76
  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
74
80
  if not sample.hifi_yield:
75
81
  LOG.debug(f"Sample {sample.internal_id} has no hifi yield.")
76
82
  return False
@@ -136,26 +142,34 @@ def any_sample_in_case_has_reads(case: Case) -> bool:
136
142
  def raw_data_case_pass_qc(case: Case) -> bool:
137
143
  if is_case_ready_made_library(case):
138
144
  return ready_made_library_case_pass_sequencing_qc(case)
139
- if is_first_sample_yield_based_and_processed(case):
145
+ if is_any_processed_sample_yield_based(case):
140
146
  return all(sample_has_enough_hifi_yield(sample) for sample in case.samples)
141
- elif is_first_sample_reads_based_and_processed(case):
147
+ elif is_any_processed_sample_read_based(case):
142
148
  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
143
152
  LOG.warning(f"Not all samples for case {case.internal_id} have been post-processed.")
144
153
  return False
145
154
 
146
155
 
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
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
+ )
152
162
 
153
163
 
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
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
+ )
169
+
170
+
171
+ def are_all_samples_external(case: Case) -> bool:
172
+ return all(sample.is_external for sample in case.samples)
159
173
 
160
174
 
161
175
  def is_case_express_priority(case: Case) -> bool:
@@ -205,6 +219,9 @@ def sample_has_enough_reads(sample: Sample) -> bool:
205
219
  """
206
220
  Check if the sample has more or equal reads than the expected reads for the sample.
207
221
  """
222
+ if sample.is_external:
223
+ LOG.info(f"Sample {sample.internal_id} is external, skipping check.")
224
+ return True
208
225
  enough_reads: bool = sample.reads >= sample.expected_reads_for_sample
209
226
  if not enough_reads:
210
227
  LOG.warning(f"Sample {sample.internal_id} has too few reads.")
@@ -218,7 +235,12 @@ def sample_has_enough_hifi_yield(sample: Sample) -> bool:
218
235
  Raises:
219
236
  ApplicationDoesNotHaveHiFiYieldError if the sample doesn't have expected HiFi yield.
220
237
  """
221
- if not sample.expected_hifi_yield:
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:
222
244
  raise ApplicationDoesNotHaveHiFiYieldError(
223
245
  f"Application for sample {sample.internal_id} does not have target HiFi yield."
224
246
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cg
3
- Version: 83.20.1
3
+ Version: 83.20.2
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=GFqt4Icx2AK3Z-OoKayN2h7JVrY5YsoN-klwkCVbbn8,41
1
+ cg/__init__.py,sha256=BeY80I67U51q6aLgK7vrT1Z-paSugKRtXMtbF02Y5OY,41
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
@@ -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=2WN7S4kYsN_9iYPx7d4coAYcWHeueQWrPP2pJ8ztMMc,8969
856
+ cg/services/sequencing_qc_service/quality_checks/utils.py,sha256=MkFUyQQz1RFHbgD9cyqEuOkYe0NYQlbkJkyy9BkOWQw,9844
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.1.dist-info/METADATA,sha256=HffGnfy04xHfr3UN69aKgKxnelPMX0NyxNh8N_H8SSc,4940
926
- cg-83.20.1.dist-info/WHEEL,sha256=kJCRJT_g0adfAJzTx2GUMmS80rTJIVHRCfG0DQgLq3o,88
927
- cg-83.20.1.dist-info/entry_points.txt,sha256=q5f47YQQGltzK_xnIq1mDopRXXEItr85Xe1BCtG-Wts,39
928
- cg-83.20.1.dist-info/RECORD,,
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,,
File without changes