flowcellar 0.1.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.
Files changed (159) hide show
  1. flowcellar/__init__.py +9 -0
  2. flowcellar/__main__.py +4 -0
  3. flowcellar/_version.py +1 -0
  4. flowcellar/aggregates/__init__.py +11 -0
  5. flowcellar/aggregates/build.py +151 -0
  6. flowcellar/aggregates/derive.py +109 -0
  7. flowcellar/aggregates/merge.py +362 -0
  8. flowcellar/catalogue/__init__.py +63 -0
  9. flowcellar/catalogue/metrics_nanopore.json +1 -0
  10. flowcellar/cli/__init__.py +97 -0
  11. flowcellar/cli/_options.py +25 -0
  12. flowcellar/cli/analysis.py +317 -0
  13. flowcellar/cli/discover.py +168 -0
  14. flowcellar/cli/doctor.py +31 -0
  15. flowcellar/cli/hub.py +47 -0
  16. flowcellar/cli/init.py +41 -0
  17. flowcellar/cli/ls.py +94 -0
  18. flowcellar/cli/recompute.py +52 -0
  19. flowcellar/cli/rm.py +21 -0
  20. flowcellar/cli/run.py +333 -0
  21. flowcellar/cli/scan.py +60 -0
  22. flowcellar/cli/schema.py +25 -0
  23. flowcellar/cli/serve.py +46 -0
  24. flowcellar/cli/show.py +109 -0
  25. flowcellar/cli/validate.py +44 -0
  26. flowcellar/config/__init__.py +4 -0
  27. flowcellar/config/defaults.toml +51 -0
  28. flowcellar/config/loader.py +369 -0
  29. flowcellar/contracts.py +159 -0
  30. flowcellar/discovery/__init__.py +141 -0
  31. flowcellar/discovery/guard.py +208 -0
  32. flowcellar/discovery/patterns.py +209 -0
  33. flowcellar/discovery/walk.py +348 -0
  34. flowcellar/engine/__init__.py +1 -0
  35. flowcellar/engine/api.py +119 -0
  36. flowcellar/engine/assemble.py +363 -0
  37. flowcellar/engine/baselines.py +128 -0
  38. flowcellar/engine/card.py +250 -0
  39. flowcellar/engine/copy_pending.py +110 -0
  40. flowcellar/engine/flowcell_use.py +85 -0
  41. flowcellar/engine/identity.py +351 -0
  42. flowcellar/engine/limits.py +135 -0
  43. flowcellar/engine/passes.py +213 -0
  44. flowcellar/engine/status.py +728 -0
  45. flowcellar/library/__init__.py +4 -0
  46. flowcellar/library/api.py +61 -0
  47. flowcellar/library/cards.py +69 -0
  48. flowcellar/library/draft.py +247 -0
  49. flowcellar/library/index.py +323 -0
  50. flowcellar/library/layout.py +69 -0
  51. flowcellar/library/lease.py +248 -0
  52. flowcellar/library/maintain.py +347 -0
  53. flowcellar/library/projects.py +84 -0
  54. flowcellar/library/query.py +382 -0
  55. flowcellar/library/scan.py +1770 -0
  56. flowcellar/library/store.py +225 -0
  57. flowcellar/library/trash.py +63 -0
  58. flowcellar/model/__init__.py +1 -0
  59. flowcellar/model/axes.py +200 -0
  60. flowcellar/model/bundle.py +143 -0
  61. flowcellar/model/partial.py +96 -0
  62. flowcellar/model/runfolder.py +83 -0
  63. flowcellar/model/runkey.py +98 -0
  64. flowcellar/model/schema.py +46 -0
  65. flowcellar/model/schemas/bundle-0.1.1.schema.json +3713 -0
  66. flowcellar/model/status.py +97 -0
  67. flowcellar/modules/__init__.py +0 -0
  68. flowcellar/modules/common.py +73 -0
  69. flowcellar/modules/dyn.py +124 -0
  70. flowcellar/modules/fc.py +390 -0
  71. flowcellar/modules/len_est.py +74 -0
  72. flowcellar/modules/run.py +88 -0
  73. flowcellar/modules/yield_.py +120 -0
  74. flowcellar/readdata/__init__.py +1 -0
  75. flowcellar/readdata/_pool.py +87 -0
  76. flowcellar/readdata/acc.py +161 -0
  77. flowcellar/readdata/alnacc.py +572 -0
  78. flowcellar/readdata/alnpass.py +85 -0
  79. flowcellar/readdata/api.py +189 -0
  80. flowcellar/readdata/bam.py +851 -0
  81. flowcellar/readdata/bamindex.py +149 -0
  82. flowcellar/readdata/cards.py +82 -0
  83. flowcellar/readdata/checks.py +312 -0
  84. flowcellar/readdata/copy_pending.py +73 -0
  85. flowcellar/readdata/fate.py +341 -0
  86. flowcellar/readdata/finder.py +147 -0
  87. flowcellar/readdata/libprep.py +97 -0
  88. flowcellar/readdata/link.py +486 -0
  89. flowcellar/readdata/passes.py +149 -0
  90. flowcellar/readdata/patterns.py +230 -0
  91. flowcellar/readdata/pychopper.py +431 -0
  92. flowcellar/readdata/readtable.py +416 -0
  93. flowcellar/readdata/record.py +159 -0
  94. flowcellar/readdata/reference.py +139 -0
  95. flowcellar/readdata/rnacomp.py +329 -0
  96. flowcellar/readdata/sample_sheet.py +153 -0
  97. flowcellar/readdata/saturation.py +110 -0
  98. flowcellar/readdata/sections.py +892 -0
  99. flowcellar/readdata/sections_align.py +644 -0
  100. flowcellar/readdata/tables.py +262 -0
  101. flowcellar/report/__init__.py +1 -0
  102. flowcellar/report/api.py +54 -0
  103. flowcellar/report/html.py +342 -0
  104. flowcellar/report/hub.py +159 -0
  105. flowcellar/report/index_one.py +144 -0
  106. flowcellar/report/served.py +67 -0
  107. flowcellar/sc/__init__.py +57 -0
  108. flowcellar/sc/axes.py +211 -0
  109. flowcellar/sc/catalogue.json +1 -0
  110. flowcellar/sc/catalogue.py +51 -0
  111. flowcellar/sc/check.py +57 -0
  112. flowcellar/sc/collect.py +299 -0
  113. flowcellar/sc/collect_sr.py +450 -0
  114. flowcellar/sc/collect_wf.py +479 -0
  115. flowcellar/sc/detect.py +303 -0
  116. flowcellar/sc/judge.py +269 -0
  117. flowcellar/sc/link.py +326 -0
  118. flowcellar/sc/listing.py +144 -0
  119. flowcellar/sc/maps.py +181 -0
  120. flowcellar/sc/readpass.py +416 -0
  121. flowcellar/sc/report.py +230 -0
  122. flowcellar/sc/scan.py +176 -0
  123. flowcellar/sc/spaceranger.py +483 -0
  124. flowcellar/sc/store.py +537 -0
  125. flowcellar/sc/wfsc.py +419 -0
  126. flowcellar/serve/__init__.py +4 -0
  127. flowcellar/serve/server.py +153 -0
  128. flowcellar/sources/__init__.py +0 -0
  129. flowcellar/sources/minknow.py +455 -0
  130. flowcellar/sources/porescan.py +218 -0
  131. flowcellar/sources/seqsummary.py +450 -0
  132. flowcellar/sources/workers.py +244 -0
  133. flowcellar/testing/__init__.py +1 -0
  134. flowcellar/testing/demo.py +1217 -0
  135. flowcellar/testing/demo_spatial.py +370 -0
  136. flowcellar/testing/fixtures.py +459 -0
  137. flowcellar/testing/libprep.py +252 -0
  138. flowcellar/testing/minknow_variants.py +384 -0
  139. flowcellar/testing/readdata.py +744 -0
  140. flowcellar/testing/sc.py +817 -0
  141. flowcellar/testing/trees.py +175 -0
  142. flowcellar/util/__init__.py +1 -0
  143. flowcellar/util/atomic.py +112 -0
  144. flowcellar/util/errors.py +72 -0
  145. flowcellar/util/fingerprint.py +49 -0
  146. flowcellar/util/log.py +50 -0
  147. flowcellar/util/text.py +43 -0
  148. flowcellar/util/timeutil.py +52 -0
  149. flowcellar/viewer_dist/favicon.svg +1 -0
  150. flowcellar/viewer_dist/manifest.json +37 -0
  151. flowcellar/viewer_dist/template.html +12 -0
  152. flowcellar/viewer_dist/viewer.core.js +3 -0
  153. flowcellar/viewer_dist/viewer.css +2151 -0
  154. flowcellar-0.1.0.dist-info/METADATA +506 -0
  155. flowcellar-0.1.0.dist-info/RECORD +159 -0
  156. flowcellar-0.1.0.dist-info/WHEEL +4 -0
  157. flowcellar-0.1.0.dist-info/entry_points.txt +2 -0
  158. flowcellar-0.1.0.dist-info/licenses/LICENSE +674 -0
  159. flowcellar-0.1.0.dist-info/licenses/THIRD_PARTY_NOTICES.md +85 -0
@@ -0,0 +1,63 @@
1
+ """The metric catalogue: ids, sections, limits, display copy, the panel registry and the tile order.
2
+
3
+ The source is ``catalogue/metrics_nanopore.yaml`` in the repository; ``tools/build_catalogue.py`` writes the JSON
4
+ beside this file, and only that JSON is read at run time (no YAML parser is a run-time dependency).
5
+ """
6
+ from __future__ import annotations
7
+
8
+ import json
9
+ from functools import lru_cache
10
+ from importlib import resources
11
+
12
+ CATALOGUE_FILE = "metrics_nanopore.json"
13
+
14
+
15
+ @lru_cache(maxsize=1)
16
+ def load() -> dict:
17
+ """The whole catalogue as one dict (keys: metrics, derived, panels, tiles, limit_text, axes, modules, ...)."""
18
+ return json.loads(resources.files(__name__).joinpath(CATALOGUE_FILE).read_text("utf-8"))
19
+
20
+
21
+ @lru_cache(maxsize=1)
22
+ def metrics() -> dict[str, dict]:
23
+ """Every metric and derived summary id -> its entry."""
24
+ cat = load()
25
+ out = {m["id"]: m for m in cat["metrics"]}
26
+ out.update({d["id"]: d for d in cat.get("derived", [])})
27
+ return out
28
+
29
+
30
+ def metric(metric_id: str) -> dict | None:
31
+ return metrics().get(metric_id)
32
+
33
+
34
+ def display(metric_id: str) -> dict:
35
+ """The display copy of a metric (label, short_label, reading, message, advice, panel); empty when it has none."""
36
+ m = metrics().get(metric_id) or {}
37
+ return m.get("display") or {}
38
+
39
+
40
+ def label(metric_id: str) -> str:
41
+ return display(metric_id).get("label") or metric_id
42
+
43
+
44
+ def checks(tier: int | None = None) -> list[dict]:
45
+ """The key and supporting metrics (the ones a status rule exists for), optionally of one tier."""
46
+ return [m for m in load()["metrics"]
47
+ if m.get("verdict_role") in ("key", "supporting") and (tier is None or m.get("tier") == tier)]
48
+
49
+
50
+ def limit_text() -> dict[str, str]:
51
+ return load()["limit_text"]
52
+
53
+
54
+ def panels() -> list[dict]:
55
+ return load()["panels"]
56
+
57
+
58
+ def tiles() -> dict[str, list[str]]:
59
+ return load()["tiles"]
60
+
61
+
62
+ def version() -> str:
63
+ return str(load().get("catalogue_version", "0"))