apb-export 0.2.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.
Files changed (39) hide show
  1. apb_export/__init__.py +1 -0
  2. apb_export/api.py +98 -0
  3. apb_export/cli.py +562 -0
  4. apb_export/computed.py +135 -0
  5. apb_export/engine.py +717 -0
  6. apb_export/export_rules/__init__.py +0 -0
  7. apb_export/export_rules/documents/_schema/document.schema.json +1280 -0
  8. apb_export/export_rules/documents/_schema/rule.schema.json +1454 -0
  9. apb_export/export_rules/documents/alphapepttools/v0_4/rules.json +98 -0
  10. apb_export/export_rules/documents/explorede/v1_0/rules.json +197 -0
  11. apb_export/export_rules/documents/msmu/v0_4/rules.json +127 -0
  12. apb_export/export_rules/documents/msstats/v4_20/rules.json +66 -0
  13. apb_export/export_rules/documents/perseus/v2/rules.json +59 -0
  14. apb_export/export_rules/documents/prolfqua/v2_11/rules.json +223 -0
  15. apb_export/export_rules/documents/proteopy/v0_1/rules.json +53 -0
  16. apb_export/export_rules/documents/proteopy_ion/v0_1/rules.json +62 -0
  17. apb_export/export_rules/documents/qfeatures/v1_22/rules.json +98 -0
  18. apb_export/export_rules/documents/qpx/v1_1/rules.json +110 -0
  19. apb_export/export_rules/layout.py +60 -0
  20. apb_export/export_rules/loader.py +208 -0
  21. apb_export/export_rules/schema.py +502 -0
  22. apb_export/export_rules/schema_artifact.py +40 -0
  23. apb_export/long_table.py +75 -0
  24. apb_export/outputs.py +90 -0
  25. apb_export/perseus_table.py +100 -0
  26. apb_export/py.typed +1 -0
  27. apb_export/qpx/LICENSE.qpx +81 -0
  28. apb_export/qpx/__init__.py +0 -0
  29. apb_export/qpx/output.py +215 -0
  30. apb_export/qpx/schema.json +662 -0
  31. apb_export/qpx/schema.py +32 -0
  32. apb_export/rows.py +72 -0
  33. apb_export/sources.py +415 -0
  34. apb_export-0.2.2.dist-info/METADATA +159 -0
  35. apb_export-0.2.2.dist-info/RECORD +39 -0
  36. apb_export-0.2.2.dist-info/WHEEL +4 -0
  37. apb_export-0.2.2.dist-info/entry_points.txt +3 -0
  38. apb_export-0.2.2.dist-info/licenses/LICENSE +21 -0
  39. apb_export-0.2.2.dist-info/licenses/src/apb_export/qpx/LICENSE.qpx +81 -0
@@ -0,0 +1,662 @@
1
+ {
2
+ "source": "https://github.com/bigbio/qpx/tree/v1.1.6",
3
+ "revision": "b148b0a47f57effa15f3b2285ea727b98ed1a3c6",
4
+ "license": "Apache-2.0",
5
+ "types": {
6
+ "score": {
7
+ "fields": {
8
+ "score_name": {
9
+ "type": "string"
10
+ },
11
+ "score_value": {
12
+ "type": "float64"
13
+ },
14
+ "higher_better": {
15
+ "type": "bool",
16
+ "nullable": true
17
+ }
18
+ }
19
+ },
20
+ "cv_param": {
21
+ "fields": {
22
+ "cv_name": {
23
+ "type": "string"
24
+ },
25
+ "cv_value": {
26
+ "type": "string"
27
+ }
28
+ }
29
+ },
30
+ "modification_position": {
31
+ "fields": {
32
+ "position": {
33
+ "type": "int32"
34
+ },
35
+ "amino_acid": {
36
+ "type": "string",
37
+ "nullable": true
38
+ },
39
+ "scores": {
40
+ "type": "list<score>",
41
+ "nullable": true
42
+ }
43
+ }
44
+ },
45
+ "modification": {
46
+ "fields": {
47
+ "name": {
48
+ "type": "string"
49
+ },
50
+ "accession": {
51
+ "type": "string",
52
+ "nullable": true
53
+ },
54
+ "positions": {
55
+ "type": "list<modification_position>"
56
+ }
57
+ }
58
+ },
59
+ "intensity": {
60
+ "fields": {
61
+ "label": {
62
+ "type": "string"
63
+ },
64
+ "intensity": {
65
+ "type": "float32"
66
+ }
67
+ }
68
+ },
69
+ "intensity_pair": {
70
+ "fields": {
71
+ "intensity_name": {
72
+ "type": "string"
73
+ },
74
+ "intensity_value": {
75
+ "type": "float32"
76
+ }
77
+ }
78
+ },
79
+ "additional_intensity": {
80
+ "fields": {
81
+ "label": {
82
+ "type": "string"
83
+ },
84
+ "intensities": {
85
+ "type": "list<intensity_pair>"
86
+ }
87
+ }
88
+ },
89
+ "pg_protein": {
90
+ "fields": {
91
+ "accession": {
92
+ "type": "string"
93
+ },
94
+ "start": {
95
+ "type": "int32",
96
+ "nullable": true
97
+ },
98
+ "end": {
99
+ "type": "int32",
100
+ "nullable": true
101
+ },
102
+ "pre": {
103
+ "type": "string",
104
+ "nullable": true
105
+ },
106
+ "post": {
107
+ "type": "string",
108
+ "nullable": true
109
+ }
110
+ }
111
+ },
112
+ "protein_position": {
113
+ "fields": {
114
+ "protein_accession": {
115
+ "type": "string"
116
+ },
117
+ "start": {
118
+ "type": "int32"
119
+ },
120
+ "end": {
121
+ "type": "int32"
122
+ }
123
+ }
124
+ },
125
+ "ontology_property": {
126
+ "fields": {
127
+ "key": {
128
+ "type": "string"
129
+ },
130
+ "value": {
131
+ "type": "string"
132
+ }
133
+ }
134
+ },
135
+ "ontology_term": {
136
+ "fields": {
137
+ "accession": {
138
+ "type": "string"
139
+ },
140
+ "name": {
141
+ "type": "string",
142
+ "nullable": true
143
+ },
144
+ "properties": {
145
+ "type": "list<ontology_property>",
146
+ "nullable": true
147
+ }
148
+ }
149
+ },
150
+ "sample_channel": {
151
+ "fields": {
152
+ "sample_accession": {
153
+ "type": "string"
154
+ },
155
+ "label": {
156
+ "type": "string"
157
+ },
158
+ "biological_replicate": {
159
+ "type": "int32",
160
+ "nullable": true
161
+ },
162
+ "technical_replicate": {
163
+ "type": "int32",
164
+ "nullable": true
165
+ }
166
+ }
167
+ },
168
+ "modification_param": {
169
+ "fields": {
170
+ "accession": {
171
+ "type": "string"
172
+ },
173
+ "name": {
174
+ "type": "string",
175
+ "nullable": true
176
+ },
177
+ "fixed": {
178
+ "type": "bool",
179
+ "nullable": true
180
+ },
181
+ "position": {
182
+ "type": "string",
183
+ "nullable": true
184
+ },
185
+ "target_amino_acid": {
186
+ "type": "string",
187
+ "nullable": true
188
+ }
189
+ }
190
+ },
191
+ "peptide_per_protein": {
192
+ "fields": {
193
+ "protein_name": {
194
+ "type": "string"
195
+ },
196
+ "peptide_count": {
197
+ "type": "int32"
198
+ }
199
+ }
200
+ },
201
+ "peptide_counts": {
202
+ "fields": {
203
+ "unique_sequences": {
204
+ "type": "int32"
205
+ },
206
+ "total_sequences": {
207
+ "type": "int32"
208
+ }
209
+ }
210
+ },
211
+ "feature_counts": {
212
+ "fields": {
213
+ "unique_features": {
214
+ "type": "int32"
215
+ },
216
+ "total_features": {
217
+ "type": "int32"
218
+ }
219
+ }
220
+ },
221
+ "precursor": {
222
+ "fields": {
223
+ "selected_ion_mz": {
224
+ "type": "float32"
225
+ },
226
+ "selected_ion_charge": {
227
+ "type": "int32",
228
+ "nullable": true
229
+ },
230
+ "selected_ion_intensity": {
231
+ "type": "float32",
232
+ "nullable": true
233
+ },
234
+ "isolation_window_target": {
235
+ "type": "float32",
236
+ "nullable": true
237
+ },
238
+ "isolation_window_lower": {
239
+ "type": "float32",
240
+ "nullable": true
241
+ },
242
+ "isolation_window_upper": {
243
+ "type": "float32",
244
+ "nullable": true
245
+ },
246
+ "spectrum_ref": {
247
+ "type": "string",
248
+ "nullable": true
249
+ }
250
+ }
251
+ },
252
+ "parameter": {
253
+ "fields": {
254
+ "key": {
255
+ "type": "string"
256
+ },
257
+ "value": {
258
+ "type": "string"
259
+ }
260
+ }
261
+ },
262
+ "cross_link": {
263
+ "fields": {
264
+ "xl_type": {
265
+ "type": "string"
266
+ },
267
+ "partner_sequence": {
268
+ "type": "string",
269
+ "nullable": true
270
+ },
271
+ "partner_peptidoform": {
272
+ "type": "string",
273
+ "nullable": true
274
+ },
275
+ "donor_position": {
276
+ "type": "int32"
277
+ },
278
+ "acceptor_position": {
279
+ "type": "int32",
280
+ "nullable": true
281
+ },
282
+ "linker_name": {
283
+ "type": "string"
284
+ },
285
+ "linker_accession": {
286
+ "type": "string",
287
+ "nullable": true
288
+ },
289
+ "linker_mass": {
290
+ "type": "float64"
291
+ }
292
+ }
293
+ }
294
+ },
295
+ "feature": {
296
+ "fields": {
297
+ "feature_id": {
298
+ "type": "int64",
299
+ "nullable": false
300
+ },
301
+ "sequence": {
302
+ "type": "string",
303
+ "nullable": false
304
+ },
305
+ "peptidoform": {
306
+ "type": "string",
307
+ "nullable": false
308
+ },
309
+ "modifications": {
310
+ "type": "list<modification>",
311
+ "nullable": true
312
+ },
313
+ "charge": {
314
+ "type": "int16",
315
+ "nullable": false
316
+ },
317
+ "posterior_error_probability": {
318
+ "type": "float64",
319
+ "nullable": true
320
+ },
321
+ "peptide_qvalue": {
322
+ "type": "float64",
323
+ "nullable": true,
324
+ "optional": true
325
+ },
326
+ "is_decoy": {
327
+ "type": "bool",
328
+ "nullable": false
329
+ },
330
+ "calculated_mz": {
331
+ "type": "float32",
332
+ "nullable": true
333
+ },
334
+ "observed_mz": {
335
+ "type": "float32",
336
+ "nullable": true
337
+ },
338
+ "mass_error_ppm": {
339
+ "type": "float32",
340
+ "nullable": true
341
+ },
342
+ "additional_scores": {
343
+ "type": "list<score>",
344
+ "nullable": true
345
+ },
346
+ "predicted_rt": {
347
+ "type": "float32",
348
+ "nullable": true
349
+ },
350
+ "run_file_name": {
351
+ "type": "string",
352
+ "nullable": false
353
+ },
354
+ "quantification_unit_id": {
355
+ "type": "string",
356
+ "nullable": true,
357
+ "optional": true
358
+ },
359
+ "cv_params": {
360
+ "type": "list<cv_param>",
361
+ "nullable": true
362
+ },
363
+ "scan": {
364
+ "type": "list<int32>",
365
+ "nullable": false
366
+ },
367
+ "rt": {
368
+ "type": "float32",
369
+ "nullable": true
370
+ },
371
+ "consensus_rt": {
372
+ "type": "float32",
373
+ "nullable": true,
374
+ "optional": true
375
+ },
376
+ "ion_mobility": {
377
+ "type": "float32",
378
+ "nullable": true
379
+ },
380
+ "compensation_voltage": {
381
+ "type": "float32",
382
+ "nullable": true,
383
+ "optional": true
384
+ },
385
+ "missed_cleavages": {
386
+ "type": "int16",
387
+ "nullable": true
388
+ },
389
+ "intensities": {
390
+ "type": "list<intensity>",
391
+ "nullable": true
392
+ },
393
+ "additional_intensities": {
394
+ "type": "list<additional_intensity>",
395
+ "nullable": true
396
+ },
397
+ "pg_accessions": {
398
+ "type": "list<pg_protein>",
399
+ "nullable": true
400
+ },
401
+ "anchor_protein": {
402
+ "type": "string",
403
+ "nullable": true
404
+ },
405
+ "unique": {
406
+ "type": "bool",
407
+ "nullable": true
408
+ },
409
+ "pg_global_qvalue": {
410
+ "type": "float64",
411
+ "optional": true,
412
+ "nullable": true
413
+ },
414
+ "pg_positions": {
415
+ "type": "list<protein_position>",
416
+ "optional": true,
417
+ "nullable": true
418
+ },
419
+ "ion_mobility_start": {
420
+ "type": "float32",
421
+ "nullable": true
422
+ },
423
+ "ion_mobility_stop": {
424
+ "type": "float32",
425
+ "nullable": true
426
+ },
427
+ "gg_accessions": {
428
+ "type": "list<string>",
429
+ "optional": true,
430
+ "nullable": true
431
+ },
432
+ "gg_names": {
433
+ "type": "list<string>",
434
+ "optional": true,
435
+ "nullable": true
436
+ },
437
+ "id_run_file_name": {
438
+ "type": "string",
439
+ "nullable": true
440
+ },
441
+ "rt_start": {
442
+ "type": "float32",
443
+ "nullable": true
444
+ },
445
+ "rt_stop": {
446
+ "type": "float32",
447
+ "nullable": true
448
+ },
449
+ "psm_ids": {
450
+ "type": "list<int64>",
451
+ "optional": true,
452
+ "nullable": true
453
+ },
454
+ "pg_ids": {
455
+ "type": "list<int64>",
456
+ "optional": true,
457
+ "nullable": true
458
+ }
459
+ }
460
+ },
461
+ "pg": {
462
+ "fields": {
463
+ "pg_id": {
464
+ "type": "int64",
465
+ "nullable": false
466
+ },
467
+ "pg_accessions": {
468
+ "type": "list<string>",
469
+ "nullable": false
470
+ },
471
+ "pg_names": {
472
+ "type": "list<string>",
473
+ "nullable": true
474
+ },
475
+ "gg_accessions": {
476
+ "type": "list<string>",
477
+ "nullable": true
478
+ },
479
+ "gg_names": {
480
+ "type": "list<string>",
481
+ "nullable": true
482
+ },
483
+ "gg_qvalue": {
484
+ "type": "float64",
485
+ "nullable": true
486
+ },
487
+ "anchor_protein": {
488
+ "type": "string",
489
+ "nullable": false
490
+ },
491
+ "grouped_runs": {
492
+ "type": "list<string>",
493
+ "nullable": false
494
+ },
495
+ "global_qvalue": {
496
+ "type": "float64",
497
+ "nullable": true
498
+ },
499
+ "pg_qvalue": {
500
+ "type": "float64",
501
+ "nullable": true
502
+ },
503
+ "label": {
504
+ "type": "string",
505
+ "nullable": true
506
+ },
507
+ "intensity": {
508
+ "type": "float32",
509
+ "nullable": true
510
+ },
511
+ "additional_intensities": {
512
+ "type": "list<additional_intensity>",
513
+ "nullable": true
514
+ },
515
+ "is_decoy": {
516
+ "type": "bool",
517
+ "nullable": false
518
+ },
519
+ "contaminant": {
520
+ "type": "bool",
521
+ "nullable": true
522
+ },
523
+ "peptides": {
524
+ "type": "list<peptide_per_protein>",
525
+ "nullable": false
526
+ },
527
+ "peptide_counts": {
528
+ "type": "peptide_counts",
529
+ "nullable": true
530
+ },
531
+ "feature_counts": {
532
+ "type": "feature_counts",
533
+ "nullable": true
534
+ },
535
+ "sequence_coverage": {
536
+ "type": "float32",
537
+ "nullable": true
538
+ },
539
+ "molecular_weight": {
540
+ "type": "float32",
541
+ "nullable": true
542
+ },
543
+ "additional_scores": {
544
+ "type": "list<score>",
545
+ "nullable": true
546
+ },
547
+ "cv_params": {
548
+ "type": "list<cv_param>",
549
+ "nullable": true
550
+ }
551
+ }
552
+ },
553
+ "run": {
554
+ "fields": {
555
+ "run_accession": {
556
+ "type": "string",
557
+ "nullable": false
558
+ },
559
+ "run_file_name": {
560
+ "type": "string",
561
+ "nullable": false
562
+ },
563
+ "file_name": {
564
+ "type": "string",
565
+ "nullable": true
566
+ },
567
+ "samples": {
568
+ "type": "list<sample_channel>",
569
+ "nullable": false
570
+ },
571
+ "fraction": {
572
+ "type": "string",
573
+ "nullable": true
574
+ },
575
+ "instrument": {
576
+ "type": "string",
577
+ "nullable": true
578
+ },
579
+ "enzymes": {
580
+ "type": "list<string>",
581
+ "nullable": true
582
+ },
583
+ "dissociation_method": {
584
+ "type": "string",
585
+ "nullable": true
586
+ },
587
+ "acquisition_method": {
588
+ "type": "string",
589
+ "nullable": true
590
+ },
591
+ "additional_terms": {
592
+ "type": "list<ontology_term>",
593
+ "nullable": true
594
+ },
595
+ "modification_parameters": {
596
+ "type": "list<modification_param>",
597
+ "nullable": true
598
+ }
599
+ }
600
+ },
601
+ "sample": {
602
+ "fields": {
603
+ "sample_accession": {
604
+ "type": "string",
605
+ "nullable": false
606
+ },
607
+ "organism": {
608
+ "type": "string",
609
+ "nullable": false
610
+ },
611
+ "organism_part": {
612
+ "type": "string",
613
+ "nullable": false
614
+ },
615
+ "disease": {
616
+ "type": "string",
617
+ "optional": true,
618
+ "nullable": true
619
+ },
620
+ "cell_line": {
621
+ "type": "string",
622
+ "optional": true,
623
+ "nullable": true
624
+ },
625
+ "cell_type": {
626
+ "type": "string",
627
+ "optional": true,
628
+ "nullable": true
629
+ },
630
+ "sex": {
631
+ "type": "string",
632
+ "optional": true,
633
+ "nullable": true
634
+ },
635
+ "age": {
636
+ "type": "string",
637
+ "optional": true,
638
+ "nullable": true
639
+ },
640
+ "developmental_stage": {
641
+ "type": "string",
642
+ "optional": true,
643
+ "nullable": true
644
+ },
645
+ "ancestry": {
646
+ "type": "string",
647
+ "optional": true,
648
+ "nullable": true
649
+ },
650
+ "individual": {
651
+ "type": "string",
652
+ "optional": true,
653
+ "nullable": true
654
+ },
655
+ "sample_description": {
656
+ "type": "string",
657
+ "optional": true,
658
+ "nullable": true
659
+ }
660
+ }
661
+ }
662
+ }
@@ -0,0 +1,32 @@
1
+ """The QPX 1.1 Arrow contract, frozen from the qpx 1.1.6 schemas."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import json
6
+ from importlib.resources import files
7
+ from typing import Any, cast
8
+
9
+ import pyarrow as pa
10
+
11
+ _SPEC = cast(dict[str, Any], json.loads(files(__package__).joinpath("schema.json").read_text()))
12
+
13
+
14
+ def _type(name: str) -> pa.DataType:
15
+ if name.startswith("list<"):
16
+ return pa.list_(_type(name[5:-1]))
17
+ if name in _SPEC["types"]:
18
+ return pa.struct(_fields(_SPEC["types"][name]["fields"]))
19
+ return pa.type_for_alias(name)
20
+
21
+
22
+ def _fields(fields: dict[str, Any]) -> list[pa.Field]:
23
+ return [
24
+ pa.field(name, _type(field["type"]), nullable=field.get("nullable", True))
25
+ for name, field in fields.items()
26
+ if not field.get("optional", False)
27
+ ]
28
+
29
+
30
+ def arrow_schema(view: str) -> pa.Schema:
31
+ """Required columns and their exact nested types; unknown values may be null."""
32
+ return pa.schema(_fields(_SPEC[view]["fields"]))