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

feat(api): subscription for genomic axis changes #935

Merged
merged 4 commits into from
Jul 24, 2023

Conversation

etowahadams
Copy link
Contributor

@etowahadams etowahadams commented Jul 10, 2023

Fix #910
Toward #

Change List

  • Add a new API subscription location which returns the track ID and the genomic coordinates of a track when the track axis changes

Corresponding documentation PR

Example Spec

views: [
   { ..., tracks: [..., { type: 'brush', x: { linkingId: 'detail' } }]},
   { tracks: [{ ..., id: 'detail-track-1', x: { ..., linkingId: 'detail' } }]
]

Example API

gosRef.current.api.subscribe('location', (data) ⇒ {
  const { id, genomicPosition } = data;
  if(id === 'detail-track-1') {
      console.log('brush has been moved to ', genomicPosition);
   }
});

Checklist

  • Ensure the PR works with all demos on the online editor
  • Unit tests added or updated
  • Examples added or updated
  • Documentation updated (e.g., added API functions)
  • Screenshots for visual changes (e.g., new encoding support or UI change on Editor)

Comment on lines 335 to 338
// Location API
// gosRef.current.api.subscribe('location', (type, eventData) => {
// console.warn(type, eventData.id, eventData.genomicRange);
// });
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where I've been testing the new location API. I noticed that there was commented out code for the other subscriptions so I did the same.

Comment on lines +23 to +25
* @param returnWithinAssembly If true, then if the absolute position is before the first chromosome, it returns the
* first position of the first chromosome. If the absolute position is after the last chromosome, it returns the last
* position of the last chromosome
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the extra option I added to this function so that it doesn't return "unknown" chromosome if the axis is out of the assembly bounds.

@etowahadams etowahadams marked this pull request as ready for review July 11, 2023 11:55
Copy link
Member

@sehilyi sehilyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Let's wait for the @ThHarbig's review

@sehilyi
Copy link
Member

sehilyi commented Jul 24, 2023

@etowahadams Let's merge this and make further patches depending on @ThHarbig's feedback in future

@etowahadams
Copy link
Contributor Author

Sounds good! Will merge now

@etowahadams etowahadams merged commit a2c36f5 into master Jul 24, 2023
5 checks passed
@etowahadams etowahadams deleted the etowahadams/unify-brush branch July 24, 2023 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Idea: Unify brush and rangeSelect mouse event
2 participants