SkillAgentSearch skills...

Pybioviz

bioinformatics visualization tools with pyviz/bokeh

Install / Use

/learn @dmnfarrell/Pybioviz
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

License: GPL v3

pybioviz - Bioinformatics visualization tools with PyViz Panel and Bokeh.

<img align="right" src=img/logo.svg width=150px>

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

<img src=https://github.com/dmnfarrell/pybioviz/raw/master/doc/source/sequence_align_plot.png width=600px>

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')

<img src=https://github.com/dmnfarrell/pybioviz/raw/master/doc/source/sequence_aligner_dashboard.gif width=600px>

Genomic feature viewer

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

<img src=https://github.com/dmnfarrell/pybioviz/raw/master/doc/source/genome_features_dashboard.gif width=600px>

Links

  • https://panel.pyviz.org/
  • https://docs.bokeh.org/en/latest/

Related Skills

View on GitHub
GitHub Stars20
CategoryDevelopment
Updated1y ago
Forks3

Languages

Jupyter Notebook

Security Score

80/100

Audited on Jan 18, 2025

No findings