Merge
Command-line interface for merging multiple Protein Data Bank (PDB) files into a single file.
add_pdb_merge_subparser(subparsers)
¶
Adds the 'merge' subcommand to the Simlify CLI for combining multiple PDB files.
This function configures an argparse
subparser named 'merge' which allows
users to specify one or more PDB files to be merged together. It also provides
an option to specify the output path for the merged PDB file.
PARAMETER | DESCRIPTION |
---|---|
subparsers
|
An
|
RETURNS | DESCRIPTION |
---|---|
The configured |
The 'merge' subcommand accepts the following arguments:
pdb_paths
: One or more paths to the PDB files that should be merged. These files will be concatenated in the order they are provided.--output
: Path to the new PDB file where the content of all input PDB files will be written.
The function sets the default action for this subparser to be the
cli_merge_pdbs
function, which will be called when the user invokes
the 'merge' subcommand.
cli_merge_pdbs(args, parser)
¶
Command-line interface function to merge multiple PDB files into one.
This function serves as the entry point when the user executes the 'merge'
subcommand of the Simlify CLI. It receives the parsed command-line arguments
and the argument parser object. It first checks if the --output
argument
was provided, as it is a requirement for this operation. If not, it raises
a RuntimeError
. Otherwise, it extracts the list of input PDB file paths
and the output path and calls the run_merge_pdbs
function from the
simlify.structure.pdb.utils
module to perform the merging operation.
PARAMETER | DESCRIPTION |
---|---|
args
|
An
TYPE:
|
parser
|
The argument parser object for the 'merge' subcommand, used to display help messages if necessary (though not explicitly used in this function).
TYPE:
|
RAISES | DESCRIPTION |
---|---|
RuntimeError
|
If the |
The function retrieves the following arguments from the args
object:
pdb_paths
: A list of paths to the PDB files to be merged.output
: The path to the output PDB file.
It then unpacks the pdb_paths
list as positional arguments to the
run_merge_pdbs
function and provides
the output
path as a keyword argument.