Skip to content

Commit

Permalink
pileup.js component (#543)
Browse files Browse the repository at this point in the history
* tests work for hard coded reference

* tracks can be loaded in, tests passing

* tests all pass, demos in progress

* clean up

* fixed rendering bug in pileup.js

* data for RNA-seq demo

* added pileup demo image

* tests pass

* fixed css and cleaned unused styles

* demo done

* revert dev build

* deleted unused files

* rebuild async files after merge

* review comments

* added option to modify visualization options

* Apply suggestions from code review

Co-authored-by: HammadTheOne <[email protected]>

* small documentation fixes

* Apply suggestions from code review

Co-authored-by: Alex Johnson <[email protected]>

* Linting fixes

* Fixed layout_helper linting

* Rebuilding package

* Updated CHANGELOG

* Added shared chunk for webpack deps with IGV and Pileup

Co-authored-by: HammadTheOne <[email protected]>
Co-authored-by: Alex Johnson <[email protected]>
  • Loading branch information
3 people authored Apr 1, 2021
1 parent 43faebe commit 9e5da85
Show file tree
Hide file tree
Showing 67 changed files with 3,697 additions and 140 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Unreleased
### Added
* [#543](https://github.com/plotly/dash-bio/pull/543) Added Dash Pileup component.

## [0.6.1] - 2021-02-15
### Fixed
* [#544](https://github.com/plotly/dash-bio/pull/544) Miscellaneous fixes for NglMoleculeViewer component.
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
include dash_bio/bundle.js
include dash_bio/dash_bio-shared.js
include dash_bio/async-*.js
include dash_bio/async-*.js.map
include dash_bio/metadata.json
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export(dashbioMolecule3dViewer)
export(dashbioNeedlePlot)
export(dashbioNglMoleculeViewer)
export(dashbioOncoPrint)
export(dashbioPileup)
export(dashbioSequenceViewer)
export(dashbioSpeck)
export(dashbioVolcano)
Expand Down
18 changes: 18 additions & 0 deletions R/dashbioPileup.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# AUTO GENERATED FILE - DO NOT EDIT

dashbioPileup <- function(id=NULL, style=NULL, className=NULL, range=NULL, reference=NULL, tracks=NULL) {

props <- list(id=id, style=style, className=className, range=range, reference=reference, tracks=tracks)
if (length(props) > 0) {
props <- props[!vapply(props, is.null, logical(1))]
}
component <- list(
props = props,
type = 'Pileup',
namespace = 'dash_bio',
propNames = c('id', 'style', 'className', 'range', 'reference', 'tracks'),
package = 'dashBio'
)

structure(component, class = c('dash_component', 'list'))
}
20 changes: 19 additions & 1 deletion R/internal.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ all_files = FALSE, async = TRUE), class = "html_dependency"),
`dash_bio` = structure(list(name = "dash_bio",
version = "0.6.1", src = list(href = NULL,
file = "deps"), meta = NULL,
script = 'async-pileup.js',
stylesheet = NULL, head = NULL, attachment = NULL, package = "dashBio",
all_files = FALSE, async = TRUE), class = "html_dependency"),
`dash_bio` = structure(list(name = "dash_bio",
version = "0.6.1", src = list(href = NULL,
file = "deps"), meta = NULL,
script = 'async-moleculeviewer2.js',
stylesheet = NULL, head = NULL, attachment = NULL, package = "dashBio",
all_files = FALSE, async = TRUE), class = "html_dependency"),
Expand Down Expand Up @@ -92,6 +98,12 @@ all_files = FALSE, dynamic = TRUE), class = "html_dependency"),
`dash_bio` = structure(list(name = "dash_bio",
version = "0.6.1", src = list(href = NULL,
file = "deps"), meta = NULL,
script = 'async-pileup.js.map',
stylesheet = NULL, head = NULL, attachment = NULL, package = "dashBio",
all_files = FALSE, dynamic = TRUE), class = "html_dependency"),
`dash_bio` = structure(list(name = "dash_bio",
version = "0.6.1", src = list(href = NULL,
file = "deps"), meta = NULL,
script = 'async-moleculeviewer2.js.map',
stylesheet = NULL, head = NULL, attachment = NULL, package = "dashBio",
all_files = FALSE, dynamic = TRUE), class = "html_dependency"),
Expand Down Expand Up @@ -136,6 +148,12 @@ version = "0.6.1", src = list(href = NULL,
file = "deps"), meta = NULL,
script = 'bundle.js',
stylesheet = NULL, head = NULL, attachment = NULL, package = "dashBio",
all_files = FALSE), class = "html_dependency"))
all_files = FALSE), class = "html_dependency"),
`dash_bio-shared` = structure(list(name = "dash_bio-shared",
version = "0.6.1", src = list(href = NULL,
file = "deps"), meta = NULL,
script = 'dash_bio-shared.js',
stylesheet = NULL, head = NULL, attachment = NULL, package = "dashBio",
all_files = FALSE, async = TRUE), class = "html_dependency"))
return(deps_metadata)
}
62 changes: 62 additions & 0 deletions dash_bio/Pileup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# AUTO GENERATED FILE - DO NOT EDIT

from dash.development.base_component import Component, _explicitize_args


class Pileup(Component):
"""A Pileup component.
The Pileup component is a genome visualization component
developed by the the Hammerlab. It uses an
example integration of pileup.js and React (https://www.npmjs.com/package/pileup).
Keyword arguments:
- id (string; optional): The ID of this component, used to identify dash components in callbacks.
The ID needs to be unique across all of the components in an app.
- style (dict; optional): Generic style overrides on the plot div
- className (string; optional): className of the component div.
- range (dict; optional): Object defining genomic location.
Of the format: {contig: 'chr17', start: 7512384, stop: 7512544}. range has the following type: dict containing keys 'contig', 'start', 'stop'.
Those keys have the following types:
- contig (string; optional): Name of contig to display. (ie. chr17)
- start (number; optional): Start location to display
- stop (number; optional): Stop location to display
- reference (dict; optional): Object defining genomic reference. reference has the following type: dict containing keys 'label', 'url'.
Those keys have the following types:
- label (string; optional): Label to display by reference
- url (string; optional): Url of 2bit file.
https://genome.ucsc.edu/goldenPath/help/twoBit.html
- tracks (dict; optional): Array of configuration objects defining tracks initially displayed when app launches.
See https://github.com/hammerlab/pileup.js#usage. tracks has the following type: list of dicts containing keys 'viz', 'vizOptions', 'label', 'source', 'sourceOptions'.
Those keys have the following types:
- viz (optional): Name of visualization. Must be one of
(coverage, genome, genes, features, idiogram, location, scale,
variants, genotypes, or pileup)
See https://github.com/hammerlab/pileup.js/blob/master/src/main/pileup.js
- vizOptions (optional): Options that define viz details.
Options depend on the viz type selected.
- label (string; optional): Label to display by track
- source (optional): Data source to visualize. Must be one of
(bam, vcf, alignmentJson, variantJson, featureJson, idiogramJson, cytoBand,
vcf, twoBit, bigBed, GAReadAlignment, GAVariant, GAFeature, GAGene)
See https://github.com/hammerlab/pileup.js/blob/master/src/main/pileup.js
- sourceOptions (optional): Options that define data source.
Options depend on the source selected."""
@_explicitize_args
def __init__(self, id=Component.UNDEFINED, style=Component.UNDEFINED, className=Component.UNDEFINED, range=Component.UNDEFINED, reference=Component.UNDEFINED, tracks=Component.UNDEFINED, **kwargs):
self._prop_names = ['id', 'style', 'className', 'range', 'reference', 'tracks']
self._type = 'Pileup'
self._namespace = 'dash_bio'
self._valid_wildcard_attributes = []
self.available_properties = ['id', 'style', 'className', 'range', 'reference', 'tracks']
self.available_wildcard_properties = []

_explicit_args = kwargs.pop('_explicit_args')
_locals = locals()
_locals.update(kwargs) # For wildcard attrs
args = {k: _locals[k] for k in _explicit_args if k != 'children'}

for k in []:
if k not in args:
raise TypeError(
'Required argument `' + k + '` was not specified.')
super(Pileup, self).__init__(**args)
13 changes: 13 additions & 0 deletions dash_bio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
'circos',
'ideogram',
'igv',
'pileup',
'moleculeviewer2',
'moleculeviewer3',
'needle',
Expand Down Expand Up @@ -79,6 +80,18 @@
}
])

_js_dist.extend([
{
'relative_package_path': 'dash_bio-shared.js',
'external_url': (
'https://unpkg.com/dash-bio@{}'
'/' + package_name + '/dash_bio-shared.js'
).format(__version__),
'async': True,
'namespace': 'dash_bio'
}
])

_css_dist = []


Expand Down
2 changes: 2 additions & 0 deletions dash_bio/_imports_.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from .NeedlePlot import NeedlePlot
from .NglMoleculeViewer import NglMoleculeViewer
from .OncoPrint import OncoPrint
from .Pileup import Pileup
from .SequenceViewer import SequenceViewer
from .Speck import Speck

Expand All @@ -22,6 +23,7 @@
"NeedlePlot",
"NglMoleculeViewer",
"OncoPrint",
"Pileup",
"SequenceViewer",
"Speck"
]
20 changes: 10 additions & 10 deletions dash_bio/async-alignment.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dash_bio/async-circos.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dash_bio/async-ideogram.js

Large diffs are not rendered by default.

21 changes: 7 additions & 14 deletions dash_bio/async-igv.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dash_bio/async-moleculeviewer2.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dash_bio/async-moleculeviewer3.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dash_bio/async-needle.js

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions dash_bio/async-nglmoleculeviewer.js

Large diffs are not rendered by default.

Loading

0 comments on commit 9e5da85

Please sign in to comment.