### System-wide Database Installation Source: https://github.com/oschwengers/bakta/blob/main/README.md Copy the downloaded database directory to the Bakta installation directory for a system-wide setup. This makes the database accessible without specifying a path. ```bash cp -r db/ ``` -------------------------------- ### Manual Database Download and Install Source: https://github.com/oschwengers/bakta/blob/main/README.md Manually download a database archive using wget and then install it using the bakta_db install command. Useful if the internal download tool is not preferred. ```bash wget https://zenodo.org/record/14916843/files/db-light.tar.xz bakta_db install -i db-light.tar.xz ``` -------------------------------- ### Install Pre-downloaded Bakta Database Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/api-reference/db.md Command-line utility to install a pre-downloaded Bakta database tarball. Requires specifying the input tarball path and the output directory for extraction. ```bash bakta_db install --input /path/to/database.tar.xz --output /data/bakta_db ``` -------------------------------- ### Install Bakta via Pip Source: https://github.com/oschwengers/bakta/blob/main/README.md Install Bakta using pip for Python environments. Ensure Python 3 is available. ```bash python3 -m pip install --user bakta ``` -------------------------------- ### Multiple Outputs with Different Configurations Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/api-reference/plot.md Example demonstrating how to generate multiple output plots with different configurations and prefixes. ```bash # Multiple outputs with different configurations bakta_plot --prefix features genome.json bakta_plot --type cog --prefix cog genome.json ``` -------------------------------- ### Install BAKTA using Conda Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/README.md Install BAKTA and its dependencies using Conda. Ensure you have the correct channels configured. ```bash # Install conda install -c conda-forge -c bioconda bakta ``` -------------------------------- ### Replicon Metadata Example Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/configuration.md Example of the TSV/CSV format for specifying per-sequence properties like original ID, new ID, type, topology, and name. ```plaintext original_seq_id new_id type topology name NODE_1 chr1 chromosome circular — NODE_2 p1 plasmid c pXYZ1 NODE_3 — — — — ``` -------------------------------- ### bakta_db install Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/api-reference/db.md Installs a pre-downloaded Bakta database tarball. This command extracts a downloaded database archive to a specified output directory. ```APIDOC ## Command: `bakta_db install` ### Description Install pre-downloaded database tarball. ### Arguments #### Path Parameters - **--input, -i** (path) - Required - Path to database tarball (`.tar.xz`) - **--output, -o** (path) - Required - Output directory for extraction ``` -------------------------------- ### Sequence Selection Formats Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/api-reference/plot.md Examples demonstrating how to use the --sequences argument to select specific sequences for plotting, supporting 'all', 1-based numbers, FASTA identifiers, or a mix. ```bash # All sequences (default) --sequences all ``` ```bash # By 1-based number --sequences 1,2,3 ``` ```bash # By FASTA identifier --sequences chr1,chr2,plasmid1 ``` ```bash # Mix of numbers and names --sequences 1,chr2,3 ``` -------------------------------- ### Setup Runtime Environment Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/configuration.md Configures the runtime environment using parsed command-line arguments. This function is automatically called after argument parsing and performs essential validation checks for the database, genome file, and other configuration parameters. ```python def setup(args: argparse.Namespace): """Configure runtime environment from parsed arguments.""" pass ``` -------------------------------- ### Bakta User-Provided HMMs (Default Format) Source: https://github.com/oschwengers/bakta/blob/main/README.md Example of providing user-defined HMM profiles in the default HMMER text format. ```bash # default HMMER3/f [3.1b2 | February 2015] NAME id ACC id DESC product LENG 435 TC 600 600 ``` -------------------------------- ### Bakta User-Provided HMMs (Short Format) Source: https://github.com/oschwengers/bakta/blob/main/README.md Example of providing user-defined HMM profiles in a short format, including gene and product information in the description. ```bash # short NAME id ACC id DESC gene~~~product~~~dbxrefs LENG 435 TC 600 600 ``` -------------------------------- ### Bakta User-Provided Proteins (Short Fasta Format) Source: https://github.com/oschwengers/bakta/blob/main/README.md Example of providing user-defined protein sequences in a short Fasta format, including gene and product information. ```bash # short: >id gene~~~product~~~dbxrefs MAQ... ``` -------------------------------- ### Example manifest.tsv for ENA Submission Source: https://github.com/oschwengers/bakta/blob/main/README.md This is an example manifest.tsv file used for ENA genome submission. It specifies study, sample, assembly details, and file locations. ```bash $ cat manifest.tsv STUDY PRJEB44484 SAMPLE ERS6291240 ASSEMBLYNAME GCF ASSEMBLY_TYPE isolate COVERAGE 100 PROGRAM SPAdes PLATFORM Illumina MOLECULETYPE genomic DNA FLATFILE GCF_000008865.2.embl.gz CHROMOSOME_LIST chrom-list.tsv.gz ``` -------------------------------- ### Example FASTA Entry with Custom Thresholds Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/api-reference/expert-systems.md An example of a FASTA entry using the long format, specifying custom thresholds for identity and coverage, along with gene, product, and database cross-references. ```fasta >P00123 85~~~75~~~75~~~myfactor~~~my favorite factor~~~MyDB:P00123,GO:0003674 MSTVSTOP... ``` -------------------------------- ### Example Usage: bakta.psc.search Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/api-reference/ups-ips-psc.md Shows how to use the psc.search function to perform a Diamond BLASTP search on CDS features. It then iterates through the successful hits to print sequence and product information. ```python import bakta.psc as psc hits, no_hits, low_quality = psc.search(cds_features) for feat in hits: print(f"{feat['sequence']}: {feat['psc']['product']}") ``` -------------------------------- ### Bad Commit Message Example Source: https://github.com/oschwengers/bakta/blob/main/CONTRIBUTION.md An example of a poorly formatted commit message that lacks a clear subject and detailed explanation. ```bash some changes fixing this and that... ``` -------------------------------- ### Custom Configuration and High Resolution Plot Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/api-reference/plot.md Example of generating a plot with a custom configuration file, high DPI, and specified size. ```bash # Custom configuration and high resolution bakta_plot --config colors.yaml --dpi 600 --size 16 genome.json ``` -------------------------------- ### Pull and Run Bakta Docker Image Source: https://github.com/oschwengers/bakta/blob/main/README.md Download the official Bakta Docker image and run it to display help information. This is a convenient way to use Bakta without local installation. ```bash podman pull oschwengers/bakta ``` ```bash podman run oschwengers/bakta --help ``` -------------------------------- ### Good Commit Message Example Source: https://github.com/oschwengers/bakta/blob/main/CONTRIBUTION.md An example of a well-structured commit message following best practices, including an imperative subject line, issue reference, and a detailed body explaining the 'what' and 'why'. ```bash fix broken link in reports #123 As foo changed their internal data structure in the last release bar, we need to update our external links accordingly. ``` -------------------------------- ### Bakta User-Provided Proteins (Long Fasta Format) Source: https://github.com/oschwengers/bakta/blob/main/README.md Example of providing user-defined protein sequences in a long Fasta format, including identity and coverage thresholds. ```bash # long: >id min_identity~~~min_query_cov~~~min_subject_cov~~~gene~~~product~~~dbxrefs MAQ... ``` -------------------------------- ### Basic Plot Generation Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/api-reference/plot.md Example of a basic plot generation using the default features type. ```bash # Basic plot (features type) bakta_plot genome.json ``` -------------------------------- ### Example: Performing UPS Lookup and Printing Results Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/api-reference/ups-ips-psc.md Demonstrates how to use the `ups.lookup` function to find UPS matches for a given set of CDS features. It iterates through the found features and prints their sequence along with the associated UniParc identifier. ```python import bakta.ups as ups features_with_ups, features_without_ups = ups.lookup(cds_features) for feat in features_with_ups: print(f"{feat['sequence']}: UniParc={feat['ups'].get('uniparc_id')}") ``` -------------------------------- ### check_db_path Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/api-reference/config.md Resolves the database path from arguments, environment variables, or a default installation directory. It follows a specific resolution order and raises SystemExit if the path is invalid. ```APIDOC ## Function: `check_db_path(args: Namespace) -> Path` Resolve database path from argument, environment variable, or default installation directory. **Parameters:** | Parameter | Type | Description | |-----------|------|-------------| | `args` | `Namespace` | Parsed arguments containing `db` attribute | **Return:** `pathlib.Path` — Resolved database directory **Resolution order:** 1. `args.db` (from `--db` argument) 2. `os.environ['BAKTA_DB']` (from `BAKTA_DB` env var) 3. `/db` (default installation directory) **Raises:** `SystemExit` if path doesn't exist or schema version mismatches **Example:** ```python import bakta.config as cfg db_path = cfg.check_db_path(args) # db_path now contains Path to valid database directory ``` ``` -------------------------------- ### Example Usage: bakta.ips.lookup Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/api-reference/ups-ips-psc.md Demonstrates how to use the ips.lookup function to retrieve IPS annotations for features that have already undergone UPS lookup. It iterates through the results to print gene and product information. ```python import bakta.ips as ips features_with_ips, features_without_ips = ips.lookup(features_with_ups) for feat in features_with_ips: print(f"{feat['gene']}: {feat['product']}") ``` -------------------------------- ### Check Database Path Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/api-reference/config.md Resolves the database path based on command-line arguments, environment variables, or a default installation directory. Raises SystemExit if the path is invalid or the schema version mismatches. ```python def check_db_path(args: Namespace) -> Path: """Resolve database path.""" ``` ```python import bakta.config as cfg db_path = cfg.check_db_path(args) # db_path now contains Path to valid database directory ``` -------------------------------- ### bakta.config.setup Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/api-reference/config.md Initializes and validates the runtime configuration from parsed arguments. It sets global configuration variables related to the environment, I/O paths, organism information, annotation options, feature workflow, and performs input validation. Raises SystemExit if validation fails. ```APIDOC ## Function: `setup(args: argparse.Namespace)` ### Description Initialize and validate runtime configuration from parsed arguments. ### Parameters #### Path Parameters - `args` (argparse.Namespace) - Required - Parsed command-line arguments from `bakta.utils.parse_arguments()` ### Return None (modifies global `bakta.config` module variables) ### Behavior Validates inputs and populates global configuration variables: 1. **Runtime config** — Set `env`, `threads`, `verbose`, `debug` from args 2. **I/O paths** — Validate and resolve `db_path`, `tmp_path`, `genome_path`, `output_path` 3. **Organism info** — Parse and capitalize/lowercase `genus`, `species`, `strain`, `plasmid` 4. **Annotation options** — Set `complete`, `prodigal_tf`, `translation_table`, `gram`, `locus`, `locus_tag`, `compliant` 5. **Feature workflow** — Set all `skip_*` options 6. **Input validation** — Verify file readability, database schema version, external dependencies ### Raises `SystemExit` with error message if validation fails (invalid paths, schema mismatch, etc.) ### Example ```python import sys import argparse import bakta.config as cfg import bakta.utils as bu args = bu.parse_arguments() cfg.setup(args) # Now cfg.threads, cfg.db_path, cfg.verbose, etc. are initialized print(f"Database: {cfg.db_path}") print(f"Threads: {cfg.threads}") print(f"Output: {cfg.output_path}") ``` ``` -------------------------------- ### EMBL Format Example Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/output-formats.md This is an example of the EMBL flatfile format, which is an INSDC-compliant alternative to GenBank. It includes sequence metadata and the sequence itself. ```embl ID ECO_CHR standard; DNA; linear; UNK; ?; ?; ?; UNK; UNK. AC UNKNOWN; SV UNKNOWN.1 DT 01-JAN-2024 (Rel. 0, Created) DE Escherichia coli (strain K-12). OS Escherichia coli OC Bacteria; Proteobacteria; Gammaproteobacteria; Enterobacterales; OC Enterobacteriaceae; Escherichia. FT source 1..4687549 FT /organism="Escherichia coli" FT /strain="K-12" FT CDS 190..1157 FT /locus_tag="ECO_0001" FT /gene="dnaB" FT /product="DNA polymerase III" FT /db_xref="RefSeq:WP_000123456" SQ Sequence 4687549 BP; ???????; ? checksum. agctttcatc gactagctag ctacgactac gactacgact agctagctag ctactgactg ctacgactac gactacgact agctagctag ctacgactac gactacgact agctagctag ``` -------------------------------- ### main() Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/api-reference/proteins.md Main entry point for bulk protein annotation. Parses command-line arguments to configure and execute the annotation pipeline. ```APIDOC ## main() ### Description Main entry point for bulk protein annotation. Parses command-line arguments to configure and execute the annotation pipeline. ### Method CLI Command ### Endpoint N/A (CLI function) ### Parameters #### Command-line Arguments **Input/Output:** - **``** (path) - Required - Input protein sequences in FASTA format - **`--db, -d`** (path) - Optional - Database directory (Installation default) - **`--output, -o`** (path) - Optional - Output directory (Current directory) - **`--prefix, -p`** (str) - Optional - Output file prefix (Input stem) - **`--force, -f`** (flag) - Optional - Overwrite existing output (False) **Annotation:** - **`--proteins`** (path) - Optional - Trusted protein sequences (None) - **`--hmms`** (path) - Optional - Trusted HMMs in HMMER format (None) **General:** - **`--help, -h`** (flag) - Optional - Show help - **`--verbose, -v`** (flag) - Optional - Verbose output (False) - **`--debug`** (flag) - Optional - Debug mode (False) - **`--threads, -t`** (int) - Optional - Worker threads (CPU count) - **`--tmp-dir`** (path) - Optional - Temporary directory (OS default) - **`--version, -V`** (flag) - Optional - Version ### Behavior 1. Parse arguments 2. Setup logging 3. Load input sequences 4. Configure database and temporary directory 5. Run annotation pipeline (UPS, IPS, PSC, PSCC, Expert systems, Functional annotation) 6. Perform hypothetical analysis (Pfam, Protein statistics) 7. Write outputs (TSV, FASTA, JSON) 8. Cleanup temporary directory ``` -------------------------------- ### List Available Bakta Database Versions Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/api-reference/db.md Command-line utility to list all available Bakta database versions hosted on Zenodo. ```bash bakta_db list # Output: v6.0, v5.2, v5.1, ... ``` -------------------------------- ### JSON Structure Example Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/api-reference/io.md This is an example of the expected JSON structure for annotation data, including version, genome, stats, sequences, and features. ```json { "version": { "bakta": "1.12.0", "db": {"version": "6.0", "type": "full"} }, "genome": { "genus": "Escherichia", "species": "coli", "strain": "...", "taxonomy": "Bacteria; ...", "gc": 0.507, "complete": true }, "stats": { "size": 4687549, "cds": 4290, "trna": 86, "rrna": 7, ... }, "sequences": [ { "id": "chr", "type": "chromosome", "topology": "circular", "length": 4687549, "nt": "AGCT...", ... } ], "features": [ { "type": "cds", "locus": "ECO_0001", "product": "DNA polymerase", "gene": "dnaB", "start": 190, "stop": 1157, "strand": "+", "aa": "MVSTOP...", "db_xrefs": ["RefSeq:WP_000123456", "UniRef100_...", ...], ... } ] } ``` -------------------------------- ### Install DeepSig on Linux Source: https://github.com/oschwengers/bakta/blob/main/README.md Install DeepSig for signal predictions on Linux systems within a Conda environment. Note: DeepSig is not available for MacOS. ```bash conda install -c conda-forge -c bioconda python=3.8 deepsig ``` -------------------------------- ### Example chrom-list.tsv for ENA Submission Source: https://github.com/oschwengers/bakta/blob/main/README.md This is an example chrom-list.tsv file used for ENA genome submission. It lists contigs and their types (chromosome or plasmid). ```bash $ cat chrom-list.tsv contig_1 contig_1 circular-chromosome contig_2 contig_2 circular-plasmid contig_3 contig_3 circular-plasmid ``` -------------------------------- ### I/O Configuration Variables Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/api-reference/config.md Manage input and output paths, database information, and file handling. ```python version: str # Bakta version string db_path: Path # Database directory db_info: dict # {'major': int, 'minor': int, 'type': str} tmp_path: Path # Temporary directory genome_path: Path # Input genome FASTA path min_sequence_length: int # Minimum contig/sequence length prefix: str # Output file prefix output_path: Path # Output directory force: bool # Force overwrite flag ``` -------------------------------- ### List Available Bakta Database Versions Source: https://github.com/oschwengers/bakta/blob/main/README.md Use this command to see the different versions of the Bakta database that are available for download. Databases come in 'full' and 'light' types. ```bash bakta_db list ... ``` -------------------------------- ### Initialize and Validate Bakta Configuration Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/api-reference/config.md Use this function to set up Bakta's runtime configuration from parsed command-line arguments. It validates inputs and populates global configuration variables like database path, threads, and output path. ```python import sys import argparse import bakta.config as cfg import bakta.utils as bu args = bu.parse_arguments() cfg.setup(args) # Now cfg.threads, cfg.db_path, cfg.verbose, etc. are initialized print(f"Database: {cfg.db_path}") print(f"Threads: {cfg.threads}") print(f"Output: {cfg.output_path}") ``` -------------------------------- ### GFF3 Format Example Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/output-formats.md This is an example of the GFF3 format, including the header, sequence region, feature lines, and embedded FASTA sequences. It adheres to the GFF3 specification. ```plaintext ##gff-version 3 ##sequence-region chr1 1 4687549 chr1 bakta CDS 190 1157 . + 0 ID=eco_1;locus_tag=ECO_0001;gene=dnaB;product=DNA polymerase III chr1 bakta tRNA 1500 1573 . + . ID=eco_tRNA_1;locus_tag=ECO_tRNA_0001;product=tRNA-Ala ##FASTA >chr1 AGCTTTCATCGACTAGCTA... ``` -------------------------------- ### Command-line Invocation of Bakta Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/api-reference/main.md Demonstrates how to invoke the Bakta CLI from the command line. Ensure you provide the path to the database and specify an output directory. ```bash # Command-line invocation bakta --db /path/to/db --output results/ genome.fasta ``` -------------------------------- ### Download BAKTA Database Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/README.md Download the full BAKTA database to a specified output directory. This is a prerequisite for annotation. ```bash # Download database bakta_db download --output /data/bakta_db --type full ``` -------------------------------- ### GFF3 CDS Feature Example Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/output-formats.md An example of a GFF3 feature line specifically for a CDS (Coding Sequence). It includes essential attributes like ID, Parent, locus_tag, gene symbol, product, Dbxref, and inference information. ```plaintext chr1 bakta CDS 190 1157 . + 0 ID=eco_1;Parent=gene_1;locus_tag=ECO_0001;gene=dnaB;product=DNA polymerase III;Dbxref=RefSeq:WP_000123456,UniRef100_ABC123;inference=ab initio prediction:Prodigal:v2 ``` -------------------------------- ### Feature TSV Example Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/output-formats.md This example demonstrates the structure of the feature annotation TSV file. It includes columns for locus tag, feature type, genomic location, strand, length, gene symbol, product description, and database cross-references. ```tsv locus type location strand length gene product db_xrefs ECO_0001 CDS 190-1157 + 967 dnaB DNA polymerase III RefSeq:WP_000123456;UniRef100_ABC123 ECO_0002 CDS 1190-1400 + 210 - hypothetical protein UniRef50_XYZ789 ECO_tRNA_0001 tRNA 1500-1573 + 73 - RNA-Ala RFAM:RF00005 ``` -------------------------------- ### Execution Time Variables Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/api-reference/config.md Record the start and end times of the Bakta execution. ```python run_start: datetime # Execution start time run_end: datetime | None # Execution end time ``` -------------------------------- ### Download Bakta Database using Docker Source: https://github.com/oschwengers/bakta/blob/main/README.md Download a Bakta database to a specified host path using Docker. Ensure the host path is mounted correctly into the container. ```bash docker run -v /path/to/desired-db-path:/db --entrypoint /bin/bash oschwengers/bakta:latest -c "bakta_db download --output /db --type [light|full]" ``` -------------------------------- ### Custom Label and Size Plot Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/api-reference/plot.md Example of generating a plot with a custom label and specified size. ```bash # Custom label and size bakta_plot --size 16 --label "E. coli|Chromosome" genome.json ``` -------------------------------- ### Bakta Proteins CLI Usage Help Source: https://github.com/oschwengers/bakta/blob/main/README.md Displays the help message for the `bakta_proteins` command, outlining all available arguments and options for input, output, and annotation. ```bash usage: bakta_proteins [--db DB] [--output OUTPUT] [--prefix PREFIX] [--force] [--proteins PROTEINS] [--help] [--verbose] [--debug] [--threads THREADS] [--tmp-dir TMP_DIR] [--version] Rapid & standardized annotation of bacterial genomes, MAGs & plasmids positional arguments: Protein sequences in (zipped) fasta format Input / Output: --db DB, -d DB Database path (default = /db). Can also be provided as BAKTA_DB environment variable. --output OUTPUT, -o OUTPUT Output directory (default = current working directory) --prefix PREFIX, -p PREFIX Prefix for output files --force, -f Force overwriting existing output folder Annotation: --proteins PROTEINS Fasta file of trusted protein sequences for annotation General: --help, -h Show this help message and exit --verbose, -v Print verbose information --debug Run Bakta in debug mode. Temp data will not be removed. --threads THREADS, -t THREADS Number of threads to use (default = number of available CPUs) --tmp-dir TMP_DIR Location for temporary files (default = system dependent auto detection) --version, -V show program's version number and exit ``` -------------------------------- ### Fetch Available Database Versions Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/api-reference/db.md Retrieves a list of available database version tags from Zenodo. Use this to determine which versions can be downloaded. ```python def fetch_db_versions() -> list: """Fetch available DB versions from Zenodo.""" ``` -------------------------------- ### BLAST+ Version Command Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/api-reference/features-rna.md Command to check the installed version of BLAST+. Ensure version 2.17.0 or higher is used for origin detection. ```bash blastn -version ``` -------------------------------- ### Bakta Output Customization Arguments Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/INDEX.md Control the naming and location of output files. Use --prefix for a base name and --output for a directory. The --force option allows overwriting existing files. ```bash # Output customization --prefix # Output file prefix --output # Output directory --force # Overwrite existing ``` -------------------------------- ### Bakta Database Cross-Reference Formats Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/types.md Examples of standardized formats for database cross-references used in Bakta. These follow the 'source:identifier' pattern. ```python 'UniRef100_ABC123' # UniRef100 cluster ID ``` ```python 'RefSeq:WP_000123456' # RefSeq NRP accession ``` ```python 'UniParc:UPI000ABC123' # UniParc identifier ``` ```python 'EC:1.1.1.1' # Enzyme commission number ``` ```python 'GO:0003674' # Gene ontology ID ``` ```python 'COG:COG0001' # COG identifier ``` ```python 'Pfam:PF00001' # Pfam domain ``` ```python 'VFDB:VF0123' # Virulence factor database ID ``` ```python 'amrfinder:AMR_GENE_ID' # AMRFinderPlus reference ``` ```python 'UserProtein:custom_id' # User-provided protein ``` ```python 'SO:0001217' # Sequence Ontology (coding sequence) ``` -------------------------------- ### Simple Bakta Genome Analysis Source: https://github.com/oschwengers/bakta/blob/main/README.md Basic command to run Bakta on a genome file. Requires a database path. ```bash bakta --db genome.fasta ``` -------------------------------- ### Update AMRFinder Database Source: https://github.com/oschwengers/bakta/blob/main/README.md Run this command once to set up AMRFinder's internal database if it's crashing. Alternatively, use Bakta's download logic. ```bash amrfinder_update --force_update --database /amrfinderplus-db ``` ```bash bakta_db download --output ``` -------------------------------- ### COG Functional Plot for Specific Sequence Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/api-reference/plot.md Example of generating a COG functional plot for a specific sequence (plasmid1) with a custom prefix. ```bash # COG functional plot of plasmid only bakta_plot --sequences plasmid1 --type cog --prefix plasmid1_cog genome.json ``` -------------------------------- ### Main Entry Point for Protein Annotation Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/api-reference/proteins.md This is the main function for the bulk protein annotation CLI. It parses arguments, sets up logging, loads input sequences, configures the annotation pipeline, performs various annotation steps, and writes the results. ```python def main(): """Annotate protein sequences.""" ``` -------------------------------- ### Gap Feature Dictionary Structure Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/types.md Represents gaps in sequence data. Includes sequence, start and stop positions, and an optional estimated length. ```python { 'type': 'gap', 'sequence': str, 'start': int, 'stop': int, 'strand': str, # Not meaningful for gaps 'product': 'gap', 'estimated_length': int | None, # Estimated gap size if available 'locus': str } ``` -------------------------------- ### Download ENA Webin-CLI Source: https://github.com/oschwengers/bakta/blob/main/README.md Download the Webin-CLI JAR file for submitting genomes to ENA. Ensure you have the correct version. ```bash # download ENA Webin-CLI $ wget https://github.com/enasequence/webin-cli/releases/download/8.1.0/webin-cli-8.1.0.jar ``` -------------------------------- ### Basic Protein Annotation with BAKTA Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/api-reference/proteins.md Use this command for a straightforward annotation of protein sequences. Ensure your database path is correctly specified. ```bash # Basic protein annotation bakta_proteins --db /path/to/db proteins.fasta ``` -------------------------------- ### Download Bakta Database Source: https://github.com/oschwengers/bakta/blob/main/README.md This command downloads a specified type of Bakta database to a given output path. Recommended for obtaining the most recent compatible database version. ```bash bakta_db download --output --type [light|full] ``` -------------------------------- ### Bakta CLI Usage Source: https://github.com/oschwengers/bakta/blob/main/README.md This snippet displays the full command-line usage for the Bakta tool, including all available arguments and their descriptions. Use this to understand the various parameters for genome annotation. ```bash usage: bakta [--db DB] [--min-contig-length MIN_CONTIG_LENGTH] [--prefix PREFIX] [--output OUTPUT] [--force] [--genus GENUS] [--species SPECIES] [--strain STRAIN] [--plasmid PLASMID] [--complete] [--prodigal-tf PRODIGAL_TF] [--translation-table {11,4,25}] [--gram {+,-,?}] [--locus LOCUS] [--locus-tag LOCUS_TAG] [--locus-tag-increment {1,5,10}] [--keep-contig-headers] [--compliant] [--replicons REPLICONS] [--regions REGIONS] [--proteins PROTEINS] [--hmms HMMS] [--meta] [--skip-trna] [--skip-tmrna] [--skip-rrna] [--skip-ncrna] [--skip-ncrna-region] [--skip-crispr] [--skip-cds] [--skip-pseudo] [--skip-sorf] [--skip-gap] [--skip-ori] [--skip-filter] [--skip-plot] [--help] [--verbose] [--debug] [--threads THREADS] [--tmp-dir TMP_DIR] [--version] Rapid & standardized annotation of bacterial genomes, MAGs & plasmids positional arguments: Genome sequences in (zipped) fasta format Input / Output: --db DB, -d DB Database path (default = /db). Can also be provided as BAKTA_DB environment variable. --min-contig-length MIN_CONTIG_LENGTH, -m MIN_CONTIG_LENGTH Minimum contig/sequence size (default = 1; 200 in compliant mode) --prefix PREFIX, -p PREFIX Prefix for output files --output OUTPUT, -o OUTPUT Output directory (default = current working directory) --force, -f Force overwriting existing output folder (except for current working directory) Organism: --genus GENUS Genus name --species SPECIES Species name --strain STRAIN Strain name --plasmid PLASMID Plasmid name Annotation: --complete All sequences are complete replicons (chromosome/plasmid[s]) --prodigal-tf PRODIGAL_TF Path to existing Prodigal training file to use for CDS prediction --translation-table {11,4,25} Translation table: 11/4/25 (default = 11) --gram {+,-,?} Gram type for signal peptide predictions: +/-/? (default = ?) --locus LOCUS Locus prefix (default = 'contig') --locus-tag LOCUS_TAG Locus tag prefix (default = autogenerated) --locus-tag-increment {1,5,10} Locus tag increment: 1/5/10 (default = 1) --keep-contig-headers Keep original contig/sequence headers --compliant Force Genbank/ENA/DDJB compliance --replicons REPLICONS, -r REPLICONS Replicon information table (tsv/csv) --regions REGIONS Path to pre-annotated regions in GFF3 or Genbank format (regions only, no functional annotations). --proteins PROTEINS Fasta file of trusted protein sequences for CDS annotation --hmms HMMS HMM file of trusted hidden markov models in HMMER format for CDS annotation --meta Run in metagenome mode. This only affects CDS prediction. Workflow: --skip-trna Skip tRNA detection & annotation --skip-tmrna Skip tmRNA detection & annotation --skip-rrna Skip rRNA detection & annotation --skip-ncrna Skip ncRNA detection & annotation --skip-ncrna-region Skip ncRNA region detection & annotation --skip-crispr Skip CRISPR array detection & annotation --skip-cds Skip CDS detection & annotation --skip-pseudo Skip pseudogene detection & annotation --skip-sorf Skip sORF detection & annotation --skip-gap Skip gap detection & annotation --skip-ori Skip oriC/oriT detection & annotation --skip-filter Skip feature overlap filters --skip-plot Skip generation of circular genome plots General: --help, -h Show this help message and exit --verbose, -v Print verbose information --debug Run Bakta in debug mode. Temp data will not be removed. --threads THREADS, -t THREADS Number of threads to use (default = number of available CPUs) --tmp-dir TMP_DIR Location for temporary files (default = system dependent auto detection) --version show program's version number and exit ``` -------------------------------- ### Get ORFs Function Signature Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/api-reference/features-rna.md Defines the function signature for extracting open reading frames (ORFs) from a DNA sequence. Specify the sequence, genetic code table, and minimum ORF length. ```python def get_orfs(sequence: str, translation_table: int, min_length: int) -> list: """Extract all ORFs.""" ``` -------------------------------- ### Download Bakta Database Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/api-reference/db.md Command-line utility to download and extract Bakta databases from Zenodo. Supports specifying output directory, database type, and download threads. It also handles verification and extraction. ```bash bakta_db download --output /data/bakta_db --type full ``` -------------------------------- ### Resolve Database Path Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/configuration.md Determines the database path by checking the `--db` argument, the `BAKTA_DB` environment variable, or the default installation directory. Ensures the database path exists and has a compatible schema version. ```python def check_db_path(args: Namespace) -> Path: """Resolve database path from argument, env var, or installation directory.""" pass ``` -------------------------------- ### GenBank Flatfile Format (GBFF) Record Structure Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/output-formats.md This example shows the typical structure of a GenBank flatfile record, including locus information, definition, accession, source, features, and sequence origin. It is INSDC-compliant. ```plaintext LOCUS ECO_CHR 4687549 bp DNA circular BCT 01-JAN-2024 DEFINITION Escherichia coli (strain K-12). ACCESSION TBD VERSION TBD.1 KEYWORDS . SOURCE Escherichia coli ORGANISM Escherichia coli Bacteria; Proteobacteria; Gammaproteobacteria; Enterobacterales; Enterobacteriaceae; Escherichia. FEATURES Location/Qualifiers source 1..4687549 /organism="Escherichia coli" /strain="K-12" gene 190..1157 /locus_tag="ECO_0001" /gene="dnaB" CDS 190..1157 /locus_tag="ECO_0001" /gene="dnaB" /product="DNA polymerase III" /db_xref="RefSeq:WP_000123456" /db_xref="UniRef100_ABC123" /translation="MVSTOP..." ORIGIN 1 agctttcatc gactagctag ctacgactac gactacgact agctagctag ctactgactg 61 ctacgactac gactacgact agctagctag ctacgactac gactacgact agctagctag ... // ``` -------------------------------- ### fetch_db_versions Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/api-reference/db.md Fetches a list of available database versions from Zenodo. ```APIDOC ## Function: `fetch_db_versions()` ### Description Fetch list of available database versions from Zenodo. ### Return `list[str]` — List of version tags (e.g., ['v6.0', 'v5.2', ...]) ``` -------------------------------- ### Create a single CDS feature dictionary Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/api-reference/features-cds.md Use this function to create a single CDS feature dictionary. It requires sequence information, start and stop positions, strand, edge status, and nucleotide and amino acid sequences. ```python def create_cds(sequence: dict, start: int, stop: int, strand: str, edge: bool, nt: str, aa: str) -> dict: ``` ```python import bakta.features.cds as cds_module seq = {'id': 'chr1', 'length': 10000} cds_feat = cds_module.create_cds(seq, 100, 300, '+', False, 'ATGTAG...', 'MVSTOP...') print(cds_feat['type']) # 'cds' print(cds_feat['frame']) # 1 ``` -------------------------------- ### Process JSON Results with bakta_io Source: https://github.com/oschwengers/bakta/blob/main/README.md Use the `bakta_io` helper function to create standard output files from a gzipped JSON result file. This is useful for reducing storage requirements for long-term or large-scale projects. The `--output` and `--prefix` arguments control the output path and file prefix, respectively. ```bash bakta_io --output --prefix result.json.gz ``` ```bash bakta_io --help ``` -------------------------------- ### Basic Protein Bulk Annotation Source: https://github.com/oschwengers/bakta/blob/main/README.md Use this command for direct bulk annotation of protein sequences. Ensure you provide the path to your Bakta database. ```bash bakta_proteins --db input.fasta ``` -------------------------------- ### download Source: https://github.com/oschwengers/bakta/blob/main/_autodocs/api-reference/db.md Downloads a database tarball from a given URL with progress tracking and support for resumable downloads. ```APIDOC ## Function: `download(db_url: str, tarball_path: Path)` ### Description Download database tarball from URL with progress tracking. ### Parameters #### Path Parameters - **db_url** (str) - Required - Full URL to database tarball - **tarball_path** (Path) - Required - Target path for downloaded file ### Behavior - Streams download with progress bar - Supports resumable downloads - Validates with MD5 checksum ```