Git Product home page Git Product logo

dash-bio's Introduction

Dash Bio

CircleCI PyPI version

Dash Bio is a suite of bioinformatics components built to work with Dash.

Announcement: https://medium.com/@plotlygraphs/announcing-dash-bio-ed8835d5da0c

Demo: https://dash-gallery.plotly.host/Portal/?search=Bioinformatics

Documentation: https://dash.plotly.com/dash-bio

Components

The Dash Bio components each fall into one of three categories:

  • Custom chart types
  • Sequence analysis tools
  • 3D rendering tools

Custom chart types

  • Dash Circos
  • Dash Clustergram
  • Dash Manhattan Plot
  • Dash Needle Plot
  • Dash Volcano Plot

Sequence analysis tools

  • Dash Alignment Chart
  • Dash Onco Print
  • Dash Forna Container
  • Dash Sequence Viewer

Visualization tools

  • Dash Mol2D
  • Dash Mol3D
  • Dash Speck
  • Dash Ngl

Using Dash Bio

It's easy to add a fully interactive chromosomal, molecular or genomic visualization to your Dash app by simply including the Dash Bio component into your app layout as follows:

import urllib.request as urlreq
from dash import Dash, html
import dash_bio as dashbio

app = Dash(__name__)

data = urlreq.urlopen(
    'https://raw.githubusercontent.com/plotly/dash-bio-docs-files/master/alignment_viewer_p53.fasta'
).read().decode('utf-8')

app.layout = html.Div([
    dashbio.AlignmentChart(
        id='my-default-alignment-viewer',
        data=data
    )
])

if __name__ == '__main__':
    app.run_server(debug=True)

See the Dash Bio documentation for more components and examples.

Run Dash Bio in a JupyterLab environment

  1. Create a virtual environment:

    The following steps require a virtual environment tool to be installed on your computer: pip install virtualenv

    a. On macOS and Linux: python3 -m venv env

    b. On Windows, enter: py -m venv env

  2. Activate your new environment:

    a. On macOS and Linux, enter: source env/bin/activate

    b. On Windows, enter: .\env\Scripts\activate

  3. Install required libraries (make sure you have pip installed with pip help):

pip install dash dash-bio pandas numpy Jupyterlab
  1. To run Dash inside Jupyter lab:

    a. Install jupyter-dash: pip install jupyter-dash

    b. Enter jupyter lab build

    (Note: This step requires Node.js and NPM installed on yourcomputer. To check if Node and NPM are installed, enter node -v and npm -v in your terminal. For install instructions see nodejs.org.

  2. To display Plotly figures in JupyterLab:

pip install jupyterlab "ipywidgets>=7.5”
jupyter labextension install [email protected]
  1. Start JupyterLab by typing: jupyter lab

    Important: JupyterLab must be run within the virtual environment that was previously activated.

For more on running a Dash app in Jupyter Lab visit Getting Started with Jupyter Dash.

Dash

Learn more about Dash at https://plotly.com/products/dash/.

Consulting and OEM

For inquiries about Dash app development, advanced OEM integration, and more, please reach out.

Contributing and Local Development

If you would like to contribute to this repository, or run demo apps and tests, please refer to the contributing guidelines.

dash-bio's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dash-bio's Issues

The whole d3 library might be imported...

@matthewchan15 When syncing up my master after you merged PR #89 (which came with commit 7154cb2), I noticed that file dash_bio/bundle.js got huge... Was everything you added necessary?

For reference:

$ git pull origin master
remote: Enumerating objects: 10, done.
remote: Counting objects: 100% (10/10), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 10 (delta 6), reused 9 (delta 6), pack-reused 0
Unpacking objects: 100% (10/10), done.
From github.com:plotly/dash-bio
 * branch            master     -> FETCH_HEAD
   87bd4a0..66ca418  master     -> origin/master
Updating 87bd4a0..66ca418
Fast-forward
 dash_bio-0.0.1.tar.gz              |  Bin 1081660 -> 2086631 bytes
 dash_bio/Circos.py                 |    8 +-
 dash_bio/DashCircos.py             |   83 --
 dash_bio/DashIdeogram.py           |  194 ---
 dash_bio/bundle.js                 | 7977 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 dash_bio/metadata.json             |   14 +
 dash_bio/package.json              |    2 +-
 package-lock.json                  |  175 +--
 package.json                       |    2 +-
 src/lib/components/Circos.react.js |   11 +-
 tests/dash/app_circos.py           |    2 +-
 11 files changed, 7969 insertions(+), 499 deletions(-)
 delete mode 100644 dash_bio/DashCircos.py
 delete mode 100644 dash_bio/DashIdeogram.py

Volcano two different data set has a strange behavior

I created a self contained demo of the reduced problem at https://dash-gallery.plotly.host/dash-volcano-bug-app/ (the repo is at https://dash-gallery.plotly.host/GIT/dash-volcano-bug-app).

When you use the dropdown to select Set2 from Set3 (which are the same), it is fine. The problem arises when you select Set1 and then again Set2 or Set3, then a whole bunch of data point are not rendered but you can see that they are there with the hover info... you can get the whole dataset to be displayed properly by setting the Thershold to 7 and then back to its initial value of 4, then everything works properly until one selects Set1 and then Set2 again...

I have checked that the data sets that were sent to the figure prop of the dcc.Graph were the one I expected and they were. For some reason they do not get rendered.

Clustergram component improvements

From @Bachibouzouk's comments on #70

  • Use a numpy or pandas function to loop over the list when converting from list to array in _clustergram.py (fixed in #77)
  • Create a function dedicated specifically for the above
  • Ensure that row and column labels still show even if there is no clustering

Dash Bio apps need to be moved to dash-bio.plotly.host

In accordance with https://github.com/plotly/streambed/issues/12263, we are making our index.py app obsolete. The applications we currently have are not true standalone apps, since they just modify the layout on the main index.py app. Right now, index.py lives on that server (https://dash-gallery.plotly.host/dash-bio) and its portal (https://dash-bio.plotly.host/Portal/)

What we need to do:

  • Publish the dash bio package to test.pypi.org
  • Separate the requirements for each app from our requirements.txt file, add in the dash_bio dependency
  • Set up a file structure within the repository that will house all of the applications. I'm thinking just a folder called demo_apps that contains a folder for each app
  • Copy each app's relevant sample_data files into its folder
  • Create all the necessary files (looks like we need a config.py and runtime.txt) for each app in its folder
  • Once the apps are on the portal, tag them (this looks like a really cool feature we should take advantage of!) with things like "genomics", "visualizations", etc.

Let's get this done before I fly out to Boston for training with Amgen (13 Feb)! They're a huge pharmaceutical company and it would be awesome to show off Dash Bio and sell them on DDS simultaneously :) let's get that 🍞

Ideogram: Top-left input might make a biologist frown

Hi @matthewchan15,

I'm not a biologist (@shammamah can you please remind me who are the biologists so I can tag them?) but under "Organism" (species?) I find it odd to see "Human" and "Homo-sapiens" (also, I believe you don't hyphenate it).

Now I'm aware they're pointing to two different datasets, which contain different features (data-wise). If we want to include both datasets, we probably want to figure out something UX-wise so it gives a better first impression.

PS: This follows from a PR #90 I originally opened and then closed.

Why are generated files in the version control?

I noticed that generated files in dash-bio/dash_bio (such as bundle.js etc.), or the .tar.gz, are versioned in this repository. I wonder why this is the case: usually (at least in my experience) files which can be generated are not integrated in the version control, in particular for large files.

create common user for all dash gallery apps

as mentioned in : https://github.com/plotly/streambed/issues/11788#issuecomment-436746312

  • see with Chelsea if this user already exists
  • create developers/dataliberation user on dds
  • dash-gallery exceeded the 15 person license, checkup with Hamza on that, as new user cannot create apps
  • delete /dash-bio app from sham's account (if not there's url conflict..)
  • add dash-bio path to common user
  • setup environment requirements for dash-bio app so that Chitra's app works: https://github.com/plotly/streambed/issues/11803
  • redeploy master with developers as user
  • edit pr template with new steps for deployment, now everyone will be responsible for redeploy once they merge to master

Gunicorn doesn't run standalone apps

Running python tests/dashbio_demos/app_speck.py works and runs the app correctly, but when trying to run it with gunicorn, which will happen on the server (gunicorn tests.dashbio_demos.app_speck:server) it fails with the following error:

Failed to find application object 'server' in 'tests.dashbio_demos.app_speck'

We need to expose the server variable somehow within the app file. I've tried declaring server = app.server within run_standalone_app and returning it, but that doesn't work either.

@mkcor @Bachibouzouk Any ideas on how to get this to work? We might have to start running the apps from index.py after all.

Write tests for all components/apps

Now we have integration testing set up, we need a common test suite that is used for all common features and files specific to each component's features.

@Bachibouzouk has already started on his (#102) for Volcano plot.

We still need to finish tests for:

  • general (to be used for all components) (#142, #146, #173)
  • Alignment Chart
  • Circos
  • Ideogram (#182)
  • Molecule3D
  • NeedlePlot (#146)
  • SequenceViewer
  • Speck
  • Clustergram
  • Manhattan plot (#142)
  • Volcano plot (#142, #102)
  • Oncoprint (#191, #194)

Test Ideogram

List all stylistic or functional issues here.
When done, change issue assignment to the component creator for them to fix the issues.

Make setup.py require dash

Really just a suggestion, but I believe it would be nice to have setup.py require dash by default:

dash-bio/setup.py

Lines 11 to 20 in bd5ce53

setup(
name=package_name,
version=package["version"],
author=package['author'],
packages=[package_name, '{}/utils'.format(package_name), '{}/component_factory'.format(package_name)],
include_package_data=True,
license=package['license'],
description=package['description'] if 'description' in package else package_name,
install_requires=[]
)

That way, when the user installs dash-bio, they simply need to create a venv and run:

pip install dash-bio

with dash, dash-html-components, dash_renderer being installed as well.

It could be implemented along the line of:

 setup( 
     name=package_name, 
     version=package["version"], 
     author=package['author'], 
     packages=[package_name, '{}/utils'.format(package_name), '{}/component_factory'.format(package_name)], 
     include_package_data=True, 
     license=package['license'], 
     description=package['description'] if 'description' in package else package_name, 
     install_requires=[
         'dash', 'dash-html-components', 'dash_renderer'
     ] 
 ) 

Test Needleplot

List all stylistic or functional issues here.
When done, change issue assignment to the component creator for them to fix the issues.

Dash Bio vs R packages features comparison

Goals before releasing dash-bio:

  • At least feature parity with R
  • Better documentation
  • More compelling example apps
  • Easier installation

Circos: https://dash-gallery.plotly.host/dash-bio/circos
https://cran.r-project.org/package=RCircos
https://cran.r-project.org/web/packages/SanzCircos/index.html
https://github.com/hpeaker/ggcircos,
https://github.com/lvulliard/BioCircos.R

Ideogram: https://dash-gallery.plotly.host/dash-bio/ideogram
https://bioconductor.org/packages/release/bioc/html/ggbio.html
https://github.com/freestatman/ideogRam

Clustergram: https://dash-gallery.plotly.host/dash-bio/clustergram
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5925766/
https://cran.r-project.org/web/packages/shinyHeatmaply/index.html

Manhattan: https://dash-gallery.plotly.host/dash-bio/manhattan-plot
http://sahirbhatnagar.com/manhattanly/

Volcano: https://dash-gallery.plotly.host/dash-bio/volcano-plot
http://sahirbhatnagar.com/manhattanly/

Needle plot: https://dash-gallery.plotly.host/dash-bio/needle-plot
https://github.com/freezecoder/mutsneedle

Cytoscape: https://dash-gallery.plotly.host/cytoscape-phylogeny
https://saezlab.github.io/cyrface/
https://bioconductor.org/packages/release/bioc/html/RCyjs.html

3d molecule viewer:
http://bio3d.ucsd.edu/pca-app/?SSUID=2018-10-30_180238089b05
http://thegrantlab.org/bio3d/index.php

MSA viewer:
https://zachcp.github.io/msaR/
http://resources.qiagenbioinformatics.com/manuals/clcsequenceviewer/current/index.php?manual=Sequence_alignment.html

Phylocanvas
https://thibautjombart.github.io/treespace/
https://github.com/zachcp/phylocanvas
https://zachcp.github.io/phylocanvas/

Oncoprint
https://github.com/dakl/oncoprint
https://www.bioconductor.org/packages/release/bioc/vignettes/ComplexHeatmap/inst/doc/s8.oncoprint.html

Gene track/coverage plots
http://www.sthda.com/english/wiki/ggbio-visualize-genomic-data
https://bioconductor.org/packages/release/bioc/html/ggbio.html
https://bioconductor.org/packages/release/bioc/vignettes/seqplots/inst/doc/SeqPlotsGUI.html

Speck

Test Dash Clustergram

List all stylistic or functional issues here.
When done, change issue assignment to the component creator for them to fix the issues.

CI is not (visibly) in place

Hi @matthewchan15,

I'd love to go over how you set up the Heroku deployment via GitHub, which is triggered every time one pushes to a feature branch.

As discussed with @VeraZab, it would be great to automate this deployment also every time the author of a pull request merges into master.

/cc @shammamah

Create a common DashBio Page component

I have seen that this header is part of a few PRs:

html.Div(
	id='header',
	className='banner',
	children=[
		html.H2('Dash bio: Manhattan plot'),
		html.Img(
			src='assets/dashbio_logo.svg',
			style={
				'height': '100',
				'float': 'right',
			}
		)
	],
	style={
		'width': '100%',
		'display': 'flex',
		'flexDirection': 'row',
		'alignItems': 'center',
		'justifyContent': 'space-between',
		'background': '#A2B1C6',
		'color': '#506784'
	}
)

So imho it makes sense to move this bit into a common component, s.t. future changes are easy?

Though this could also be an entire page component wrapper, s.t. e.g. a footer for all components can be added later easily.

Clustergram label is obscure and lengthy.

Hi @shammamah,

As I was linting app_clustergram.py, I noticed some heavy and confusing wording, lines 162-164:

'Header of row labels column in uploaded dataset',
title='If a dataset was uploaded, enter the header of' +
'the column that contains the title of each row.',

Even when I view it in context, it's unclear what this label means (I mean 'label' in the context of an app layout).

In Pandas language, when talking about a DataFrame, row labels are referred to as the index and column labels as columns.
Reference: https://pandas.pydata.org/pandas-docs/stable/dsintro.html

Maybe we could follow this convention, instead of torturing our brains?

invalid plotly syntax in component factory manhattan component

The syntax in https://github.com/plotly/dash-bio/blob/master/dash_bio/component_factory/_manhattan.py#L440 and https://github.com/plotly/dash-bio/blob/master/dash_bio/component_factory/_manhattan.py#L453 may need to be updated.

when running locally (after pip install -r requirements.txt) I'm getting:

(venv3) ➜  dash-bio git:(master) python index.py 
Traceback (most recent call last):
  File "index.py", line 31, in <module>
    for filename in appList
  File "index.py", line 32, in <dictcomp>
    if filename.startswith("app_") and filename.endswith(".py")
  File "/Users/chelsea/Repos/dash-repos/gallery-apps/dash-bio/tests/dash/app_manhattan_plot.py", line 12, in <module>
    fig = dash_bio.ManhattanPlot(df)  # Feed the data to a function which creates a Manhattan Plot figure
  File "/Users/chelsea/Repos/dash-repos/gallery-apps/dash-bio/dash_bio/component_factory/_manhattan.py", line 165, in ManhattanPlot
    highlight_color=highlight_color
  File "/Users/chelsea/Repos/dash-repos/gallery-apps/dash-bio/dash_bio/component_factory/_manhattan.py", line 440, in figure
    suggestiveline = go.layout.Shape(
AttributeError: module 'plotly.graph_objs' has no attribute 'layout'

Index.py app improvements

  • Let's have one common header for all apps: Header can take a prop for background color and text color. When clicking on the logo, you're brought back to the main index page. This work was started here: https://github.com/plotly/dash-bio/blob/master/tests/dash/utils/app_wrapper.py Let's build on it.
  • Let's make it so logo is on the left side and title of app is right after, I think that it's what people are more used to when clicking to be brought back to main index page
  • Let's change all the apps to use that header
  • Let's fix app ordering: #34

Circos description is vague and non-standard.

Hi @matthewchan15 @shammamah @VeraZab!

When visiting the gallery and hovering for each component's description, Circos's reads very different from all others:

  • it doesn't use the same imperative mood as all other descriptions (view, analyze, display, ...);
  • it doesn't mention anything bioinformatics-related (gene, chromosome, molecule, ...);
  • it isn't clear what "between data/datasets" means (sounds like a draft version).

Alignment viewer: Issues with sync between subplots

  • If you zoom into the center heatmap, the viewport of the bottom global view doesn't always update.
  • When you are very zoomed into the main heatmap, if you click-drag on the bottom global view, only the x-axis labels of the center heatmap update.

image

I thought this might be a plotly.js issue, but I don't get this off synch behavior in Chart Studio: https://plot.ly/~jackp/18501/#/

So I wonder if this app is using an older version of plotly.js.

The JS console is full of these bundle.js errors from click-dragging. I see calcdata in the compressed source, so it does seem plotly.js is having trouble in this particular environment.

image

Test Circos

List all stylistic or functional issues here.
When done, change issue assignment to the component creator for them to fix the issues.

Test Volcanoplot

List all stylistic or functional issues here.
When done, change issue assignment to the component creator for them to fix the issues.

Dash Bio apps - initial impressions

First-level impressions clicking through Dash Bio gallery beta apps: https://dash-gallery.plotly.host/dash-bio

Header

Would be great to have a GitHub link in the upper-right of the header that links to the code for each app on GitHub.

Dash Circos

  • A lot of stuff in this sidebar. Pretty overwhelming. Maybe try organizing into tabs within the sidebar? Eg perhaps could organize tabs as, Data | Layout | Events | Upload

image

  • Add a dropdown of a few different datasets?

Dash Clustergram

  • Heatmap is a bit small. Maybe put the right-hand column on the left side instead, and try to make the clustergram go full-bleed to the right edge of the screen? Usually sidebars like this are on the left hand side.
  • Would be nice to have a dropdown with a few classic clustergram data sets. Look at what the R clustergram packages and shiny apps use (eg heatmaply). Eg the mtcars dataset is a "classic:"

https://cran.rstudio.com/web/packages/heatmaply/vignettes/heatmaply.html

Dash Ideogram

  • Needs margin on the left-hand side. Bugs me that controls are touching window edge.
  • Make an issue in the original ideogram JS repo with a link to this app, to share and get feedback. Maybe will motivate the PI to address some of the issues you've raised.

Manhattan Plot

  • Hover mode should be closest by default
  • The "Visualize genome wide association studies..." description should should have a top margin so it's not touch the top header.

Sequence Viewer

  • Not sure what "Entry to view" is
  • Might want a dropdown with a few other sequences besides insulin
  • Would be great to combine this with 3d molecule viewer if there's a way that makes sense
  • vertical space between labels
  • Sequence doesn't wrap

image

Dash needle plot

  • Labels such as Stem thickness are too large in font-size IMO.
  • I only see one sample dataset in the dropdown - need to add more. A bunch here:
    https://github.com/jackparmer/react-needle-plot/tree/master/src/data
    On one of the Dash Bio calls I thought you had also found others in a Nature paper.
  • Should be a left-side margin so that controls and labels don't touch the edge of the window

image

Volcano

  • This app doesn't do much. Should maybe reduce the opacity of the points above the threshold? To make it more interesting, could add 2 overlaid histograms to the app - one histogram is all of the data and the other histogram is the data above the threshold. When the threshold is zero, the histograms are the same.
  • Get rid of "Lower effect size" and "Upper effect size" controls. They just reset the x-axis range which I don't think is very interesting.
  • Set default hover mode to closest

Remaining apps

Test Sequence Viewer

List all stylistic or functional issues here.
When done, change issue assignment to the component creator for them to fix the issues.

Test Manhattanplot

List all stylistic or functional issues here.
When done, change issue assignment to the component creator for them to fix the issues.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.