[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M73BAVF97D563XNF9HE8RY4K":3,"skill-same:01M73BAVF97D563XNF9HE8RY4K":48},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":32,"updatedAt":33,"install":34,"resources":47},"01M73BAVF97D563XNF9HE8RY4K","bakta-genome-annotation",null,"Annotate bacterial and archaeal genomes and plasmids with Bakta's Prodigal\u002FHMM\u002Fdiamond pipeline. Identifies CDS, ncRNA, tRNA, rRNA, tmRNA, sORFs, CRISPR arrays, oriC\u002ForiV\u002ForiT, and gaps against a curated UniRef-derived database. Produces NCBI-compatible GFF3, GenBank, EMBL, JSON, FASTA, TSV, and a circular genome plot. Use Prokka for legacy pipelines or non-bacterial kingdoms; PGAP for NCBI GenBank submission.","bg-szy\u002FTOP-SKILLS","bg-szy","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F106576190?v=4","01M73A4E8KPV67SFXRY8XZGNBX","ShuZhiyong","01M73A4E96MQ294MHM74TZBVQD",6,"GPL-3.0","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fawesome-skills\u002Fbakta-genome-annotation\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: \"bakta-genome-annotation\"\ndescription: \"Annotate bacterial and archaeal genomes and plasmids with Bakta's Prodigal\u002FHMM\u002Fdiamond pipeline. Identifies CDS, ncRNA, tRNA, rRNA, tmRNA, sORFs, CRISPR arrays, oriC\u002ForiV\u002ForiT, and gaps against a curated UniRef-derived database. Produces NCBI-compatible GFF3, GenBank, EMBL, JSON, FASTA, TSV, and a circular genome plot. Use Prokka for legacy pipelines or non-bacterial kingdoms; PGAP for NCBI GenBank submission.\"\nlicense: \"GPL-3.0\"\n---\n\n# Bakta Genome Annotation\n\n## Overview\n\nBakta is a command-line pipeline for rapid, standardized annotation of bacterial and archaeal genomes and plasmids. It combines Prodigal for CDS prediction, tRNAscan-SE\u002FAragorn\u002FBarrnap\u002FInfernal for non-coding RNA, PILER-CR\u002FPILERCR for CRISPR detection, and a tiered DIAMOND\u002FHMM search against a curated UniRef100 + IPS\u002FUPS database to assign gene names, EC numbers, GO terms, and COG categories. Bakta produces NCBI-compatible outputs (GFF3, GenBank, EMBL, INSDC-formatted FASTA, plus a JSON summary and a circular Circos plot) for a typical 5 Mb genome in 5–15 minutes on 8 CPUs.\n\n## When to Use\n\n- Annotating bacterial or archaeal genome assemblies (Illumina, PacBio, Nanopore) with NCBI-compatible locus tags and product names\n- Annotating plasmids and other circular replicons separately with `--plasmid` and `--complete` flags\n- Producing JSON-structured annotation outputs that can be parsed without GenBank or GFF3 detours\n- Generating a publication-ready circular genome plot via the bundled `bakta_plot` command\n- Annotating MAGs (metagenome-assembled genomes) with `--meta` to disable Prodigal training\n- Use **Prokka** instead when you need viral\u002Fmitochondrial kingdoms or when you must reproduce a legacy Prokka pipeline exactly\n- Use **PGAP** instead when submitting to NCBI GenBank with full standards compliance\n- Use **Bakta** when you want faster runs, regularly updated UniRef-derived databases, AMRFinderPlus integration, and a JSON summary out of the box\n\n## Prerequisites\n\n- **Software**: Bakta ≥ 1.9, Python 3.8+, Prodigal, tRNAscan-SE, Aragorn, Barrnap, Infernal, DIAMOND, HMMER3, PILER-CR, BLAST+, AMRFinderPlus\n- **Database**: Bakta DB (full ~70 GB, or light ~3 GB) downloaded once with `bakta_db download`\n- **Python packages** (for output parsing): `biopython`, `pandas`, `matplotlib`\n- **Input**: assembled genome in FASTA format (one or more contigs)\n- **Hardware**: ≥ 16 GB RAM for full DB, ≥ 4 GB RAM for light DB; ≥ 8 CPUs recommended\n\n> **Check before installing**: The tool may already be available in the current environment (e.g., inside a `pixi` \u002F `conda` env). Run `command -v bakta` first and skip the install commands below if it returns a path. When running inside a pixi project, invoke the tool via `pixi run bakta` rather than bare `bakta`.\n\n```bash\n# Install Bakta via conda\u002Fmamba (recommended)\nmamba install -c conda-forge -c bioconda bakta\n\n# Verify installation\nbakta --version\n# bakta 1.9.4\n\n# Download the light database (~3 GB, faster, fewer functional hits)\nbakta_db download --output db\u002F --type light\n\n# Or full database (~70 GB, comprehensive UniRef100 coverage)\n# bakta_db download --output db\u002F --type full\n\n# Install Python parsing dependencies\npip install biopython pandas matplotlib\n```\n\n## Pre-flight Interview\n\nSettle these with the user before writing any analysis code.\n\n```yaml\ndecisions:\n  - id: D1\n    param: database\n    kind: required\n    source: user\n    ask: \"Annotate against the light database or the full one? The light database leaves more genes described only generically.\"\n    default: null\n\n  - id: D2\n    param: organismMetadata\n    kind: required\n    source: user\n    ask: \"Which genus, species, and strain should be recorded in the output?\"\n    default: null\n\n  - id: D3\n    param: repliconTopology\n    kind: required\n    source: data\n    ask: \"Are these contigs complete circular replicons, plasmids, or draft fragments?\"\n    default: \"draft fragments - no circularity assumed\"\n\n  - id: D4\n    param: assemblyOrigin\n    kind: required\n    source: data\n    ask: \"Is this an isolate genome, or a bin recovered from a metagenome?\"\n    default: \"isolate - gene prediction trains on the assembly itself\"\n\n  - id: D5\n    param: translationTable\n    kind: required\n    source: user\n    ask: \"Which genetic code does this organism use?\"\n    default: \"11, the bacterial and archaeal code\"\n\n  - id: D6\n    param: locusTagPrefix\n    kind: optional\n    source: user\n    ask: \"Which prefix should locus tags carry, if they will be submitted or cross-referenced?\"\n    default: \"generated automatically\"\n\n  - id: D7\n    param: minContigLength\n    kind: optional_conditional\n    source: data\n    ask: \"Should short contigs be skipped?\"\n    default: \"no minimum\"\n\n  - id: D8\n    param: threadsAndPlotting\n    kind: never_ask\n    source: data\n    reason: \"Thread count and the circular plot affect runtime and output files, not the annotation\"\n    default: \"available cores, plot enabled\"\n```\n\nD5 is asked rather than defaulted because the exceptions are real and silent:\nMycoplasma and relatives reassign a stop codon, so annotating them with the\nstandard bacterial code truncates a large fraction of their genes into\nfragments that still look like ordinary short CDS calls.\n\n## Quick Start\n\n```bash\n# Annotate a bacterial genome — results in results\u002F directory\nbakta genome.fasta \\\n    --db db\u002Fbakta_db_light \\\n    --output results\u002F \\\n    --prefix sample1 \\\n    --threads 8\n\n# Inspect the JSON summary for feature counts\npython -c \"\nimport json\nwith open('results\u002Fsample1.json') as f:\n    d = json.load(f)\nprint('Genus:', d['genome'].get('genus'))\nprint('Length:', d['genome']['size'], 'bp')\nprint('CDS:', sum(1 for f in d['features'] if f['type'] == 'cds'))\nprint('tRNA:', sum(1 for f in d['features'] if f['type'] == 'tRNA'))\n\"\n```\n\n## Workflow\n\n### Step 1: Install Bakta and Download the Database\n\nInstall Bakta and prepare the reference database. The database download is one-time and reused across runs.\n\n```bash\n# Create a dedicated conda environment (avoids dependency conflicts)\nmamba create -n bakta_env -c conda-forge -c bioconda bakta python=3.11 -y\nmamba activate bakta_env\n\n# Verify Bakta and its dependencies\nbakta --version\n# bakta 1.9.4\n\nbakta --help | head -20\n\n# Download the light database (sufficient for routine annotation)\nmkdir -p db\u002F\nbakta_db download --output db\u002F --type light\n# Downloads ~3 GB; expands to ~5 GB on disk\n\n# Verify the database was extracted correctly\nls db\u002Fbakta_db_light\u002F\n# antifam.h3f  bakta.db  expert  oric.fna  pfam.h3f  rfam-go.tsv  ...\n\n# (Optional) Update AMRFinderPlus DB used by Bakta for AMR gene calling\namrfinder -u\n\n# Install Python parsing tools\npip install biopython pandas matplotlib\n```\n\n### Step 2: Prepare the Input Assembly\n\nBakta requires clean FASTA headers without spaces or special characters. Pre-clean and optionally filter short contigs.\n\n```python\nfrom Bio import SeqIO\nimport re\n\ninput_fasta = \"genome.fasta\"\nrecords = list(SeqIO.parse(input_fasta, \"fasta\"))\nprint(f\"Input assembly: {len(records)} contigs\")\ntotal_bases = sum(len(r) for r in records)\nprint(f\"Total bases: {total_bases:,}\")\nprint(f\"Largest contig: {max(len(r) for r in records):,} bp\")\n\n# Bakta preferred: short, alphanumeric, unique IDs\ncleaned = []\nfor i, rec in enumerate(records, 1):\n    new_id = f\"contig_{i:04d}\"\n    new_rec = rec.__class__(rec.seq, id=new_id, description=\"\")\n    cleaned.append(new_rec)\n\nSeqIO.write(cleaned, \"genome_clean.fasta\", \"fasta\")\nprint(f\"Wrote genome_clean.fasta with {len(cleaned)} contigs\")\n```\n\n```bash\n# Filter out short contigs (\u003C200 bp) which contribute little to annotation\nawk 'BEGIN{RS=\">\"; ORS=\"\"} NR>1 {n=split($0, a, \"\\n\"); seq=\"\"; for(i=2;i\u003C=n;i++) seq=seq a[i]; if (length(seq) >= 200) print \">\" $0}' \\\n    genome_clean.fasta > genome_filtered.fasta\n\necho \"Filtered assembly: $(grep -c '>' genome_filtered.fasta) contigs\"\n```\n\n### Step 3: Run Standard Bakta Annotation\n\nRun Bakta with genus\u002Fspecies hints. Locus tags are auto-generated from the strain field.\n\n```bash\n# Standard annotation for a draft bacterial genome\nbakta genome_clean.fasta \\\n    --db db\u002Fbakta_db_light \\\n    --output annotation\u002F \\\n    --prefix E_coli_K12 \\\n    --genus Escherichia \\\n    --species coli \\\n    --strain K12 \\\n    --locus-tag ECOLI \\\n    --threads 8 \\\n    --keep-contig-headers\n\n# Expected runtime: 5–15 min for ~5 Mb genome on 8 CPUs (light DB)\n\necho \"Bakta annotation outputs:\"\nls annotation\u002F\n# E_coli_K12.embl   E_coli_K12.faa     E_coli_K12.ffn\n# E_coli_K12.fna    E_coli_K12.gbff    E_coli_K12.gff3\n# E_coli_K12.hypotheticals.faa  E_coli_K12.hypotheticals.tsv\n# E_coli_K12.json   E_coli_K12.log     E_coli_K12.png\n# E_coli_K12.svg    E_coli_K12.tsv     E_coli_K12.txt\n```\n\n### Step 4: Parse the JSON Summary\n\nBakta's JSON output is the canonical, machine-readable annotation. Parse it directly for downstream pipelines.\n\n```python\nimport json\nimport pandas as pd\nfrom collections import Counter\n\nwith open(\"annotation\u002FE_coli_K12.json\") as f:\n    bakta = json.load(f)\n\n# Genome-level metadata\ngenome = bakta[\"genome\"]\nprint(f\"Organism: {genome.get('genus')} {genome.get('species')} {genome.get('strain')}\")\nprint(f\"Size: {genome['size']:,} bp across {len(bakta['sequences'])} sequences\")\nprint(f\"GC content: {genome['gc']:.2%}\")\n\n# Feature type counts\nfeatures = bakta[\"features\"]\ntype_counts = Counter(f[\"type\"] for f in features)\nprint(\"\\nFeature counts:\")\nfor ftype, n in sorted(type_counts.items(), key=lambda x: -x[1]):\n    print(f\"  {ftype:>10}: {n}\")\n\n# Build a tidy CDS DataFrame\ncds_rows = []\nfor f in features:\n    if f[\"type\"] != \"cds\":\n        continue\n    cds_rows.append({\n        \"locus_tag\": f.get(\"locus\", \"\"),\n        \"contig\":    f.get(\"contig\", \"\"),\n        \"start\":     f.get(\"start\"),\n        \"stop\":      f.get(\"stop\"),\n        \"strand\":    f.get(\"strand\"),\n        \"gene\":      f.get(\"gene\", \"\"),\n        \"product\":   f.get(\"product\", \"\"),\n        \"length_aa\": len(f.get(\"aa\", \"\")),\n    })\n\ncds_df = pd.DataFrame(cds_rows)\nprint(f\"\\nTotal CDS: {len(cds_df)}\")\nprint(cds_df.head(5).to_string(index=False))\n```\n\n### Step 5: Parse the TSV Feature Table\n\nThe TSV output is convenient for spreadsheet workflows and quick filtering.\n\n```python\nimport pandas as pd\n\n# Bakta TSV begins with comment lines starting with '#'\ndf = pd.read_csv(\"annotation\u002FE_coli_K12.tsv\", sep=\"\\t\", comment=\"#\",\n                 names=[\"sequence_id\", \"type\", \"start\", \"stop\", \"strand\",\n                        \"locus_tag\", \"gene\", \"product\", \"dbxrefs\"])\nprint(f\"Total features: {len(df)}\")\nprint(f\"Feature types: {df['type'].value_counts().to_dict()}\")\n\n# Hypothetical vs annotated CDS\ncds = df[df[\"type\"] == \"cds\"].copy()\nhypothetical = cds[\"product\"].str.contains(\"hypothetical\", case=False, na=True)\nprint(f\"\\nCDS with assigned function: {(~hypothetical).sum()} \u002F {len(cds)}\")\nprint(f\"Hypothetical proteins: {hypothetical.sum()}\")\n\n# Cross-references (UniRef, KEGG, EC, GO, etc.) parsed from the dbxrefs column\ndef split_xrefs(xref_str):\n    if not isinstance(xref_str, str) or xref_str in (\"\", \"-\"):\n        return []\n    return [x.strip() for x in xref_str.split(\",\")]\n\ncds[\"dbxref_list\"] = cds[\"dbxrefs\"].apply(split_xrefs)\nec_hits = cds[cds[\"dbxref_list\"].apply(lambda xs: any(x.startswith(\"EC:\") for x in xs))]\nprint(f\"CDS with EC numbers: {len(ec_hits)}\")\nprint(ec_hits[[\"locus_tag\", \"gene\", \"product\"]].head(5).to_string(index=False))\n```\n\n### Step 6: Render the Circular Genome Plot\n\nBakta emits a Circos-style PNG\u002FSVG by default. Regenerate with custom styling using `bakta_plot`.\n\n```bash\n# Re-render the plot from the existing JSON with a different style\nbakta_plot --output annotation\u002F \\\n           --prefix E_coli_K12_replot \\\n           --type cog \\\n           --dpi 300 \\\n           annotation\u002FE_coli_K12.json\n\nls annotation\u002FE_coli_K12_replot.*\n# E_coli_K12_replot.png  E_coli_K12_replot.svg\n\n# Display the rendered PNG inline in a Jupyter notebook\npython \u003C\u003C'PY'\nfrom pathlib import Path\nimport matplotlib.pyplot as plt\nimport matplotlib.image as mpimg\n\nimg = mpimg.imread(\"annotation\u002FE_coli_K12.png\")\nfig, ax = plt.subplots(figsize=(6, 6))\nax.imshow(img)\nax.axis(\"off\")\nax.set_title(\"Bakta circular genome annotation\")\nplt.savefig(\"bakta_circular_thumbnail.png\", dpi=120, bbox_inches=\"tight\")\nprint(\"Saved bakta_circular_thumbnail.png\")\nPY\n```\n\n### Step 7: Compute Annotation Quality Statistics\n\nSummarize hypothetical-protein rate, gene density, and feature coverage to assess annotation quality.\n\n```python\nimport json\nimport pandas as pd\nimport matplotlib.pyplot as plt\n\nwith open(\"annotation\u002FE_coli_K12.json\") as f:\n    bakta = json.load(f)\n\ngenome_size = bakta[\"genome\"][\"size\"]\nfeatures = bakta[\"features\"]\n\n# Per-feature-type counts and density (per Mb)\ncounts = {}\nfor f in features:\n    counts[f[\"type\"]] = counts.get(f[\"type\"], 0) + 1\ndensity = {k: v \u002F (genome_size \u002F 1e6) for k, v in counts.items()}\n\ncds = [f for f in features if f[\"type\"] == \"cds\"]\nn_cds = len(cds)\nn_hypo = sum(1 for f in cds if \"hypothetical\" in (f.get(\"product\") or \"\").lower())\nn_known = n_cds - n_hypo\ncoding_density = sum(abs(f[\"stop\"] - f[\"start\"] + 1) for f in cds) \u002F genome_size\n\nprint(f\"Genome: {genome_size:,} bp\")\nprint(f\"CDS: {n_cds}  ({density.get('cds', 0):.1f} per Mb)\")\nprint(f\"  Known function: {n_known}  Hypothetical: {n_hypo}\")\nprint(f\"Coding density: {coding_density:.1%}\")\nprint(f\"tRNA: {counts.get('tRNA', 0)}   rRNA: {counts.get('rRNA', 0)}\")\nprint(f\"ncRNA: {counts.get('ncRNA', 0)}  CRISPR: {counts.get('crispr', 0)}\")\n\n# Bar plot of feature type counts\nfig, ax = plt.subplots(figsize=(8, 4))\nitems = sorted(counts.items(), key=lambda x: -x[1])\nlabels = [k for k, _ in items]\nvalues = [v for _, v in items]\nbars = ax.bar(labels, values, color=\"#2980B9\", edgecolor=\"white\")\nfor bar, v in zip(bars, values):\n    ax.text(bar.get_x() + bar.get_width() \u002F 2, v + max(values) * 0.01,\n            str(v), ha=\"center\", fontsize=9)\nax.set_ylabel(\"Count\")\nax.set_title(\"Bakta feature counts by type\")\nplt.xticks(rotation=20)\nplt.tight_layout()\nplt.savefig(\"bakta_feature_counts.png\", dpi=150, bbox_inches=\"tight\")\nprint(\"Saved bakta_feature_counts.png\")\n```\n\n### Step 8: Batch Annotation Across Multiple Genomes\n\nRun Bakta over a directory of assemblies and aggregate per-sample summary statistics.\n\n```bash\n#!\u002Fbin\u002Fbash\n# batch_bakta.sh — annotate all FASTA files in a directory\nINPUT_DIR=\"genomes\u002F\"\nOUTPUT_DIR=\"annotations\u002F\"\nDB=\"db\u002Fbakta_db_light\"\nmkdir -p \"$OUTPUT_DIR\"\n\nfor FASTA in \"$INPUT_DIR\"\u002F*.fasta; do\n    SAMPLE=$(basename \"$FASTA\" .fasta)\n    echo \"Annotating: $SAMPLE\"\n    bakta \"$FASTA\" \\\n        --db \"$DB\" \\\n        --output \"${OUTPUT_DIR}\u002F${SAMPLE}\" \\\n        --prefix \"$SAMPLE\" \\\n        --threads 4 \\\n        --skip-plot \\\n        --force\ndone\n\necho \"Batch annotation complete.\"\n```\n\n```python\n# Aggregate per-genome summaries from each sample's JSON file\nfrom pathlib import Path\nimport json\nimport pandas as pd\n\nannotation_dir = Path(\"annotations\u002F\")\nrows = []\nfor json_file in sorted(annotation_dir.glob(\"*\u002F*.json\")):\n    with open(json_file) as f:\n        bakta = json.load(f)\n    sample = json_file.stem\n    counts = {}\n    for feat in bakta[\"features\"]:\n        counts[feat[\"type\"]] = counts.get(feat[\"type\"], 0) + 1\n    rows.append({\n        \"sample\":  sample,\n        \"size\":    bakta[\"genome\"][\"size\"],\n        \"gc\":      bakta[\"genome\"][\"gc\"],\n        \"CDS\":     counts.get(\"cds\", 0),\n        \"tRNA\":    counts.get(\"tRNA\", 0),\n        \"rRNA\":    counts.get(\"rRNA\", 0),\n        \"ncRNA\":   counts.get(\"ncRNA\", 0),\n        \"crispr\":  counts.get(\"crispr\", 0),\n    })\n\nsummary_df = pd.DataFrame(rows)\nprint(f\"Annotated genomes: {len(summary_df)}\")\nprint(summary_df.to_string(index=False))\nsummary_df.to_csv(\"batch_bakta_summary.csv\", index=False)\nprint(\"Saved: batch_bakta_summary.csv\")\n```\n\n## Key Parameters\n\n| Parameter | Default | Range \u002F Options | Effect |\n|-----------|---------|-----------------|--------|\n| `--db` | — | path to Bakta DB directory | Required; selects light or full reference DB |\n| `--genus` | — | any genus name string | Sets organism metadata in GenBank\u002FEMBL output |\n| `--species` | — | any species name string | Combined with `--genus` for organism qualifier |\n| `--strain` | — | any string | Adds strain qualifier to organism metadata |\n| `--locus-tag` | auto | 3–24 alphanumeric chars | Prefix for locus tags (e.g., `ECOLI_00001`) |\n| `--complete` | off | flag | Treat all input contigs as complete circular replicons |\n| `--plasmid` | off | flag | Treat all input contigs as plasmids (circular) |\n| `--meta` | off | flag | Disable Prodigal training (use for MAGs \u002F metagenomic bins) |\n| `--translation-table` | `11` | NCBI table IDs (1, 4, 11, 25, …) | Genetic code used by Prodigal for CDS translation |\n| `--min-contig-length` | `1` | any integer (bp) | Skip contigs shorter than this length |\n| `--threads` | `1` | `1`–CPU count | Parallel threads for DIAMOND\u002FHMMER searches |\n| `--skip-plot` | off | flag | Skip the slow circular plot rendering step |\n| `--keep-contig-headers` | off | flag | Preserve original contig IDs instead of renaming |\n| `--proteins` | — | path to GenBank or FASTA file | Custom expert protein DB used before UniRef search |\n\n## Common Recipes\n\n### Recipe: Plasmid-only Annotation\n\nWhen to use: A finished circular plasmid sequence that should be annotated without chromosome assumptions.\n\n```bash\nbakta plasmid.fasta \\\n    --db db\u002Fbakta_db_light \\\n    --output plasmid_annotation\u002F \\\n    --prefix pBR322 \\\n    --plasmid \\\n    --complete \\\n    --threads 4\n\n# Inspect plasmid-typing results (incompatibility group, replication initiator)\ngrep -E \"rep|inc\" plasmid_annotation\u002FpBR322.tsv | head -10\n```\n\n### Recipe: MAG (Metagenome-Assembled Genome) Annotation\n\nWhen to use: Annotating a bin from metagenomic assembly where Prodigal cannot train on the full sequence.\n\n```bash\nbakta MAG_bin_42.fasta \\\n    --db db\u002Fbakta_db_light \\\n    --output mag_annotation\u002F \\\n    --prefix MAG_bin_42 \\\n    --meta \\\n    --min-contig-length 500 \\\n    --skip-plot \\\n    --threads 8\n\ncat mag_annotation\u002FMAG_bin_42.txt | head -20\n```\n\n### Recipe: Annotation with Custom Expert Protein Database\n\nWhen to use: You have curated reference proteins (e.g., a virulence factor catalog) that should take priority over UniRef.\n\n```bash\n# Custom proteins are searched before the bundled UniRef DB\nbakta genome.fasta \\\n    --db db\u002Fbakta_db_light \\\n    --proteins virulence_factors.faa \\\n    --output annotation_custom\u002F \\\n    --prefix novel_strain \\\n    --threads 8\n\necho \"Annotations referencing custom DB:\"\ngrep \"User-provided\" annotation_custom\u002Fnovel_strain.tsv | head\n```\n\n### Recipe: Convert Bakta GFF3 to a Pandas DataFrame\n\nWhen to use: You need feature coordinates and qualifiers for downstream coordinate-overlap analyses.\n\n```python\nimport pandas as pd\n\ndef parse_gff3(gff_file):\n    rows = []\n    with open(gff_file) as f:\n        for line in f:\n            if line.startswith(\"##FASTA\"):\n                break\n            if line.startswith(\"#\") or not line.strip():\n                continue\n            parts = line.rstrip(\"\\n\").split(\"\\t\")\n            if len(parts) \u003C 9:\n                continue\n            attrs = {}\n            for item in parts[8].split(\";\"):\n                if \"=\" in item:\n                    k, v = item.split(\"=\", 1)\n                    attrs[k] = v\n            rows.append({\n                \"seqname\":   parts[0],\n                \"feature\":   parts[2],\n                \"start\":     int(parts[3]),\n                \"end\":       int(parts[4]),\n                \"strand\":    parts[6],\n                \"locus_tag\": attrs.get(\"locus_tag\", attrs.get(\"ID\", \"\")),\n                \"gene\":      attrs.get(\"gene\", \"\"),\n                \"product\":   attrs.get(\"product\", \"\"),\n            })\n    return pd.DataFrame(rows)\n\ngff_df = parse_gff3(\"annotation\u002FE_coli_K12.gff3\")\nprint(f\"Features parsed: {len(gff_df)}\")\nprint(gff_df[gff_df[\"feature\"] == \"CDS\"].head(5).to_string(index=False))\n```\n\n## Expected Outputs\n\n| Output File | Format | Description |\n|-------------|--------|-------------|\n| `{prefix}.gff3` | GFF3 | Genome annotation with feature coordinates and attributes; INSDC-compliant |\n| `{prefix}.gbff` | GenBank Flat File | Annotated GenBank record for use in Geneious, BioPython, NCBI submission prep |\n| `{prefix}.embl` | EMBL | EMBL-format annotation for ENA submission |\n| `{prefix}.fna` | FASTA | Nucleotide sequences of the input contigs |\n| `{prefix}.ffn` | FASTA | Nucleotide sequences of all annotated features |\n| `{prefix}.faa` | FASTA | Protein sequences for all CDS features |\n| `{prefix}.hypotheticals.faa` | FASTA | Protein sequences flagged as hypothetical (for further investigation) |\n| `{prefix}.hypotheticals.tsv` | TSV | Detailed table for hypothetical CDS with low-confidence hits |\n| `{prefix}.tsv` | TSV | Full feature table: seqid, type, start, stop, strand, locus_tag, gene, product, dbxrefs |\n| `{prefix}.json` | JSON | Machine-readable summary with genome metadata + every feature with full qualifiers |\n| `{prefix}.png` \u002F `.svg` | Image | Circos circular genome plot colored by COG category |\n| `{prefix}.txt` | Text | Plain-text summary of feature counts and per-replicon stats |\n| `{prefix}.log` | Text | Full Bakta run log including timing per step |\n\n## Troubleshooting\n\n| Problem | Cause | Solution |\n|---------|-------|----------|\n| `Error: database not found at \u003Cpath>` | DB path incorrect, or DB not extracted | Re-run `bakta_db download --output db\u002F --type light`; pass full path to `--db` |\n| `KILLED` during DIAMOND step | Out of memory on full DB | Switch to `--type light`, reduce `--threads`, or run on a host with ≥ 32 GB RAM |\n| Very high hypothetical-protein rate (>60 %) | Divergent strain or light DB without close hits | Re-run with the full DB or supply a curated `--proteins` reference set |\n| `tRNAscan-SE: Error opening file` | Missing tRNAscan-SE installation in conda env | `mamba install -c bioconda trnascan-se` and rerun |\n| Bakta complains about contig headers | Spaces or special characters in FASTA IDs | Pre-clean headers with `awk '\u002F^>\u002F{print \">contig_\"++i; next}{print}'` |\n| Plot generation hangs or fails | Circos \u002F matplotlib backend issue | Re-run with `--skip-plot`; render later via `bakta_plot` from the JSON file |\n| `AMRFinderPlus: database not up-to-date` warning | AMRFinderPlus DB stale | `amrfinder -u` to refresh, or pass `--skip-amr` to bypass |\n| Different locus tag prefix than expected | `--locus-tag` not set, default uses random prefix | Explicitly pass `--locus-tag MYORG` to control prefix |\n| Run is much slower than reported | Default `--threads 1` | Set `--threads` to physical core count; use `--skip-plot` for batch jobs |\n\n## References\n\n- [Bakta GitHub: oschwengers\u002Fbakta](https:\u002F\u002Fgithub.com\u002Foschwengers\u002Fbakta) — source code, installation, parameter reference, and changelog\n- [Schwengers et al. (2021) Microb Genom 7(11):000685](https:\u002F\u002Fdoi.org\u002F10.1099\u002Fmgen.0.000685) — original Bakta publication with benchmarks vs. Prokka and PGAP\n- [Bakta database releases on Zenodo](https:\u002F\u002Fdoi.org\u002F10.5281\u002Fzenodo.4247252) — versioned light\u002Ffull database archives\n- [Prodigal documentation](https:\u002F\u002Fgithub.com\u002Fhyattpd\u002FProdigal\u002Fwiki) — gene prediction engine used by Bakta for CDS calling\n- [BioPython GenBank parsing tutorial](https:\u002F\u002Fbiopython.org\u002Fwiki\u002FSeqIO) — reference for parsing Bakta `.gbff` output in Python\n- [DIAMOND aligner](https:\u002F\u002Fgithub.com\u002Fbbuchfink\u002Fdiamond) — protein search engine used for the UniRef-derived database lookups\n","# Bakta Genome Annotation\n\n## Overview\n\nBakta is a command-line pipeline for rapid, standardized annotation of bacterial and archaeal genomes and plasmids. It combines Prodigal for CDS prediction, tRNAscan-SE\u002FAragorn\u002FBarrnap\u002FInfernal for non-coding RNA, PILER-CR\u002FPILERCR for CRISPR detection, and a tiered DIAMOND\u002FHMM search against a curated UniRef100 + IPS\u002FUPS database to assign gene names, EC numbers, GO terms, and COG categories. Bakta produces NCBI-compatible outputs (GFF3, GenBank, EMBL, INSDC-formatted FASTA, plus a JSON summary and a circular Circos plot) for a typical 5 Mb genome in 5–15 minutes on 8 CPUs.\n\n## When to Use\n\n- Annotating bacterial or archaeal genome assemblies (Illumina, PacBio, Nanopore) with NCBI-compatible locus tags and product names\n- Annotating plasmids and other circular replicons separately with `--plasmid` and `--complete` flags\n- Producing JSON-structured annotation outputs that can be parsed without GenBank or GFF3 detours\n- Generating a publication-ready circular genome plot via the bundled `bakta_plot` command\n- Annotating MAGs (metagenome-assembled genomes) with `--meta` to disable Prodigal training\n- Use **Prokka** instead when you need viral\u002Fmitochondrial kingdoms or when you must reproduce a legacy Prokka pipeline exactly\n- Use **PGAP** instead when submitting to NCBI GenBank with full standards compliance\n- Use **Bakta** when you want faster runs, regularly updated UniRef-derived databases, AMRFinderPlus integration, and a JSON summary out of the box\n\n## Prerequisites\n\n- **Software**: Bakta ≥ 1.9, Python 3.8+, Prodigal, tRNAscan-SE, Aragorn, Barrnap, Infernal, DIAMOND, HMMER3, PILER-CR, BLAST+, AMRFinderPlus\n- **Database**: Bakta DB (full ~70 GB, or light ~3 GB) downloaded once with `bakta_db download`\n- **Python packages** (for output parsing): `biopython`, `pandas`, `matplotlib`\n- **Input**: assembled genome in FASTA format (one or more contigs)\n- **Hardware**: ≥ 16 GB RAM for full DB, ≥ 4 GB RAM for light DB; ≥ 8 CPUs recommended\n\n> **Check before installing**: The tool may already be available in the current environment (e.g., inside a `pixi` \u002F `conda` env). Run `command -v bakta` first and skip the install commands below if it returns a path. When running inside a pixi project, invoke the tool via `pixi run bakta` rather than bare `bakta`.\n\n```bash\n# Install Bakta via conda\u002Fmamba (recommended)\nmamba install -c conda-forge -c bioconda bakta\n\n# Verify installation\nbakta --version\n# bakta 1.9.4\n\n# Download the light database (~3 GB, faster, fewer functional hits)\nbakta_db download --output db\u002F --type light\n\n# Or full database (~70 GB, comprehensive UniRef100 coverage)\n# bakta_db download --output db\u002F --type full\n\n# Install Python parsing dependencies\npip install biopython pandas matplotlib\n```\n\n## Pre-flight Interview\n\nSettle these with the user before writing any analysis code.\n\n```yaml\ndecisions:\n  - id: D1\n    param: database\n    kind: required\n    source: user\n    ask: \"Annotate against the light database or the full one? The light database leaves more genes described only generically.\"\n    default: null\n\n  - id: D2\n    param: organismMetadata\n    kind: required\n    source: user\n    ask: \"Which genus, species, and strain should be recorded in the output?\"\n    default: null\n\n  - id: D3\n    param: repliconTopology\n    kind: required\n    source: data\n    ask: \"Are these contigs complete circular replicons, plasmids, or draft fragments?\"\n    default: \"draft fragments - no circularity assumed\"\n\n  - id: D4\n    param: assemblyOrigin\n    kind: required\n    source: data\n    ask: \"Is this an isolate genome, or a bin recovered from a metagenome?\"\n    default: \"isolate - gene prediction trains on the assembly itself\"\n\n  - id: D5\n    param: translationTable\n    kind: required\n    source: user\n    ask: \"Which genetic code does this organism use?\"\n    default: \"11, the bacterial and archaeal code\"\n\n  - id: D6\n    param: locusTagPrefix\n    kind: optional\n    source: user\n    ask: \"Which prefix should locus tags carry, if they will be submitted or cross-referenced?\"\n    default: \"generated automatically\"\n\n  - id: D7\n    param: minContigLength\n    kind: optional_conditional\n    source: data\n    ask: \"Should short contigs be skipped?\"\n    default: \"no minimum\"\n\n  - id: D8\n    param: threadsAndPlotting\n    kind: never_ask\n    source: data\n    reason: \"Thread count and the circular plot affect runtime and output files, not the annotation\"\n    default: \"available cores, plot enabled\"\n```\n\nD5 is asked rather than defaulted because the exceptions are real and silent:\nMycoplasma and relatives reassign a stop codon, so annotating them with the\nstandard bacterial code truncates a large fraction of their genes into\nfragments that still look like ordinary short CDS calls.\n\n## Quick Start\n\n```bash\n# Annotate a bacterial genome — results in results\u002F directory\nbakta genome.fasta \\\n    --db db\u002Fbakta_db_light \\\n    --output results\u002F \\\n    --prefix sample1 \\\n    --threads 8\n\n# Inspect the JSON summary for feature counts\npython -c \"\nimport json\nwith open('results\u002Fsample1.json') as f:\n    d = json.load(f)\nprint('Genus:', d['genome'].get('genus'))\nprint('Length:', d['genome']['size'], 'bp')\nprint('CDS:', sum(1 for f in d['features'] if f['type'] == 'cds'))\nprint('tRNA:', sum(1 for f in d['features'] if f['type'] == 'tRNA'))\n\"\n```\n\n## Workflow\n\n### Step 1: Install Bakta and Download the Database\n\nInstall Bakta and prepare the reference database. The database download is one-time and reused across runs.\n\n```bash\n# Create a dedicated conda environment (avoids dependency conflicts)\nmamba create -n bakta_env -c conda-forge -c bioconda bakta python=3.11 -y\nmamba activate bakta_env\n\n# Verify Bakta and its dependencies\nbakta --version\n# bakta 1.9.4\n\nbakta --help | head -20\n\n# Download the light database (sufficient for routine annotation)\nmkdir -p db\u002F\nbakta_db download --output db\u002F --type light\n# Downloads ~3 GB; expands to ~5 GB on disk\n\n# Verify the database was extracted correctly\nls db\u002Fbakta_db_light\u002F\n# antifam.h3f  bakta.db  expert  oric.fna  pfam.h3f  rfam-go.tsv  ...\n\n# (Optional) Update AMRFinderPlus DB used by Bakta for AMR gene calling\namrfinder -u\n\n# Install Python parsing tools\npip install biopython pandas matplotlib\n```\n\n### Step 2: Prepare the Input Assembly\n\nBakta requires clean FASTA headers without spaces or special characters. Pre-clean and optionally filter short contigs.\n\n```python\nfrom Bio import SeqIO\nimport re\n\ninput_fasta = \"genome.fasta\"\nrecords = list(SeqIO.parse(input_fasta, \"fasta\"))\nprint(f\"Input assembly: {len(records)} contigs\")\ntotal_bases = sum(len(r) for r in records)\nprint(f\"Total bases: {total_bases:,}\")\nprint(f\"Largest contig: {max(len(r) for r in records):,} bp\")\n\n# Bakta preferred: short, alphanumeric, unique IDs\ncleaned = []\nfor i, rec in enumerate(records, 1):\n    new_id = f\"contig_{i:04d}\"\n    new_rec = rec.__class__(rec.seq, id=new_id, description=\"\")\n    cleaned.append(new_rec)\n\nSeqIO.write(cleaned, \"genome_clean.fasta\", \"fasta\")\nprint(f\"Wrote genome_clean.fasta with {len(cleaned)} contigs\")\n```\n\n```bash\n# Filter out short contigs (\u003C200 bp) which contribute little to annotation\nawk 'BEGIN{RS=\">\"; ORS=\"\"} NR>1 {n=split($0, a, \"\\n\"); seq=\"\"; for(i=2;i\u003C=n;i++) seq=seq a[i]; if (length(seq) >= 200) print \">\" $0}' \\\n    genome_clean.fasta > genome_filtered.fasta\n\necho \"Filtered assembly: $(grep -c '>' genome_filtered.fasta) contigs\"\n```\n\n### Step 3: Run Standard Bakta Annotation\n\nRun Bakta with genus\u002Fspecies hints. Locus tags are auto-generated from the strain field.\n\n```bash\n# Standard annotation for a draft bacterial genome\nbakta genome_clean.fasta \\\n    --db db\u002Fbakta_db_light \\\n    --output annotation\u002F \\\n    --prefix E_coli_K12 \\\n    --genus Escherichia \\\n    --species coli \\\n    --strain K12 \\\n    --locus-tag ECOLI \\\n    --threads 8 \\\n    --keep-contig-headers\n\n# Expected runtime: 5–15 min for ~5 Mb genome on 8 CPUs (light DB)\n\necho \"Bakta annotation outputs:\"\nls annotation\u002F\n# E_coli_K12.embl   E_coli_K12.faa     E_coli_K12.ffn\n# E_coli_K12.fna    E_coli_K12.gbff    E_coli_K12.gff3\n# E_coli_K12.hypotheticals.faa  E_coli_K12.hypotheticals.tsv\n# E_coli_K12.json   E_coli_K12.log     E_coli_K12.png\n# E_coli_K12.svg    E_coli_K12.tsv     E_coli_K12.txt\n```\n\n### Step 4: Parse the JSON Summary\n\nBakta's JSON output is the canonical, machine-readable annotation. Parse it directly for downstream pipelines.\n\n```python\nimport json\nimport pandas as pd\nfrom collections import Counter\n\nwith open(\"annotation\u002FE_coli_K12.json\") as f:\n    bakta = json.load(f)\n\n# Genome-level metadata\ngenome = bakta[\"genome\"]\nprint(f\"Organism: {genome.get('genus')} {genome.get('species')} {genome.get('strain')}\")\nprint(f\"Size: {genome['size']:,} bp across {len(bakta['sequences'])} sequences\")\nprint(f\"GC content: {genome['gc']:.2%}\")\n\n# Feature type counts\nfeatures = bakta[\"features\"]\ntype_counts = Counter(f[\"type\"] for f in features)\nprint(\"\\nFeature counts:\")\nfor ftype, n in sorted(type_counts.items(), key=lambda x: -x[1]):\n    print(f\"  {ftype:>10}: {n}\")\n\n# Build a tidy CDS DataFrame\ncds_rows = []\nfor f in features:\n    if f[\"type\"] != \"cds\":\n        continue\n    cds_rows.append({\n        \"locus_tag\": f.get(\"locus\", \"\"),\n        \"contig\":    f.get(\"contig\", \"\"),\n        \"start\":     f.get(\"start\"),\n        \"stop\":      f.get(\"stop\"),\n        \"strand\":    f.get(\"strand\"),\n        \"gene\":      f.get(\"gene\", \"\"),\n        \"product\":   f.get(\"product\", \"\"),\n        \"length_aa\": len(f.get(\"aa\", \"\")),\n    })\n\ncds_df = pd.DataFrame(cds_rows)\nprint(f\"\\nTotal CDS: {len(cds_df)}\")\nprint(cds_df.head(5).to_string(index=False))\n```\n\n### Step 5: Parse the TSV Feature Table\n\nThe TSV output is convenient for spreadsheet workflows and quick filtering.\n\n```python\nimport pandas as pd\n\n# Bakta TSV begins with comment lines starting with '#'\ndf = pd.read_csv(\"annotation\u002FE_coli_K12.tsv\", sep=\"\\t\", comment=\"#\",\n                 names=[\"sequence_id\", \"type\", \"start\", \"stop\", \"strand\",\n                        \"locus_tag\", \"gene\", \"product\", \"dbxrefs\"])\nprint(f\"Total features: {len(df)}\")\nprint(f\"Feature types: {df['type'].value_counts().to_dict()}\")\n\n# Hypothetical vs annotated CDS\ncds = df[df[\"type\"] == \"cds\"].copy()\nhypothetical = cds[\"product\"].str.contains(\"hypothetical\", case=False, na=True)\nprint(f\"\\nCDS with assigned function: {(~hypothetical).sum()} \u002F {len(cds)}\")\nprint(f\"Hypothetical proteins: {hypothetical.sum()}\")\n\n# Cross-references (UniRef, KEGG, EC, GO, etc.) parsed from the dbxrefs column\ndef split_xrefs(xref_str):\n    if not isinstance(xref_str, str) or xref_str in (\"\", \"-\"):\n        return []\n    return [x.strip() for x in xref_str.split(\",\")]\n\ncds[\"dbxref_list\"] = cds[\"dbxrefs\"].apply(split_xrefs)\nec_hits = cds[cds[\"dbxref_list\"].apply(lambda xs: any(x.startswith(\"EC:\") for x in xs))]\nprint(f\"CDS with EC numbers: {len(ec_hits)}\")\nprint(ec_hits[[\"locus_tag\", \"gene\", \"product\"]].head(5).to_string(index=False))\n```\n\n### Step 6: Render the Circular Genome Plot\n\nBakta emits a Circos-style PNG\u002FSVG by default. Regenerate with custom styling using `bakta_plot`.\n\n```bash\n# Re-render the plot from the existing JSON with a different style\nbakta_plot --output annotation\u002F \\\n           --prefix E_coli_K12_replot \\\n           --type cog \\\n           --dpi 300 \\\n           annotation\u002FE_coli_K12.json\n\nls annotation\u002FE_coli_K12_replot.*\n# E_coli_K12_replot.png  E_coli_K12_replot.svg\n\n# Display the rendered PNG inline in a Jupyter notebook\npython \u003C\u003C'PY'\nfrom pathlib import Path\nimport matplotlib.pyplot as plt\nimport matplotlib.image as mpimg\n\nimg = mpimg.imread(\"annotation\u002FE_coli_K12.png\")\nfig, ax = plt.subplots(figsize=(6, 6))\nax.imshow(img)\nax.axis(\"off\")\nax.set_title(\"Bakta circular genome annotation\")\nplt.savefig(\"bakta_circular_thumbnail.png\", dpi=120, bbox_inches=\"tight\")\nprint(\"Saved bakta_circular_thumbnail.png\")\nPY\n```\n\n### Step 7: Compute Annotation Quality Statistics\n\nSummarize hypothetical-protein rate, gene density, and feature coverage to assess annotation quality.\n\n```python\nimport json\nimport pandas as pd\nimport matplotlib.pyplot as plt\n\nwith open(\"annotation\u002FE_coli_K12.json\") as f:\n    bakta = json.load(f)\n\ngenome_size = bakta[\"genome\"][\"size\"]\nfeatures = bakta[\"features\"]\n\n# Per-feature-type counts and density (per Mb)\ncounts = {}\nfor f in features:\n    counts[f[\"type\"]] = counts.get(f[\"type\"], 0) + 1\ndensity = {k: v \u002F (genome_size \u002F 1e6) for k, v in counts.items()}\n\ncds = [f for f in features if f[\"type\"] == \"cds\"]\nn_cds = len(cds)\nn_hypo = sum(1 for f in cds if \"hypothetical\" in (f.get(\"product\") or \"\").lower())\nn_known = n_cds - n_hypo\ncoding_density = sum(abs(f[\"stop\"] - f[\"start\"] + 1) for f in cds) \u002F genome_size\n\nprint(f\"Genome: {genome_size:,} bp\")\nprint(f\"CDS: {n_cds}  ({density.get('cds', 0):.1f} per Mb)\")\nprint(f\"  Known function: {n_known}  Hypothetical: {n_hypo}\")\nprint(f\"Coding density: {coding_density:.1%}\")\nprint(f\"tRNA: {counts.get('tRNA', 0)}   rRNA: {counts.get('rRNA', 0)}\")\nprint(f\"ncRNA: {counts.get('ncRNA', 0)}  CRISPR: {counts.get('crispr', 0)}\")\n\n# Bar plot of feature type counts\nfig, ax = plt.subplots(figsize=(8, 4))\nitems = sorted(counts.items(), key=lambda x: -x[1])\nlabels = [k for k, _ in items]\nvalues = [v for _, v in items]\nbars = ax.bar(labels, values, color=\"#2980B9\", edgecolor=\"white\")\nfor bar, v in zip(bars, values):\n    ax.text(bar.get_x() + bar.get_width() \u002F 2, v + max(values) * 0.01,\n            str(v), ha=\"center\", fontsize=9)\nax.set_ylabel(\"Count\")\nax.set_title(\"Bakta feature counts by type\")\nplt.xticks(rotation=20)\nplt.tight_layout()\nplt.savefig(\"bakta_feature_counts.png\", dpi=150, bbox_inches=\"tight\")\nprint(\"Saved bakta_feature_counts.png\")\n```\n\n### Step 8: Batch Annotation Across Multiple Genomes\n\nRun Bakta over a directory of assemblies and aggregate per-sample summary statistics.\n\n```bash\n#!\u002Fbin\u002Fbash\n# batch_bakta.sh — annotate all FASTA files in a directory\nINPUT_DIR=\"genomes\u002F\"\nOUTPUT_DIR=\"annotations\u002F\"\nDB=\"db\u002Fbakta_db_light\"\nmkdir -p \"$OUTPUT_DIR\"\n\nfor FASTA in \"$INPUT_DIR\"\u002F*.fasta; do\n    SAMPLE=$(basename \"$FASTA\" .fasta)\n    echo \"Annotating: $SAMPLE\"\n    bakta \"$FASTA\" \\\n        --db \"$DB\" \\\n        --output \"${OUTPUT_DIR}\u002F${SAMPLE}\" \\\n        --prefix \"$SAMPLE\" \\\n        --threads 4 \\\n        --skip-plot \\\n        --force\ndone\n\necho \"Batch annotation complete.\"\n```\n\n```python\n# Aggregate per-genome summaries from each sample's JSON file\nfrom pathlib import Path\nimport json\nimport pandas as pd\n\nannotation_dir = Path(\"annotations\u002F\")\nrows = []\nfor json_file in sorted(annotation_dir.glob(\"*\u002F*.json\")):\n    with open(json_file) as f:\n        bakta = json.load(f)\n    sample = json_file.stem\n    counts = {}\n    for feat in bakta[\"features\"]:\n        counts[feat[\"type\"]] = counts.get(feat[\"type\"], 0) + 1\n    rows.append({\n        \"sample\":  sample,\n        \"size\":    bakta[\"genome\"][\"size\"],\n        \"gc\":      bakta[\"genome\"][\"gc\"],\n        \"CDS\":     counts.get(\"cds\", 0),\n        \"tRNA\":    counts.get(\"tRNA\", 0),\n        \"rRNA\":    counts.get(\"rRNA\", 0),\n        \"ncRNA\":   counts.get(\"ncRNA\", 0),\n        \"crispr\":  counts.get(\"crispr\", 0),\n    })\n\nsummary_df = pd.DataFrame(rows)\nprint(f\"Annotated genomes: {len(summary_df)}\")\nprint(summary_df.to_string(index=False))\nsummary_df.to_csv(\"batch_bakta_summary.csv\", index=False)\nprint(\"Saved: batch_bakta_summary.csv\")\n```\n\n## Key Parameters\n\n| Parameter | Default | Range \u002F Options | Effect |\n|-----------|---------|-----------------|--------|\n| `--db` | — | path to Bakta DB directory | Required; selects light or full reference DB |\n| `--genus` | — | any genus name string | Sets organism metadata in GenBank\u002FEMBL output |\n| `--species` | — | any species name string | Combined with `--genus` for organism qualifier |\n| `--strain` | — | any string | Adds strain qualifier to organism metadata |\n| `--locus-tag` | auto | 3–24 alphanumeric chars | Prefix for locus tags (e.g., `ECOLI_00001`) |\n| `--complete` | off | flag | Treat all input contigs as complete circular replicons |\n| `--plasmid` | off | flag | Treat all input contigs as plasmids (circular) |\n| `--meta` | off | flag | Disable Prodigal training (use for MAGs \u002F metagenomic bins) |\n| `--translation-table` | `11` | NCBI table IDs (1, 4, 11, 25, …) | Genetic code used by Prodigal for CDS translation |\n| `--min-contig-length` | `1` | any integer (bp) | Skip contigs shorter than this length |\n| `--threads` | `1` | `1`–CPU count | Parallel threads for DIAMOND\u002FHMMER searches |\n| `--skip-plot` | off | flag | Skip the slow circular plot rendering step |\n| `--keep-contig-headers` | off | flag | Preserve original contig IDs instead of renaming |\n| `--proteins` | — | path to GenBank or FASTA file | Custom expert protein DB used before UniRef search |\n\n## Common Recipes\n\n### Recipe: Plasmid-only Annotation\n\nWhen to use: A finished circular plasmid sequence that should be annotated without chromosome assumptions.\n\n```bash\nbakta plasmid.fasta \\\n    --db db\u002Fbakta_db_light \\\n    --output plasmid_annotation\u002F \\\n    --prefix pBR322 \\\n    --plasmid \\\n    --complete \\\n    --threads 4\n\n# Inspect plasmid-typing results (incompatibility group, replication initiator)\ngrep -E \"rep|inc\" plasmid_annotation\u002FpBR322.tsv | head -10\n```\n\n### Recipe: MAG (Metagenome-Assembled Genome) Annotation\n\nWhen to use: Annotating a bin from metagenomic assembly where Prodigal cannot train on the full sequence.\n\n```bash\nbakta MAG_bin_42.fasta \\\n    --db db\u002Fbakta_db_light \\\n    --output mag_annotation\u002F \\\n    --prefix MAG_bin_42 \\\n    --meta \\\n    --min-contig-length 500 \\\n    --skip-plot \\\n    --threads 8\n\ncat mag_annotation\u002FMAG_bin_42.txt | head -20\n```\n\n### Recipe: Annotation with Custom Expert Protein Database\n\nWhen to use: You have curated reference proteins (e.g., a virulence factor catalog) that should take priority over UniRef.\n\n```bash\n# Custom proteins are searched before the bundled UniRef DB\nbakta genome.fasta \\\n    --db db\u002Fbakta_db_light \\\n    --proteins virulence_factors.faa \\\n    --output annotation_custom\u002F \\\n    --prefix novel_strain \\\n    --threads 8\n\necho \"Annotations referencing custom DB:\"\ngrep \"User-provided\" annotation_custom\u002Fnovel_strain.tsv | head\n```\n\n### Recipe: Convert Bakta GFF3 to a Pandas DataFrame\n\nWhen to use: You need feature coordinates and qualifiers for downstream coordinate-overlap analyses.\n\n```python\nimport pandas as pd\n\ndef parse_gff3(gff_file):\n    rows = []\n    with open(gff_file) as f:\n        for line in f:\n            if line.startswith(\"##FASTA\"):\n                break\n            if line.startswith(\"#\") or not line.strip():\n                continue\n            parts = line.rstrip(\"\\n\").split(\"\\t\")\n            if len(parts) \u003C 9:\n                continue\n            attrs = {}\n            for item in parts[8].split(\";\"):\n                if \"=\" in item:\n                    k, v = item.split(\"=\", 1)\n                    attrs[k] = v\n            rows.append({\n                \"seqname\":   parts[0],\n                \"feature\":   parts[2],\n                \"start\":     int(parts[3]),\n                \"end\":       int(parts[4]),\n                \"strand\":    parts[6],\n                \"locus_tag\": attrs.get(\"locus_tag\", attrs.get(\"ID\", \"\")),\n                \"gene\":      attrs.get(\"gene\", \"\"),\n                \"product\":   attrs.get(\"product\", \"\"),\n            })\n    return pd.DataFrame(rows)\n\ngff_df = parse_gff3(\"annotation\u002FE_coli_K12.gff3\")\nprint(f\"Features parsed: {len(gff_df)}\")\nprint(gff_df[gff_df[\"feature\"] == \"CDS\"].head(5).to_string(index=False))\n```\n\n## Expected Outputs\n\n| Output File | Format | Description |\n|-------------|--------|-------------|\n| `{prefix}.gff3` | GFF3 | Genome annotation with feature coordinates and attributes; INSDC-compliant |\n| `{prefix}.gbff` | GenBank Flat File | Annotated GenBank record for use in Geneious, BioPython, NCBI submission prep |\n| `{prefix}.embl` | EMBL | EMBL-format annotation for ENA submission |\n| `{prefix}.fna` | FASTA | Nucleotide sequences of the input contigs |\n| `{prefix}.ffn` | FASTA | Nucleotide sequences of all annotated features |\n| `{prefix}.faa` | FASTA | Protein sequences for all CDS features |\n| `{prefix}.hypotheticals.faa` | FASTA | Protein sequences flagged as hypothetical (for further investigation) |\n| `{prefix}.hypotheticals.tsv` | TSV | Detailed table for hypothetical CDS with low-confidence hits |\n| `{prefix}.tsv` | TSV | Full feature table: seqid, type, start, stop, strand, locus_tag, gene, product, dbxrefs |\n| `{prefix}.json` | JSON | Machine-readable summary with genome metadata + every feature with full qualifiers |\n| `{prefix}.png` \u002F `.svg` | Image | Circos circular genome plot colored by COG category |\n| `{prefix}.txt` | Text | Plain-text summary of feature counts and per-replicon stats |\n| `{prefix}.log` | Text | Full Bakta run log including timing per step |\n\n## Troubleshooting\n\n| Problem | Cause | Solution |\n|---------|-------|----------|\n| `Error: database not found at \u003Cpath>` | DB path incorrect, or DB not extracted | Re-run `bakta_db download --output db\u002F --type light`; pass full path to `--db` |\n| `KILLED` during DIAMOND step | Out of memory on full DB | Switch to `--type light`, reduce `--threads`, or run on a host with ≥ 32 GB RAM |\n| Very high hypothetical-protein rate (>60 %) | Divergent strain or light DB without close hits | Re-run with the full DB or supply a curated `--proteins` reference set |\n| `tRNAscan-SE: Error opening file` | Missing tRNAscan-SE installation in conda env | `mamba install -c bioconda trnascan-se` and rerun |\n| Bakta complains about contig headers | Spaces or special characters in FASTA IDs | Pre-clean headers with `awk '\u002F^>\u002F{print \">contig_\"++i; next}{print}'` |\n| Plot generation hangs or fails | Circos \u002F matplotlib backend issue | Re-run with `--skip-plot`; render later via `bakta_plot` from the JSON file |\n| `AMRFinderPlus: database not up-to-date` warning | AMRFinderPlus DB stale | `amrfinder -u` to refresh, or pass `--skip-amr` to bypass |\n| Different locus tag prefix than expected | `--locus-tag` not set, default uses random prefix | Explicitly pass `--locus-tag MYORG` to control prefix |\n| Run is much slower than reported | Default `--threads 1` | Set `--threads` to physical core count; use `--skip-plot` for batch jobs |\n\n## References\n\n- [Bakta GitHub: oschwengers\u002Fbakta](https:\u002F\u002Fgithub.com\u002Foschwengers\u002Fbakta) — source code, installation, parameter reference, and changelog\n- [Schwengers et al. (2021) Microb Genom 7(11):000685](https:\u002F\u002Fdoi.org\u002F10.1099\u002Fmgen.0.000685) — original Bakta publication with benchmarks vs. Prokka and PGAP\n- [Bakta database releases on Zenodo](https:\u002F\u002Fdoi.org\u002F10.5281\u002Fzenodo.4247252) — versioned light\u002Ffull database archives\n- [Prodigal documentation](https:\u002F\u002Fgithub.com\u002Fhyattpd\u002FProdigal\u002Fwiki) — gene prediction engine used by Bakta for CDS calling\n- [BioPython GenBank parsing tutorial](https:\u002F\u002Fbiopython.org\u002Fwiki\u002FSeqIO) — reference for parsing Bakta `.gbff` output in Python\n- [DIAMOND aligner](https:\u002F\u002Fgithub.com\u002Fbbuchfink\u002Fdiamond) — protein search engine used for the UniRef-derived database lookups\n",{"name":5,"license":15,"description":7},"master","fd76f882a04e445e899d5cfb2732f2105ea054ee","skills\u002Fawesome-skills\u002Fbakta-genome-annotation",0,"https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS","https:\u002F\u002Fbg-szy.github.io\u002FTOP-SKILLS\u002F","https:\u002F\u002Fgithub.com\u002Fbg-szy","https:\u002F\u002Fwww.ecust.edu.cn\u002F","a student of East China University of Science and Technology","2026-11-15 03:38:02",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add bg-szy\u002FTOP-SKILLS --skill bakta-genome-annotation",{"tool":40,"command":41},"bunx","bunx skills add bg-szy\u002FTOP-SKILLS --skill bakta-genome-annotation",{"tool":43,"command":44},"pnpm","pnpm dlx skills add bg-szy\u002FTOP-SKILLS --skill bakta-genome-annotation","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fawesome-skills\u002Fbakta-genome-annotation\u002FSKILL.md",true,[],[49,58,65,72,79,86],{"skillNo":50,"name":51,"nameZh":6,"description":52,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":53,"licenseFileUrl":6,"sourceHtmlUrl":54,"categories":55,"keywords":56,"publishedAt":57},"01M7DXW9N826PKXK174PVW3038","serpmaven","Scrape Google search results (SERP) to JSON with SERP Maven (serpmaven) - a real Chrome browser on a residential proxy with sticky sessions. Run it as a CLI, a Python library, a local HTTP search API (`serve`), an MCP server or a Docker image; set the proxy login, workers, pages and cost tracking. Use when the user wants Google results, rank tracking, a self-hosted SERP API, or live Google search for an AI agent.","MIT","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Fserpmaven\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":59,"name":60,"nameZh":6,"description":61,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":53,"licenseFileUrl":6,"sourceHtmlUrl":62,"categories":63,"keywords":64,"publishedAt":57},"01M7DXVHSTWDV65475QEQ915M7","revnu-landing-page-audit","Find out why a landing page isn't turning visitors into signups, demos or sales. Audits one page against what the ad, post or search that sends people there promised, then checks the first screen, proof, call to action, friction and mobile. Returns at most 7 prioritized fixes, plus what is fine and what could not be checked; rewrites specific lines and fixes the page in the repo when asked. Never promises a conversion lift. Works without a Revnu account. Use when the user says or asks: \"audit my landing page\", \"why isn't this page converting\", \"review my homepage\", \"my ads get clicks but no signups\", \"people bounce from the pricing page\", \"CRO review\", \"improve conversion rate\", \"is my hero section clear\", \"roast my landing page\", \"rewrite my headline\", \"what's wrong with this page\", \"landing page feedback\", \"make the signup page convert better\". Not for SEO or AI-search audits, page speed engineering on its own, or building a new page from scratch.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Frevnu-landing-page-audit\u002FSKILL.md",[],[],{"skillNo":66,"name":67,"nameZh":6,"description":68,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":53,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":57},"01M7DXV8X2D7B3VTD4HHYYHTGR","revnu-growth-context","Write down once who buys, what they're stuck on, what it costs, what proof you have and what you've already tried, so every growth task starts from facts instead of a questionnaire. Creates or updates .agents\u002Frevnu-growth.md from the repo, the live site and the user, and imports an existing product-marketing.md. Use when the user says \"set up our marketing context\", \"who is our ideal customer\", \"write our ICP\", \"describe the product for marketing\", \"positioning doc\", \"what's our brand voice\", \"remember this about our customers\", \"log what we tried\", \"what have we learned from marketing\", \"we changed pricing, update the context\", \"update our growth notes\", \"summarize the business for the agent\", \"import my product-marketing.md\", \"start a growth doc\", or before a first marketing, SEO, outreach or launch task when no context file exists. Works without a Revnu account.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Frevnu-growth-context\u002FSKILL.md",[],[],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":53,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":57},"01M7DXV0DGJ1G0A60PAHC6J3C5","revnu-get-listed","Get onto the third-party pages AI answers and search cite when buyers ask for the best tool in your category: \"best X\" roundups, directories, review sites, GitHub awesome lists, community threads and comparison pages. Finds which ones are cited, ranks them by fit and effort, and drafts each submission, PR or pitch by the target's own rules. Use when the user says \"get us listed\", \"which directories should we submit to\", \"how do we get into best-of lists\", \"why does ChatGPT recommend competitors and not us\", \"get mentioned in AI answers\", \"submit to awesome lists\", \"get on G2\", \"where are our competitors listed\", \"pitch listicle authors\", \"find backlink opportunities\", \"launch directories\", \"get into roundups\", \"Product Hunt alternatives\", \"where should we be listed\", \"get cited by Perplexity\". Never submits, pays or posts without a yes. Works without a Revnu account.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Frevnu-get-listed\u002FSKILL.md",[],[],{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":53,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":57},"01M7DXTSPMGT9D6DSS0HP9BSTA","revnu-ai-readiness-audit","Audit whether your website gives ChatGPT, Perplexity, Claude, Gemini and Google's AI Overviews something worth quoting, and fix the pages that don't. Use when the user says or asks \"is my site ready for AI search\", \"audit my site for AI answers\", \"AEO audit\", \"GEO audit\", \"why doesn't ChatGPT quote our pricing\", \"make our pages citable by AI\", \"do I need llms.txt\", \"does schema help with ChatGPT\", \"check our structured data\", \"is our content visible without JavaScript\", \"AI SEO audit\", \"optimize our homepage for AI answers\", \"LLM SEO check\", \"why does AI get our product wrong\", \"fix our site for AI Overviews\". Checks fetchability and indexability, answers in the raw HTML, entity facts, schema (including JS-injected markup), headings, dates and llms.txt, then gives at most 10 prioritised fixes and edits the repo when asked. Works without a Revnu account.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Frevnu-ai-readiness-audit\u002FSKILL.md",[],[],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":53,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":57},"01M7DXSZHCVTRS620GC3S97JZV","proxy-troubleshooting","Diagnose residential proxy failures, with NodeMaven's gateway as the reference - 407 with correct credentials, 406, 410, 500, a connection that hangs, ERR_TUNNEL_CONNECTION_FAILED in a browser, Playwright or Puppeteer ignoring proxy credentials, a sticky session that changes IP, geo-targeting that is silently ignored, passwords with special characters, and unexpected traffic from headless Chrome. Use when a proxy connection fails, returns the wrong location, or costs more traffic than expected.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Fproxy-troubleshooting\u002FSKILL.md",[],[]]