Skip to content
Please note that GitHub no longer supports your web browser.

We recommend upgrading to the latest Google Chrome or Firefox.

Learn more
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

Visualization Enhancement #3

Closed
alan-jarmusch opened this issue Oct 4, 2019 · 13 comments

Comments

@alan-jarmusch
Copy link

commented Oct 4, 2019

provide m/z labels for peaks >5% intensity

@mwang87 mwang87 changed the title enhancement Visualization Enhancement Oct 4, 2019
@bittremieux

This comment has been minimized.

Copy link
Collaborator

commented Oct 4, 2019

The plot might become pretty crowded if multiple peaks are close to each other though. Anyway:

spec = spec.scale_intensity(max_intensity=1)
for fragment_mz, fragment_in in zip(spec.mz, spec.intensity):
    if fragment_in >= 0.05:
        spec.annotate_mz_fragment(fragment_mz, None, 0.1, 'Da')
@schymane

This comment has been minimized.

Copy link

commented Oct 5, 2019

If you select the most intense peak within a certain window (e.g. 10 mz, or scale the window with the max(mz) so it's a larger window for higher mz spectra) for annotation, you will be able to avoid most overlap automatically, but still be informative (at least those values are what worked for us in R). Depends how you wish to orient the text. I piggybacked off the satellite peak filtering in RMassBank:
https://github.com/schymane/ReSOLUTION/blob/master/R/MS1_functions.R#L115

@sdrogers

This comment has been minimized.

Copy link
Collaborator

commented Oct 5, 2019

I could easily implement Emma's suggestion within the app...

@sdrogers

This comment has been minimized.

Copy link
Collaborator

commented Oct 6, 2019

Done - it's a bit messy, but we can tidy up.

  • Plots just 2dp of mz
  • Doesn't plot things too close in mz to one another
  • Width (for exclusion) is calculated based upon min and max mz range to ensure zoomed in regions can still get plenty of labels
@schymane

This comment has been minimized.

Copy link

commented Oct 6, 2019

Can we have 4 dp please? Or an option to add more than 2? It's essential for interpretation.

@sdrogers

This comment has been minimized.

Copy link
Collaborator

commented Oct 7, 2019

Done...will be online next time Ming updates

@mwang87

This comment has been minimized.

Copy link
Owner

commented Oct 10, 2019

Awesome! Just saw the thread. I made a few changes to display both the unlabled and labeled SVG in the default plot:

https://metabolomics-usi.ucsd.edu/spectrum/?usi=mzspec:GNPSLIBRARY:CCMSLIB00000840338

Deployed live, cutting release.

Thanks @schymane @sdrogers @bittremieux @alan-jarmusch.

Ming

@mwang87 mwang87 closed this Oct 10, 2019
@schymane

This comment has been minimized.

Copy link

commented Oct 10, 2019

Looking great! Tiny suggestion, if you tilt the masses on an angle (eg 25-30 degrees?) you'll avoid it crossing the line and it makes it easier for people to read ...
Great work! Need to integrate MassBank at some point ;-)

@mwang87

This comment has been minimized.

Copy link
Owner

commented Oct 10, 2019

Awesome, will make issue about suggestion!

Going to also add issue integrating massbank. If you have a web api should be super easy to integrate.

sdrogers added a commit that referenced this issue Oct 10, 2019
@alan-jarmusch

This comment has been minimized.

Copy link
Author

commented Oct 10, 2019

@alan-jarmusch

This comment has been minimized.

Copy link
Author

commented Oct 10, 2019

@bittremieux if you are responsible for the italics on m/z... then kudos
image

@bittremieux

This comment has been minimized.

Copy link
Collaborator

commented Oct 10, 2019

I'm actually not a big fan of the rotated peak labels because that way they can overlap with neighboring peaks.

@schymane

This comment has been minimized.

Copy link

commented Oct 11, 2019

yes I see what you mean, my x axis is usually much more stretched wrt y so it works better as the peaks are more spread out. Maybe add this as an option that people can adjust? Vertical is very difficult to read, and some like horizontal even if this overlaps even more ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.