rawtrace-qc 0.1.0__tar.gz

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 (61) hide show
  1. rawtrace_qc-0.1.0/LICENSE +202 -0
  2. rawtrace_qc-0.1.0/PKG-INFO +186 -0
  3. rawtrace_qc-0.1.0/README.md +152 -0
  4. rawtrace_qc-0.1.0/pyproject.toml +115 -0
  5. rawtrace_qc-0.1.0/pyproject.toml.orig +109 -0
  6. rawtrace_qc-0.1.0/src/rawtrace_qc/__init__.py +12 -0
  7. rawtrace_qc-0.1.0/src/rawtrace_qc/cli/__init__.py +33 -0
  8. rawtrace_qc-0.1.0/src/rawtrace_qc/cli/errors.py +70 -0
  9. rawtrace_qc-0.1.0/src/rawtrace_qc/cli/extract.py +144 -0
  10. rawtrace_qc-0.1.0/src/rawtrace_qc/cli/main.py +32 -0
  11. rawtrace_qc-0.1.0/src/rawtrace_qc/cli/thermo.py +140 -0
  12. rawtrace_qc-0.1.0/src/rawtrace_qc/discovery/__init__.py +53 -0
  13. rawtrace_qc-0.1.0/src/rawtrace_qc/discovery/discover.py +584 -0
  14. rawtrace_qc-0.1.0/src/rawtrace_qc/discovery/models.py +116 -0
  15. rawtrace_qc-0.1.0/src/rawtrace_qc/discovery/policies.py +193 -0
  16. rawtrace_qc-0.1.0/src/rawtrace_qc/discovery/registry.py +51 -0
  17. rawtrace_qc-0.1.0/src/rawtrace_qc/environment.py +63 -0
  18. rawtrace_qc-0.1.0/src/rawtrace_qc/errors.py +114 -0
  19. rawtrace_qc-0.1.0/src/rawtrace_qc/extractors/__init__.py +9 -0
  20. rawtrace_qc-0.1.0/src/rawtrace_qc/extractors/bruker.py +413 -0
  21. rawtrace_qc-0.1.0/src/rawtrace_qc/extractors/common.py +114 -0
  22. rawtrace_qc-0.1.0/src/rawtrace_qc/extractors/protocol.py +26 -0
  23. rawtrace_qc-0.1.0/src/rawtrace_qc/extractors/thermo.py +276 -0
  24. rawtrace_qc-0.1.0/src/rawtrace_qc/gui/__init__.py +13 -0
  25. rawtrace_qc-0.1.0/src/rawtrace_qc/gui/app.py +2125 -0
  26. rawtrace_qc-0.1.0/src/rawtrace_qc/gui/cache.py +200 -0
  27. rawtrace_qc-0.1.0/src/rawtrace_qc/gui/config.py +190 -0
  28. rawtrace_qc-0.1.0/src/rawtrace_qc/gui/patterns.py +123 -0
  29. rawtrace_qc-0.1.0/src/rawtrace_qc/gui/reporting.py +324 -0
  30. rawtrace_qc-0.1.0/src/rawtrace_qc/gui/resources/chevron-down-dark.svg +1 -0
  31. rawtrace_qc-0.1.0/src/rawtrace_qc/gui/resources/chevron-down-light.svg +1 -0
  32. rawtrace_qc-0.1.0/src/rawtrace_qc/gui/resources/perutz-ms-facility_logo-inverted.svg +61 -0
  33. rawtrace_qc-0.1.0/src/rawtrace_qc/gui/resources/settings-icon.svg +5 -0
  34. rawtrace_qc-0.1.0/src/rawtrace_qc/gui/resources/tool-icon.svg +4 -0
  35. rawtrace_qc-0.1.0/src/rawtrace_qc/gui/resources/trash-icon.svg +7 -0
  36. rawtrace_qc-0.1.0/src/rawtrace_qc/gui/resources/upload-icon.svg +6 -0
  37. rawtrace_qc-0.1.0/src/rawtrace_qc/gui/theme.py +928 -0
  38. rawtrace_qc-0.1.0/src/rawtrace_qc/gui/thermo_tool.py +614 -0
  39. rawtrace_qc-0.1.0/src/rawtrace_qc/gui/workflow.py +304 -0
  40. rawtrace_qc-0.1.0/src/rawtrace_qc/models.py +18 -0
  41. rawtrace_qc-0.1.0/src/rawtrace_qc/processing/__init__.py +20 -0
  42. rawtrace_qc-0.1.0/src/rawtrace_qc/processing/models.py +97 -0
  43. rawtrace_qc-0.1.0/src/rawtrace_qc/processing/process.py +219 -0
  44. rawtrace_qc-0.1.0/src/rawtrace_qc/py.typed +0 -0
  45. rawtrace_qc-0.1.0/src/rawtrace_qc/report/__init__.py +32 -0
  46. rawtrace_qc-0.1.0/src/rawtrace_qc/report/channels.py +48 -0
  47. rawtrace_qc-0.1.0/src/rawtrace_qc/report/html.py +1674 -0
  48. rawtrace_qc-0.1.0/src/rawtrace_qc/report/models.py +214 -0
  49. rawtrace_qc-0.1.0/src/rawtrace_qc/report/prepare.py +287 -0
  50. rawtrace_qc-0.1.0/src/rawtrace_qc/thermo/__init__.py +69 -0
  51. rawtrace_qc-0.1.0/src/rawtrace_qc/thermo/installation.py +619 -0
  52. rawtrace_qc-0.1.0/src/rawtrace_qc/thermo/license.py +191 -0
  53. rawtrace_qc-0.1.0/src/rawtrace_qc/thermo/locator.py +520 -0
  54. rawtrace_qc-0.1.0/src/rawtrace_qc/thermo/runner.py +224 -0
  55. rawtrace_qc-0.1.0/src/rawtrace_qc/thermo/runtime.py +27 -0
  56. rawtrace_qc-0.1.0/src/rawtrace_qc/thermo/specification.py +170 -0
  57. rawtrace_qc-0.1.0/src/rawtrace_qc/traces/__init__.py +41 -0
  58. rawtrace_qc-0.1.0/src/rawtrace_qc/traces/artifact.py +325 -0
  59. rawtrace_qc-0.1.0/src/rawtrace_qc/traces/schema.py +139 -0
  60. rawtrace_qc-0.1.0/src/rawtrace_qc/workflows/__init__.py +19 -0
  61. rawtrace_qc-0.1.0/src/rawtrace_qc/workflows/extraction.py +225 -0
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,186 @@
1
+ Metadata-Version: 2.4
2
+ Name: rawtrace-qc
3
+ Version: 0.1.0
4
+ Summary: Extract TIC and scan-level traces from Thermo and Bruker mass spectrometry raw files and generate interactive HTML QC reports
5
+ Keywords: bruker,mass-spectrometry,proteomics,quality-control,thermo,timstof
6
+ Author: David M. Hollenstein
7
+ Author-email: David M. Hollenstein <hollenstein.david@gmail.com>
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: Operating System :: MacOS
13
+ Classifier: Operating System :: Microsoft :: Windows
14
+ Classifier: Operating System :: POSIX :: Linux
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
20
+ Classifier: Typing :: Typed
21
+ Requires-Dist: numpy>=1.26
22
+ Requires-Dist: platformdirs>=4.0
23
+ Requires-Dist: pyarrow>=14.0
24
+ Requires-Dist: plotly>=6.0
25
+ Requires-Dist: cyclopts>=4.8 ; extra == 'cli'
26
+ Requires-Dist: pyside6>=6.11 ; extra == 'gui'
27
+ Requires-Python: >=3.12
28
+ Project-URL: Homepage, https://github.com/maxperutzlabs-ms/rawtrace-qc
29
+ Project-URL: Repository, https://github.com/maxperutzlabs-ms/rawtrace-qc
30
+ Project-URL: Issues, https://github.com/maxperutzlabs-ms/rawtrace-qc/issues
31
+ Provides-Extra: cli
32
+ Provides-Extra: gui
33
+ Description-Content-Type: text/markdown
34
+
35
+ # rawtrace-qc
36
+
37
+ [![CI](https://github.com/maxperutzlabs-ms/rawtrace-qc/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/maxperutzlabs-ms/rawtrace-qc/actions/workflows/ci.yml)
38
+ [![PyPI version](https://img.shields.io/pypi/v/rawtrace-qc)](https://pypi.org/project/rawtrace-qc/)
39
+ [![Python versions](https://img.shields.io/pypi/pyversions/rawtrace-qc)](https://pypi.org/project/rawtrace-qc/)
40
+
41
+ rawtrace-qc creates interactive HTML reports from mass spectrometry raw files, so that you can compare runs and spot problems in them. You select Thermo `.raw` files or Bruker timsTOF `.d` folders in a desktop application, and the report then opens in your browser.
42
+
43
+ ![Dragging five raw files into rawtrace-qc, generating a report and viewing it in the browser](https://raw.githubusercontent.com/maxperutzlabs-ms/rawtrace-qc/media/docs/screenshots/gui-create-report-v1.gif)
44
+
45
+ *This recording uses traces that rawtrace-qc had already extracted and cached. Your first report takes longer because rawtrace-qc must extract the traces first.*
46
+
47
+ ## Install
48
+
49
+ You need Windows to use the desktop application in this release. We recommend [uv](https://docs.astral.sh/uv/getting-started/installation/) because it installs rawtrace-qc in a separate environment and downloads a suitable Python version if necessary:
50
+
51
+ ```bash
52
+ uv tool install "rawtrace-qc[gui]"
53
+ ```
54
+
55
+ If you prefer pip, you need Python 3.12 or later:
56
+
57
+ ```bash
58
+ pip install "rawtrace-qc[gui]"
59
+ ```
60
+
61
+ Then start the application with this command:
62
+
63
+ ```bash
64
+ rawtrace-qc-gui
65
+ ```
66
+
67
+ ## Set up Thermo support
68
+
69
+ To read `.raw` files, rawtrace-qc uses a separate program from us called the Thermo tool (`ThermoScanHeaderExtractor`). This program has its own license from Thermo, so you install it and accept the license yourself. You can skip this section if you only use Bruker `.d` folders.
70
+
71
+ 1. Click the wrench button at the top right of the application. A dot on this button shows that the setup is not complete.
72
+ 2. Click **Download**.
73
+ 3. Click **Show license** to read the terms.
74
+ 4. Click **Accept license** if you agree to the terms. Your acceptance applies to your user account.
75
+ 5. Click **Close**.
76
+
77
+ If your computer has no internet access, use another computer to download the ZIP file that the window names. Then copy the file to your computer and click **Install from ZIP** instead of **Download**.
78
+
79
+ ![Installing the Thermo tool and accepting its license in rawtrace-qc](https://raw.githubusercontent.com/maxperutzlabs-ms/rawtrace-qc/media/docs/screenshots/gui-setup-thermo-tool-v1.gif)
80
+
81
+ ## Create a report
82
+
83
+ 1. Drag your raw files into the **Selected files** area. Alternatively, click **Choose folder** and then **Scan folder**.
84
+ 2. Check the files that you want in the report.
85
+ 3. Select **Temporary** or **Permanent**. The application deletes a temporary report when you close the application, while a permanent report stays in the folder that you choose.
86
+ 4. Click **Generate report**.
87
+
88
+ The report opens in your default browser when it is ready. Because rawtrace-qc keeps the extracted traces in a cache, it does not extract the same files again for later reports.
89
+
90
+ If rawtrace-qc cannot use a file, it marks that file with a red cross and creates the report without it. To see the reason, hold the mouse pointer over the file.
91
+
92
+ ## Read a report
93
+
94
+ Each report is one HTML file that you can open without a network connection. The report has these tabs:
95
+
96
+ - **TIC** shows the total ion current.
97
+ - **BPC** shows the base peak chromatogram.
98
+ - **Metadata** lists one row for each trace.
99
+
100
+ ![A pairwise report view that compares the TIC of two HeLa QC runs](https://raw.githubusercontent.com/maxperutzlabs-ms/rawtrace-qc/media/docs/screenshots/report-pairwise-v1.png)
101
+
102
+ You can show the traces of the selected MS level in three views:
103
+
104
+ - **Overlay** draws the selected traces in one plot.
105
+ - **Stacked** gives each selected trace its own plot.
106
+ - **Pairwise** compares the reference trace with one other trace. Use the arrow buttons or the arrow keys to move to the next trace.
107
+
108
+ To compare runs against one specific run, select it as the **Reference trace**. The report then draws that run in red, which is the only trace with this color. In the **Metadata** tab, you can click a column header to sort the rows, and the plots then use the same order.
109
+
110
+ ## Limitations
111
+
112
+ This release has the following limitations, which we will address in upcoming releases:
113
+
114
+ - **Desktop application:** The desktop application runs only on Windows. We plan to add support for Linux and macOS.
115
+ - **Thermo files:** You can read `.raw` files only on Windows for now. Although the Thermo tool itself is cross-platform, rawtrace-qc does not yet use it on other systems.
116
+ - **Command line:** The command-line interface cannot create reports yet, although it can extract traces.
117
+ - **MS2 traces:** The reports include MS2 traces, but these traces are not very useful yet. We are working on a better way to show MS2 data.
118
+ - **FAIMS:** rawtrace-qc splits a FAIMS run into one trace for each compensation voltage (CV). This split is not optimal, and a combined view is not available yet.
119
+
120
+ ## Use the command line
121
+
122
+ The command-line interface extracts traces in batches and sets up the Thermo tool. Install it with the `cli` option:
123
+
124
+ ```bash
125
+ uv tool install "rawtrace-qc[cli]"
126
+ ```
127
+
128
+ Use `"rawtrace-qc[cli,gui]"` if you want both interfaces. The same options work with `pip install`.
129
+
130
+ To set up the Thermo tool, run the commands below. The `accept-license` command prints the terms and records your acceptance in one step, so run it only if you agree to them. To read the terms first, use **Show license** in the desktop application.
131
+
132
+ ```bash
133
+ rawtrace-qc thermo install
134
+ rawtrace-qc thermo accept-license
135
+ rawtrace-qc thermo status
136
+ ```
137
+
138
+ The `extract` command then writes the traces of each raw file as Parquet files:
139
+
140
+ ```bash
141
+ rawtrace-qc extract sample.raw run.d
142
+ rawtrace-qc extract /data/acquisitions --recursive --output-dir /data/traces
143
+ ```
144
+
145
+ Run `rawtrace-qc extract --help` to see all options.
146
+
147
+ ## Use the Python library
148
+
149
+ The Python library does not need an extra option, so `pip install rawtrace-qc` is sufficient. Unlike the command line, the library can create reports. This example creates a report from Parquet files that the `extract` command wrote:
150
+
151
+ ```python
152
+ from pathlib import Path
153
+
154
+ from rawtrace_qc.processing import process_traces
155
+ from rawtrace_qc.report import write_html
156
+ from rawtrace_qc.traces import load_trace
157
+
158
+ traces = [
159
+ load_trace(Path("traces/sample.raw.ms1-trace.parquet")),
160
+ load_trace(Path("traces/sample.raw.msn-trace.parquet")),
161
+ ]
162
+ write_html(process_traces(traces), Path("sample-qc.html"))
163
+ ```
164
+
165
+ ## Develop rawtrace-qc
166
+
167
+ We build rawtrace-qc library-first, so the desktop application and the command-line interface call the same library services. To set up a development environment, clone the repository and install all dependencies with [uv](https://docs.astral.sh/uv/):
168
+
169
+ ```bash
170
+ git clone https://github.com/maxperutzlabs-ms/rawtrace-qc.git
171
+ cd rawtrace-qc
172
+ uv sync --all-extras
173
+ ```
174
+
175
+ Run the tests and the code checks with these commands:
176
+
177
+ ```bash
178
+ uv run pytest
179
+ uv run ruff check .
180
+ uv run ruff format --check .
181
+ uv run pyrefly check
182
+ ```
183
+
184
+ ## License
185
+
186
+ rawtrace-qc is licensed under the [Apache License 2.0](https://github.com/maxperutzlabs-ms/rawtrace-qc/blob/main/LICENSE). The Thermo tool is a separate program, so it has its own license terms.
@@ -0,0 +1,152 @@
1
+ # rawtrace-qc
2
+
3
+ [![CI](https://github.com/maxperutzlabs-ms/rawtrace-qc/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/maxperutzlabs-ms/rawtrace-qc/actions/workflows/ci.yml)
4
+ [![PyPI version](https://img.shields.io/pypi/v/rawtrace-qc)](https://pypi.org/project/rawtrace-qc/)
5
+ [![Python versions](https://img.shields.io/pypi/pyversions/rawtrace-qc)](https://pypi.org/project/rawtrace-qc/)
6
+
7
+ rawtrace-qc creates interactive HTML reports from mass spectrometry raw files, so that you can compare runs and spot problems in them. You select Thermo `.raw` files or Bruker timsTOF `.d` folders in a desktop application, and the report then opens in your browser.
8
+
9
+ ![Dragging five raw files into rawtrace-qc, generating a report and viewing it in the browser](https://raw.githubusercontent.com/maxperutzlabs-ms/rawtrace-qc/media/docs/screenshots/gui-create-report-v1.gif)
10
+
11
+ *This recording uses traces that rawtrace-qc had already extracted and cached. Your first report takes longer because rawtrace-qc must extract the traces first.*
12
+
13
+ ## Install
14
+
15
+ You need Windows to use the desktop application in this release. We recommend [uv](https://docs.astral.sh/uv/getting-started/installation/) because it installs rawtrace-qc in a separate environment and downloads a suitable Python version if necessary:
16
+
17
+ ```bash
18
+ uv tool install "rawtrace-qc[gui]"
19
+ ```
20
+
21
+ If you prefer pip, you need Python 3.12 or later:
22
+
23
+ ```bash
24
+ pip install "rawtrace-qc[gui]"
25
+ ```
26
+
27
+ Then start the application with this command:
28
+
29
+ ```bash
30
+ rawtrace-qc-gui
31
+ ```
32
+
33
+ ## Set up Thermo support
34
+
35
+ To read `.raw` files, rawtrace-qc uses a separate program from us called the Thermo tool (`ThermoScanHeaderExtractor`). This program has its own license from Thermo, so you install it and accept the license yourself. You can skip this section if you only use Bruker `.d` folders.
36
+
37
+ 1. Click the wrench button at the top right of the application. A dot on this button shows that the setup is not complete.
38
+ 2. Click **Download**.
39
+ 3. Click **Show license** to read the terms.
40
+ 4. Click **Accept license** if you agree to the terms. Your acceptance applies to your user account.
41
+ 5. Click **Close**.
42
+
43
+ If your computer has no internet access, use another computer to download the ZIP file that the window names. Then copy the file to your computer and click **Install from ZIP** instead of **Download**.
44
+
45
+ ![Installing the Thermo tool and accepting its license in rawtrace-qc](https://raw.githubusercontent.com/maxperutzlabs-ms/rawtrace-qc/media/docs/screenshots/gui-setup-thermo-tool-v1.gif)
46
+
47
+ ## Create a report
48
+
49
+ 1. Drag your raw files into the **Selected files** area. Alternatively, click **Choose folder** and then **Scan folder**.
50
+ 2. Check the files that you want in the report.
51
+ 3. Select **Temporary** or **Permanent**. The application deletes a temporary report when you close the application, while a permanent report stays in the folder that you choose.
52
+ 4. Click **Generate report**.
53
+
54
+ The report opens in your default browser when it is ready. Because rawtrace-qc keeps the extracted traces in a cache, it does not extract the same files again for later reports.
55
+
56
+ If rawtrace-qc cannot use a file, it marks that file with a red cross and creates the report without it. To see the reason, hold the mouse pointer over the file.
57
+
58
+ ## Read a report
59
+
60
+ Each report is one HTML file that you can open without a network connection. The report has these tabs:
61
+
62
+ - **TIC** shows the total ion current.
63
+ - **BPC** shows the base peak chromatogram.
64
+ - **Metadata** lists one row for each trace.
65
+
66
+ ![A pairwise report view that compares the TIC of two HeLa QC runs](https://raw.githubusercontent.com/maxperutzlabs-ms/rawtrace-qc/media/docs/screenshots/report-pairwise-v1.png)
67
+
68
+ You can show the traces of the selected MS level in three views:
69
+
70
+ - **Overlay** draws the selected traces in one plot.
71
+ - **Stacked** gives each selected trace its own plot.
72
+ - **Pairwise** compares the reference trace with one other trace. Use the arrow buttons or the arrow keys to move to the next trace.
73
+
74
+ To compare runs against one specific run, select it as the **Reference trace**. The report then draws that run in red, which is the only trace with this color. In the **Metadata** tab, you can click a column header to sort the rows, and the plots then use the same order.
75
+
76
+ ## Limitations
77
+
78
+ This release has the following limitations, which we will address in upcoming releases:
79
+
80
+ - **Desktop application:** The desktop application runs only on Windows. We plan to add support for Linux and macOS.
81
+ - **Thermo files:** You can read `.raw` files only on Windows for now. Although the Thermo tool itself is cross-platform, rawtrace-qc does not yet use it on other systems.
82
+ - **Command line:** The command-line interface cannot create reports yet, although it can extract traces.
83
+ - **MS2 traces:** The reports include MS2 traces, but these traces are not very useful yet. We are working on a better way to show MS2 data.
84
+ - **FAIMS:** rawtrace-qc splits a FAIMS run into one trace for each compensation voltage (CV). This split is not optimal, and a combined view is not available yet.
85
+
86
+ ## Use the command line
87
+
88
+ The command-line interface extracts traces in batches and sets up the Thermo tool. Install it with the `cli` option:
89
+
90
+ ```bash
91
+ uv tool install "rawtrace-qc[cli]"
92
+ ```
93
+
94
+ Use `"rawtrace-qc[cli,gui]"` if you want both interfaces. The same options work with `pip install`.
95
+
96
+ To set up the Thermo tool, run the commands below. The `accept-license` command prints the terms and records your acceptance in one step, so run it only if you agree to them. To read the terms first, use **Show license** in the desktop application.
97
+
98
+ ```bash
99
+ rawtrace-qc thermo install
100
+ rawtrace-qc thermo accept-license
101
+ rawtrace-qc thermo status
102
+ ```
103
+
104
+ The `extract` command then writes the traces of each raw file as Parquet files:
105
+
106
+ ```bash
107
+ rawtrace-qc extract sample.raw run.d
108
+ rawtrace-qc extract /data/acquisitions --recursive --output-dir /data/traces
109
+ ```
110
+
111
+ Run `rawtrace-qc extract --help` to see all options.
112
+
113
+ ## Use the Python library
114
+
115
+ The Python library does not need an extra option, so `pip install rawtrace-qc` is sufficient. Unlike the command line, the library can create reports. This example creates a report from Parquet files that the `extract` command wrote:
116
+
117
+ ```python
118
+ from pathlib import Path
119
+
120
+ from rawtrace_qc.processing import process_traces
121
+ from rawtrace_qc.report import write_html
122
+ from rawtrace_qc.traces import load_trace
123
+
124
+ traces = [
125
+ load_trace(Path("traces/sample.raw.ms1-trace.parquet")),
126
+ load_trace(Path("traces/sample.raw.msn-trace.parquet")),
127
+ ]
128
+ write_html(process_traces(traces), Path("sample-qc.html"))
129
+ ```
130
+
131
+ ## Develop rawtrace-qc
132
+
133
+ We build rawtrace-qc library-first, so the desktop application and the command-line interface call the same library services. To set up a development environment, clone the repository and install all dependencies with [uv](https://docs.astral.sh/uv/):
134
+
135
+ ```bash
136
+ git clone https://github.com/maxperutzlabs-ms/rawtrace-qc.git
137
+ cd rawtrace-qc
138
+ uv sync --all-extras
139
+ ```
140
+
141
+ Run the tests and the code checks with these commands:
142
+
143
+ ```bash
144
+ uv run pytest
145
+ uv run ruff check .
146
+ uv run ruff format --check .
147
+ uv run pyrefly check
148
+ ```
149
+
150
+ ## License
151
+
152
+ rawtrace-qc is licensed under the [Apache License 2.0](https://github.com/maxperutzlabs-ms/rawtrace-qc/blob/main/LICENSE). The Thermo tool is a separate program, so it has its own license terms.
@@ -0,0 +1,115 @@
1
+ [project]
2
+ name = "rawtrace-qc"
3
+ version = "0.1.0"
4
+ description = "Extract TIC and scan-level traces from Thermo and Bruker mass spectrometry raw files and generate interactive HTML QC reports"
5
+ readme = "README.md"
6
+ license = "Apache-2.0"
7
+ license-files = ["LICENSE"]
8
+ requires-python = ">=3.12"
9
+ keywords = [
10
+ "bruker",
11
+ "mass-spectrometry",
12
+ "proteomics",
13
+ "quality-control",
14
+ "thermo",
15
+ "timstof",
16
+ ]
17
+ classifiers = [
18
+ "Development Status :: 4 - Beta",
19
+ "Intended Audience :: Science/Research",
20
+ "Operating System :: MacOS",
21
+ "Operating System :: Microsoft :: Windows",
22
+ "Operating System :: POSIX :: Linux",
23
+ "Programming Language :: Python :: 3",
24
+ "Programming Language :: Python :: 3.12",
25
+ "Programming Language :: Python :: 3.13",
26
+ "Programming Language :: Python :: 3.14",
27
+ "Topic :: Scientific/Engineering :: Bio-Informatics",
28
+ "Typing :: Typed",
29
+ ]
30
+ dependencies = [
31
+ "numpy>=1.26",
32
+ "platformdirs>=4.0",
33
+ "pyarrow>=14.0",
34
+ "plotly>=6.0",
35
+ ]
36
+
37
+ [[project.authors]]
38
+ name = "David M. Hollenstein"
39
+ email = "hollenstein.david@gmail.com"
40
+
41
+ [project.optional-dependencies]
42
+ cli = ["cyclopts>=4.8"]
43
+ gui = ["pyside6>=6.11"]
44
+
45
+ [project.urls]
46
+ Homepage = "https://github.com/maxperutzlabs-ms/rawtrace-qc"
47
+ Repository = "https://github.com/maxperutzlabs-ms/rawtrace-qc"
48
+ Issues = "https://github.com/maxperutzlabs-ms/rawtrace-qc/issues"
49
+
50
+ [project.scripts]
51
+ rawtrace-qc = "rawtrace_qc.cli:main"
52
+ rawtrace-qc-gui = "rawtrace_qc.gui:main"
53
+
54
+ [build-system]
55
+ requires = ["uv_build>=0.13.5,<0.14.0"]
56
+ build-backend = "uv_build"
57
+
58
+ [dependency-groups]
59
+ dev = [
60
+ "cyclopts>=4.8",
61
+ "pyrefly==1.2.0",
62
+ "pytest==9.1.1",
63
+ "pytest-cov==7.1.0",
64
+ "ruff==0.16.1",
65
+ ]
66
+
67
+ [tool.pytest.ini_options]
68
+ addopts = [
69
+ "--strict-config",
70
+ "--strict-markers",
71
+ ]
72
+ testpaths = ["tests"]
73
+ markers = [
74
+ "unit: fast unit tests without external resources or network access",
75
+ "network: tests that require network access",
76
+ "integration: tests covering multi-component workflows and cross-module behavior",
77
+ ]
78
+
79
+ [tool.coverage.run]
80
+ branch = true
81
+ source = ["rawtrace_qc"]
82
+
83
+ [tool.coverage.report]
84
+ exclude_also = [
85
+ "if TYPE_CHECKING:",
86
+ "raise NotImplementedError",
87
+ ]
88
+ show_missing = true
89
+
90
+ [tool.ruff]
91
+ extend-exclude = ["*.md"]
92
+ line-length = 88
93
+ src = ["src"]
94
+
95
+ [tool.ruff.lint]
96
+ select = [
97
+ "E",
98
+ "F",
99
+ "I",
100
+ "UP",
101
+ "B",
102
+ ]
103
+
104
+ [tool.ruff.lint.isort]
105
+ known-first-party = ["rawtrace_qc"]
106
+
107
+ [tool.ruff.format]
108
+ quote-style = "double"
109
+ indent-style = "space"
110
+
111
+ [tool.pyrefly]
112
+ preset = "default"
113
+ python-version = "3.12"
114
+ project-includes = ["src/**/*.py"]
115
+ search-path = ["src"]