Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add first draft of FornaContainer component. #418

Merged
merged 65 commits into from
Oct 22, 2019
Merged
Show file tree
Hide file tree
Changes from 64 commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
14ff1d7
Add first draft of FornaContainer component.
Sep 18, 2019
7702d2e
Add first version of demo app.
Sep 18, 2019
71e872d
Fix Speck demo application argument names.
Aug 2, 2019
f4829e3
Change parameter names in demo apps.
Sep 18, 2019
112ec28
Add image for Forna Container.
Sep 18, 2019
ea1451c
Update version in package.
Sep 18, 2019
e25d12f
Update auto-generated files.
Sep 18, 2019
aaad47e
Update version in requirements.
Sep 18, 2019
a21bea9
Update Dash requirement.
Sep 18, 2019
3d126ea
Add fornac library to package.json requirements.
Sep 18, 2019
63d7224
Merge branch 'master' into add-forna-component
Sep 23, 2019
9a731d8
Restructure shouldComponentUpdate code.
Oct 4, 2019
fd272ea
Fix pylint errors.
Oct 4, 2019
d01a200
Fix flake8 errors.
Oct 4, 2019
524232d
Change PropTypes.shape to PropTypes.exact.
Oct 4, 2019
0cc040a
Avoid directly modifying 'options' object.
Oct 9, 2019
f8a4f1b
Add support for custom color schemes.
Oct 9, 2019
dba202a
Remove outline.
Oct 9, 2019
ed2005f
Add more detailed prop descriptions for custom color scheme.
Oct 9, 2019
5322933
Add custom colors to FornaContainer demo app.
Oct 9, 2019
ab35ecf
Update style for FornaContainer app.
Oct 9, 2019
f726054
Update Dash DAQ requirement.
Oct 9, 2019
56a44c8
Update requirements to latest version.
Oct 9, 2019
0654538
Add auto-generated files and linted FornaContainer code.
Oct 9, 2019
3537b31
Update package.json.
Oct 9, 2019
a965b1a
Always update color scheme.
Oct 10, 2019
32d3dcf
Small changes to the app.
Oct 10, 2019
82e6a48
Update version in package.
Oct 10, 2019
775dc78
Add auto-generated files.
Oct 10, 2019
b17d6f1
Update version in requirements.
Oct 10, 2019
4f91108
Fix width and height being backwards.
Oct 10, 2019
de68e61
Small changes and improvements.
Oct 10, 2019
040d781
Add better description of app and different initial colors.
Oct 10, 2019
07a1173
Check for existence of options before comparing them.
Oct 11, 2019
942daab
Remove unnecessary comma
Oct 11, 2019
39a25bd
Add tests for FornaContainer.
Oct 11, 2019
04dbdd5
Merge branch 'master' into add-forna-component
Oct 11, 2019
edf88d4
Use Ramda equals.
Oct 18, 2019
9b3527b
Move new sequence rendering to componentDidUpdate.
Oct 18, 2019
e1a6b24
Update tests/dashbio_demos/app_forna_container.py
Oct 18, 2019
7e3bc68
Use dcc.Markdown.
Oct 18, 2019
9411e5d
Add back renderNewSequences to componentDidMount.
Oct 18, 2019
ef225b1
Use ref instead of ID.
Oct 18, 2019
afbc06b
Change callbacks argument name and remove pylint statement.
Oct 18, 2019
3745fd9
Fix arguments for Circos app table.
Oct 18, 2019
9c5aedb
Merge branch 'master' into add-forna-component
Oct 18, 2019
b83ebe3
Merge branch 'master' into add-forna-component
Oct 18, 2019
04faf48
Use React.createRef().
Oct 18, 2019
a627320
Update version.
Oct 18, 2019
45c73c7
Update autogenerated files.
Oct 18, 2019
8f4f572
Update CHANGELOG.
Oct 18, 2019
7f5df65
Update description of FornaContainer component.
Oct 18, 2019
877f3e9
Ensure that colors are updated on initial render.
Oct 18, 2019
1aac6b3
Add test for initial color scheme.
Oct 18, 2019
7ecfc19
Update version.
Oct 18, 2019
52db7f0
Update autogenerated files.
Oct 18, 2019
4af466d
Merge branch 'master' into add-forna-component
Oct 18, 2019
b890bb5
Fix ordering and logic for color scheme changes.
Oct 21, 2019
2f6e424
Fix typo and correctly pass in allowPanningAndZooming option.
Oct 21, 2019
548260e
Update version and add auto-generated files.
Oct 21, 2019
f795f39
Fix more bugs related to nodeFillColor behaviour.
Oct 21, 2019
69dc7b1
Update version of react-docgen.
Oct 21, 2019
cf6bd8f
Update package version and all autogenerated files.
Oct 21, 2019
e1eb149
Update version of package.
Oct 22, 2019
7b267a4
Add new app to list of remotes.
Oct 22, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

### Added

* Added FornaContainer component for RNA secondary structure analysis.

## [0.2.0] - 2019-10-18

### Fixed
Expand Down
108 changes: 108 additions & 0 deletions assets/forna-style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
#forna-container {
display: inline-block;
padding: 20px;
margin-top: 50px;
}

#forna-body ::-webkit-scrollbar-thumb {
background-color: #85002D !important;
}

#forna-control-tabs .tab--selected {
color: #85002D !important;
}

#forna-body .rc-slider-track {
background-color: #85002D !important;
}

#forna-body .rc-slider-handle, #forna-body .rc-slider-dot-active {
border-color: #85002D !important;
}

#forna-sequence, #forna-structure, #forna-id {
width: 100%;
margin-top: 15px;
}

#forna-body #forna-bond-length {
display: inline-block;
width: 150px;
margin-top: 10px;
}

#forna-control-tabs .app-controls-block {
margin-bottom: 20px;
}

#forna-submit-sequence, #forna-submit-custom-colors {
width: 100%;
}

#forna-apply-force, #forna-circularize-external,
#forna-avoid-others, #forna-label-interval,
#forna-color-scheme, #forna-custom-colors-molecule,
#forna-color-range {
display: inline-block !important;
text-align: right;
position: relative;
top: 5px;
float: right;
}

#forna-label-interval, #forna-color-scheme,
#forna-custom-colors-molecule, #forna-color-range {
width: 150px;
position: relative;
text-align: left;
}

#forna-color-range {
position: relative;
top: 10px;
}

#forna-color-domain-low, #forna-color-domain-high,
#forna-color-map-nucleotide, #forna-color-map-color,
#forna-custom-colorscheme > #forna-color-low,
#forna-custom-colorscheme > #forna-color-high {
display: inline-block;
width: 48%;
}

#forna-custom-colorscheme > #forna-color-low,
#forna-custom-colorscheme > #forna-color-high {
margin-bottom: 20px;
}
#forna-custom-colorscheme > #forna-color-low,
#forna-color-domain-low,
#forna-color-map-nucleotide {
margin-right: 2%;
}
#forna-custom-colorscheme > #forna-color-high,
#forna-color-domain-high,
#forna-color-map-color {
margin-left: 2%;
}

#forna-custom-colorscheme .chrome-picker {
width: 100% !important;
border: none !important;
}

#forna-sequence-info {
font-size: 10pt;
}

#forna-color-scheme, #forna-custom-colors-molecule {
position: relative;
top: 0px;
}

#forna-error-message {
text-align: center;
}

#forna-color-scheme-desc {
margin-top: 20px;
}
98 changes: 98 additions & 0 deletions dash_bio/FornaContainer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# AUTO GENERATED FILE - DO NOT EDIT

from dash.development.base_component import Component, _explicitize_args


class FornaContainer(Component):
"""A FornaContainer component.
FornaContainer is a force-directed graph that is used to visualize
the secondary structure of biomolecules. It is based on the fornac
library (https://github.com/ViennaRNA/fornac).

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.
- height (number; default 500): The height (in px) of the container in which the molecules will
be displayed.
- width (number; default 300): The width (in px) of the container in which the molecules will
be displayed.
- sequences (dict; optional): The molecules that will be displayed. sequences has the following type: list of dicts containing keys 'sequence', 'structure', 'options'.
Those keys have the following types:
- sequence (string; required): A string representing the RNA nucleotide sequence of
the RNA molecule.
- structure (string; required): A dot-bracket string
(https://software.broadinstitute.org/software/igv/RNAsecStructure)
that specifies the secondary structure of the RNA
molecule.
- options (dict; optional): Additional options to be applied to the rendering of
the RNA molecule. options has the following type: dict containing keys 'applyForce', 'circularizeExternal', 'labelInterval', 'name', 'avoidOthers'.
Those keys have the following types:
- applyForce (boolean; optional): Indicate whether the force-directed layout will be
applied to the displayed molecule. Enabling this
option allows users to change the layout of the
molecule by selecting and dragging the individual
nucleotide nodes. True by default.
- circularizeExternal (boolean; optional): This only makes sense in connection with the
applyForce argument. If it's true, the external
loops will be arranged in a nice circle. If false,
they will be allowed to flop around as the force
layout dictates. True by default.
- labelInterval (number; optional): Change how often nucleotide numbers are labelled
with their number. 10 by default.
- name (string; optional): The molecule name; this is used in custom color
scales.
- avoidOthers (boolean; optional): Whether or not this molecule should "avoid" other
molecules in the map.
- nodeFillColor (string; optional): The fill color for all of the nodes. This will override any
color scheme defined in colorScheme.
- colorScheme (a value equal to: 'sequence', 'structure', 'positions', 'custom'; default 'sequence'): The color scheme that is used to color the nodes.
- customColors (dict; optional): The custom colors used to color the nodes if the 'custom'
option is chosen for the `colorScheme` prop.
For example, if the domain is `[0, 20]`, the range is
`['yellow', 'red']`, and the dictionary specified in
'colorValues' that corresponds to a molecule is `{'6': 10}`,
the sixth nucleotide in that molecule will have a color that is
perfectly in between yellow and red (i.e., orange), since 10 is
perfectly in between 0 and 20. customColors has the following type: dict containing keys 'domain', 'range', 'colorValues'.
Those keys have the following types:
- domain (list of numbers; optional): The limits for the color scale. This is used with the range
specified in `range` to calculate the color of a given
nucleotide, based on the number that it is assigned.
- range (list of strings; optional): The range of colors that will be used in conjunction with
the `domain` prop.
- colorValues (dict with strings as keys and values of type dict with strings as keys and values of type string | number; optional): A dictionary which contains keys, each of which are either
an empty string (`''`) or the name of a molecule that has
been defined in the `name` prop in the `options` for a
sequence in the `sequences` property.
The value corresponding to the key that is an empty string
(if that key exists) is a "default" color scheme that will
be applied first, and can be overridden by the color
schemes defined for molecule-specific keys. The
aforementioned color schemes each take the form of a
dictionary in which the keys are the nucleotide positions
and the values are either a) numbers to be normalized with
respect to the scale defined in `domain` (so that their
color will be calculated), or b) direct string
representations of colors.
- allowPanningAndZooming (boolean; default True): Allow users to zoom in and pan the display. If this is enabled,
then pressing the 'c' key on the keyboard will center the view."""
@_explicitize_args
def __init__(self, id=Component.UNDEFINED, height=Component.UNDEFINED, width=Component.UNDEFINED, sequences=Component.UNDEFINED, nodeFillColor=Component.UNDEFINED, colorScheme=Component.UNDEFINED, customColors=Component.UNDEFINED, allowPanningAndZooming=Component.UNDEFINED, labelInterval=Component.UNDEFINED, **kwargs):
self._prop_names = ['id', 'height', 'width', 'sequences', 'nodeFillColor', 'colorScheme', 'customColors', 'allowPanningAndZooming']
self._type = 'FornaContainer'
self._namespace = 'dash_bio'
self._valid_wildcard_attributes = []
self.available_properties = ['id', 'height', 'width', 'sequences', 'nodeFillColor', 'colorScheme', 'customColors', 'allowPanningAndZooming']
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(FornaContainer, self).__init__(**args)
2 changes: 2 additions & 0 deletions dash_bio/_imports_.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from .AlignmentChart import AlignmentChart
from .Circos import Circos
from .FornaContainer import FornaContainer
from .Ideogram import Ideogram
from .Molecule2dViewer import Molecule2dViewer
from .Molecule3dViewer import Molecule3dViewer
Expand All @@ -11,6 +12,7 @@
__all__ = [
"AlignmentChart",
"Circos",
"FornaContainer",
"Ideogram",
"Molecule2dViewer",
"Molecule3dViewer",
Expand Down
26 changes: 13 additions & 13 deletions dash_bio/bundle.js

Large diffs are not rendered by default.

Loading