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:
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
Try the basics.ipynb notebook in the notebook folder to see how it works.
from bokeh.io import show, output_notebook
output_notebook()
import panel as pn
pn.extension()
from pybioviz import dashboards, plotters, utils
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
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 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.
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')
app = dashboards.genome_features_viewer('Mbovis_AF212297.gff','Mbovis-AF212297.fa')