1
|
|
|
""" |
2
|
|
|
Command-line interface for mandos. |
3
|
|
|
""" |
4
|
|
|
|
5
|
|
|
from __future__ import annotations |
6
|
|
|
|
7
|
|
|
from pathlib import Path |
8
|
|
|
from typing import Optional, List |
9
|
|
|
|
10
|
|
|
import typer |
|
|
|
|
11
|
|
|
from mandos.entries.searcher import InputFrame |
12
|
|
|
|
13
|
|
|
from mandos import logger, MANDOS_SETUP |
14
|
|
|
from mandos.analysis.io_defns import SimilarityDfLongForm |
15
|
|
|
from mandos.analysis.concordance import ConcordanceCalculation |
16
|
|
|
from mandos.analysis.distances import MatrixCalculation |
17
|
|
|
from mandos.analysis.filtration import Filtration |
18
|
|
|
from mandos.analysis.enrichment import EnrichmentCalculation, RealAlg, BoolAlg |
19
|
|
|
from mandos.analysis.io_defns import ScoreDf |
20
|
|
|
from mandos.analysis.prepping import MatrixPrep |
21
|
|
|
from mandos.analysis.reification import Reifier |
22
|
|
|
from mandos.entries.common_args import Arg, CommonArgs |
23
|
|
|
from mandos.entries.common_args import CommonArgs as Ca |
|
|
|
|
24
|
|
|
from mandos.entries.common_args import Opt |
25
|
|
|
from mandos.entries.multi_searches import MultiSearch |
26
|
|
|
from mandos.entries.filler import CompoundIdFiller, IdMatchFrame |
27
|
|
|
from mandos.model import MandosResources |
28
|
|
|
from mandos.model.utils import MiscUtils |
29
|
|
|
from mandos.model.apis.g2p_api import CachingG2pApi |
30
|
|
|
from mandos.model.hits import HitFrame |
31
|
|
|
from mandos.model.settings import MANDOS_SETTINGS |
32
|
|
|
from mandos.model.taxonomy_caches import TaxonomyFactories |
33
|
|
|
from mandos.analysis.projection import UMAP |
34
|
|
|
|
35
|
|
|
set_up = MANDOS_SETUP |
36
|
|
|
DEF_SUFFIX = MANDOS_SETTINGS.default_table_suffix |
37
|
|
|
|
38
|
|
|
if UMAP is None: |
39
|
|
|
_umap_params = {} |
40
|
|
|
else: |
41
|
|
|
_umap_params = { |
42
|
|
|
k: v |
43
|
|
|
for k, v in UMAP().get_params(deep=False).items() |
44
|
|
|
if k not in {"random_state", "metric"} |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
|
48
|
|
|
class MiscCommands: |
|
|
|
|
49
|
|
|
@staticmethod |
50
|
|
|
def search( |
|
|
|
|
51
|
|
|
path: Path = Ca.compounds, |
|
|
|
|
52
|
|
|
config: Path = Arg.in_file( |
|
|
|
|
53
|
|
|
r""" |
54
|
|
|
TOML config file. See docs. |
55
|
|
|
""" |
56
|
|
|
), |
57
|
|
|
log: Optional[Path] = CommonArgs.log_path, |
|
|
|
|
58
|
|
|
quiet: bool = CommonArgs.quiet, |
|
|
|
|
59
|
|
|
verbose: bool = CommonArgs.verbose, |
|
|
|
|
60
|
|
|
out_dir: Path = Ca.out_dir, |
|
|
|
|
61
|
|
|
) -> None: |
62
|
|
|
""" |
63
|
|
|
Run multiple searches. |
64
|
|
|
""" |
65
|
|
|
set_up(log, quiet, verbose) |
66
|
|
|
MultiSearch.build(path, out_dir, config).run() |
67
|
|
|
|
68
|
|
|
@staticmethod |
69
|
|
|
def serve( |
|
|
|
|
70
|
|
|
port: int = Opt.val(r"Port to serve on", default=1540), |
|
|
|
|
71
|
|
|
db: str = Opt.val("Name of the MySQL database", default="mandos"), |
|
|
|
|
72
|
|
|
log: Optional[Path] = CommonArgs.log_path, |
|
|
|
|
73
|
|
|
quiet: bool = CommonArgs.quiet, |
|
|
|
|
74
|
|
|
verbose: bool = CommonArgs.verbose, |
|
|
|
|
75
|
|
|
) -> None: |
76
|
|
|
r""" |
77
|
|
|
Start a REST server. |
78
|
|
|
|
79
|
|
|
The connection information is stored in your global settings file. |
80
|
|
|
""" |
81
|
|
|
set_up(log, quiet, verbose) |
82
|
|
|
|
83
|
|
|
@staticmethod |
84
|
|
|
def export_db( |
|
|
|
|
85
|
|
|
path: Path = Ca.file_input, |
|
|
|
|
86
|
|
|
db: str = Opt.val(r"Name of the MySQL database", default="mandos"), |
|
|
|
|
87
|
|
|
host: str = Opt.val( |
|
|
|
|
88
|
|
|
r"Database hostname (ignored if ``--socket`` is passed", default="127.0.0.1" |
89
|
|
|
), |
90
|
|
|
socket: Optional[str] = Opt.val("Path to a Unix socket (if set, ``--host`` is ignored)"), |
|
|
|
|
91
|
|
|
user: Optional[str] = Opt.val("Database username (empty if not set)"), |
|
|
|
|
92
|
|
|
password: Optional[str] = Opt.val("Database password (empty if not set)"), |
|
|
|
|
93
|
|
|
as_of: Optional[str] = CommonArgs.as_of, |
|
|
|
|
94
|
|
|
log: Optional[Path] = CommonArgs.log_path, |
|
|
|
|
95
|
|
|
quiet: bool = CommonArgs.quiet, |
|
|
|
|
96
|
|
|
verbose: bool = CommonArgs.verbose, |
|
|
|
|
97
|
|
|
) -> None: |
98
|
|
|
r""" |
99
|
|
|
Export to a relational database. |
100
|
|
|
|
101
|
|
|
Saves data from Mandos search commands to a database for serving via REST. |
102
|
|
|
|
103
|
|
|
See also: ``:serve``. |
104
|
|
|
""" |
105
|
|
|
set_up(log, quiet, verbose) |
106
|
|
|
|
107
|
|
|
@staticmethod |
108
|
|
|
def fill( |
|
|
|
|
109
|
|
|
path: Path = Ca.compounds_to_fill, |
|
|
|
|
110
|
|
|
to: Path = Ca.id_table_to, |
|
|
|
|
111
|
|
|
no_pubchem: bool = Opt.flag("Do not use PubChem.", "--no-pubchem"), |
|
|
|
|
112
|
|
|
no_chembl: bool = Opt.flag("Do not use ChEMBL.", "--no-chembl"), |
|
|
|
|
113
|
|
|
replace: bool = Ca.replace, |
|
|
|
|
114
|
|
|
log: Optional[Path] = Ca.log_path, |
|
|
|
|
115
|
|
|
quiet: bool = Ca.quiet, |
|
|
|
|
116
|
|
|
verbose: bool = Ca.verbose, |
|
|
|
|
117
|
|
|
) -> None: |
118
|
|
|
r""" |
119
|
|
|
Fill in missing IDs from existing compound data. |
120
|
|
|
|
121
|
|
|
The idea is to find a ChEMBL ID, a PubChem ID, and parent-compound InChI/InChI Key. |
122
|
|
|
Useful to check compound/ID associations before running a search. |
123
|
|
|
|
124
|
|
|
To be filled, each row must should have a non-null value for |
125
|
|
|
"inchikey", "chembl_id", and/or "pubchem_id". |
126
|
|
|
"inchi" will be used but not to match to PubChem and ChEMBL. |
127
|
|
|
|
128
|
|
|
No existing columns will be dropped or modified. |
129
|
|
|
Any conflicting column will be renamed to 'origin_<column>'. |
130
|
|
|
E.g. 'inchikey' will be renamed to 'origin_inchikey'. |
131
|
|
|
(Do not include a column beginning with 'origin_'). |
132
|
|
|
|
133
|
|
|
Final columns (assuming --no-chembl and --no-pubchem) will include: |
134
|
|
|
inchikey, inchi, pubchem_id, chembl_id, pubchem_inch, chembl_inchi, |
135
|
|
|
pubchem_inchikey, and chembl_inchikey. |
136
|
|
|
The "inchikey" and "inchikey" columns will be the "best" available: |
137
|
|
|
chembl (preferred), then pubchem, then your source inchikey column. |
138
|
|
|
In cases where PubChem and ChEMBL differ, an error will be logged. |
139
|
|
|
You can always check the columns "origin_inchikey" (yours), |
140
|
|
|
chembl_inchikey, and pubchem_inchikey. |
141
|
|
|
|
142
|
|
|
The steps are: |
143
|
|
|
|
144
|
|
|
- If "chembl_id" or "pubchem_id" is non-null, uses that to find an InChI Key (for each). |
145
|
|
|
|
146
|
|
|
- Otherwise, if only "inchikey" is non-null, uses it to find ChEMBL and PubChem records. |
147
|
|
|
|
148
|
|
|
- Log an error if the inchikeys or inchis differ between PubChem and ChEMBL. |
149
|
|
|
|
150
|
|
|
- Set the final "inchi" and "inchikey" to the best choice, |
151
|
|
|
falling back to the input inchi and inchikey if they are missing. |
152
|
|
|
""" |
153
|
|
|
set_up(log, quiet, verbose) |
154
|
|
|
default = str(Path(path).with_suffix("")) + "-filled" + "".join(path.suffixes) |
155
|
|
|
to = MiscUtils.adjust_filename(to, default, replace) |
156
|
|
|
df = IdMatchFrame.read_file(path) |
|
|
|
|
157
|
|
|
df = CompoundIdFiller(chembl=not no_chembl, pubchem=not no_pubchem).fill(df) |
|
|
|
|
158
|
|
|
df.write_file(to) |
159
|
|
|
|
160
|
|
|
@staticmethod |
161
|
|
|
def cache_data( |
|
|
|
|
162
|
|
|
path: Path = Ca.compounds, |
|
|
|
|
163
|
|
|
no_pubchem: bool = Opt.flag(r"Do not download data from PubChem", "--no-pubchem"), |
|
|
|
|
164
|
|
|
no_chembl: bool = Opt.flag(r"Do not fetch IDs from ChEMBL", "--no_chembl"), |
|
|
|
|
165
|
|
|
log: Optional[Path] = CommonArgs.log_path, |
|
|
|
|
166
|
|
|
quiet: bool = CommonArgs.quiet, |
|
|
|
|
167
|
|
|
verbose: bool = CommonArgs.verbose, |
|
|
|
|
168
|
|
|
) -> None: |
169
|
|
|
r""" |
170
|
|
|
Fetch and cache compound data. |
171
|
|
|
|
172
|
|
|
Useful to freeze data before running a search. |
173
|
|
|
""" |
174
|
|
|
set_up(log, quiet, verbose) |
175
|
|
|
logger.error(f"Not implemented fully yet.") |
|
|
|
|
176
|
|
|
df = IdMatchFrame.read_file(path) |
|
|
|
|
177
|
|
|
df = CompoundIdFiller(chembl=not no_chembl, pubchem=not no_pubchem).fill(df) |
|
|
|
|
178
|
|
|
logger.notice(f"Done caching.") |
|
|
|
|
179
|
|
|
|
180
|
|
|
@staticmethod |
181
|
|
|
def export_taxa( |
|
|
|
|
182
|
|
|
taxa: str = Ca.taxa, |
|
|
|
|
183
|
|
|
forbid: str = Opt.val( |
|
|
|
|
184
|
|
|
r"""Exclude descendents of these taxa IDs or names (comma-separated).""", default="" |
185
|
|
|
), |
186
|
|
|
to: Path = typer.Option( |
|
|
|
|
187
|
|
|
None, |
188
|
|
|
help=rf""" |
189
|
|
|
Where to export. |
190
|
|
|
|
191
|
|
|
{Ca.output_formats} |
192
|
|
|
|
193
|
|
|
[default: ./<taxa>-<datetime>.{DEF_SUFFIX}] |
194
|
|
|
""", |
195
|
|
|
), |
196
|
|
|
replace: bool = Ca.replace, |
|
|
|
|
197
|
|
|
in_cache: bool = CommonArgs.in_cache, |
|
|
|
|
198
|
|
|
log: Optional[Path] = CommonArgs.log_path, |
|
|
|
|
199
|
|
|
quiet: bool = CommonArgs.quiet, |
|
|
|
|
200
|
|
|
verbose: bool = CommonArgs.verbose, |
|
|
|
|
201
|
|
|
): |
202
|
|
|
""" |
203
|
|
|
Export a taxonomic tree to a table. |
204
|
|
|
|
205
|
|
|
Writes a taxonomy of given taxa and their descendants to a table. |
206
|
|
|
""" |
207
|
|
|
set_up(log, quiet, verbose) |
208
|
|
|
concat = taxa + "-" + forbid |
209
|
|
|
taxa = Ca.parse_taxa(taxa) |
210
|
|
|
forbid = Ca.parse_taxa(forbid) |
211
|
|
|
default = concat + "-" + MandosResources.start_timestamp_filesys + DEF_SUFFIX |
212
|
|
|
to = MiscUtils.adjust_filename(to, default, replace) |
213
|
|
|
my_tax = TaxonomyFactories.get_smart_taxonomy(taxa, forbid) |
214
|
|
|
my_tax = my_tax.to_df() |
215
|
|
|
to.parent.mkdir(exist_ok=True, parents=True) |
216
|
|
|
my_tax.write_file(to) |
217
|
|
|
|
218
|
|
|
@staticmethod |
219
|
|
|
def cache_taxa( |
220
|
|
|
taxa: str = Opt.val( |
|
|
|
|
221
|
|
|
r""" |
222
|
|
|
Either "vertebrata", "all", or a comma-separated list of UniProt taxon IDs. |
223
|
|
|
|
224
|
|
|
"all" is only valid when --replace is passed; |
225
|
|
|
this will regenerate all taxonomy files that are found in the cache. |
226
|
|
|
""", |
227
|
|
|
default="", |
228
|
|
|
), |
229
|
|
|
replace: bool = Ca.replace, |
|
|
|
|
230
|
|
|
log: Optional[Path] = CommonArgs.log_path, |
|
|
|
|
231
|
|
|
quiet: bool = CommonArgs.quiet, |
|
|
|
|
232
|
|
|
verbose: bool = CommonArgs.verbose, |
|
|
|
|
233
|
|
|
) -> None: |
234
|
|
|
""" |
235
|
|
|
Prep a new taxonomy file for use in mandos. |
236
|
|
|
|
237
|
|
|
With --replace set, will delete any existing file. |
238
|
|
|
This can be useful to make sure your cached taxonomy is up-to-date before running. |
239
|
|
|
|
240
|
|
|
Downloads and converts a tab-separated file from UniProt. |
241
|
|
|
(To find manually, follow the ``All lower taxonomy nodes`` link and click ``Download``.) |
242
|
|
|
Then applies fixes and reduces the file size, creating a new file alongside. |
243
|
|
|
Puts both the raw data and fixed data in the cache under ``~/.mandos/taxonomy/``. |
244
|
|
|
""" |
245
|
|
|
if taxa == "": |
246
|
|
|
logger.info("No taxa were specified. No data downloaded.") |
247
|
|
|
return |
248
|
|
|
if ( |
249
|
|
|
taxa not in ["all", "vertebrata"] |
|
|
|
|
250
|
|
|
and not taxa.replace(",", "").replace(" ", "").isdigit() |
|
|
|
|
251
|
|
|
): |
252
|
|
|
raise ValueError(f"Use either 'all', 'vertebrata', or a UniProt taxon ID") |
|
|
|
|
253
|
|
|
if taxa == "all" and not replace: |
254
|
|
|
raise ValueError(f"Use --replace with taxon 'all'") |
|
|
|
|
255
|
|
|
set_up(log, quiet, verbose) |
256
|
|
|
factory = TaxonomyFactories.from_uniprot() |
257
|
|
|
if taxa == "all" and replace: |
258
|
|
|
listed = TaxonomyFactories.list_cached_files() |
259
|
|
|
for p in listed.values(): |
|
|
|
|
260
|
|
|
p.unlink() |
261
|
|
|
factory.rebuild_vertebrata() |
262
|
|
|
for t in listed.keys(): |
|
|
|
|
263
|
|
|
factory.load_dl(t) |
264
|
|
|
elif taxa == "vertebrata" and (replace or not factory.resolve_path(7742).exists()): |
265
|
|
|
factory.rebuild_vertebrata() |
266
|
|
|
elif taxa == "vertebrata": |
267
|
|
|
factory.load_vertebrate(7742) # should usually do nothing |
268
|
|
|
else: |
269
|
|
|
for taxon in [int(t.strip()) for t in taxa.split(",")]: |
270
|
|
|
factory.delete_exact(taxon) |
271
|
|
|
|
272
|
|
|
@staticmethod |
273
|
|
|
def cache_d2p( |
274
|
|
|
replace: bool = Ca.replace, |
|
|
|
|
275
|
|
|
log: Optional[Path] = CommonArgs.log_path, |
|
|
|
|
276
|
|
|
quiet: bool = CommonArgs.quiet, |
|
|
|
|
277
|
|
|
verbose: bool = CommonArgs.verbose, |
|
|
|
|
278
|
|
|
) -> None: |
279
|
|
|
""" |
280
|
|
|
Caches GuideToPharmacology data. |
281
|
|
|
|
282
|
|
|
With --replace set, will overwrite existing cached data. |
283
|
|
|
Data will generally be stored under``~/.mandos/g2p/``. |
284
|
|
|
""" |
285
|
|
|
set_up(log, quiet, verbose) |
286
|
|
|
api = CachingG2pApi(MANDOS_SETTINGS.g2p_cache_path) |
287
|
|
|
api.download(force=replace) |
288
|
|
|
|
289
|
|
|
@staticmethod |
290
|
|
|
def cache_clear( |
291
|
|
|
log: Optional[Path] = CommonArgs.log_path, |
|
|
|
|
292
|
|
|
quiet: bool = CommonArgs.quiet, |
|
|
|
|
293
|
|
|
verbose: bool = CommonArgs.verbose, |
|
|
|
|
294
|
|
|
yes: bool = CommonArgs.yes, |
|
|
|
|
295
|
|
|
) -> None: |
296
|
|
|
""" |
297
|
|
|
Deletes all cached data. |
298
|
|
|
""" |
299
|
|
|
set_up(log, quiet, verbose) |
300
|
|
|
typer.echo(f"Will recursively delete all of these paths:") |
|
|
|
|
301
|
|
|
for p in MANDOS_SETTINGS.all_cache_paths: |
|
|
|
|
302
|
|
|
typer.echo(f" {p}") |
303
|
|
|
if not yes: |
304
|
|
|
typer.confirm("Delete?", abort=True) |
305
|
|
|
for p in MANDOS_SETTINGS.all_cache_paths: |
|
|
|
|
306
|
|
|
p.unlink(missing_ok=True) |
307
|
|
|
logger.notice("Deleted all cached data") |
308
|
|
|
|
309
|
|
|
@staticmethod |
310
|
|
|
def concat( |
|
|
|
|
311
|
|
|
path: Path = Ca.input_dir, |
|
|
|
|
312
|
|
|
to: Optional[Path] = Ca.to_single, |
|
|
|
|
313
|
|
|
replace: bool = Ca.replace, |
|
|
|
|
314
|
|
|
log: Optional[Path] = CommonArgs.log_path, |
|
|
|
|
315
|
|
|
quiet: bool = CommonArgs.quiet, |
|
|
|
|
316
|
|
|
verbose: bool = CommonArgs.verbose, |
|
|
|
|
317
|
|
|
) -> None: |
318
|
|
|
r""" |
319
|
|
|
Concatenate Mandos annotation files into one. |
320
|
|
|
|
321
|
|
|
Note that ``:search`` automatically performs this; |
322
|
|
|
this is needed only if you want to combine results from multiple independent searches. |
323
|
|
|
""" |
324
|
|
|
set_up(log, quiet, verbose) |
325
|
|
|
default = path / ("concat" + DEF_SUFFIX) |
326
|
|
|
to = MiscUtils.adjust_filename(to, default, replace) |
327
|
|
|
for found in path.iterdir(): |
|
|
|
|
328
|
|
|
pass |
329
|
|
|
|
330
|
|
|
@staticmethod |
331
|
|
|
def filter( |
|
|
|
|
332
|
|
|
path: Path = Ca.to_single, |
|
|
|
|
333
|
|
|
by: Optional[Path] = Arg.in_file( |
|
|
|
|
334
|
|
|
r""" |
335
|
|
|
Path to a TOML (.toml) file containing filters. |
336
|
|
|
|
337
|
|
|
The file contains a list of ``mandos.filter`` keys, |
338
|
|
|
each containing an expression on a single column. |
339
|
|
|
This is only meant for simple, quick-and-dirty filtration. |
340
|
|
|
|
341
|
|
|
See the docs for more info. |
342
|
|
|
""" |
343
|
|
|
), |
344
|
|
|
to: Optional[Path] = Ca.to_single, |
|
|
|
|
345
|
|
|
replace: bool = Ca.replace, |
|
|
|
|
346
|
|
|
log: Optional[Path] = CommonArgs.log_path, |
|
|
|
|
347
|
|
|
quiet: bool = CommonArgs.quiet, |
|
|
|
|
348
|
|
|
verbose: bool = CommonArgs.verbose, |
|
|
|
|
349
|
|
|
) -> None: |
350
|
|
|
""" |
351
|
|
|
Filters by simple expressions. |
352
|
|
|
""" |
353
|
|
|
set_up(log, quiet, verbose) |
354
|
|
|
default = str(path) + "-filter-" + by.stem + DEF_SUFFIX |
355
|
|
|
to = MiscUtils.adjust_filename(to, default, replace) |
356
|
|
|
df = HitFrame.read_file(path) |
|
|
|
|
357
|
|
|
Filtration.from_file(by).apply(df).write_file(to) |
358
|
|
|
|
359
|
|
|
@staticmethod |
360
|
|
|
def export_state( |
|
|
|
|
361
|
|
|
path: Path = Ca.file_input, |
|
|
|
|
362
|
|
|
to: Optional[Path] = Opt.out_path( |
|
|
|
|
363
|
|
|
""" |
364
|
|
|
Path to the output file. |
365
|
|
|
|
366
|
|
|
Valid formats and filename suffixes are .nt and .txt with an optional .gz, .zip, or .xz. |
367
|
|
|
If only a filename suffix is provided, will use that suffix with the default directory. |
368
|
|
|
If no suffix is provided, will interpret the path as a directory and use the default filename. |
|
|
|
|
369
|
|
|
Will fail if the file exists and ``--replace`` is not set. |
370
|
|
|
|
371
|
|
|
[default: <path>-statements.nt] |
372
|
|
|
""" |
373
|
|
|
), |
374
|
|
|
replace: bool = Ca.replace, |
|
|
|
|
375
|
|
|
log: Optional[Path] = CommonArgs.log_path, |
|
|
|
|
376
|
|
|
quiet: bool = CommonArgs.quiet, |
|
|
|
|
377
|
|
|
verbose: bool = CommonArgs.verbose, |
|
|
|
|
378
|
|
|
) -> None: |
379
|
|
|
""" |
380
|
|
|
Output simple N-triples statements. |
381
|
|
|
|
382
|
|
|
Each statement is of this form, where the InChI Key refers to the input data: |
383
|
|
|
|
384
|
|
|
`"InChI Key" "predicate" "object" .` |
385
|
|
|
""" |
386
|
|
|
set_up(log, quiet, verbose) |
387
|
|
|
default = f"{path}-statements.nt" |
388
|
|
|
to = MiscUtils.adjust_filename(to, default, replace) |
389
|
|
|
hits = HitFrame.read_file(path).to_hits() |
390
|
|
|
with to.open() as f: |
|
|
|
|
391
|
|
|
for hit in hits: |
392
|
|
|
f.write(hit.to_triple.n_triples) |
393
|
|
|
|
394
|
|
|
@staticmethod |
395
|
|
|
def export_reify( |
|
|
|
|
396
|
|
|
path: Path = Ca.file_input, |
|
|
|
|
397
|
|
|
to: Optional[Path] = Opt.out_path( |
|
|
|
|
398
|
|
|
r""" |
399
|
|
|
Path to the output file. |
400
|
|
|
|
401
|
|
|
The filename suffix should be either .nt (N-triples) or .ttl (Turtle), |
402
|
|
|
with an optional .gz, .zip, or .xz. |
403
|
|
|
If only a filename suffix is provided, will use that suffix with the default directory. |
404
|
|
|
If no suffix is provided, will interpret the path as a directory but use the default filename. |
|
|
|
|
405
|
|
|
Will fail if the file exists and ``--replace`` is not set. |
406
|
|
|
|
407
|
|
|
[default: <path>-reified.nt] |
408
|
|
|
""" |
409
|
|
|
), |
410
|
|
|
replace: bool = Ca.replace, |
|
|
|
|
411
|
|
|
log: Optional[Path] = CommonArgs.log_path, |
|
|
|
|
412
|
|
|
quiet: bool = CommonArgs.quiet, |
|
|
|
|
413
|
|
|
verbose: bool = CommonArgs.verbose, |
|
|
|
|
414
|
|
|
) -> None: |
415
|
|
|
""" |
416
|
|
|
Outputs reified semantic triples. |
417
|
|
|
""" |
418
|
|
|
set_up(log, quiet, verbose) |
419
|
|
|
default = f"{path}-reified.nt" |
420
|
|
|
to = MiscUtils.adjust_filename(to, default, replace) |
421
|
|
|
hits = HitFrame.read_file(path).to_hits() |
422
|
|
|
with to.open() as f: |
|
|
|
|
423
|
|
|
for triple in Reifier().reify(hits): |
424
|
|
|
f.write(triple.n_triples) |
425
|
|
|
|
426
|
|
|
@staticmethod |
427
|
|
|
def export_copy( |
|
|
|
|
428
|
|
|
path: Path = Ca.file_input, |
|
|
|
|
429
|
|
|
to: Optional[Path] = Opt.out_path( |
|
|
|
|
430
|
|
|
rf""" |
431
|
|
|
Path to the output file. |
432
|
|
|
|
433
|
|
|
{Ca.output_formats} |
434
|
|
|
|
435
|
|
|
[default: <path.parent>/export{DEF_SUFFIX}] |
436
|
|
|
""" |
437
|
|
|
), |
438
|
|
|
replace: bool = Ca.replace, |
|
|
|
|
439
|
|
|
log: Optional[Path] = CommonArgs.log_path, |
|
|
|
|
440
|
|
|
quiet: bool = CommonArgs.quiet, |
|
|
|
|
441
|
|
|
verbose: bool = CommonArgs.verbose, |
|
|
|
|
442
|
|
|
) -> None: |
443
|
|
|
""" |
444
|
|
|
Copies and/or converts annotation files. |
445
|
|
|
|
446
|
|
|
Example: ``:export:copy --to .snappy`` to highly compress a data set. |
447
|
|
|
""" |
448
|
|
|
set_up(log, quiet, verbose) |
449
|
|
|
default = path.parent / DEF_SUFFIX |
450
|
|
|
to = MiscUtils.adjust_filename(to, default, replace) |
451
|
|
|
df = HitFrame.read_file(path) |
|
|
|
|
452
|
|
|
df.write_file(to) |
453
|
|
|
|
454
|
|
|
@staticmethod |
455
|
|
|
def calc_analysis( |
|
|
|
|
456
|
|
|
path: Path = Ca.file_input, |
|
|
|
|
457
|
|
|
phi: Path = Ca.input_matrix, |
|
|
|
|
458
|
|
|
scores: Path = Ca.alpha_input, |
|
|
|
|
459
|
|
|
seed: int = Ca.seed, |
|
|
|
|
460
|
|
|
samples: int = Ca.boot, |
|
|
|
|
461
|
|
|
to: Optional[Path] = Ca.misc_out_dir, |
|
|
|
|
462
|
|
|
replace: bool = Ca.replace, |
|
|
|
|
463
|
|
|
log: Optional[Path] = CommonArgs.log_path, |
|
|
|
|
464
|
|
|
quiet: bool = CommonArgs.quiet, |
|
|
|
|
465
|
|
|
verbose: bool = CommonArgs.verbose, |
|
|
|
|
466
|
|
|
) -> None: |
467
|
|
|
""" |
468
|
|
|
Shorthand for multiple calculations and plots. |
469
|
|
|
|
470
|
|
|
Generates n-triple statements and reified n-triples. |
471
|
|
|
Calculates correlation and enrichment using ``scores``, |
472
|
|
|
psi matrices (one per variable), and concordance between psi and tau matrices (tau). |
473
|
|
|
Plots UMAP of psi variables, enrichment bar plots, correlation violin plots, |
474
|
|
|
phi-vs-psi scatter and line plots, and phi-vs-psi (tau) violin plots. |
475
|
|
|
""" |
476
|
|
|
|
477
|
|
|
@staticmethod |
478
|
|
|
def calc_score( |
|
|
|
|
479
|
|
|
path: Path = Ca.file_input, |
|
|
|
|
480
|
|
|
scores: Path = Ca.alpha_input, |
|
|
|
|
481
|
|
|
bool_alg: Optional[str] = Opt.val( |
|
|
|
|
482
|
|
|
rf""" |
483
|
|
|
Algorithm to use for scores starting with 'is_'. |
484
|
|
|
|
485
|
|
|
Allowed values: {Ca.list(BoolAlg)} |
486
|
|
|
""", |
487
|
|
|
default="alpha", |
488
|
|
|
), |
489
|
|
|
real_alg: Optional[str] = Opt.val( |
|
|
|
|
490
|
|
|
rf""" |
491
|
|
|
Algorithm to use for scores starting with 'score_'. |
492
|
|
|
|
493
|
|
|
Allowed values: {Ca.list(RealAlg)} |
494
|
|
|
""", |
495
|
|
|
default="weighted", |
496
|
|
|
), |
497
|
|
|
on: bool = Ca.on, |
|
|
|
|
498
|
|
|
boot: int = Ca.boot, |
|
|
|
|
499
|
|
|
seed: int = Ca.seed, |
|
|
|
|
500
|
|
|
to: Optional[Path] = Ca.alpha_to, |
|
|
|
|
501
|
|
|
replace: bool = Ca.replace, |
|
|
|
|
502
|
|
|
log: Optional[Path] = CommonArgs.log_path, |
|
|
|
|
503
|
|
|
quiet: bool = CommonArgs.quiet, |
|
|
|
|
504
|
|
|
verbose: bool = CommonArgs.verbose, |
|
|
|
|
505
|
|
|
) -> None: |
506
|
|
|
""" |
507
|
|
|
Compare annotations to user-supplied values. |
508
|
|
|
|
509
|
|
|
Calculates correlation between provided scores and object/predicate pairs. |
510
|
|
|
For booleans, compares annotations for hits and non-hits. |
511
|
|
|
See the docs for more info. |
512
|
|
|
""" |
513
|
|
|
set_up(log, quiet, verbose) |
514
|
|
|
default = f"{path}-{scores.name}{DEF_SUFFIX}" |
515
|
|
|
to = MiscUtils.adjust_filename(to, default, replace) |
516
|
|
|
hits = HitFrame.read_file(path) |
517
|
|
|
scores = ScoreDf.read_file(scores) |
518
|
|
|
calculator = EnrichmentCalculation(bool_alg, real_alg, boot, seed) |
519
|
|
|
df = calculator.calculate(hits, scores) |
|
|
|
|
520
|
|
|
df.write_file(to) |
521
|
|
|
|
522
|
|
|
@staticmethod |
523
|
|
|
def calc_psi( |
|
|
|
|
524
|
|
|
path: Path = Ca.file_input, |
|
|
|
|
525
|
|
|
algorithm: str = Opt.val( |
|
|
|
|
526
|
|
|
r""" |
527
|
|
|
The algorithm for calculating similarity between annotation sets. |
528
|
|
|
|
529
|
|
|
Currently, only "j" (J') is supported. Refer to the docs for the equation. |
530
|
|
|
""", |
531
|
|
|
default="j", |
532
|
|
|
), |
533
|
|
|
to: Path = Ca.output_matrix, |
|
|
|
|
534
|
|
|
replace: bool = Ca.replace, |
|
|
|
|
535
|
|
|
log: Optional[Path] = CommonArgs.log_path, |
|
|
|
|
536
|
|
|
quiet: bool = CommonArgs.quiet, |
|
|
|
|
537
|
|
|
verbose: bool = CommonArgs.verbose, |
|
|
|
|
538
|
|
|
) -> None: |
539
|
|
|
r""" |
540
|
|
|
Calculate a similarity matrix from annotations. |
541
|
|
|
|
542
|
|
|
The data are output as a dataframe (CSV by default), where rows and columns correspond |
543
|
|
|
to compounds, and the cell i,j is the overlap J' in annotations between compounds i and j. |
544
|
|
|
""" |
545
|
|
|
set_up(log, quiet, verbose) |
546
|
|
|
default = path.parent / (algorithm + DEF_SUFFIX) |
547
|
|
|
to = MiscUtils.adjust_filename(to, default, replace) |
548
|
|
|
hits = HitFrame.read_file(path).to_hits() |
549
|
|
|
calculator = MatrixCalculation.create(algorithm) |
550
|
|
|
matrix = calculator.calc_all(hits) |
551
|
|
|
matrix.write_file(to) |
552
|
|
|
|
553
|
|
|
@staticmethod |
554
|
|
|
def calc_ecfp( |
|
|
|
|
555
|
|
|
path: Path = CommonArgs.compounds, |
|
|
|
|
556
|
|
|
radius: int = Opt.val(r"""Radius of the ECFP fingerprint.""", default=4), |
|
|
|
|
557
|
|
|
n_bits: int = Opt.val(r"""Number of bits.""", default=2048), |
|
|
|
|
558
|
|
|
psi: bool = Opt.flag( |
|
|
|
|
559
|
|
|
r"""Use "psi" as the type in the resulting matrix instead of "phi".""" |
560
|
|
|
), |
561
|
|
|
to: Path = Ca.output_matrix, |
|
|
|
|
562
|
|
|
replace: bool = Ca.replace, |
|
|
|
|
563
|
|
|
log: Optional[Path] = CommonArgs.log_path, |
|
|
|
|
564
|
|
|
quiet: bool = CommonArgs.quiet, |
|
|
|
|
565
|
|
|
verbose: bool = CommonArgs.verbose, |
|
|
|
|
566
|
|
|
) -> None: |
567
|
|
|
r""" |
568
|
|
|
Compute a similarity matrix from ECFP fingerprints. |
569
|
|
|
|
570
|
|
|
Requires rdkit to be installed. |
571
|
|
|
|
572
|
|
|
This is a bit faster than computing using a search and then calculating with ``:calc:psi``. |
573
|
|
|
Values range from 0 (no overlap) to 1 (identical). |
574
|
|
|
The type will be "phi" -- in contrast to using :calc:phi. |
575
|
|
|
See ``:calc:phi`` for more info. |
576
|
|
|
This is most useful for comparing a phenotypic phi against pure structural similarity. |
577
|
|
|
""" |
578
|
|
|
set_up(log, quiet, verbose) |
579
|
|
|
name = f"ecfp{radius}-n{n_bits}" |
580
|
|
|
default = path.parent / (name + DEF_SUFFIX) |
581
|
|
|
to = MiscUtils.adjust_filename(to, default, replace) |
582
|
|
|
df = InputFrame.read_file(path) |
|
|
|
|
583
|
|
|
kind = "psi" if psi else "phi" |
584
|
|
|
short = MatrixPrep.ecfp_matrix(df, radius, n_bits) |
585
|
|
|
long_form = MatrixPrep(kind, False, False, False).create({name: short}) |
586
|
|
|
long_form.write_file(to) |
587
|
|
|
|
588
|
|
|
@staticmethod |
589
|
|
|
def calc_tau( |
|
|
|
|
590
|
|
|
phi: Path = Ca.input_matrix, |
|
|
|
|
591
|
|
|
psi: Path = Ca.input_matrix, |
|
|
|
|
592
|
|
|
algorithm: str = Opt.val( |
|
|
|
|
593
|
|
|
r""" |
594
|
|
|
The algorithm for calculating concordance. |
595
|
|
|
|
596
|
|
|
Currently, only "tau" is supported. |
597
|
|
|
This calculation is a modified Kendall’s τ-a, where disconcordant ignores ties. |
598
|
|
|
See the docs for more info. |
599
|
|
|
""", |
600
|
|
|
default="tau", |
601
|
|
|
), |
602
|
|
|
seed: int = Ca.seed, |
|
|
|
|
603
|
|
|
samples: int = Ca.boot, |
|
|
|
|
604
|
|
|
to: Optional[Path] = Opt.out_file( |
|
|
|
|
605
|
|
|
rf""" |
606
|
|
|
The path to a table for output. |
607
|
|
|
|
608
|
|
|
{Ca.output_formats} |
609
|
|
|
|
610
|
|
|
[default: <input-path.parent>/<algorithm>-concordance.{DEF_SUFFIX}] |
611
|
|
|
""", |
612
|
|
|
), |
613
|
|
|
replace: bool = Ca.replace, |
|
|
|
|
614
|
|
|
log: Optional[Path] = CommonArgs.log_path, |
|
|
|
|
615
|
|
|
quiet: bool = CommonArgs.quiet, |
|
|
|
|
616
|
|
|
verbose: bool = CommonArgs.verbose, |
|
|
|
|
617
|
|
|
) -> None: |
618
|
|
|
r""" |
619
|
|
|
Calculate correlation between matrices. |
620
|
|
|
|
621
|
|
|
Values are calculated over bootstrap, outputting a table. |
622
|
|
|
|
623
|
|
|
Phi is typically a phenotypic matrix, and psi a matrix from Mandos. |
624
|
|
|
This command is designed to calculate the similarity between compound annotations |
625
|
|
|
(from Mandos) and some user-input compound–compound similarity matrix. |
626
|
|
|
(For example, vectors from a high-content cell screen. |
627
|
|
|
See ``:calc:correlation`` or ``:calc:enrichment`` if you have a single variable, |
628
|
|
|
such as a hit or lead-like score. |
629
|
|
|
""" |
630
|
|
|
set_up(log, quiet, verbose) |
631
|
|
|
default = phi.parent / f"{psi.stem}-{algorithm}{DEF_SUFFIX}" |
632
|
|
|
to = MiscUtils.adjust_filename(to, default, replace) |
633
|
|
|
phi = SimilarityDfLongForm.read_file(phi) |
634
|
|
|
psi = SimilarityDfLongForm.read_file(psi) |
635
|
|
|
calculator = ConcordanceCalculation.create(algorithm, phi, psi, samples, seed) |
636
|
|
|
concordance = calculator.calc_all(phi, psi) |
637
|
|
|
concordance.write_file(to) |
638
|
|
|
|
639
|
|
|
@staticmethod |
640
|
|
|
def calc_project( |
|
|
|
|
641
|
|
|
psi_matrix: Path = Ca.input_matrix, |
|
|
|
|
642
|
|
|
algorithm: str = Opt.val( |
|
|
|
|
643
|
|
|
r""" |
644
|
|
|
Projection algorithm. |
645
|
|
|
|
646
|
|
|
Currently only "umap" is supported. |
647
|
|
|
""", |
648
|
|
|
default="umap", |
649
|
|
|
), |
650
|
|
|
seed: str = Opt.val( |
|
|
|
|
651
|
|
|
r""" |
652
|
|
|
Random seed (integer or 'none'). |
653
|
|
|
|
654
|
|
|
Setting to 'none' may increase performance. |
655
|
|
|
""", |
656
|
|
|
default=0, |
657
|
|
|
), |
658
|
|
|
params: str = Opt.val( |
|
|
|
|
659
|
|
|
rf""" |
660
|
|
|
Parameters fed to the algorithm. |
661
|
|
|
|
662
|
|
|
This is a comma-separated list of key=value pairs. |
663
|
|
|
For example: ``n_neighbors=4,n_components=12,min_dist=0.8`` |
664
|
|
|
Supports all UMAP parameters except random_state and metric: |
665
|
|
|
|
666
|
|
|
{Ca.definition_list(_umap_params) if UMAP else "<list is unavailable>"} |
667
|
|
|
""", |
668
|
|
|
default="", |
669
|
|
|
), |
670
|
|
|
to: Optional[Path] = Ca.project_to, |
|
|
|
|
671
|
|
|
replace: bool = Ca.replace, |
|
|
|
|
672
|
|
|
log: Optional[Path] = CommonArgs.log_path, |
|
|
|
|
673
|
|
|
quiet: bool = CommonArgs.quiet, |
|
|
|
|
674
|
|
|
verbose: bool = CommonArgs.verbose, |
|
|
|
|
675
|
|
|
) -> None: |
676
|
|
|
r""" |
677
|
|
|
Calculate compound UMAP from psi matrices. |
678
|
|
|
|
679
|
|
|
The input should probably be calculated from ``:calc:matrix``. |
680
|
|
|
Saves a table of the UMAP coordinates. |
681
|
|
|
""" |
682
|
|
|
if algorithm == "umap" and UMAP is None: |
683
|
|
|
raise ImportError(f"UMAP is not available") |
|
|
|
|
684
|
|
|
|
685
|
|
|
@staticmethod |
686
|
|
|
def format_phi( |
|
|
|
|
687
|
|
|
matrices: List[Path] = Ca.input_matrix_short_form, |
|
|
|
|
688
|
|
|
kind: str = Ca.var_type, |
|
|
|
|
689
|
|
|
to: Path = Ca.output_matrix, |
|
|
|
|
690
|
|
|
replace: bool = Ca.replace, |
|
|
|
|
691
|
|
|
normalize: bool = Opt.flag( |
|
|
|
|
692
|
|
|
r"""Rescale values to between 0 and 1 by (v-min) / (max-min). (Performed after negation.)""" |
|
|
|
|
693
|
|
|
), |
694
|
|
|
log10: bool = Opt.val(r"""Rescales values by log10. (Performed after normalization.)"""), |
|
|
|
|
695
|
|
|
invert: bool = Opt.val(r"""Multiplies the values by -1. (Performed first.)"""), |
|
|
|
|
696
|
|
|
log: Optional[Path] = CommonArgs.log_path, |
|
|
|
|
697
|
|
|
quiet: bool = CommonArgs.quiet, |
|
|
|
|
698
|
|
|
verbose: bool = CommonArgs.verbose, |
|
|
|
|
699
|
|
|
): |
700
|
|
|
r""" |
701
|
|
|
Convert phi matrices to one long-form matrix. |
702
|
|
|
|
703
|
|
|
The keys will be derived from the filenames. |
704
|
|
|
""" |
705
|
|
|
set_up(log, quiet, verbose) |
706
|
|
|
default = "." |
707
|
|
|
if to is None: |
708
|
|
|
try: |
709
|
|
|
default = next(iter({mx.parent for mx in matrices})) |
710
|
|
|
except StopIteration: |
711
|
|
|
logger.warning(f"Outputting to {default}") |
712
|
|
|
to = MiscUtils.adjust_filename(to, default, replace) |
713
|
|
|
long_form = MatrixPrep(kind, normalize, log10, invert).from_files(matrices) |
714
|
|
|
long_form.write_file(to) |
715
|
|
|
|
716
|
|
|
@staticmethod |
717
|
|
|
def plot_project( |
|
|
|
|
718
|
|
|
umap_df: Path = Ca.project_input, |
|
|
|
|
719
|
|
|
style: Optional[Path] = Ca.style_for_compounds, |
|
|
|
|
720
|
|
|
color_col: Optional[str] = Ca.color_col, |
|
|
|
|
721
|
|
|
marker_col: Optional[str] = Ca.marker_col, |
|
|
|
|
722
|
|
|
to: Optional[Path] = Ca.plot_to, |
|
|
|
|
723
|
|
|
) -> None: |
724
|
|
|
r""" |
725
|
|
|
Plot UMAP, etc. of compounds from psi matrices. |
726
|
|
|
|
727
|
|
|
Will plot one variable (psi) per column. |
728
|
|
|
""" |
729
|
|
|
|
730
|
|
|
@staticmethod |
731
|
|
|
def plot_score( |
|
|
|
|
732
|
|
|
path: Path = Ca.input_correlation, |
|
|
|
|
733
|
|
|
kind: str = Ca.plot_kind, |
|
|
|
|
734
|
|
|
style: Optional[Path] = Ca.style_for_pairs, |
|
|
|
|
735
|
|
|
color_col: Optional[str] = Ca.color_col, |
|
|
|
|
736
|
|
|
marker_col: Optional[str] = Ca.marker_col, |
|
|
|
|
737
|
|
|
ci: float = Ca.ci, |
|
|
|
|
738
|
|
|
to: Optional[Path] = Ca.plot_to, |
|
|
|
|
739
|
|
|
) -> None: |
740
|
|
|
r""" |
741
|
|
|
Plot correlation to scores. |
742
|
|
|
|
743
|
|
|
Visualizes the correlation between predicate/object pairs and user-supplied scores. |
744
|
|
|
Will output one figure (file) per scoring function. |
745
|
|
|
Will plot (psi, score-fn) pairs over a grid, |
746
|
|
|
one row per scoring function and column per psi. |
747
|
|
|
""" |
748
|
|
|
|
749
|
|
|
@staticmethod |
750
|
|
|
def plot_phi_psi( |
|
|
|
|
751
|
|
|
path: Path = Ca.input_matrix, |
|
|
|
|
752
|
|
|
join: Optional[bool] = Opt.flag( |
|
|
|
|
753
|
|
|
r""" |
754
|
|
|
Pool all psi variables into a single column with multiple plots. |
755
|
|
|
""" |
756
|
|
|
), |
757
|
|
|
kind: str = Opt.val( |
|
|
|
|
758
|
|
|
r""" |
759
|
|
|
Either 'points', 'lines', or 'points+lines'. |
760
|
|
|
|
761
|
|
|
- points: Scatter plots of (phi, psi) values. |
762
|
|
|
|
763
|
|
|
- lines: Plot a linear interpolation. |
764
|
|
|
|
765
|
|
|
- ci: Plot a linear interpolation with a confidence band. |
766
|
|
|
|
767
|
|
|
- points+lines: Both 'points' and 'lines'. |
768
|
|
|
""", |
769
|
|
|
"--type", |
770
|
|
|
), |
771
|
|
|
ci: float = Ca.ci, |
|
|
|
|
772
|
|
|
sort_by: str = Opt.val( |
|
|
|
|
773
|
|
|
r""" |
774
|
|
|
Which axis to sort by: 'phi'/'x' or 'psi'/'y'. |
775
|
|
|
|
776
|
|
|
Sorting by psi values (y-axis) makes it easier to compare psi variables, |
777
|
|
|
while sorting by phi values (x-axis) makes it easier to compare phi variables. |
778
|
|
|
""", |
779
|
|
|
default="psi", |
780
|
|
|
), |
781
|
|
|
style: Optional[Path] = Ca.style_for_psi, |
|
|
|
|
782
|
|
|
color_col: Optional[str] = Ca.color_col, |
|
|
|
|
783
|
|
|
marker_col: Optional[str] = Ca.marker_col, |
|
|
|
|
784
|
|
|
to: Optional[Path] = Ca.plot_to, |
|
|
|
|
785
|
|
|
) -> None: |
786
|
|
|
r""" |
787
|
|
|
Plot line plots of phi against psi. |
788
|
|
|
|
789
|
|
|
Plots scatter plots of (phi, psi) values, sorted by phi values. |
790
|
|
|
All plots are log/log (all similarity values should be scaled from 0 to 1). |
791
|
|
|
|
792
|
|
|
For each unique phi matrix and psi matrix, flattens the matrices and plots |
793
|
|
|
the flattened (n choose 2 - n) pairs of each jointly, phi mapped to the y-axis |
794
|
|
|
and psi mapped to the x-axis. |
795
|
|
|
|
796
|
|
|
Without --split: |
797
|
|
|
|
798
|
|
|
Will show values for all psi variables together. |
799
|
|
|
If ``--color`` is not set, will choose a palette. |
800
|
|
|
Works best with ``--type lines``. |
801
|
|
|
|
802
|
|
|
With --split: |
803
|
|
|
|
804
|
|
|
Will plot each (phi, psi) pair over a grid, one plot per cell: |
805
|
|
|
One row per phi and one column per psi. |
806
|
|
|
""" |
807
|
|
|
|
808
|
|
|
@staticmethod |
809
|
|
|
def plot_tau( |
|
|
|
|
810
|
|
|
path: Path = Ca.input_matrix, |
|
|
|
|
811
|
|
|
split: bool = Opt.flag( |
|
|
|
|
812
|
|
|
r""" |
813
|
|
|
Split each violin into phi #1 on the left and phi #2 on the right. |
814
|
|
|
|
815
|
|
|
Useful to compare two phi variables. Requires exactly 2. |
816
|
|
|
""" |
817
|
|
|
), |
818
|
|
|
style: Optional[Path] = Ca.style_for_psi, |
|
|
|
|
819
|
|
|
color_col: Optional[str] = Ca.color_col, |
|
|
|
|
820
|
|
|
marker_col: Optional[str] = Ca.marker_col, |
|
|
|
|
821
|
|
|
to: Optional[Path] = Ca.plot_to, |
|
|
|
|
822
|
|
|
) -> None: |
823
|
|
|
r""" |
824
|
|
|
Plot violin plots from tau values. |
825
|
|
|
|
826
|
|
|
The input data should be generated by ``:calc:phi-vs-psi.tau``. |
827
|
|
|
|
828
|
|
|
Will plot each (phi, psi) pair over a grid, one row per phi and one column per psi |
829
|
|
|
(unless ``--split`` is set). |
830
|
|
|
""" |
831
|
|
|
|
832
|
|
|
|
833
|
|
|
__all__ = ["MiscCommands"] |
834
|
|
|
|