gosling.js icon indicating copy to clipboard operation
gosling.js copied to clipboard

Raw data event improvements

Open ThHarbig opened this issue 1 year ago • 1 comments

In my scenario I have an overview with a brush and a detailed view. I want to get some of the data displayed in the detailed view in order to show it in a table. I'm using this event in the IslandVIewer example:

gosRef.current.api.subscribe('rawData', (type, rawdata) => {
        // get range from highglass API
	const range = gosRef.current.hgApi.api.getLocation(detailID).xDomain
        // filter to get the desired data set for the desired component
	if (rawdata.data.length > 0 && rawdata.id === detailID && 'Accnum' in rawdata.data[0]) {
                // filter by range to get exactly the data displayed in the detailed view
		const dataInRange = rawdata.data.filter(entry => (entry['Gene start'] > range[0] && entry['Gene start'] < range[1]) || (entry['Gene end'] > range[0] && entry['Gene end'] < range[1]))
                // filter out duplicates 
		const uniqueInRange = dataInRange.filter((v, i, a) => a.findIndex(v2 => (v2['Gene name'] === v['Gene name'])) === i)
		setData(uniqueInRange)
	}
});

When using the rawdata event using this function, rawdata has an attribute id and data, to show which data is currently displayed in the view with id. I found some issues with this that I am still trying to explore:

  • The data I get returned for the detailed view is not in the range that I get when retrieving the range manually using the highglass API (related to #845) (Could this be because more data is rendered than displayed for smooth scrolling?)
  • Some elements in the raw data arrays occur multiple times
  • Not only the data for the track is returned but all data from the view.

In general, it would be a great enhancement to make the event listener a bit more fine-grained for example by specifying a view ID and a data set for which the data should be returned. Right now I need to manually filter for both.

ThHarbig avatar May 08 '23 20:05 ThHarbig

@ThHarbig Please share with us what issues are remaining for the use case of meta vis.

sehilyi avatar Jul 06 '23 15:07 sehilyi