Comments (7)
from clustergrammer.
Hi Paul,
That's great, I'm glad progress is being made. If I understand you correctly you want to be able to get the current rows/columns and set the current rows/columns.
The Clustergrammer.js API (API docs) supports setting the current rows/columns and you can get the current rows/col from the cgm
object (I'll build an API for getting rows/columns later).
You can get the current row/column names using
// get current row names
cgm.params.network_data.row_nodes_names
// get current column names
cgm.params.network_data.col_nodes_names
You can set the current rows/columns using
cgm.filter_viz_using_names({'row':['LRRK2','NRK'], 'col':['H2106', 'H23']})
You can leave the row
and/or col
attributes empty to reset the rows/columns.
You can try running these commands in the developer console of the github.io page: http://maayanlab.github.io/clustergrammer/
Let us know if that is what you are looking for.
Best,
Nick
from clustergrammer.
from clustergrammer.
Hi Paul,
Scenario 1
You can interactively select a row or cluster of rows in two ways. You can crop, where you draw out a region of interest that filters out only that area (then you can use the previous command to get the row/col names in JavaScript). You can also use the interactive dendrogram to crop into clusters of different sizes and to get the row/col names of the selected cluster.
Scenario 2
Would the cgm.filter_viz_using_names
endpoint work for this? You can use it to programmatically filter the visualization for rows/columns of interest.
Let me know if that helps.
Best,
Nick
from clustergrammer.
Great, I'll close the issue then.
from clustergrammer.
@cornhundred, I want to report which subset of rows the user has clicked on when they crop the matrix. To do so, I've used matrix_update_callback
when constructing the Clustergrammer object. However, the callback doesn't seem to be passed any arguments. So then I called cgm.params.network_data.row_nodes_names
from inside the callback as you suggest above. However, the issue is that this list of row_nodes is outdated; it's what the matrix had before the user cropped. I want the new subset of nodes that is the result of the current filtering. How can I get that, as soon as it happens?
/* This is the function I pass as 'matrix_update_callback' */
handleMatrixUpdate(matrix_filter) {
/* when I set a breakpoint here, 'matrix_filter' is null,
so this callback isn't passed any info */
const new_rows = this.cgm.params.network_data.row_nodes_names; /* But this doesn't give
me what I want, `new_rows` is outdated, it's what was visible before the current matrix update */
}
from clustergrammer.
After looking at the code that calls the callback, it looks like in order to get the behavior I am looking for, one of these two must be the case:
- We need a new optional callback, something like
matrix_updated_callback
, to be called after the update completes - We need to call the callback function and pass in
new_network_data
Either one would require a fork and rebuild of Clustergrammer. However, I'm hoping there's some other way to do this that I'm not aware of.
Thanks!
from clustergrammer.
Related Issues (20)
- Annotation column with multiple values HOT 3
- Embedded Clustergrammer Error in Firefox and Safari HOT 1
- maximum recursion depth exceeded while getting the str of an object clustermap HOT 5
- clustergrammer with Dash? HOT 3
- send_to_Enrichr function
- Matrix tile tooltip - Missing value label option
- Row search - missing reset HOT 1
- multiple_clustergrams?? HOT 6
- Original Value not showing in JS viewer
- Pandas df format for categories HOT 1
- stable sorting on categories HOT 5
- AttributeError: 'DataFrame' object has no attribute 'ix' HOT 2
- Legend for Clustergrammer JS doesnt get updated on Defining Custom Tile Colors
- Unable to set any other color other than white to denote a 0 value in a heatmap
- Internal Server Error HOT 1
- Depricated jQuery shorthands
- Large row count causes label SVGs to swell and overlap - workaround to prevent timed auto-adjust? HOT 3
- clustergrammer not working inside an Electron app HOT 1
- Uncaught TypeError: Cannot read property 'forEach' of undefined
- Is ranking by variance done from top to lowest or vice versa? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clustergrammer.