-
-
Notifications
You must be signed in to change notification settings - Fork 193
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
Clustergram: app improvements #70
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
532c2d1
Restyle app; clustergram now on right hand side and larger, and color…
901dc04
Begin to implement usage of dcc.Store.
d000684
Add some print statements for debugging
b93bb5b
Add fix for cases in which serialization of numpy arrays loses nan da…
4c75207
Remove printing of grid.
e04f19d
Interim solution; currently trace storage does not work, so the entir…
f25d173
Add some sample datasets and begin to put those in a dropdown.
9c0f219
Fixed bug in which correct number of header rows was not getting pass…
d44707c
Some bugs with loading initial data options.
f9761f7
Fix bug in which the datasets were not immediately calculating and di…
976ac95
Remove debugging print statements and add petal width to default data…
04391f2
Make some stylistic changes.
95f44a3
Add ability to hide labels for one dimension on the plot.
acd7949
Add mtcars dataset, fix styling, and add information for all preloade…
cedc546
Add symmetric values and log transforms only for uploaded data, not p…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -356,7 +356,8 @@ def figure( | |
[{}, {'colspan': 2}, None, {}] | ||
], | ||
vertical_spacing=0, | ||
horizontal_spacing=0 | ||
horizontal_spacing=0, | ||
print_grid=False | ||
) | ||
|
||
fig['layout']['hovermode'] = 'closest' | ||
|
@@ -369,22 +370,56 @@ def figure( | |
|
||
# for column dendrogram, leaves are at bottom (y=0) | ||
for i in range(len(t['col'])): | ||
xs = t['col'][i]['x'] | ||
ys = t['col'][i]['y'] | ||
|
||
# during serialization (e.g., in a dcc.Store, the NaN | ||
# values become None and the arrays get turned into lists; | ||
# they must be converted back | ||
if(isinstance(xs, list)): | ||
xs = [x if x is not None else np.nan for x in xs] | ||
xs = np.array(xs) | ||
t['col'][i].update( | ||
x=xs | ||
) | ||
if(isinstance(ys, list)): | ||
ys = [y if y is not None else np.nan for y in ys] | ||
ys = np.array(ys) | ||
t['col'][i].update( | ||
y=ys | ||
) | ||
tickvals_col += [ | ||
t['col'][i]['x'].flatten()[j] | ||
for j in range(len(t['col'][i]['x'].flatten())) | ||
if t['col'][i]['y'].flatten()[j] == 0.0 and | ||
t['col'][i]['x'].flatten()[j] % 10 == 5 | ||
xs.flatten()[j] | ||
for j in range(len(xs.flatten())) | ||
if ys.flatten()[j] == 0.0 and | ||
xs.flatten()[j] % 10 == 5 | ||
] | ||
tickvals_col = list(set(tickvals_col)) | ||
|
||
# for row dendrogram, leaves are at right(x=0, since we | ||
# horizontally flipped it) | ||
for i in range(len(t['row'])): | ||
xs = t['row'][i]['x'] | ||
ys = t['row'][i]['y'] | ||
|
||
if(isinstance(xs, list)): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. almost the same code as above but with 'row' instead of 'col', could be done in a function for easier maintenance |
||
xs = [x if x is not None else np.nan for x in xs] | ||
xs = np.array(xs) | ||
t['row'][i].update( | ||
x=xs | ||
) | ||
if(isinstance(ys, list)): | ||
ys = [y if y is not None else np.nan for y in ys] | ||
ys = np.array(ys) | ||
t['row'][i].update( | ||
y=ys | ||
) | ||
|
||
tickvals_row += [ | ||
t['row'][i]['y'].flatten()[j] | ||
for j in range(len(t['row'][i]['y'].flatten())) | ||
if t['row'][i]['x'].flatten()[j] == 0.0 and | ||
t['row'][i]['y'].flatten()[j] % 10 == 5 | ||
ys.flatten()[j] | ||
for j in range(len(ys.flatten())) | ||
if xs.flatten()[j] == 0.0 and | ||
ys.flatten()[j] % 10 == 5 | ||
] | ||
|
||
tickvals_row = list(set(tickvals_row)) | ||
|
@@ -701,6 +736,7 @@ def _dendrogramTraces( | |
} | ||
self._rowLabels = scp.array(Prow['ivl']) | ||
trace_list['row'] = self._colorDendroClusters(Prow_tmp, 'row') | ||
|
||
return trace_list | ||
|
||
def _colorDendroClusters( | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In terms of speed looping explicitely over arrays in python is slover than using pandas or numpy functions, it would only be important for superlarge datasets though