Skip to content

dmnfarrell/pybioviz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

License: GPL v3

pybioviz - Bioinformatics visualization tools with PyViz Panel and Bokeh.

This is a demonstration project for bioinformatic dashboards with panel and bokeh. These could be re-used inside Jupyter notebooks as part of bioinformatic workflows or deployed as local web apps. Not under active development so mainly proof of concept. Use parts of the code as needed.

Tools implemented:

  • sequence alignment viewer
  • genome feature viewer
  • bam alignment viewer

Installation

pip install -e git+https://github.com/dmnfarrell/pybioviz.git#egg=pybioviz

If using JupyterLab you may need to run:

jupyter labextension install @bokeh/jupyter_bokeh
jupyter labextension install @pyviz/jupyterlab_pyviz

Notebook

Try the basics.ipynb notebook in the notebook folder to see how it works.

Usage

from bokeh.io import show, output_notebook
output_notebook()
import panel as pn
pn.extension()
from pybioviz import dashboards, plotters, utils

Sequence alignment

from Bio import AlignIO, SeqIO

aln_file = os.path.join(utils.datadir, 'test.aln')
aln = AlignIO.read(aln_file,'clustal')
seqview = plotters.plot_sequence_alignment(aln)
main = pn.Column(m,seqview)
main

Plot bam coverage

bam_file='wt_mbovis.bam'
chr='NC_002945.4'
start=1000
end=3000
df = utils.get_coverage(bam_file, chr, start, end)
p = plotters.plot_coverage(df)

Dashboards

Dashboards are small interctive apps that are created by using the plotting tools detailed above, combined with widgets that allow user interactivity. They can be created inside a notebook or launched as standalone apps in a web browser using a command in the terminal.

Sequence alignment dashboard

This dashboard is for used for viewing and manipulating multiple sequence alignments. You can load files from local directories and re-align, zoom in and out of the sequence. Other features to add and remove sequences have yet to be added.

To use this inside a notebook:

app = dashboards.sequence_alignment_viewer('file.fa')

Genomic feature viewer

app = dashboards.genome_features_viewer('Mbovis_AF212297.gff','Mbovis-AF212297.fa')

Links