Julia package for visualising genomic data



Julia package for visualising genomic data.


GenomicMaps depends on BioSequences, which is registered in BioJuliaRegistry. To install it you must first add the registry to Julia's package manager:

pkg> registry add https://github.com/BioJulia/BioJuliaRegistry.git
pkg> add GenomicMaps


Hover over a gene to see annotations.

Example map

using GenomicAnnotations
using GenomicMaps

# You can add any kind of annotation that you want to display.
# Here, I add COG annotation:
function addcogs!(chr, filename)
    cogs = split.(readlines(filename), Ref('\t'))
    i = 1
    for gene in @genes(chr, :feature == "CDS")
        if gene.locus_tag == cogs[i][1]
            if occursin(r"\w", cogs[i][2])
                gene.cog = cogs[i][2]
            i += 1

# Colour scheme for COG categories:
cogcolours = Dict("B"=>RGB{Float64}(1.0,0.630714,0.576563),

# First download annotations for E. coli:
download("ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCA/000/005/845/GCA_000005845.2_ASM584v2/GCA_000005845.2_ASM584v2_genomic.gbff.gz", "ecoli.gbk.gz")

# Then read the annotations and add COGs:
chr = readgbk("ecoli.gbk.gz")[1]
addcogs!(chr, "ecoli_cogs.tsv")

# The output can be customised, see src/initialise.jl for all options. Here I
# provide a function that will be run on each gene to determine its colour:
colourby_cog = g -> unique(String.(split(get(g, :cog, ""), "")))
    outfile = "ecoli.svg",
    colourmap = cogcolours,
    colourfunction = colourby_cog,
    annotate = true,
    nbreaks = 40)


Some keywords that can be given to drawgenome to customise the output are:

  • genetextfunction: determines the text shown above each gene. Can be either a Function that is executed for each gene, or a Symbol, in which case it defaults to g -> get(g, genetextfunction, "").
  • colourfunction: a function that is executed for each gene to determine how to colour it. Currently only categorical colouring is supported, so continuous data has to be binned.
  • colourmap: a Dict mapping categories => colours. When using categorical data to colour genes, it can be left empty, but if continuous data (say, expression levels) are used it has to be set manually.
  • defaultcolour: the default colour that is used for genes that do not have a specified colour in colourmap.
  • nbreaks: an Int determining how many lines will be used to display the genome).
  • drawingsize: determines the size of the output. Can be a String such as "A4", "A0landscape", "1000x1000", or a Tuple (e.g. (1000, 1000)).
  • legend: can be :categorical, :continuous, or :none. ... and more (see src/initialise.jl)

First Commit


Last Touched

about 2 months ago


43 commits

Used By: