A bacterial genome annotated by Prokka
The tutorials target the JBrowse v5 beta, and the v4.3.0 release
on the download page lacks some of what they show. To install the
beta of JBrowse Web, run npm install -g @jbrowse/cli@next, then
jbrowse create jbrowse2 --branch v5.0.0-beta.22. Desktop beta builds for Linux and
macOS are on the releases page;
the Windows build waits on code signing.
A bacterial assembly is usually a chromosome and a few plasmids, annotated by a pipeline such as Prokka, which writes the sequence and every gene it found into one GenBank file. JBrowse opens that one file as both the genome and its gene track, so the annotation of a new assembly can be browsed, searched and checked gene by gene without converting anything. We annotate the assembly of Escherichia coli O157:H7 Sakai, an outbreak strain whose chromosome and two plasmids were sequenced in full (Hayashi et al. 2001), and look at the Shiga toxin genes on its chromosome and the enterohemolysin operon on its plasmid pO157 (Makino et al. 1998). We:
- annotate the assembly's FASTA with Prokka
- load Prokka's GenBank file as the genome and as a gene track, with the chromosome and plasmids marked circular
- index the gene names, find a gene by typing its name, and read its protein
- open pO157 in the circular view
- save pO157 and its genes back out as a GenBank file
Prerequisites
- a JBrowse to open the sessions in (Web or Desktop)
- Prokka, which annotates the assembly
- Node.js, which the JBrowse CLI runs on
- the JBrowse CLI, for
jbrowse add-assembly,jbrowse add-trackandjbrowse text-index
# Debian/Ubuntu
sudo apt install nodejs
# or conda, which has every tool above
conda install -c bioconda -c conda-forge nodejs
# prokka in a conda environment of its own
conda create -n prokka -c bioconda -c conda-forge prokka=1.15.6
conda activate --stack prokka
# any platform
npm install -g @jbrowse/cli@nextWhen Prokka is installed beside other tools, conda resolves the old Prokka 1.13, so the install puts Prokka in a separate environment.
The data
GCF_000008865.2 is NCBI's assembly of the Sakai strain: the chromosome NC_002695.2 and the plasmids pOSAK1 (NC_002127.1) and pO157 (NC_002128.1). The first command below fetches its FASTA, the only input, and every step after it runs on that copy; for your own genome, use your assembly's FASTA in its place.
| What it is | File |
|---|---|
| The Sakai assembly, a copy of NCBI's FASTA | GCF_000008865.2_ASM886v2_genomic.fna.gz |
Annotating the assembly
We'll download the assembly, 1.6 MB compressed:
wget -c https://jbrowse.org/demos/prokka_sakai/GCF_000008865.2_ASM886v2_genomic.fna.gzWe decompress it for Prokka:
gzip -dc GCF_000008865.2_ASM886v2_genomic.fna.gz > assembly.fnaProkka finds the genes and names them by similarity to known proteins, then writes the same annotation in several formats into one directory. On your own assembly, pick your own locus tag prefix:
# --locustag prefixes every gene's locus_tag (SAKAI_00001, ...)
# --cpus 0 uses every core
prokka --outdir annotation --prefix sakai --locustag SAKAI --cpus 0 assembly.fnaannotation/sakai.gbk is the GenBank file: one record per contig, each with its
sequence and its genes. Prokka names each record after its contig and writes
every record as linear, as each record's first line shows:
grep '^LOCUS' annotation/sakai.gbkLOCUS NC_002695.2 5498578 bp DNA linear 21-NOV-2026
LOCUS NC_002127.1 3306 bp DNA linear 21-NOV-2026
LOCUS NC_002128.1 92721 bp DNA linear 21-NOV-2026
A contig name longer than the LOCUS line's name column, such as SPAdes's
NODE_1_length_52345_cov_23.451523, runs into the length on that line; JBrowse
splits the two again by the record's length, so the refNames match the contig
names in your FASTA and in any reads mapped to it. Prokka refuses a name over 37
characters, though, and its --centre and --compliant options get past that
by renaming the contigs, after which the names match neither.
Loading the genome and the genes
We'll run the JBrowse commands from the annotation folder, beside sakai.gbk.
The GenBank file is the genome, and circularRefNames lists the contigs that
are rings, here the chromosome and both plasmids, since Prokka writes every
record as linear. On your own assembly, Flye's assembly_info.txt marks each
circular contig Y. The add-genome form has no field for circularRefNames, so
in JBrowse Desktop the assembly loads from a
CLI-built config.json:
Goes in the assemblies array of config.json. See Assemblies.
{
"name": "sakai",
"displayName": "E. coli O157:H7 Sakai (Prokka)",
"uri": "sakai.gbk",
"circularRefNames": ["NC_002695.2", "NC_002127.1", "NC_002128.1"]
}Edits config.json in the current folder, creating it if there is none. See JBrowse CLI with Desktop.
jbrowse add-assembly sakai.gbk \
--name sakai \
--displayName "E. coli O157:H7 Sakai (Prokka)" \
--config '{"circularRefNames":["NC_002695.2","NC_002127.1","NC_002128.1"]}' \
--load copysakai.gbk is also the gene track. Its features are Prokka's CDS, tRNA, rRNA
and tmRNA records, each labeled by its /gene, else its /locus_tag, and one
CRISPR array as a repeat_region:
Goes in the tracks array of config.json. See Tracks.
{
"trackId": "sakai_prokka",
"name": "Prokka genes",
"assemblyNames": ["sakai"],
"uri": "sakai.gbk"
}Edits config.json in the current folder. See JBrowse CLI with Desktop.
jbrowse add-track sakai.gbk \
--trackId sakai_prokka \
--name "Prokka genes" \
--assemblyNames sakai \
--load copyIn JBrowse Desktop, or in any running JBrowse Web session, open a view on this track’s assembly, then File → Open track..., choose Add track from pasted JSON, and paste:
{
"trackId": "sakai_prokka",
"name": "Prokka genes",
"assemblyNames": ["sakai"],
"uri": "sakai.gbk"
}sakai.gbk is relative to a config.json. Replace it with its URL or its path on this computer.
When the genome opens, JBrowse reads the whole file into memory for the assembly and again for the track, which suits a genome of a few megabases.1
Finding a gene by name
We'll index the gene names, so a name typed into the location box goes to the
gene. text-index reads each record's /gene and /locus_tag:
jbrowse text-index --tracks sakai_prokkaProkka numbers a name it gives more than once, so typing stxA into the
location box offers stxA_1 and stxA_2, the A subunits of the two Shiga toxin
operons on the chromosome. Choosing stxA_1 opens NC_002695.2 at the gene, with
stxB_1 beside it.
Reading a CDS's protein
Clicking a CDS opens its details: the qualifiers Prokka wrote, including its
/product, the /inference lines naming the protein it was matched to, and its
/translation. Show feature sequence then reads the CDS's bases from the
genome, and the Protein choice in its menu translates them with the genetic
code in the CDS's /transl_table:
Goes at the top level of config.json, replacing any defaultSession there. See Default session.
{
"defaultSession": {
"name": "Prokka's stxA_1",
"views": [
{
"type": "LinearGenomeView",
"assembly": "sakai",
"loc": "NC_002695.2:1,266,700-1,268,700",
"tracks": ["sakai_prokka"]
}
]
}
}Replaces any defaultSession in config.json in the current folder. See JBrowse CLI with Desktop.
jbrowse set-default-session --session - << 'EOF'
{
"name": "Prokka's stxA_1",
"views": [
{
"type": "LinearGenomeView",
"assembly": "sakai",
"loc": "NC_002695.2:1,266,700-1,268,700",
"tracks": ["sakai_prokka"]
}
]
}
EOFOpen this session in JBrowse Web ↗
Needs JBrowse Desktop 5.0 or newer. If nothing opens, copy the link and paste it into Desktop's Open JBrowse Web link..., on the start screen or under File → Session.
https://jbrowse.org/code/jb2/main/?config=test_data%2Fprokka_sakai%2Fconfig.json&session=json-%7B%22session%22%3A%7B%22name%22%3A%22Prokka%27s+stxA_1%22%2C%22views%22%3A%5B%7B%22type%22%3A%22LinearGenomeView%22%2C%22assembly%22%3A%22sakai%22%2C%22loc%22%3A%22NC_002695.2%3A1%2C266%2C700-1%2C268%2C700%22%2C%22tracks%22%3A%5B%22sakai_prokka%22%5D%7D%5D%7D%7D&sessionName=JBrowse+docs+examplepO157 as a ring
We'll open pO157 in the circular view. A circular view of one circular sequence closes at position 1, ticks its bases, and prints the sequence's name and length in the middle:
Goes at the top level of config.json, replacing any defaultSession there. See Default session.
{
"defaultSession": {
"name": "pO157 as a circle",
"views": [
{
"type": "CircularView",
"assembly": "sakai",
"displayedRegionNames": ["NC_002128.1"],
"tracks": ["sakai_prokka"]
}
]
}
}Replaces any defaultSession in config.json in the current folder. See JBrowse CLI with Desktop.
jbrowse set-default-session --session - << 'EOF'
{
"name": "pO157 as a circle",
"views": [
{
"type": "CircularView",
"assembly": "sakai",
"displayedRegionNames": ["NC_002128.1"],
"tracks": ["sakai_prokka"]
}
]
}
EOFOpen this session in JBrowse Web ↗
Needs JBrowse Desktop 5.0 or newer. If nothing opens, copy the link and paste it into Desktop's Open JBrowse Web link..., on the start screen or under File → Session.
https://jbrowse.org/code/jb2/main/?config=test_data%2Fprokka_sakai%2Fconfig.json&session=json-%7B%22session%22%3A%7B%22name%22%3A%22pO157+as+a+circle%22%2C%22views%22%3A%5B%7B%22type%22%3A%22CircularView%22%2C%22assembly%22%3A%22sakai%22%2C%22displayedRegionNames%22%3A%5B%22NC_002128.1%22%5D%2C%22tracks%22%3A%5B%22sakai_prokka%22%5D%7D%5D%7D%7D&sessionName=JBrowse+docs+exampleProkka names the enterohemolysin operon hlyC, ehxA, hlyB and hlyD, the
four genes in a row on one strand between 16 and 24 kb.
Saving a plasmid as GenBank
We'll write pO157 and its genes back out as a GenBank file, for a plasmid map
program or a collaborator. Type NC_002128.1 into a linear view's location box
to show the whole plasmid, then choose Save track data... in the gene
track's menu and pick GenBank. The file holds one record over the plasmid,
written circular because the assembly lists it in circularRefNames, with the
source feature and each CDS's qualifiers as Prokka wrote them. Genus species
and strain are Prokka's placeholders; its --genus, --species and
--strain options fill them in. The file begins:
LOCUS NC_002128.1 92721 bp DNA circular UNK 10-JAN-1970
DEFINITION NC_002128.1:1..92721 from sakai.
ACCESSION NC_002128.1
VERSION NC_002128.1
KEYWORDS .
SOURCE Genus species
ORGANISM Genus species
.
FEATURES Location/Qualifiers
source 1..92721
/organism="Genus species"
/mol_type="genomic DNA"
/strain="strain"
CDS 88..2502
/label="stcE"
/gene="stcE"
/locus_tag="SAKAI_05419"
/EC_number="3.4.24.-"
/inference="ab initio prediction:Prodigal:v2.6"
/inference="similar to AA sequence:UniProtKB:O82882"
/codon_start=1
/transl_table=11
/product="Metalloprotease StcE"Reproduce it end to end
build_prokka_genbank.sh
wraps every step above. It:
- downloads the Sakai assembly, or takes your own FASTA
- annotates it with Prokka
- writes a JBrowse with the GenBank file as the assembly and the gene track, the chromosome and plasmids circular and the gene names indexed
With your own FASTA, CIRCULAR names the contigs that are rings, and none are
unless you list them; the default session opens the last one listed in the
circular view, or every contig in a linear view when the list is empty.
curl -fO https://raw.githubusercontent.com/GMOD/jbrowse-components/main/scripts/build_prokka_genbank.sh
bash build_prokka_genbank.sh # builds ./prokka_genbank_build/jbrowse2
FASTA=my_assembly.fna CIRCULAR=contig_2,contig_3 NAME=my_genome LOCUSTAG=MYG DISPLAY_NAME="My genome" bash build_prokka_genbank.sh my_build
npx --yes serve prokka_genbank_build/jbrowse2 # then open the printed URLSee also
- Tutorial: A map of the human mitochondrial genome
- Tutorial: Pangenome (pggb)
- User guide: Circular genome view
- Config guide: Text searching
External links
Citations
- Hayashi et al. (2001). Complete genome sequence of enterohemorrhagic Escherichia coli O157:H7 and genomic comparison with a laboratory strain K-12
- Makino et al. (1998). Complete nucleotide sequences of 93-kb and 3.3-kb plasmids of an enterohemorrhagic Escherichia coli O157:H7 derived from Sakai outbreak
- Seemann (2014). Prokka: rapid prokaryotic genome annotation
- Schwengers et al. (2021). Bakta: rapid and standardized annotation of bacterial genomes via alignment-free sequence identification
Notes
-
Prokka also writes the annotation as
sakai.gff, with the sequence appended under a##FASTAline.jbrowse sort-gff sakai.gff | bgzip > sakai.gff.gzdrops that section, sotabix -p gff sakai.gff.gzcan index the rest, for a track oversakai.fnaas the assembly. Bakta (Schwengers et al. 2021) writes its GenBank file as<prefix>.gbff, which loads the same way; on this assembly it named the contigscontig_1tocontig_3and wrote each as circular, because NCBI's FASTA headers call each one complete (--completedoes the same for any FASTA). ↩
Feedback on this tutorial is welcome: contact us.