Library manipulation scripts¶
This notebook showcases several useful commands that allow following library manipulations:
Library concatenation (
molli merge)Subset selection based on regular expression (
molli pick)Collect descriptive statistics (
molli stats)
molli merge¶
When several files (.mlib / .clib) are specified as positional arguments, those files are sequentially read (without interpretation!) and written into a new file. Linux style glob patterns are supported: molli merge *.clib
It is the user’s responsibility to ensure homogeneous inputs
[4]:
!molli merge --help
usage: molli merge [-h] -o <combined.mlib> [-c COMMENT] [--overwrite] [--sort]
sources [sources ...]
Merge several molli libraries into a single file
positional arguments:
sources List of library files (or glob patterns)
options:
-h, --help show this help message and exit
-o <combined.mlib>, --output <combined.mlib>
Merge the files into this output file
-c COMMENT, --comment COMMENT
Specify a text based comment to override the uKV
default
--overwrite Overwrite the target files if they exist (default is
false)
--sort Sort the keys before writing
molli pick¶
This script iterates over a library keys, attempting to match key to each of patterns specified as positional arguments that follow. For full documentation on regular expressions, see Python re module documentation
[7]:
!molli pick --help
usage: molli pick [-h] [-f FILE] [-o <combined.mlib>] [--overwrite] [--sort]
source [patterns ...]
Merge several molli libraries into a single file
positional arguments:
source Library file
patterns List of regular expressions to match
options:
-h, --help show this help message and exit
-f FILE, --file FILE Specify the name patterns from file
-o <combined.mlib>, --output <combined.mlib>
Merge the files into this output file
--overwrite Overwrite the target files if they exist (default is
false)
--sort Sort the keys before writing