-
-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support data input as DataFrame in Clustergram. (#478)
* Write test for dataframe input of Clustergram * Support data input as DataFrame in Clustergram * Add integration test for Clustergram reading in dataframes * Lint and standardize imports * Log enhancement for upcoming release * Update version number in package. * Update autogenerated files. * Update CHANGELOG with release date. Co-authored-by: Shammamah Hossain <[email protected]>
- Loading branch information
Showing
7 changed files
with
79 additions
and
24 deletions.
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
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1 +1 @@ | ||
{"name": "dash_bio", "version": "0.4.6", "author": "The Plotly Team <[email protected]>"} | ||
{"name": "dash_bio", "version": "0.4.7", "author": "The Plotly Team <[email protected]>"} |
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
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 |
---|---|---|
@@ -1,33 +1,51 @@ | ||
import numpy as np | ||
import pandas as pd | ||
|
||
from dash_bio import Clustergram | ||
|
||
DATA = np.array( | ||
[[1, 1, 1, 1], | ||
[3, 3, 3, 3], | ||
[1, 1, 1, 1], | ||
[3, 3, 3, 3], | ||
[1, 1, 1, 1], | ||
[3, 3, 3, 3]] | ||
) | ||
CLUSTERED_DATA = np.array( | ||
[[1, 1, 1, 1], | ||
[1, 1, 1, 1], | ||
[1, 1, 1, 1], | ||
[3, 3, 3, 3], | ||
[3, 3, 3, 3], | ||
[3, 3, 3, 3]] | ||
) | ||
|
||
|
||
def test_cluster_rows(): | ||
"""Test that rows of 1's and 3's are properly clustered.""" | ||
data = np.array( | ||
[[1, 1, 1, 1], | ||
[3, 3, 3, 3], | ||
[1, 1, 1, 1], | ||
[3, 3, 3, 3], | ||
[1, 1, 1, 1], | ||
[3, 3, 3, 3]] | ||
) | ||
|
||
data = DATA | ||
_, _, curves_dict = Clustergram( | ||
data, | ||
generate_curves_dict=True, | ||
return_computed_traces=True, | ||
center_values=False | ||
) | ||
clustered_data = CLUSTERED_DATA | ||
|
||
assert np.array_equal(curves_dict['heatmap']['z'], clustered_data) | ||
|
||
|
||
def test_read_dataframe(): | ||
"""Test that input data can be in a dataframe.""" | ||
|
||
clustered_data = np.array( | ||
[[1, 1, 1, 1], | ||
[1, 1, 1, 1], | ||
[1, 1, 1, 1], | ||
[3, 3, 3, 3], | ||
[3, 3, 3, 3], | ||
[3, 3, 3, 3]] | ||
data = pd.DataFrame(DATA) | ||
_, _, curves_dict = Clustergram( | ||
data, | ||
generate_curves_dict=True, | ||
return_computed_traces=True, | ||
center_values=False | ||
) | ||
clustered_data = CLUSTERED_DATA | ||
|
||
assert np.array_equal(curves_dict['heatmap']['z'], clustered_data) |