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

Initial merge: Dash sequence viewer #8

Merged
merged 121 commits into from
Nov 27, 2018
Merged
Show file tree
Hide file tree
Changes from 92 commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
0722955
Add sequence viewer to package.json.
Sep 18, 2018
7132b6a
Add React wrapper for sequence viewer component.
Sep 18, 2018
05246ba
Add in requirements to package.json; add in selection feature for seq…
Sep 19, 2018
0ac439b
Implement coverage feature.
Sep 19, 2018
bb0fac8
Add testing code for sequence viewer.
Sep 19, 2018
11857a3
Update progress; setProps still undefined.
Sep 22, 2018
f5cf9f4
Back to working state; setProps still is not defined as a function.
Sep 24, 2018
417697d
Fix issue with setProps; all onclick functions work now for coverage.
Sep 24, 2018
8a5b347
Change deprecated ComponentWillMount to ComponentDidMount.
Sep 24, 2018
4c63481
Use Insulin for Dash app.
Sep 24, 2018
4eaab3c
Add error handling for updating coverage.
Sep 24, 2018
3f30379
First attempt at implementing mouse selection and subpart selection.
Sep 24, 2018
efdd25e
Add sections for testing all aspects of coverage and selection.
Sep 24, 2018
1822c96
Add descriptions of all prop types.
Sep 24, 2018
d9f80e8
Implement and show example of legend.
Sep 24, 2018
aada372
onMouseSelection and onSubpartSelected correctly work with the consol…
Sep 25, 2018
d0c3079
Remove some unnecessary lines of code and add TODO for ShouldComponen…
Sep 25, 2018
36b6a7b
Fix issue with rerendering in the middle of searching for a sequence;…
Sep 26, 2018
649d7a5
Modify usage.py to demonstrate subpart selection.
Sep 26, 2018
2b50356
Minor typo corrections; note that onMouseSelection and onclick events…
Sep 26, 2018
993140f
Add beginnings of app styling.
Sep 26, 2018
ef71c57
Implement shouldComponentUpdate to deal with issue of re-rendering up…
Sep 27, 2018
28c4da3
First draft of demo app for meeting.
Sep 27, 2018
cdf6ab4
Add fix for webpack issue described on dash-component-boilerplate rep…
Sep 28, 2018
c41c910
Add dash_bio and package-lock.
Sep 28, 2018
89d5098
Add in a helper script to parse .fasta files, and incorporate these c…
Oct 3, 2018
c592834
Add functionality for multiple proteins in single fasta file.
Oct 4, 2018
f92b636
Always return a list of proteins in protein reader.
Oct 4, 2018
7a75876
Modify to allow reading a raw data string as well as reading from a f…
Oct 4, 2018
62212d4
Add docstrings and clean up code.
Oct 4, 2018
c64afa2
Add test app for sequence viewer.
Oct 11, 2018
af0d116
Remove protein files and folder.
Oct 11, 2018
c5e5c29
Delete ExampleComponent.py
Oct 11, 2018
b1c8f70
Fix merge conflicts when merging master back in.
Oct 17, 2018
a34fa84
Update code to reflect dependencies for this app.
Oct 17, 2018
45db005
Make some changes as suggested in PR.
Oct 18, 2018
b7f11ae
Add coverage option into demo app.
Oct 18, 2018
0b47c33
Add files for DDS.
Oct 22, 2018
fb51211
Add tarball.
Oct 22, 2018
1704c92
Fix double declaration of dash in requirements.txt.
Oct 22, 2018
cfd4317
Remove base64 from requirements.txt.
Oct 22, 2018
002949c
Add server variable for DDS to usage.py.
Oct 22, 2018
1fa3885
Include entire event details for mouse selection event.
Oct 22, 2018
36bb743
Fix control box height.
Oct 22, 2018
a8e80d8
Ensure that component updates when a new sequence is loaded.
Oct 22, 2018
7e6f1d2
Fix issue with coverage not being enabled.
Oct 22, 2018
a385184
Update tarball.
Oct 22, 2018
8ab63da
Fix issue with selection and/or coverage not having a length due to b…
Oct 22, 2018
8df4b5e
Update tarball.
Oct 22, 2018
2bdb7b5
Update tarball to fix error with initializing selection and coverage …
Oct 22, 2018
d20f427
Initialize coverage and selection to be empty lists instead of null.
Oct 24, 2018
63af5e3
Fix issue with trying to access 'selection' key in a NoneType variable.
Oct 24, 2018
f59a687
Add support for selecting a different protein in the same file.
Oct 24, 2018
400acd1
Update tarball to reflect changes in component.
Oct 24, 2018
14ce87f
Update tarball again.
Oct 24, 2018
45ffb43
Modify protein reader to use Bio.SeqIO for parsing; clean up usage.py…
Oct 24, 2018
33cb3c4
add biopython to requirements.
Oct 24, 2018
20a4322
Regenerate package-lock.
Oct 30, 2018
6d80edc
Alphabetize requirements.
Oct 30, 2018
d310c8e
Remove onMouseSelection and onSubpartSelected functions from componen…
Oct 30, 2018
94162a2
Provide default prop values.
Oct 30, 2018
43bf798
condense declaration of constants in render method.
Oct 30, 2018
b7bc8a7
Remove null initialization of selection in usage.py, and remove condi…
Oct 30, 2018
79e888e
Use "some" functions to filter through selection and coverage in shou…
Oct 30, 2018
77a98f1
Change 'var' to 'let'.
Oct 30, 2018
6414b95
Put sequenceMaxHeight in defaultProps.
Oct 30, 2018
fd27eb3
Clean up code and fix stylesheet to be specific to sequence viewer co…
Nov 5, 2018
c04e9e6
Add sequence viewer test app.
Nov 5, 2018
1a09619
Add new stylesheet.
Nov 5, 2018
38d5cba
Redeploy to DDS
Nov 6, 2018
2711e48
Re-add usage.py.
Nov 6, 2018
ca63439
Add parsing for other databases.
Nov 6, 2018
8a31bdf
Add default props to sequence viewer component.
Nov 7, 2018
2c1b26b
Test out empty component
Nov 8, 2018
a676040
Merge branch 'master' into dash-sequence-viewer
Nov 8, 2018
f2f1c17
Merge branch 'master' into dash-sequence-viewer
Nov 8, 2018
a89c1a3
rename test app.
Nov 8, 2018
1beec3d
merge master back and resolve conflicts.
Nov 8, 2018
d4e119f
Fix conflicts with master and add description/image.
Nov 8, 2018
6cc5e77
Update style to display properly in new gallery page.
Nov 8, 2018
e5b1392
Merge branch 'master' into dash-sequence-viewer
Nov 8, 2018
8be97df
Merge branch 'master' into dash-sequence-viewer
Nov 9, 2018
298582b
Ignore changes to index
Nov 9, 2018
acbe097
Remove JQuery dependency.
Nov 13, 2018
fdeefcc
Remove unnecessary functionality from proteinReader.
Nov 13, 2018
eea852d
Use Biopython to translate amino acid sequences.
Nov 13, 2018
a05e5a6
Fix height of controls container.
Nov 13, 2018
0c33b1c
Use Biopython for translation and add translation alphabet options.
Nov 13, 2018
659d4da
change style and add logo to demo app.
Nov 13, 2018
343a74e
Add logo to demo app.
Nov 13, 2018
cde91a6
Update index.py
Nov 13, 2018
2e6a738
Remove index.py from gitignore.
Nov 13, 2018
34b4a8d
Remove whitespace and clean up code as per code review comments.
Nov 14, 2018
d27e9be
Merge master and resolve conflicts.
Nov 15, 2018
71e1adf
Add tarball.
Nov 15, 2018
bdcf860
Remove versions from requirements.
Nov 15, 2018
d96376e
Merge master back into branch.
Nov 16, 2018
784683b
Fix index.py and package.json to include most current versions on mas…
Nov 16, 2018
63f1db5
Regenerate tarball.
Nov 16, 2018
34ea248
Fix whitespace errors in package.json; regenerate tarball.
Nov 19, 2018
843db0d
tarball again
Nov 19, 2018
c587ece
update folder
Nov 19, 2018
dc09725
Change react-sequence-viewer dependency to come from git repository.
Nov 19, 2018
f1de95b
Update stylesheet to have component-specific scrollbar styling.
Nov 20, 2018
0a2bd3f
Remove usage.py
Nov 20, 2018
072813c
Add title to sequence viewer.
Nov 20, 2018
584544f
Move onclick function assignments for coverage outside of render meth…
Nov 20, 2018
f0533f5
Add sample data and add support for adding coverage in-app.
Nov 20, 2018
3981419
Load default data and coverage.
Nov 21, 2018
8bd694e
Fix webkit scrollbar styling to be specific to app.
Nov 21, 2018
ea2882e
Fix bug in which multiples of 3 for subsequence selection would not a…
Nov 21, 2018
701a0ae
Rename SequenceViewerComponent to SequenceViewer.
Nov 21, 2018
d43c1c7
Regenerate tarball.
Nov 22, 2018
b87e041
Stylistic changes.
Nov 23, 2018
3fbf236
Regenerate tarball
Nov 23, 2018
d36bb36
Add specific sequence viewer commit ID.
Nov 23, 2018
0fcffd6
Merge master back into branch.
Nov 23, 2018
2e97c18
Add or update descriptions for component and props.
Nov 23, 2018
5c6b20d
Re-add selection to props in render.
Nov 27, 2018
a6c678f
Merge master back into branch and re-build package.
Nov 27, 2018
58014d0
Remove inline styles.
Nov 27, 2018
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.


shammamah-zz marked this conversation as resolved.
Show resolved Hide resolved
# dependencies
/node_modules

Expand Down
85 changes: 85 additions & 0 deletions assets/sequence-viewer-style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
@import url('https://fonts.googleapis.com/css?family=Open+Sans');

#seq-view-body {
position: absolute;
overflow: auto;
top: 0px;
left: 0px;
bottom: 0px;
width: 100%;
height: 100%;
background-color: #F3F6FA;
font-family: 'Open Sans';
}
::-webkit-scrollbar{
shammamah-zz marked this conversation as resolved.
Show resolved Hide resolved
width: 0px;
height: 0px;
}
#seq-view-header {
width: calc(100% - 40px);
height: auto;
margin: 0px;
font-size: 60px;
margin-bottom: 20px;
background: #C8D4E3;
color: #636efa;
font-family: 'Open Sans';
font-variant: all-small-caps;
}

.inputSearchSeq {
font-size: 14px;
width: 100px;
padding:5px;
border-radius:3px;
border: solid 1px grey;
margin-left: 10px;
}
#seq-view-fasta-upload{
width: 400px;
margin: 20px;
padding: 10px;
}
#sequence-viewer-container{
width: 400px;
display: inline-block;
vertical-align: top;
border: solid 1px #636efa;
border-radius: 5px;
padding: 10px;
margin:20px;
overflow:scroll;
}

#seq-view-controls-container {
width:150px;
display: inline-block;
vertical-align: top;
height:auto;
margin: 20px;
border: solid 1px #636efa;
border-radius: 5px;
padding: 10px;
padding-top:30px;
}

#seq-view-sel-slider-container {
width: 100px;
padding: 10px;
border: solid 1px #636efa;
border-radius: 5px;
margin: 10px;
margin-top:30px;
}

#seq-view-info-container {
width: 400px;
height: 500px;
border: solid 1px #636efa;
overflow:scroll;
margin: 20px;
vertical-align: top;
border-radius: 5px;
padding: 20px;
display: inline-block;
}
12 changes: 9 additions & 3 deletions config.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import os

# Replace with the name of your Dash app
# This will end up being part of the URL of your deployed app,
# so it can't contain any spaces, capitalizations, or special characters
#
# This name MUST match the name that you specified in the
# Dash App Manager
DASH_APP_NAME = 'dash-bio'
# Set to 'private' if you want to add a login screen to your app
# Set to 'private' if you want to add a login screen to your app

# You can choose who can view the app in your list of files
# at <your-plotly-server>/organize.
# Set to 'public' if you want your app to be accessible to
Expand All @@ -15,7 +17,8 @@
# Set to 'secret' if you want to add a login screen, but allow it
# to be bypassed by using a secret "share_key" parameter.
DASH_APP_PRIVACY = 'public'
# Dash On-Premise is configured with either "Path based routing"

# Dash On-Premise is configured with either "Path based routing"
# or "Domain based routing"
# Ask your server administrator which version was set up.
# If a separate subdomain was created,
Expand All @@ -30,21 +33,24 @@
# Fill in with your Plotly On-Premise username
os.environ['PLOTLY_USERNAME'] = 'shammamah'
# Fill in with your Plotly On-Premise API key
# See <your-plotly-server>/settings/api to generate a key

# See <your-plotly-server>/settings/api to generate a key
# If you have already created a key and saved it on your own machine
# (from the Plotly-Python library instructions at https://plot.ly/python/getting-started)
# then you can view that key in your ~/.plotly/.config file
# or inside a Python session with these commands:
# import plotly
# print(plotly.tools.get_config_file())
os.environ['PLOTLY_API_KEY'] = 'your-plotly-api-key'

# Fill in with your Plotly On-Premise domain
os.environ['PLOTLY_DOMAIN'] = 'https://your-plotly-domain.com'
os.environ['PLOTLY_API_DOMAIN'] = os.environ['PLOTLY_DOMAIN']
# Fill in with the domain of your Dash subdomain.
# This matches the domain of the Dash App Manager
PLOTLY_DASH_DOMAIN='https://your-dash-manager-plotly-domain.com'
# Keep as True if your SSL certificates are valid.

shammamah-zz marked this conversation as resolved.
Show resolved Hide resolved
# If you are just trialing Plotly On-Premise with self signed certificates,
# then you can set this to False. Note that self-signed certificates are not
# safe for production.
Expand Down
Binary file removed dash_bio-0.0.1.tar.gz
Binary file not shown.
91 changes: 91 additions & 0 deletions dash_bio/SequenceViewerComponent.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# AUTO GENERATED FILE - DO NOT EDIT

from dash.development.base_component import Component, _explicitize_args


class SequenceViewerComponent(Component):
"""A SequenceViewerComponent component.


Keyword arguments:
- id (string; optional): The ID used to identify this component in Dash callbacks.
- sequence (string; optional): The amino acid sequence that will be displayed.
- showLineNumbers (boolean; optional): The option of whether or not to display line numbers.
- wrapAminoAcids (boolean; optional): The option of whether or not to display the list of amino acids
as broken up into separate lines of a fixed length set by
charsPerLine.
- charsPerLine (number; optional): The number of amino acids that will display per line.
- toolbar (boolean; optional): The option of whether or not to display a toolbar at the top
that allows the user to choose the number of letters per line.
- search (boolean; optional): The option of whether or not to include a search bar in
the header. This supports regex.
- title (string; optional): A string that displays at the top of the component.
- sequenceMaxHeight (string; optional): The maximum height of the sequence; default "400px".
- badge (boolean; optional): The option of whether or not to display a badge showing the
amino acid count at the top of the component beside the title.
- selection (list; optional): A highlighted section of the sequence; the color of the highlight
can also be defined. Takes a list of format [min, max, color] where
min is a number that represents the starting index of the selection,
max is a number that represents the stopping index of the selection,
and color is a string that defines the highlight color.
Cannot be used at the same time as coverage.
- coverage (list; optional): A coverage of the entire sequence; each section of the sequence
can have its own text color, background color, tooltip (on hover),
and an optional underscore. The props start and end represent the
beginning and terminating indices of the section in question.
Cannot be used at the same time as selection.
- legend (list; optional): A legend corresponding to the color codes above (optionally displayed).
- coverageClicked (number; optional): Contains the index of the section that was clicked last in
the coverage.
- mouseSelection (optional): A string containing the mouse selection.. mouseSelection has the following type: dict containing keys 'start', 'end', 'selection'.
Those keys have the following types:
- start (number; optional)
- end (number; optional)
- selection (string; optional)
- subpartSelected (list; optional): A string containing all of the highlighted sections when
using the search bar.

Available events: """
@_explicitize_args
def __init__(self, id=Component.UNDEFINED, sequence=Component.UNDEFINED, showLineNumbers=Component.UNDEFINED, wrapAminoAcids=Component.UNDEFINED, charsPerLine=Component.UNDEFINED, toolbar=Component.UNDEFINED, search=Component.UNDEFINED, title=Component.UNDEFINED, sequenceMaxHeight=Component.UNDEFINED, badge=Component.UNDEFINED, selection=Component.UNDEFINED, coverage=Component.UNDEFINED, legend=Component.UNDEFINED, coverageClicked=Component.UNDEFINED, mouseSelection=Component.UNDEFINED, subpartSelected=Component.UNDEFINED, onMouseSelection=Component.UNDEFINED, onSubpartSelected=Component.UNDEFINED, **kwargs):
self._prop_names = ['id', 'sequence', 'showLineNumbers', 'wrapAminoAcids', 'charsPerLine', 'toolbar', 'search', 'title', 'sequenceMaxHeight', 'badge', 'selection', 'coverage', 'legend', 'coverageClicked', 'mouseSelection', 'subpartSelected']
self._type = 'SequenceViewerComponent'
self._namespace = 'dash_bio'
self._valid_wildcard_attributes = []
self.available_events = []
self.available_properties = ['id', 'sequence', 'showLineNumbers', 'wrapAminoAcids', 'charsPerLine', 'toolbar', 'search', 'title', 'sequenceMaxHeight', 'badge', 'selection', 'coverage', 'legend', 'coverageClicked', 'mouseSelection', 'subpartSelected']
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(SequenceViewerComponent, self).__init__(**args)

def __repr__(self):
if(any(getattr(self, c, None) is not None
for c in self._prop_names
if c is not self._prop_names[0])
or any(getattr(self, c, None) is not None
for c in self.__dict__.keys()
if any(c.startswith(wc_attr)
for wc_attr in self._valid_wildcard_attributes))):
props_string = ', '.join([c+'='+repr(getattr(self, c, None))
for c in self._prop_names
if getattr(self, c, None) is not None])
wilds_string = ', '.join([c+'='+repr(getattr(self, c, None))
for c in self.__dict__.keys()
if any([c.startswith(wc_attr)
for wc_attr in
self._valid_wildcard_attributes])])
return ('SequenceViewerComponent(' + props_string +
(', ' + wilds_string if wilds_string != '' else '') + ')')
else:
return (
'SequenceViewerComponent(' +
repr(getattr(self, self._prop_names[0], None)) + ')')
4 changes: 2 additions & 2 deletions dash_bio/_imports_.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .ExampleComponent import ExampleComponent
from .SequenceViewerComponent import SequenceViewerComponent

__all__ = [
"ExampleComponent"
"SequenceViewerComponent",
]
Loading