A map of the human mitochondrial genome
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.
We draw the human mitochondrial genome as a circular map, the way plasmid and organelle genomes are usually pictured, with base-pair ticks around one closed ring and the genes along it in a row per strand, colored by feature type. The same steps make a map of any small circular sequence that NCBI annotates, from a chloroplast to a plasmid. We:
- fetch a GenBank accession's FASTA and GFF3 from NCBI
- load the genome as an assembly marked circular, so the ring closes with no gap at its origin, and the genes as a feature track
- open the genome in the circular view and color the genes by feature type
- open ND6 and its neighbours in a linear view
Prerequisites
- a JBrowse to open the sessions in (Web or Desktop)
- Node.js, which the JBrowse CLI runs on
- the JBrowse CLI, for
jbrowse add-assembly,jbrowse sort-gffandjbrowse add-track - samtools, for the FASTA index
- htslib (
bgzip,tabix), for the GFF3 index
# Debian/Ubuntu
sudo apt install samtools tabix nodejs
# or conda, which has every tool above
conda install -c bioconda -c conda-forge samtools htslib nodejs
# any platform
npm install -g @jbrowse/cli@nextThe data
NC_012920.1 is the revised Cambridge Reference Sequence of the human mitochondrion (Andrews et al. 1999). The commands below fetch both files from NCBI, and every step after them runs on those copies.
| What it is | File |
|---|---|
| The sequence as FASTA | efetch.fcgi |
| The annotation as GFF3 | viewer.cgi |
Downloading the sequence and its genes
We'll start from a GenBank accession, which is all NCBI needs to hand back the sequence and its annotation. Set it once, so the same commands fetch your own organelle or plasmid:
ACC=NC_012920.1The sequence comes back as FASTA from NCBI's E-utilities:
curl -o genome.fa "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=nuccore&id=$ACC&rettype=fasta"The annotation comes back as GFF3 from the sequence viewer's export:
curl -o genes.gff3 "https://www.ncbi.nlm.nih.gov/sviewer/viewer.cgi?db=nuccore&report=gff3&id=$ACC"For a circular genome, check two records of genes.gff3: the region that
spans the whole sequence, which NCBI marks Is_circular=true, and the D-loop,
the control region that spans the origin, which is written as one record whose
end runs past the sequence's length:
grep -e 'Is_circular=true' -e 'D_loop' genes.gff3 | cut -f 1-5NC_012920.1 RefSeq region 1 16569
NC_012920.1 RefSeq D_loop 16024 17145
GFF3 writes a feature that crosses the origin of a circular sequence this way,
in coordinates that continue past the end. JBrowse's GFF3 adapters read the
length off the Is_circular=true record and cut such a feature at the origin
into a piece before it and a piece after, so keep that record in the file you
load.
Loading the genome and the genes
We'll load the sequence as an assembly, indexed with samtools first:
samtools faidx genome.faThe assembly is named human_mito, and two of its settings name the sequence
NC_012920.1. The add-genome form has a field for neither, so in JBrowse
Desktop the assembly loads from a
CLI-built config.json:
Goes in the assemblies array of config.json. See Assemblies.
{
"name": "human_mito",
"displayName": "Human mitochondrion (NC_012920.1)",
"uri": "genome.fa",
"circularRefNames": ["NC_012920.1"],
"geneticCodes": { "NC_012920.1": 2 }
}Edits config.json in the current folder, creating it if there is none. See JBrowse CLI with Desktop.
jbrowse add-assembly genome.fa \
--name human_mito \
--displayName "Human mitochondrion (NC_012920.1)" \
--config '{"circularRefNames":["NC_012920.1"],"geneticCodes":{"NC_012920.1":2}}' \
--load copycircularRefNamesmarks the sequence circular, so the circular view closes it into a ring with no gap at its origin.geneticCodestranslates the reference sequence track's six frames with NCBI's vertebrate mitochondrial code, table 2. NCBI's CDS records name the same table in their owntransl_table, which a gene's protein sequence reads.
For your own accession, put your sequence's name in both settings and pick its NCBI genetic code (11 for a plastid or a bacterial plasmid).
We'll sort, compress and index the GFF3, keeping the pragma at the top (Quickstart has the general recipe):
jbrowse sort-gff genes.gff3 | bgzip > genes.gff.gztabix -p gff genes.gff.gzIn grammar-of-graphics terms, the gene
track's facet splits it into a section per strand, and its encoding.color
is a color scale mapping the GFF3 type field to colors. The name label is the
first of the gene, product, name, gbkey and id attributes that the
record has, so a record with no gene or product, like the D-loop, is labeled
by its gbkey:
Goes in the tracks array of config.json. See Tracks.
{
"type": "FeatureTrack",
"trackId": "mito_genes",
"name": "NCBI genes",
"assemblyNames": ["human_mito"],
"adapter": {
"type": "Gff3TabixAdapter",
"uri": "genes.gff.gz"
},
"displayDefaults": {
"labels": {
"name": "jexl:feature.gene || feature.product || feature.name || feature.gbkey || feature.id"
},
"facet": { "field": "strand" },
"encoding": { "color": "type" },
"height": 250
}
}Edits config.json in the current folder. See JBrowse CLI with Desktop.
jbrowse add-track genes.gff.gz \
--trackId mito_genes \
--name "NCBI genes" \
--assemblyNames human_mito \
--displayDefaults '{"labels":{"name":"jexl:feature.gene || feature.product || feature.name || feature.gbkey || feature.id"},"facet":{"field":"strand"},"encoding":{"color":"type"},"height":250}' \
--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:
{
"type": "FeatureTrack",
"trackId": "mito_genes",
"name": "NCBI genes",
"assemblyNames": ["human_mito"],
"adapter": {
"type": "Gff3TabixAdapter",
"uri": "genes.gff.gz"
},
"displayDefaults": {
"labels": {
"name": "jexl:feature.gene || feature.product || feature.name || feature.gbkey || feature.id"
},
"facet": { "field": "strand" },
"encoding": { "color": "type" },
"height": 250
}
}genes.gff.gz is relative to a config.json. Replace it with its URL or its path on this computer.
Opening the genome as a circle
We'll open the assembly in a circular view with the gene track. 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": "Human mitochondrion as a circle",
"views": [
{
"type": "CircularView",
"assembly": "human_mito",
"legend": { "show": true },
"tracks": ["mito_genes"]
}
]
}
}Replaces any defaultSession in config.json in the current folder. See JBrowse CLI with Desktop.
jbrowse set-default-session --session - << 'EOF'
{
"name": "Human mitochondrion as a circle",
"views": [
{
"type": "CircularView",
"assembly": "human_mito",
"legend": { "show": true },
"tracks": ["mito_genes"]
}
]
}
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%2Fhuman_mito%2Fconfig.json&session=json-%7B%22session%22%3A%7B%22name%22%3A%22Human+mitochondrion+as+a+circle%22%2C%22views%22%3A%5B%7B%22type%22%3A%22CircularView%22%2C%22assembly%22%3A%22human_mito%22%2C%22legend%22%3A%7B%22show%22%3Atrue%7D%2C%22tracks%22%3A%5B%22mito_genes%22%5D%7D%5D%7D%7D&sessionName=JBrowse+docs+exampleThe config sets the track's facet and color, and the track menu offers both too, under the circular view menu's Tracks item:
- Group by with
strandsplits the ring into a section per strand - Color by → Attribute... with
typecolors each feature by its GFF3 type
The track's height sets how much of the circle's radius the track takes. The
rings together take at most half the radius, so a tall track is narrowed to fit,
and its rows are laid out in that band. In a circle of one sequence, feature
names are drawn outside the ruler, each joined to its feature by a line.
ND6 in a linear view
The minus-strand row holds a single protein-coding gene, ND6, which sits
between ND5 and CYTB. Type NC_012920.1:12,000-16,569 into a linear view
with the same track to see the three side by side:
Anderson et al. (1981) published the sequence with this layout, twelve of the thirteen protein-coding genes on one strand and ND6 on the other.
Reproduce it end to end
build_organelle_map.sh
wraps every step above. It:
- fetches the accession's FASTA and GFF3 from NCBI
- indexes the sequence, and sorts and indexes the genes
- writes a JBrowse with the circular assembly, the gene track and the circle as its default session
curl -fO https://raw.githubusercontent.com/GMOD/jbrowse-components/main/scripts/build_organelle_map.sh
bash build_organelle_map.sh # builds ./organelle_map_build/jbrowse2
ACC=NC_000932.1 GENETIC_CODE=11 NAME=arabidopsis_chloroplast DISPLAY_NAME="Arabidopsis chloroplast (NC_000932.1)" bash build_organelle_map.sh chloroplast_build
npx --yes serve organelle_map_build/jbrowse2 # then open the printed URLSee also
- Tutorial: Synteny on a circle (human and mouse)
- Tutorial: Gene density and transposon density along a chromosome
- User guide: Circular genome view
- Docs: JBrowse web quick start
External links
Citations
- Anderson et al. (1981). Sequence and organization of the human mitochondrial genome
- Andrews et al. (1999). Reanalysis and revision of the Cambridge reference sequence for human mitochondrial DNA
Feedback on this tutorial is welcome: contact us.