kaptive.db.cli¶
Command-line interface commands for managing and querying Kaptive reference databases.
This module provides CLI command implementations for listing installed databases, downloading or adding new databases, updating installed databases, extracting FASTA sequences (loci, genes, proteins), printing database metadata, and resetting local database caches.
Classes:
-
List–List installed local databases (
List). -
Database–Parent command managing database subcommands (
Database). -
Install–Install remote database by keyword (
Install). -
Update–Update installed databases (
Update). -
Reset–Uninstall local databases and clear cache (
Reset). -
Available–List available known databases to install (
Available). -
Add–Add database from GitHub repository (
Add). -
Metadata–Display database metadata (
Metadata). -
Extract–Parent command for sequence extraction (
Extract). -
Loci–Extract locus nucleotide sequences (
Loci). -
Genes–Extract gene nucleotide sequences (
Genes). -
Proteins–Extract translated protein sequences (
Proteins).
Add
¶
flowchart TD
kaptive.db.cli.Add[Add]
kaptive.cli.Command[Command]
kaptive.cli.Command --> kaptive.db.cli.Add
click kaptive.db.cli.Add href "" "kaptive.db.cli.Add"
click kaptive.cli.Command href "" "kaptive.cli.Command"
🔗 Add a custom reference database from a GitHub repository.
Fetches GenBank and TOML metadata files from any specified GitHub owner/repo/branch, compiles the database, and registers it in the local cache.
Methods:
-
__call__–Executes retrieval, compilation, and registration of a custom GitHub database.
-
add_output_arguments–Add standard report and FASTA file output options to argument group.
-
build–Wire command parser and subcommands into parent argparse hierarchy.
-
get_shared_parser–Return shared parent parser containing options passed to subcommands.
-
register_subcommands–Register child subcommand instances into
subcommandslist. -
setup_arguments–Configures argument parser options for the
addsubcommand.
Source code in src/kaptive/cli.py
__call__
¶
Executes retrieval, compilation, and registration of a custom GitHub database.
Parameters:
-
(args¶Namespace) –Parsed CLI arguments containing
database,owner,repo_name, and optionalbranch.
See Also
Source code in src/kaptive/db/cli.py
add_output_arguments
¶
add_output_arguments(opts: _ArgumentGroup, tsv_flags: tuple[str, str] = ('-o', '--out'), include_json: bool = True) -> None
Add standard report and FASTA file output options to argument group.
Parameters:
-
(opts¶_ArgumentGroup) –Target argument group to populate.
-
(tsv_flags¶tuple[str, str], default:('-o', '--out')) –Short and long flag options for TSV report output. Defaults to
("-o", "--out"). -
(include_json¶bool, default:True) –Flag indicating whether to include
--jsonargument option. Defaults toTrue.
Source code in src/kaptive/cli.py
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 | |
build
¶
build(subparsers: _SubParsersAction, parent_parsers: list[ArgumentParser] | None = None) -> None
Wire command parser and subcommands into parent argparse hierarchy.
Parameters:
-
(subparsers¶_SubParsersAction) –Target subparser action registry.
-
(parent_parsers¶list[ArgumentParser] | None, default:None) –Parent shared parsers to inherit.
Source code in src/kaptive/cli.py
get_shared_parser
¶
get_shared_parser() -> ArgumentParser | None
Return shared parent parser containing options passed to subcommands.
Returns:
-
ArgumentParser | None–argparse.ArgumentParser | None: Shared non-help argument parser or
None.
register_subcommands
¶
setup_arguments
¶
Configures argument parser options for the add subcommand.
Source code in src/kaptive/db/cli.py
Available
¶
flowchart TD
kaptive.db.cli.Available[Available]
kaptive.cli.Command[Command]
kaptive.cli.Command --> kaptive.db.cli.Available
click kaptive.db.cli.Available href "" "kaptive.db.cli.Available"
click kaptive.cli.Command href "" "kaptive.cli.Command"
🌐 List all available official databases for installation.
Displays the keywords of all officially supported databases curated in GitHub repositories
that can be installed via kaptive db install <keyword>.
Aliases
avail
Methods:
-
__call__–Executes the
availablecommand to print known database keywords. -
add_output_arguments–Add standard report and FASTA file output options to argument group.
-
build–Wire command parser and subcommands into parent argparse hierarchy.
-
get_shared_parser–Return shared parent parser containing options passed to subcommands.
-
register_subcommands–Register child subcommand instances into
subcommandslist. -
setup_arguments–Configure argument flags and positional parameters on
self.parser.
Source code in src/kaptive/cli.py
__call__
¶
Executes the available command to print known database keywords.
Parameters:
See Also
Source code in src/kaptive/db/cli.py
add_output_arguments
¶
add_output_arguments(opts: _ArgumentGroup, tsv_flags: tuple[str, str] = ('-o', '--out'), include_json: bool = True) -> None
Add standard report and FASTA file output options to argument group.
Parameters:
-
(opts¶_ArgumentGroup) –Target argument group to populate.
-
(tsv_flags¶tuple[str, str], default:('-o', '--out')) –Short and long flag options for TSV report output. Defaults to
("-o", "--out"). -
(include_json¶bool, default:True) –Flag indicating whether to include
--jsonargument option. Defaults toTrue.
Source code in src/kaptive/cli.py
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 | |
build
¶
build(subparsers: _SubParsersAction, parent_parsers: list[ArgumentParser] | None = None) -> None
Wire command parser and subcommands into parent argparse hierarchy.
Parameters:
-
(subparsers¶_SubParsersAction) –Target subparser action registry.
-
(parent_parsers¶list[ArgumentParser] | None, default:None) –Parent shared parsers to inherit.
Source code in src/kaptive/cli.py
get_shared_parser
¶
get_shared_parser() -> ArgumentParser | None
Return shared parent parser containing options passed to subcommands.
Returns:
-
ArgumentParser | None–argparse.ArgumentParser | None: Shared non-help argument parser or
None.
register_subcommands
¶
Database
¶
flowchart TD
kaptive.db.cli.Database[Database]
kaptive.cli.Command[Command]
kaptive.cli.Command --> kaptive.db.cli.Database
click kaptive.db.cli.Database href "" "kaptive.db.cli.Database"
click kaptive.cli.Command href "" "kaptive.cli.Command"
📦 Manage local and remote Kaptive databases.
Aggregates subcommands for listing, installing, updating, resetting, adding, extracting, and displaying metadata for Kaptive databases.
Aliases
db
Methods:
-
__call__–Execute command business logic for parsed arguments.
-
add_output_arguments–Add standard report and FASTA file output options to argument group.
-
build–Wire command parser and subcommands into parent argparse hierarchy.
-
get_shared_parser–Return shared parent parser containing options passed to subcommands.
-
register_subcommands–Registers subcommands for database management.
-
setup_arguments–Configure argument flags and positional parameters on
self.parser.
Source code in src/kaptive/cli.py
__call__
¶
Execute command business logic for parsed arguments.
Parameters:
add_output_arguments
¶
add_output_arguments(opts: _ArgumentGroup, tsv_flags: tuple[str, str] = ('-o', '--out'), include_json: bool = True) -> None
Add standard report and FASTA file output options to argument group.
Parameters:
-
(opts¶_ArgumentGroup) –Target argument group to populate.
-
(tsv_flags¶tuple[str, str], default:('-o', '--out')) –Short and long flag options for TSV report output. Defaults to
("-o", "--out"). -
(include_json¶bool, default:True) –Flag indicating whether to include
--jsonargument option. Defaults toTrue.
Source code in src/kaptive/cli.py
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 | |
build
¶
build(subparsers: _SubParsersAction, parent_parsers: list[ArgumentParser] | None = None) -> None
Wire command parser and subcommands into parent argparse hierarchy.
Parameters:
-
(subparsers¶_SubParsersAction) –Target subparser action registry.
-
(parent_parsers¶list[ArgumentParser] | None, default:None) –Parent shared parsers to inherit.
Source code in src/kaptive/cli.py
get_shared_parser
¶
get_shared_parser() -> ArgumentParser | None
Return shared parent parser containing options passed to subcommands.
Returns:
-
ArgumentParser | None–argparse.ArgumentParser | None: Shared non-help argument parser or
None.
register_subcommands
¶
Registers subcommands for database management.
Extract
¶
flowchart TD
kaptive.db.cli.Extract[Extract]
kaptive.cli.Command[Command]
kaptive.cli.Command --> kaptive.db.cli.Extract
click kaptive.db.cli.Extract href "" "kaptive.db.cli.Extract"
click kaptive.cli.Command href "" "kaptive.cli.Command"
📤 Extract database records in FASTA format.
Aggregates subcommands for extracting locus nucleotide sequences (loci), gene
coding sequences (genes), and translated amino acid sequences (proteins).
Methods:
-
__call__–Execute command business logic for parsed arguments.
-
add_output_arguments–Add standard report and FASTA file output options to argument group.
-
build–Wire command parser and subcommands into parent argparse hierarchy.
-
get_shared_parser–Creates shared parent parser containing common output arguments.
-
register_subcommands–Registers extraction subcommands (
Loci,Genes,Proteins). -
setup_arguments–Configure argument flags and positional parameters on
self.parser.
Source code in src/kaptive/cli.py
__call__
¶
Execute command business logic for parsed arguments.
Parameters:
add_output_arguments
¶
add_output_arguments(opts: _ArgumentGroup, tsv_flags: tuple[str, str] = ('-o', '--out'), include_json: bool = True) -> None
Add standard report and FASTA file output options to argument group.
Parameters:
-
(opts¶_ArgumentGroup) –Target argument group to populate.
-
(tsv_flags¶tuple[str, str], default:('-o', '--out')) –Short and long flag options for TSV report output. Defaults to
("-o", "--out"). -
(include_json¶bool, default:True) –Flag indicating whether to include
--jsonargument option. Defaults toTrue.
Source code in src/kaptive/cli.py
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 | |
build
¶
build(subparsers: _SubParsersAction, parent_parsers: list[ArgumentParser] | None = None) -> None
Wire command parser and subcommands into parent argparse hierarchy.
Parameters:
-
(subparsers¶_SubParsersAction) –Target subparser action registry.
-
(parent_parsers¶list[ArgumentParser] | None, default:None) –Parent shared parsers to inherit.
Source code in src/kaptive/cli.py
get_shared_parser
¶
get_shared_parser() -> ArgumentParser
Creates shared parent parser containing common output arguments.
Returns:
-
ArgumentParser–argparse.ArgumentParser: Parser configured with
--outand--use-indicesflags.
Source code in src/kaptive/db/cli.py
register_subcommands
¶
Genes
¶
flowchart TD
kaptive.db.cli.Genes[Genes]
kaptive.cli.Command[Command]
kaptive.cli.Command --> kaptive.db.cli.Genes
click kaptive.db.cli.Genes href "" "kaptive.db.cli.Genes"
click kaptive.cli.Command href "" "kaptive.cli.Command"
🧩 Extract gene coding sequences in FASTA format.
Methods:
-
__call__–Extracts gene nucleotide FASTA sequences to output stream.
-
add_output_arguments–Add standard report and FASTA file output options to argument group.
-
build–Wire command parser and subcommands into parent argparse hierarchy.
-
get_shared_parser–Return shared parent parser containing options passed to subcommands.
-
register_subcommands–Register child subcommand instances into
subcommandslist. -
setup_arguments–Configure argument flags and positional parameters on
self.parser.
Source code in src/kaptive/cli.py
__call__
¶
Extracts gene nucleotide FASTA sequences to output stream.
Parameters:
See Also
Source code in src/kaptive/db/cli.py
add_output_arguments
¶
add_output_arguments(opts: _ArgumentGroup, tsv_flags: tuple[str, str] = ('-o', '--out'), include_json: bool = True) -> None
Add standard report and FASTA file output options to argument group.
Parameters:
-
(opts¶_ArgumentGroup) –Target argument group to populate.
-
(tsv_flags¶tuple[str, str], default:('-o', '--out')) –Short and long flag options for TSV report output. Defaults to
("-o", "--out"). -
(include_json¶bool, default:True) –Flag indicating whether to include
--jsonargument option. Defaults toTrue.
Source code in src/kaptive/cli.py
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 | |
build
¶
build(subparsers: _SubParsersAction, parent_parsers: list[ArgumentParser] | None = None) -> None
Wire command parser and subcommands into parent argparse hierarchy.
Parameters:
-
(subparsers¶_SubParsersAction) –Target subparser action registry.
-
(parent_parsers¶list[ArgumentParser] | None, default:None) –Parent shared parsers to inherit.
Source code in src/kaptive/cli.py
get_shared_parser
¶
get_shared_parser() -> ArgumentParser | None
Return shared parent parser containing options passed to subcommands.
Returns:
-
ArgumentParser | None–argparse.ArgumentParser | None: Shared non-help argument parser or
None.
register_subcommands
¶
Install
¶
flowchart TD
kaptive.db.cli.Install[Install]
kaptive.cli.Command[Command]
kaptive.cli.Command --> kaptive.db.cli.Install
click kaptive.db.cli.Install href "" "kaptive.db.cli.Install"
click kaptive.cli.Command href "" "kaptive.cli.Command"
📦 Install known reference databases via keyword.
Downloads GenBank and TOML definition files from official repositories, compiles
them into vectorized Database objects, and caches
them locally.
Methods:
-
__call__–Executes database installation for a specific keyword or 'all'.
-
add_output_arguments–Add standard report and FASTA file output options to argument group.
-
build–Wire command parser and subcommands into parent argparse hierarchy.
-
get_shared_parser–Return shared parent parser containing options passed to subcommands.
-
register_subcommands–Register child subcommand instances into
subcommandslist. -
setup_arguments–Configures argument parser options for the
installsubcommand.
Source code in src/kaptive/cli.py
__call__
¶
Executes database installation for a specific keyword or 'all'.
Parameters:
Raises:
-
DatabaseError–If the specified keyword is not a known database.
See Also
Source code in src/kaptive/db/cli.py
add_output_arguments
¶
add_output_arguments(opts: _ArgumentGroup, tsv_flags: tuple[str, str] = ('-o', '--out'), include_json: bool = True) -> None
Add standard report and FASTA file output options to argument group.
Parameters:
-
(opts¶_ArgumentGroup) –Target argument group to populate.
-
(tsv_flags¶tuple[str, str], default:('-o', '--out')) –Short and long flag options for TSV report output. Defaults to
("-o", "--out"). -
(include_json¶bool, default:True) –Flag indicating whether to include
--jsonargument option. Defaults toTrue.
Source code in src/kaptive/cli.py
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 | |
build
¶
build(subparsers: _SubParsersAction, parent_parsers: list[ArgumentParser] | None = None) -> None
Wire command parser and subcommands into parent argparse hierarchy.
Parameters:
-
(subparsers¶_SubParsersAction) –Target subparser action registry.
-
(parent_parsers¶list[ArgumentParser] | None, default:None) –Parent shared parsers to inherit.
Source code in src/kaptive/cli.py
get_shared_parser
¶
get_shared_parser() -> ArgumentParser | None
Return shared parent parser containing options passed to subcommands.
Returns:
-
ArgumentParser | None–argparse.ArgumentParser | None: Shared non-help argument parser or
None.
register_subcommands
¶
setup_arguments
¶
Configures argument parser options for the install subcommand.
Source code in src/kaptive/db/cli.py
List
¶
flowchart TD
kaptive.db.cli.List[List]
kaptive.cli.Command[Command]
kaptive.cli.Command --> kaptive.db.cli.List
click kaptive.db.cli.List href "" "kaptive.db.cli.List"
click kaptive.cli.Command href "" "kaptive.cli.Command"
📋 List all currently installed local databases.
Displays the keywords of all compiled .pkl databases found in the user's
local Kaptive directory (~/.kaptive).
Aliases
ls
Methods:
-
__call__–Executes the
listcommand to print installed database keywords. -
add_output_arguments–Add standard report and FASTA file output options to argument group.
-
build–Wire command parser and subcommands into parent argparse hierarchy.
-
get_shared_parser–Return shared parent parser containing options passed to subcommands.
-
register_subcommands–Register child subcommand instances into
subcommandslist. -
setup_arguments–Configure argument flags and positional parameters on
self.parser.
Source code in src/kaptive/cli.py
__call__
¶
Executes the list command to print installed database keywords.
Parameters:
See Also
Source code in src/kaptive/db/cli.py
add_output_arguments
¶
add_output_arguments(opts: _ArgumentGroup, tsv_flags: tuple[str, str] = ('-o', '--out'), include_json: bool = True) -> None
Add standard report and FASTA file output options to argument group.
Parameters:
-
(opts¶_ArgumentGroup) –Target argument group to populate.
-
(tsv_flags¶tuple[str, str], default:('-o', '--out')) –Short and long flag options for TSV report output. Defaults to
("-o", "--out"). -
(include_json¶bool, default:True) –Flag indicating whether to include
--jsonargument option. Defaults toTrue.
Source code in src/kaptive/cli.py
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 | |
build
¶
build(subparsers: _SubParsersAction, parent_parsers: list[ArgumentParser] | None = None) -> None
Wire command parser and subcommands into parent argparse hierarchy.
Parameters:
-
(subparsers¶_SubParsersAction) –Target subparser action registry.
-
(parent_parsers¶list[ArgumentParser] | None, default:None) –Parent shared parsers to inherit.
Source code in src/kaptive/cli.py
get_shared_parser
¶
get_shared_parser() -> ArgumentParser | None
Return shared parent parser containing options passed to subcommands.
Returns:
-
ArgumentParser | None–argparse.ArgumentParser | None: Shared non-help argument parser or
None.
register_subcommands
¶
Loci
¶
flowchart TD
kaptive.db.cli.Loci[Loci]
kaptive.cli.Command[Command]
kaptive.cli.Command --> kaptive.db.cli.Loci
click kaptive.db.cli.Loci href "" "kaptive.db.cli.Loci"
click kaptive.cli.Command href "" "kaptive.cli.Command"
🧬 Extract locus nucleotide sequences in FASTA format.
Methods:
-
__call__–Extracts locus FASTA sequences to specified output file or stdout.
-
add_output_arguments–Add standard report and FASTA file output options to argument group.
-
build–Wire command parser and subcommands into parent argparse hierarchy.
-
get_shared_parser–Return shared parent parser containing options passed to subcommands.
-
register_subcommands–Register child subcommand instances into
subcommandslist. -
setup_arguments–Configure argument flags and positional parameters on
self.parser.
Source code in src/kaptive/cli.py
__call__
¶
Extracts locus FASTA sequences to specified output file or stdout.
Parameters:
See Also
Source code in src/kaptive/db/cli.py
add_output_arguments
¶
add_output_arguments(opts: _ArgumentGroup, tsv_flags: tuple[str, str] = ('-o', '--out'), include_json: bool = True) -> None
Add standard report and FASTA file output options to argument group.
Parameters:
-
(opts¶_ArgumentGroup) –Target argument group to populate.
-
(tsv_flags¶tuple[str, str], default:('-o', '--out')) –Short and long flag options for TSV report output. Defaults to
("-o", "--out"). -
(include_json¶bool, default:True) –Flag indicating whether to include
--jsonargument option. Defaults toTrue.
Source code in src/kaptive/cli.py
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 | |
build
¶
build(subparsers: _SubParsersAction, parent_parsers: list[ArgumentParser] | None = None) -> None
Wire command parser and subcommands into parent argparse hierarchy.
Parameters:
-
(subparsers¶_SubParsersAction) –Target subparser action registry.
-
(parent_parsers¶list[ArgumentParser] | None, default:None) –Parent shared parsers to inherit.
Source code in src/kaptive/cli.py
get_shared_parser
¶
get_shared_parser() -> ArgumentParser | None
Return shared parent parser containing options passed to subcommands.
Returns:
-
ArgumentParser | None–argparse.ArgumentParser | None: Shared non-help argument parser or
None.
register_subcommands
¶
Metadata
¶
flowchart TD
kaptive.db.cli.Metadata[Metadata]
kaptive.cli.Command[Command]
kaptive.cli.Command --> kaptive.db.cli.Metadata
click kaptive.db.cli.Metadata href "" "kaptive.db.cli.Metadata"
click kaptive.cli.Command href "" "kaptive.cli.Command"
📊 Print detailed metadata of a Kaptive database.
Displays summary information including organism, taxon ID, antigen type, synthesis pathway, version, identity threshold, GenBank filename, DOIs, repository URL, and curator contacts.
Aliases
info
Methods:
-
__call__–Loads database and prints formatted metadata table to standard output.
-
add_output_arguments–Add standard report and FASTA file output options to argument group.
-
build–Wire command parser and subcommands into parent argparse hierarchy.
-
get_shared_parser–Return shared parent parser containing options passed to subcommands.
-
register_subcommands–Register child subcommand instances into
subcommandslist. -
setup_arguments–Configures argument parser options for the
metadatasubcommand.
Source code in src/kaptive/cli.py
__call__
¶
Loads database and prints formatted metadata table to standard output.
Parameters:
Raises:
-
DatabaseError–If the specified database cannot be loaded.
See Also
Source code in src/kaptive/db/cli.py
add_output_arguments
¶
add_output_arguments(opts: _ArgumentGroup, tsv_flags: tuple[str, str] = ('-o', '--out'), include_json: bool = True) -> None
Add standard report and FASTA file output options to argument group.
Parameters:
-
(opts¶_ArgumentGroup) –Target argument group to populate.
-
(tsv_flags¶tuple[str, str], default:('-o', '--out')) –Short and long flag options for TSV report output. Defaults to
("-o", "--out"). -
(include_json¶bool, default:True) –Flag indicating whether to include
--jsonargument option. Defaults toTrue.
Source code in src/kaptive/cli.py
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 | |
build
¶
build(subparsers: _SubParsersAction, parent_parsers: list[ArgumentParser] | None = None) -> None
Wire command parser and subcommands into parent argparse hierarchy.
Parameters:
-
(subparsers¶_SubParsersAction) –Target subparser action registry.
-
(parent_parsers¶list[ArgumentParser] | None, default:None) –Parent shared parsers to inherit.
Source code in src/kaptive/cli.py
get_shared_parser
¶
get_shared_parser() -> ArgumentParser | None
Return shared parent parser containing options passed to subcommands.
Returns:
-
ArgumentParser | None–argparse.ArgumentParser | None: Shared non-help argument parser or
None.
register_subcommands
¶
setup_arguments
¶
Configures argument parser options for the metadata subcommand.
Source code in src/kaptive/db/cli.py
Proteins
¶
flowchart TD
kaptive.db.cli.Proteins[Proteins]
kaptive.cli.Command[Command]
kaptive.cli.Command --> kaptive.db.cli.Proteins
click kaptive.db.cli.Proteins href "" "kaptive.db.cli.Proteins"
click kaptive.cli.Command href "" "kaptive.cli.Command"
🧶 Extract translated protein sequences in FASTA format.
Methods:
-
__call__–Extracts translated protein FASTA sequences to output stream.
-
add_output_arguments–Add standard report and FASTA file output options to argument group.
-
build–Wire command parser and subcommands into parent argparse hierarchy.
-
get_shared_parser–Return shared parent parser containing options passed to subcommands.
-
register_subcommands–Register child subcommand instances into
subcommandslist. -
setup_arguments–Configure argument flags and positional parameters on
self.parser.
Source code in src/kaptive/cli.py
__call__
¶
Extracts translated protein FASTA sequences to output stream.
Parameters:
See Also
Source code in src/kaptive/db/cli.py
add_output_arguments
¶
add_output_arguments(opts: _ArgumentGroup, tsv_flags: tuple[str, str] = ('-o', '--out'), include_json: bool = True) -> None
Add standard report and FASTA file output options to argument group.
Parameters:
-
(opts¶_ArgumentGroup) –Target argument group to populate.
-
(tsv_flags¶tuple[str, str], default:('-o', '--out')) –Short and long flag options for TSV report output. Defaults to
("-o", "--out"). -
(include_json¶bool, default:True) –Flag indicating whether to include
--jsonargument option. Defaults toTrue.
Source code in src/kaptive/cli.py
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 | |
build
¶
build(subparsers: _SubParsersAction, parent_parsers: list[ArgumentParser] | None = None) -> None
Wire command parser and subcommands into parent argparse hierarchy.
Parameters:
-
(subparsers¶_SubParsersAction) –Target subparser action registry.
-
(parent_parsers¶list[ArgumentParser] | None, default:None) –Parent shared parsers to inherit.
Source code in src/kaptive/cli.py
get_shared_parser
¶
get_shared_parser() -> ArgumentParser | None
Return shared parent parser containing options passed to subcommands.
Returns:
-
ArgumentParser | None–argparse.ArgumentParser | None: Shared non-help argument parser or
None.
register_subcommands
¶
Reset
¶
flowchart TD
kaptive.db.cli.Reset[Reset]
kaptive.cli.Command[Command]
kaptive.cli.Command --> kaptive.db.cli.Reset
click kaptive.db.cli.Reset href "" "kaptive.db.cli.Reset"
click kaptive.cli.Command href "" "kaptive.cli.Command"
🧹 Uninstall all local databases and reset local cache.
Deletes all compiled .pkl and metadata .json files from the local Kaptive cache directory.
Methods:
-
__call__–Executes local cache reset and database removal.
-
add_output_arguments–Add standard report and FASTA file output options to argument group.
-
build–Wire command parser and subcommands into parent argparse hierarchy.
-
get_shared_parser–Return shared parent parser containing options passed to subcommands.
-
register_subcommands–Register child subcommand instances into
subcommandslist. -
setup_arguments–Configure argument flags and positional parameters on
self.parser.
Source code in src/kaptive/cli.py
__call__
¶
Executes local cache reset and database removal.
Parameters:
See Also
Source code in src/kaptive/db/cli.py
add_output_arguments
¶
add_output_arguments(opts: _ArgumentGroup, tsv_flags: tuple[str, str] = ('-o', '--out'), include_json: bool = True) -> None
Add standard report and FASTA file output options to argument group.
Parameters:
-
(opts¶_ArgumentGroup) –Target argument group to populate.
-
(tsv_flags¶tuple[str, str], default:('-o', '--out')) –Short and long flag options for TSV report output. Defaults to
("-o", "--out"). -
(include_json¶bool, default:True) –Flag indicating whether to include
--jsonargument option. Defaults toTrue.
Source code in src/kaptive/cli.py
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 | |
build
¶
build(subparsers: _SubParsersAction, parent_parsers: list[ArgumentParser] | None = None) -> None
Wire command parser and subcommands into parent argparse hierarchy.
Parameters:
-
(subparsers¶_SubParsersAction) –Target subparser action registry.
-
(parent_parsers¶list[ArgumentParser] | None, default:None) –Parent shared parsers to inherit.
Source code in src/kaptive/cli.py
get_shared_parser
¶
get_shared_parser() -> ArgumentParser | None
Return shared parent parser containing options passed to subcommands.
Returns:
-
ArgumentParser | None–argparse.ArgumentParser | None: Shared non-help argument parser or
None.
register_subcommands
¶
Update
¶
flowchart TD
kaptive.db.cli.Update[Update]
kaptive.cli.Command[Command]
kaptive.cli.Command --> kaptive.db.cli.Update
click kaptive.db.cli.Update href "" "kaptive.db.cli.Update"
click kaptive.cli.Command href "" "kaptive.cli.Command"
🔄 Update installed local databases from remote repositories.
Checks installed databases against their source GitHub repositories for newer versions defined in TOML metadata and re-compiles modified databases.
Methods:
-
__call__–Executes database updates for a specific keyword or 'all' installed databases.
-
add_output_arguments–Add standard report and FASTA file output options to argument group.
-
build–Wire command parser and subcommands into parent argparse hierarchy.
-
get_shared_parser–Return shared parent parser containing options passed to subcommands.
-
register_subcommands–Register child subcommand instances into
subcommandslist. -
setup_arguments–Configures argument parser options for the
updatesubcommand.
Source code in src/kaptive/cli.py
__call__
¶
Executes database updates for a specific keyword or 'all' installed databases.
Parameters:
See Also
Source code in src/kaptive/db/cli.py
add_output_arguments
¶
add_output_arguments(opts: _ArgumentGroup, tsv_flags: tuple[str, str] = ('-o', '--out'), include_json: bool = True) -> None
Add standard report and FASTA file output options to argument group.
Parameters:
-
(opts¶_ArgumentGroup) –Target argument group to populate.
-
(tsv_flags¶tuple[str, str], default:('-o', '--out')) –Short and long flag options for TSV report output. Defaults to
("-o", "--out"). -
(include_json¶bool, default:True) –Flag indicating whether to include
--jsonargument option. Defaults toTrue.
Source code in src/kaptive/cli.py
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 | |
build
¶
build(subparsers: _SubParsersAction, parent_parsers: list[ArgumentParser] | None = None) -> None
Wire command parser and subcommands into parent argparse hierarchy.
Parameters:
-
(subparsers¶_SubParsersAction) –Target subparser action registry.
-
(parent_parsers¶list[ArgumentParser] | None, default:None) –Parent shared parsers to inherit.
Source code in src/kaptive/cli.py
get_shared_parser
¶
get_shared_parser() -> ArgumentParser | None
Return shared parent parser containing options passed to subcommands.
Returns:
-
ArgumentParser | None–argparse.ArgumentParser | None: Shared non-help argument parser or
None.
register_subcommands
¶
setup_arguments
¶
Configures argument parser options for the update subcommand.