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.
- apb_export/__init__.py +1 -0
- apb_export/api.py +98 -0
- apb_export/cli.py +562 -0
- apb_export/computed.py +135 -0
- apb_export/engine.py +717 -0
- apb_export/export_rules/__init__.py +0 -0
- apb_export/export_rules/documents/_schema/document.schema.json +1280 -0
- apb_export/export_rules/documents/_schema/rule.schema.json +1454 -0
- apb_export/export_rules/documents/alphapepttools/v0_4/rules.json +98 -0
- apb_export/export_rules/documents/explorede/v1_0/rules.json +197 -0
- apb_export/export_rules/documents/msmu/v0_4/rules.json +127 -0
- apb_export/export_rules/documents/msstats/v4_20/rules.json +66 -0
- apb_export/export_rules/documents/perseus/v2/rules.json +59 -0
- apb_export/export_rules/documents/prolfqua/v2_11/rules.json +223 -0
- apb_export/export_rules/documents/proteopy/v0_1/rules.json +53 -0
- apb_export/export_rules/documents/proteopy_ion/v0_1/rules.json +62 -0
- apb_export/export_rules/documents/qfeatures/v1_22/rules.json +98 -0
- apb_export/export_rules/documents/qpx/v1_1/rules.json +110 -0
- apb_export/export_rules/layout.py +60 -0
- apb_export/export_rules/loader.py +208 -0
- apb_export/export_rules/schema.py +502 -0
- apb_export/export_rules/schema_artifact.py +40 -0
- apb_export/long_table.py +75 -0
- apb_export/outputs.py +90 -0
- apb_export/perseus_table.py +100 -0
- apb_export/py.typed +1 -0
- apb_export/qpx/LICENSE.qpx +81 -0
- apb_export/qpx/__init__.py +0 -0
- apb_export/qpx/output.py +215 -0
- apb_export/qpx/schema.json +662 -0
- apb_export/qpx/schema.py +32 -0
- apb_export/rows.py +72 -0
- apb_export/sources.py +415 -0
- apb_export-0.2.2.dist-info/METADATA +159 -0
- apb_export-0.2.2.dist-info/RECORD +39 -0
- apb_export-0.2.2.dist-info/WHEEL +4 -0
- apb_export-0.2.2.dist-info/entry_points.txt +3 -0
- apb_export-0.2.2.dist-info/licenses/LICENSE +21 -0
- apb_export-0.2.2.dist-info/licenses/src/apb_export/qpx/LICENSE.qpx +81 -0
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema_version": "0.5",
|
|
3
|
+
"file_version": "3",
|
|
4
|
+
"target_name": "prolfquapp",
|
|
5
|
+
"target_version_pattern": "^2\\.11\\.",
|
|
6
|
+
"tables": [
|
|
7
|
+
{
|
|
8
|
+
"output": ".h5ad",
|
|
9
|
+
"base": {
|
|
10
|
+
"axis": {"obs_key": "sampleName", "var_key": "feature_id"},
|
|
11
|
+
"measurements": {
|
|
12
|
+
"primary_layer": "intensity",
|
|
13
|
+
"layers": [
|
|
14
|
+
{
|
|
15
|
+
"name": "intensity",
|
|
16
|
+
"source": {"catalog": "abundance_alpha", "layers": "intensity"},
|
|
17
|
+
"fallback": [{"measurements": "primary_layer"}]
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"name": "qValue",
|
|
21
|
+
"source": {"catalog": "confidence_alpha", "layers": "q_value"},
|
|
22
|
+
"fallback": [{"catalog": "proteobench_entrapment_alpha", "var": "q_value"}],
|
|
23
|
+
"required": false
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"name": "pg_qValue",
|
|
27
|
+
"source": {
|
|
28
|
+
"catalog": "confidence_alpha",
|
|
29
|
+
"layers": "q_value",
|
|
30
|
+
"from_level": "protein"
|
|
31
|
+
},
|
|
32
|
+
"required": false
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "pg_qValue_experiment",
|
|
36
|
+
"source": {
|
|
37
|
+
"catalog": "confidence_alpha",
|
|
38
|
+
"var": "library_q_value",
|
|
39
|
+
"from_level": "protein",
|
|
40
|
+
"accept": "nonzero"
|
|
41
|
+
},
|
|
42
|
+
"fallback": [
|
|
43
|
+
{"catalog": "confidence_alpha", "var": "q_value", "from_level": "protein"}
|
|
44
|
+
],
|
|
45
|
+
"required": false
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "pep",
|
|
49
|
+
"source": {"catalog": "confidence_alpha", "layers": "pep"},
|
|
50
|
+
"fallback": [{"catalog": "confidence_alpha", "var": "pep"}],
|
|
51
|
+
"required": false
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
"columns": {
|
|
56
|
+
"obs": [
|
|
57
|
+
{"name": "sampleName", "source": {"axis": "obs_key"}},
|
|
58
|
+
{"name": "raw.file", "source": {"axis": "obs_key"}},
|
|
59
|
+
{"name": "annotations", "how": "all_values"}
|
|
60
|
+
],
|
|
61
|
+
"var": [
|
|
62
|
+
{
|
|
63
|
+
"name": "feature_id",
|
|
64
|
+
"how": "join_nonempty",
|
|
65
|
+
"inputs": [
|
|
66
|
+
{"catalog": "apb_alpha", "var": "protein_assignment"},
|
|
67
|
+
{"catalog": "apb_alpha", "var": "peptide"}
|
|
68
|
+
],
|
|
69
|
+
"separator": "~"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"name": "protein_Id",
|
|
73
|
+
"source": {"catalog": "apb_alpha", "var": "protein_assignment"},
|
|
74
|
+
"drop_missing": true
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"name": "IDcolumn",
|
|
78
|
+
"source": {"catalog": "fasta_peptides_alpha", "var": "reported_leading_accession"},
|
|
79
|
+
"fallback": [{"catalog": "apb_alpha", "var": "protein_assignment"}]
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"name": "fasta.id",
|
|
83
|
+
"source": {"catalog": "fasta_peptides_alpha", "var": "reported_leading_id"},
|
|
84
|
+
"fallback": [{"catalog": "apb_alpha", "var": "protein_assignment"}]
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"name": "description",
|
|
88
|
+
"source": {"catalog": "fasta_peptides_alpha", "var": "reported_leading_description"},
|
|
89
|
+
"fallback": [{"catalog": "apb_alpha", "var": "protein_assignment"}]
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"name": "gene_name",
|
|
93
|
+
"source": {"catalog": "fasta_peptides_alpha", "var": "reported_leading_gene_name"},
|
|
94
|
+
"required": false
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"name": "protein_length",
|
|
98
|
+
"source": {
|
|
99
|
+
"catalog": "fasta_peptides_alpha",
|
|
100
|
+
"var": "reported_leading_protein_length"
|
|
101
|
+
},
|
|
102
|
+
"type": "number",
|
|
103
|
+
"required": false
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"name": "nr_tryptic_peptides",
|
|
107
|
+
"source": {
|
|
108
|
+
"catalog": "fasta_peptides_alpha",
|
|
109
|
+
"var": "reported_leading_tryptic_peptides"
|
|
110
|
+
},
|
|
111
|
+
"type": "number",
|
|
112
|
+
"required": false
|
|
113
|
+
},
|
|
114
|
+
{"name": "peptide_Id", "source": {"catalog": "apb_alpha", "var": "peptide"}},
|
|
115
|
+
{"name": "nr_children", "how": "constant", "value": 1, "type": "integer"}
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
"uns": [
|
|
119
|
+
{"name": "X_layer_name", "how": "constant", "value": "intensity"},
|
|
120
|
+
{"name": "prolfquapp.artifact_type", "how": "constant", "value": "lfqdata"},
|
|
121
|
+
{"name": "prolfquapp.schema_version", "how": "constant", "value": "1.0.0"},
|
|
122
|
+
{
|
|
123
|
+
"name": "prolfquapp.source_software",
|
|
124
|
+
"source": {"rule": "software_name"},
|
|
125
|
+
"required": false,
|
|
126
|
+
"fill_value": "unknown"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"name": "prolfquapp.protein_annotation",
|
|
130
|
+
"how": "constant",
|
|
131
|
+
"value": {
|
|
132
|
+
"pID": "protein_Id",
|
|
133
|
+
"full_id": "protein_Id",
|
|
134
|
+
"description": "description",
|
|
135
|
+
"cleaned_ids": "IDcolumn",
|
|
136
|
+
"exp_nr_children": "nrPeptides",
|
|
137
|
+
"pattern_contaminants": "^zz|^CON|Cont_",
|
|
138
|
+
"pattern_decoys": "^REV_|^rev"
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"name": "prolfquapp.layer_names",
|
|
143
|
+
"how": "constant",
|
|
144
|
+
"value": ["intensity", "qValue", "pg_qValue", "pg_qValue_experiment", "pep"]
|
|
145
|
+
}
|
|
146
|
+
]
|
|
147
|
+
},
|
|
148
|
+
"levels": {
|
|
149
|
+
"peptide": {
|
|
150
|
+
"software": ["MaxQuant"],
|
|
151
|
+
"uns": [
|
|
152
|
+
{
|
|
153
|
+
"name": "prolfquapp.analysis_configuration",
|
|
154
|
+
"how": "constant",
|
|
155
|
+
"value": {
|
|
156
|
+
"sep": "~",
|
|
157
|
+
"file_name": "raw.file",
|
|
158
|
+
"sample_name": "sampleName",
|
|
159
|
+
"isotope_label": "isotopeLabel",
|
|
160
|
+
"ident_q_value": "qValue",
|
|
161
|
+
"nr_children": "nr_children",
|
|
162
|
+
"work_intensity": ["intensity"],
|
|
163
|
+
"is_response_transformed": false,
|
|
164
|
+
"factor_depth": 1,
|
|
165
|
+
"hierarchy": {"protein_Id": ["protein_Id"], "peptide_Id": ["peptide_Id"]},
|
|
166
|
+
"hierarchy_keys": ["protein_Id", "peptide_Id"],
|
|
167
|
+
"hierarchy_depth": 1,
|
|
168
|
+
"min_peptides_protein": 2
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
{"name": "prolfquapp.analysis_configuration.factors", "how": "annotation_map"}
|
|
172
|
+
]
|
|
173
|
+
},
|
|
174
|
+
"peptidoform_ion": {
|
|
175
|
+
"columns": {
|
|
176
|
+
"var": [
|
|
177
|
+
{
|
|
178
|
+
"name": "feature_id",
|
|
179
|
+
"how": "join_nonempty",
|
|
180
|
+
"inputs": [
|
|
181
|
+
{"catalog": "apb_alpha", "var": "protein_assignment"},
|
|
182
|
+
{"catalog": "apb_alpha", "var": "peptide"},
|
|
183
|
+
{"catalog": "apb_alpha", "var": "peptidoform_ion"}
|
|
184
|
+
],
|
|
185
|
+
"separator": "~"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"name": "precursor_Id",
|
|
189
|
+
"source": {"catalog": "apb_alpha", "var": "peptidoform_ion"}
|
|
190
|
+
}
|
|
191
|
+
]
|
|
192
|
+
},
|
|
193
|
+
"uns": [
|
|
194
|
+
{
|
|
195
|
+
"name": "prolfquapp.analysis_configuration",
|
|
196
|
+
"how": "constant",
|
|
197
|
+
"value": {
|
|
198
|
+
"sep": "~",
|
|
199
|
+
"file_name": "raw.file",
|
|
200
|
+
"sample_name": "sampleName",
|
|
201
|
+
"isotope_label": "isotopeLabel",
|
|
202
|
+
"ident_q_value": "qValue",
|
|
203
|
+
"nr_children": "nr_children",
|
|
204
|
+
"work_intensity": ["intensity"],
|
|
205
|
+
"is_response_transformed": false,
|
|
206
|
+
"factor_depth": 1,
|
|
207
|
+
"hierarchy": {
|
|
208
|
+
"protein_Id": ["protein_Id"],
|
|
209
|
+
"peptide_Id": ["peptide_Id"],
|
|
210
|
+
"precursor_Id": ["precursor_Id"]
|
|
211
|
+
},
|
|
212
|
+
"hierarchy_keys": ["protein_Id", "peptide_Id", "precursor_Id"],
|
|
213
|
+
"hierarchy_depth": 1,
|
|
214
|
+
"min_peptides_protein": 2
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
{"name": "prolfquapp.analysis_configuration.factors", "how": "annotation_map"}
|
|
218
|
+
]
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
]
|
|
223
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema_version": "0.5",
|
|
3
|
+
"file_version": "2",
|
|
4
|
+
"target_name": "ProteoPy",
|
|
5
|
+
"target_version_pattern": "^0\\.1\\.",
|
|
6
|
+
"tables": [
|
|
7
|
+
{
|
|
8
|
+
"output": ".h5ad",
|
|
9
|
+
"levels": {
|
|
10
|
+
"protein": {
|
|
11
|
+
"axis": {"obs_key": "sample_id", "var_key": "protein_id"},
|
|
12
|
+
"measurements": {
|
|
13
|
+
"primary_layer": "abundance",
|
|
14
|
+
"layers": [{"name": "abundance", "source": {"measurements": "primary_layer"}}]
|
|
15
|
+
},
|
|
16
|
+
"columns": {
|
|
17
|
+
"obs": [
|
|
18
|
+
{"name": "sample_id", "source": {"axis": "obs_key"}},
|
|
19
|
+
{"name": "annotations", "how": "all_values"}
|
|
20
|
+
],
|
|
21
|
+
"var": [
|
|
22
|
+
{
|
|
23
|
+
"name": "protein_id",
|
|
24
|
+
"source": {"catalog": "apb_alpha", "var": "protein_assignment"}
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "in_fasta",
|
|
28
|
+
"source": {"catalog": "fasta_proteins_alpha", "var": "any_member_in_fasta"},
|
|
29
|
+
"type": "boolean",
|
|
30
|
+
"required": false
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"name": "gene_id",
|
|
34
|
+
"source": {"catalog": "fasta_proteins_alpha", "var": "fasta_gene_names"},
|
|
35
|
+
"required": false
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"name": "description",
|
|
39
|
+
"source": {"catalog": "fasta_proteins_alpha", "var": "fasta_descriptions"},
|
|
40
|
+
"required": false
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "fasta_organisms",
|
|
44
|
+
"source": {"catalog": "fasta_proteins_alpha", "var": "fasta_organism_names"},
|
|
45
|
+
"required": false
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema_version": "0.5",
|
|
3
|
+
"file_version": "1",
|
|
4
|
+
"target_name": "ProteoPy",
|
|
5
|
+
"target_version_pattern": "^0\\.1\\.",
|
|
6
|
+
"tables": [
|
|
7
|
+
{
|
|
8
|
+
"output": ".h5ad",
|
|
9
|
+
"levels": {
|
|
10
|
+
"peptidoform_ion": {
|
|
11
|
+
"axis": {"obs_key": "sample_id", "var_key": "peptide_id"},
|
|
12
|
+
"measurements": {
|
|
13
|
+
"primary_layer": "abundance",
|
|
14
|
+
"layers": [{"name": "abundance", "source": {"measurements": "primary_layer"}}]
|
|
15
|
+
},
|
|
16
|
+
"columns": {
|
|
17
|
+
"obs": [
|
|
18
|
+
{"name": "sample_id", "source": {"axis": "obs_key"}},
|
|
19
|
+
{"name": "annotations", "how": "all_values"}
|
|
20
|
+
],
|
|
21
|
+
"var": [
|
|
22
|
+
{"name": "peptide_id", "source": {"catalog": "apb_alpha", "var": "peptidoform_ion"}},
|
|
23
|
+
{
|
|
24
|
+
"name": "protein_id",
|
|
25
|
+
"how": "single_accession",
|
|
26
|
+
"source": {"catalog": "apb_alpha", "var": "fasta_accessions"},
|
|
27
|
+
"drop_missing": true
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name": "decoy",
|
|
31
|
+
"source": {"catalog": "apb_alpha", "var": "decoy"},
|
|
32
|
+
"type": "boolean",
|
|
33
|
+
"required": false
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "in_fasta",
|
|
37
|
+
"source": {"catalog": "fasta_proteins_alpha", "var": "any_member_in_fasta"},
|
|
38
|
+
"type": "boolean",
|
|
39
|
+
"required": false
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "gene_id",
|
|
43
|
+
"source": {"catalog": "fasta_proteins_alpha", "var": "fasta_gene_names"},
|
|
44
|
+
"required": false
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"name": "description",
|
|
48
|
+
"source": {"catalog": "fasta_proteins_alpha", "var": "fasta_descriptions"},
|
|
49
|
+
"required": false
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"name": "fasta_organisms",
|
|
53
|
+
"source": {"catalog": "fasta_proteins_alpha", "var": "fasta_organism_names"},
|
|
54
|
+
"required": false
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema_version": "0.5",
|
|
3
|
+
"file_version": "2",
|
|
4
|
+
"target_name": "QFeatures",
|
|
5
|
+
"target_version_pattern": "^1\\.22\\.",
|
|
6
|
+
"tables": [
|
|
7
|
+
{
|
|
8
|
+
"output": ".h5mu",
|
|
9
|
+
"base": {
|
|
10
|
+
"measurements": {
|
|
11
|
+
"primary_layer": "intensity",
|
|
12
|
+
"layers": [{"name": "intensity", "source": {"measurements": "primary_layer"}}]
|
|
13
|
+
},
|
|
14
|
+
"columns": {
|
|
15
|
+
"obs": [
|
|
16
|
+
{"name": "raw_name", "source": {"axis": "obs_key"}},
|
|
17
|
+
{"name": "annotations", "how": "all_values"}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"levels": {
|
|
22
|
+
"peptidoform_ion": {
|
|
23
|
+
"modality": "precursors",
|
|
24
|
+
"axis": {"obs_key": "raw_name", "var_key": "precursor_id"},
|
|
25
|
+
"columns": {
|
|
26
|
+
"var": [
|
|
27
|
+
{
|
|
28
|
+
"name": "precursor_id",
|
|
29
|
+
"source": {"catalog": "apb_alpha", "var": "peptidoform_ion"}
|
|
30
|
+
},
|
|
31
|
+
{"name": "sequence", "source": {"catalog": "apb_alpha", "var": "peptide"}},
|
|
32
|
+
{"name": "proteins", "source": {"catalog": "apb_alpha", "var": "protein_assignment"}},
|
|
33
|
+
{"name": "contaminant", "how": "contaminant", "type": "boolean"},
|
|
34
|
+
{
|
|
35
|
+
"name": "in_fasta",
|
|
36
|
+
"source": {"catalog": "fasta_peptides_alpha", "var": "peptide_in_fasta"},
|
|
37
|
+
"type": "boolean",
|
|
38
|
+
"required": false
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"name": "fasta_proteins",
|
|
42
|
+
"source": {"catalog": "fasta_peptides_alpha", "var": "fasta_matching_protein_ids"},
|
|
43
|
+
"required": false
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"name": "fasta_organisms",
|
|
47
|
+
"source": {"catalog": "fasta_peptides_alpha", "var": "fasta_matching_organisms"},
|
|
48
|
+
"required": false
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"peptide": {
|
|
54
|
+
"modality": "peptides",
|
|
55
|
+
"required": false,
|
|
56
|
+
"axis": {"obs_key": "raw_name", "var_key": "sequence"},
|
|
57
|
+
"columns": {
|
|
58
|
+
"var": [
|
|
59
|
+
{"name": "sequence", "source": {"catalog": "apb_alpha", "var": "peptide"}},
|
|
60
|
+
{
|
|
61
|
+
"name": "proteins",
|
|
62
|
+
"source": {"catalog": "apb_alpha", "var": "protein_assignment"},
|
|
63
|
+
"required": false
|
|
64
|
+
},
|
|
65
|
+
{"name": "contaminant", "how": "contaminant", "type": "boolean"},
|
|
66
|
+
{
|
|
67
|
+
"name": "in_fasta",
|
|
68
|
+
"source": {"catalog": "fasta_peptides_alpha", "var": "peptide_in_fasta"},
|
|
69
|
+
"type": "boolean",
|
|
70
|
+
"required": false
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"name": "fasta_proteins",
|
|
74
|
+
"source": {"catalog": "fasta_peptides_alpha", "var": "fasta_matching_protein_ids"},
|
|
75
|
+
"required": false
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"name": "fasta_organisms",
|
|
79
|
+
"source": {"catalog": "fasta_peptides_alpha", "var": "fasta_matching_organisms"},
|
|
80
|
+
"required": false
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"protein": {
|
|
86
|
+
"modality": "proteins",
|
|
87
|
+
"required": false,
|
|
88
|
+
"axis": {"obs_key": "raw_name", "var_key": "proteins"},
|
|
89
|
+
"columns": {
|
|
90
|
+
"var": [
|
|
91
|
+
{"name": "proteins", "source": {"catalog": "apb_alpha", "var": "protein_assignment"}}
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema_version": "0.5",
|
|
3
|
+
"file_version": "2",
|
|
4
|
+
"target_name": "QPX",
|
|
5
|
+
"target_version_pattern": "^1\\.1\\.",
|
|
6
|
+
"tables": [
|
|
7
|
+
{
|
|
8
|
+
"output": ".qpx",
|
|
9
|
+
"base": {
|
|
10
|
+
"required": false,
|
|
11
|
+
"measurements": {
|
|
12
|
+
"primary_layer": "intensity",
|
|
13
|
+
"layers": [
|
|
14
|
+
{"name": "intensity", "source": {"measurements": "primary_layer"}, "required": true}
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"levels": {
|
|
19
|
+
"peptidoform_ion": {
|
|
20
|
+
"axis": {"obs_key": "run_file_name", "var_key": "feature_key"},
|
|
21
|
+
"columns": {
|
|
22
|
+
"obs": [
|
|
23
|
+
{"name": "run_file_name", "source": {"axis": "obs_key"}},
|
|
24
|
+
{"name": "annotations", "how": "all_values"}
|
|
25
|
+
],
|
|
26
|
+
"var": [
|
|
27
|
+
{"name": "feature_key", "source": {"axis": "var_key"}},
|
|
28
|
+
{
|
|
29
|
+
"name": "sequence",
|
|
30
|
+
"source": {"catalog": "apb_alpha", "var": "peptide"},
|
|
31
|
+
"required": true
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"name": "peptidoform",
|
|
35
|
+
"source": {"catalog": "apb_alpha", "var": "peptidoform"},
|
|
36
|
+
"required": true
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "charge",
|
|
40
|
+
"type": "integer",
|
|
41
|
+
"how": "proforma_charge",
|
|
42
|
+
"source": {"catalog": "apb_alpha", "var": "peptidoform_ion"}
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"name": "is_decoy",
|
|
46
|
+
"source": {"catalog": "apb_alpha", "var": "decoy"},
|
|
47
|
+
"required": true,
|
|
48
|
+
"type": "boolean"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"name": "proteins",
|
|
52
|
+
"source": {"catalog": "apb_alpha", "var": "protein_assignment"},
|
|
53
|
+
"required": false
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
"modality": "feature",
|
|
58
|
+
"measurements": {
|
|
59
|
+
"primary_layer": "intensity",
|
|
60
|
+
"layers": [
|
|
61
|
+
{"name": "intensity", "source": {"measurements": "primary_layer"}, "required": true},
|
|
62
|
+
{
|
|
63
|
+
"name": "rt_second",
|
|
64
|
+
"source": {
|
|
65
|
+
"catalog": "chromatography_alpha",
|
|
66
|
+
"layers": "retention_time",
|
|
67
|
+
"qualifiers": {"unit": "second"}
|
|
68
|
+
},
|
|
69
|
+
"required": false
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"name": "rt_minute",
|
|
73
|
+
"source": {
|
|
74
|
+
"catalog": "chromatography_alpha",
|
|
75
|
+
"layers": "retention_time",
|
|
76
|
+
"qualifiers": {"unit": "minute"}
|
|
77
|
+
},
|
|
78
|
+
"required": false
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"protein": {
|
|
84
|
+
"axis": {"obs_key": "run_file_name", "var_key": "proteins"},
|
|
85
|
+
"columns": {
|
|
86
|
+
"obs": [
|
|
87
|
+
{"name": "run_file_name", "source": {"axis": "obs_key"}},
|
|
88
|
+
{"name": "annotations", "how": "all_values"}
|
|
89
|
+
],
|
|
90
|
+
"var": [
|
|
91
|
+
{
|
|
92
|
+
"name": "proteins",
|
|
93
|
+
"source": {"catalog": "apb_alpha", "var": "protein_assignment"},
|
|
94
|
+
"required": true
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"name": "is_decoy",
|
|
98
|
+
"source": {"catalog": "apb_alpha", "var": "decoy"},
|
|
99
|
+
"required": true,
|
|
100
|
+
"type": "boolean"
|
|
101
|
+
},
|
|
102
|
+
{"name": "contaminant", "how": "contaminant", "type": "boolean"}
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
"modality": "pg"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"""The layout of export rule files: an object or list on one line where it fits, else one item
|
|
2
|
+
per line.
|
|
3
|
+
|
|
4
|
+
``python -m apb_export.export_rules.layout`` rewrites the packaged rules after an edit.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import json
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
|
|
12
|
+
from pydantic import JsonValue
|
|
13
|
+
|
|
14
|
+
WIDTH = 100
|
|
15
|
+
"""The widest line an object or list stays on."""
|
|
16
|
+
_INDENT = 2
|
|
17
|
+
DOCUMENTS = Path(__file__).parent / "documents"
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def format_rule(document: JsonValue) -> str:
|
|
21
|
+
"""A rule document as its file holds it."""
|
|
22
|
+
return _render(document, 0, 0) + "\n"
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _render(value: JsonValue, indent: int, start: int) -> str:
|
|
26
|
+
"""One value whose first character sits in column ``start``, nested ``indent`` deep."""
|
|
27
|
+
compact = json.dumps(value, ensure_ascii=False, separators=(", ", ": "))
|
|
28
|
+
if not isinstance(value, dict | list) or not value or start + len(compact) < WIDTH:
|
|
29
|
+
return compact
|
|
30
|
+
pad = " " * (indent + _INDENT)
|
|
31
|
+
if isinstance(value, dict):
|
|
32
|
+
lines = []
|
|
33
|
+
for key, item in value.items():
|
|
34
|
+
prefix = f"{pad}{json.dumps(key, ensure_ascii=False)}: "
|
|
35
|
+
lines.append(prefix + _render(item, indent + _INDENT, len(prefix)))
|
|
36
|
+
return "{\n" + ",\n".join(lines) + "\n" + " " * indent + "}"
|
|
37
|
+
items = [pad + _render(item, indent + _INDENT, len(pad)) for item in value]
|
|
38
|
+
return "[\n" + ",\n".join(items) + "\n" + " " * indent + "]"
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def packaged_rule_files() -> tuple[Path, ...]:
|
|
42
|
+
"""Every packaged ``<target>/<version>/rules.json``."""
|
|
43
|
+
return tuple(sorted(DOCUMENTS.glob("*/*/rules.json")))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def write_layout(paths: tuple[Path, ...]) -> tuple[Path, ...]:
|
|
47
|
+
"""Rewrite each rule file in its layout; the files that changed."""
|
|
48
|
+
changed: list[Path] = []
|
|
49
|
+
for path in paths:
|
|
50
|
+
text = path.read_text(encoding="utf-8")
|
|
51
|
+
formatted = format_rule(json.loads(text))
|
|
52
|
+
if formatted != text:
|
|
53
|
+
path.write_text(formatted, encoding="utf-8")
|
|
54
|
+
changed.append(path)
|
|
55
|
+
return tuple(changed)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
if __name__ == "__main__":
|
|
59
|
+
for written in write_layout(packaged_rule_files()):
|
|
60
|
+
print(written)
|