Giter Club home page Giter Club logo

nmrium-react-wrapper's Introduction

NMRium React Wrapper

License Maintenance GitHub issues GitHub contributors Workflow

NMRium is a powerful tool for displaying and processing nuclear magnetic resonance (NMR) spectra. Based on the popular web framework React, NMRium is distributed as a react component which can be used as a standalone or embedded in an react web-application.

To further enable integration in other applications developed with modern frameworks, the nmrium-react-wrapper project enables an iframe-based integration of NMRium into third-party applications built on any modern frameworks.

Usage

Links

Production:

https://nmrium.nmrxiv.org (currently - v0.8.0)

Development:

https://nmriumdev.nmrxiv.org (latest)

For older/specific versions

https://nmrium.nmrxiv.org/v0.8.0 -> v0.8.0

https://nmrium.nmrxiv.org/v0.7.0 -> v0.7.0

https://nmrium.nmrxiv.org/v0.6.0 -> v0.6.0

https://nmrium.nmrxiv.org/v0.5.0 -> v0.5.0

https://nmrium.nmrxiv.org/v0.4.0 -> v0.4.0

https://nmrium.nmrxiv.org/v0.3.0 -> v0.3.0

https://nmrium.nmrxiv.org/v0.2.0 -> v0.2.0

https://nmrium.nmrxiv.org/v0.1.0 -> v0.1.0

Docker Hub

Containerized using Docker and is distributed publicly via the Docker Hub.

Please refer to Docker tags corresponding to the version of the NMRium React Wrapper releases.

Link to Docker Hub - https://hub.docker.com/r/nfdi4chem/nmrium-react-wrapper

Kubernetes and Helm Charts

NMRium React Wrapper comes packaged with a Helm chart, that makes it easy to deploy and manage (scale) containers on Kubernetes via a convenient package manager interface.

Link to Helm Chart repo - https://github.com/NFDI4Chem/repo-helm-charts/tree/main/charts/nmrium

Embed

<iframe href='https://nmriumdev.nmrxiv.org' height="500" width="100%"></iframe>

# Workspaces

# Simple NMR analysis
<iframe href='https://nmriumdev.nmrxiv.org?workspace=default' height="500" width="100%"></iframe>

# NMR spectra assignment
<iframe href='https://nmriumdev.nmrxiv.org?workspace=assignment' height="500" width="100%"></iframe>

# 1D multiple spectra analysis
<iframe href='https://nmriumdev.nmrxiv.org?workspace=process1D' height="500" width="100%"></iframe>

Public Instance

NFDI4Chem - Jena offers a public instance of the nmrium wrapper for third-party applications to integrate into their interface without deploying an instance. Applications can then communicate with the NMRium via our standardised communication events and offer seamless integration. NOTE: None of the data (loaded and processed with NMRium on the public instance) will not reach our servers. Data will never reach the backend server hosting the applications, so there are no privacy concerns.

To use the public instance in your application, you need to whitelist your domain (local development doesnt need whitelisting).

To get whitelisted, provide the following details via email or raise a GitHub issue.

  • Domain:
  • Organisation:
  • Contact person (Name/Email):
  • Usage details (Optional):

Emailing: [email protected] or [email protected]

Raise an issue on GitHub - https://github.com/NFDI4Chem/nmrium-react-wrapper/issues

Versions

NMRium React Wrapper Version NMRium Version NMRium Data Schema Version Migration Script
Latest-stable v0.56.0 v4 Migration script

License

This project is licensed under the MIT License - see the LICENSE file for details

Maintained by

NMRium React Wrapper is developed and maintained by the NFDI4Chem partners at the Friedrich Schiller University Jena, Germany. The code for this web application is released under the MIT license.

NFDI4Chem Logo

Acknowledgments

Funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) under the National Research Data Infrastructure โ€“ NFDI4Chem โ€“ Projektnummer 441958208.

DFG Logo

nmrium-react-wrapper's People

Contributors

baolanlequang avatar cs76 avatar github-actions[bot] avatar hamed-musallam avatar nishasharma14 avatar nrayya avatar sriramkanakam87 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

jyarger ptrxyz

nmrium-react-wrapper's Issues

Missing peaks picking option

It should enable the peaks picking option that allows users can select peaks manually. The current version doesn't have it. See the screenshot:

Missing peaks picking option

save version object with the other data inside the database

@CS76

{
version: <number>
spectra:[],
molecules:[],
// ... other properties 
}

what is missing in the data you save in the database is the version object which is important for the migration process that is done when importing the .nmrium object inside the NMRium and without it the NMRium went be able to display the data.

another thing worth mentioning is the migration functionality moved to nmr-load-save package which means we can use the migration separately if we need it to migrate the old data

Peak picking - highlight reference peak

When the auto-peak picking option is selected, we could highlight potential reference/solvent peak in the spectra

  • Highlight the reference peak, possibly in a different colour.
  • Suggest the correct shift value to avoid the need to look up tables
  • Reference correction could be presented in one view showing a window suggesting the reference and its shift, asking the user for confirmation, correcting its shifts and the rest of the shift and deleting the solvent peak.

"Unable to connect" error when running the wrapper locally

  • Following the instructions in the README file, after docker running, (docker run \

    -it
    --rm
    -v ${PWD}:/app
    -v /app/node_modules
    -p 3001:3000
    -e CHOKIDAR_USEPOLLING=true
    nmrium-rw:dev)
    The app doesn't run on the mentioned port 3000, instead it gives a "Unable to connect" error.

  • Additionally, the message shown in the terminal says that the port is 5173, which also doesn't work.

image

NMRium versions - document list to be part of release.

  • List all nmrium versions and the corresponding data schema versions (in a table format and add it to the readme file in the nmrium-react-wrapper repository)
  • nmrium-react-wrapper's nmrium version (dev/production)
  • Compare the nmrium versions of the nmrxiv production nmrium instance and the latest nmrium release

Retrieve file name when saving preview image

How the workflow should be?

Let's say the user sends 2 files named analyse_1.dx and analyse_2.zip to the wrapper.
The user wants to save the preview image depending on which file she/he is working on.
She/he want to save the file name of the preview image as same as the file that she/he sent. For example, if she/he is working on analyse_2.zip, the preview image should be analyse_2.svg or 'analyse_2.png.

Questions

  1. Do we have any option for this workflow?
  2. If not, is it possible to implement it?

Namespacing events

While the two-way communication happens between the parent application and NMRium wrapper, event naming should be grouped via namespaces

nmr-wrapper:load:dataset
nmr-wrapper:load:spectra
nmr-wrapper:load:molecule
(loads spectra, load molecule data)

nmr-wrapper:export:image
nmr-wrapper:export:data
(export images, nmrium JSON, nmredata, string containing ranges, peaks, integrals etc)

nmr-wrapper:action:spectral-manipulation
nmr-wrapper:action:update-workspace

NMRium: 1D - 2D NMR peak assignments

NMRium:

  1. Choose about 5 of datasets with 1d and 2d NMR experimental raw data and known structure (nmrshiftdb)/ clean and noisy.
  2. Explore ways to perform molecular assignments
  3. Recreate/explore features from 2 Luc's demos
  4. Compare the process with mnova (Johannes demo, Luc demo, Michael demo)
  5. Reach to Johannes to offers help in docs
  6. Record comparison

Sherlock:

  1. Test with the same datasets.
  2. Perform CASE steps. Check if expected structure among the predicted ones.
  3. What Sherlock offers/ what blockers.

convert data from type array to an array

@CS76

we have to be careful when getting the data from onDataChange call-back to convert the data from the typed array to an array because without this step the NMRium is no longer able to load the data.

the implementation was not done at the side of NMRium for two reasons
1- concerns about the memory because the call-back is often called too much.
2- we need to listen to change and may want the typed array for another purpose

Do you think this has to be done in the wrapper or at your end?

Update README

  • an abstract code sample for using the custom actions in the wrapper from nmrXiv.
  • Add version key requirements in the data object passed to nmrium
  • convert data from type array to an array

Suggestion: Provide an endpoint to query the data version

We realized that the public nmrium-wrapper instance at Jena is running on data version 3, the development container already implements version 4.
As of now, we can't properly check what data version the nmrium wrapper uses besides "looking at the returned data structure". This doesn't seem to be a very robust way of doing it especially in the long run, so we suggest to add an API call to let applications know what data version to expect.

Propogate onChange event from the nmrium component to the parent

We would like to capture all the changes that our users might perform on the spectra. So, to enable this we need to propagate the onChange event from the nmrium react component to the parent via window message event and the parent application will then process/persist the data to the back end.

Problem with IPv6

I found that when you are parsing the origin to check if it's in the allowed origins list, you are using your very own helper function to check if an IP is an IP address. However it seems to only work for legacy IP addresses, IPv6 seems not to be supported.

Can we get this?

(I also reference #59 as I think it might be helpful)

Enable read only mode

Once the data is published to the public, nmrXiv users would like to look into the assignments (browser) and other related assay parameters.

We need to offer a read-only view of the spectra using nmrium without the options or with the options disabled. The spectra viewer still needs to be interactive while the side panels just need to display data.

Testing the NMRium pre-release with nmrXiv

Please check the new pre-release of NMRium read the integrals, ranges, and peaks, and display them correctly which was not right in the NMRium version 0.33 which was related to the new nmr-load-save package.

Implement modes

We want to load nmrium with different display options. Instead of sending all the preferences, it would be good to have this mapped on the wrapper side.

  1. ?mode=viewer
    All the side panels need to be hidden, only the viewer is shown

  2. ?mode=analysis
    The following panels need to be shown

Screenshot 2022-05-19 at 13 02 24

?mode=analysis&panelWidth=100
Would be great if we can specify the width of the side panel in percentage

Remove test buttons on the top of the NMRium component

Two possible solutions we can adapt

  1. Display the buttons only on the development instance. The production version should have this automatically hidden (subdomain check or via build process). Make sure this doesn't add up to the loading time of the application.

  2. Totally hide this and register keyboard shortcuts to trigger these events. For example

Shft+Ctrl+1 => Test load custom event
Shft+ctrl+2 => Test load observable
Shft+ctrl+2 => Test load via URLS

image

Customize NMRium Preferences and mode using URL parameters

pass preferences and workspace parameters with the URL to customize the NMRium

we encode preferences JSON data with a URL encode

{"toolBarButtons": {"import": true,"exportAs": true},"panels": {"multipleSpectraAnalysisPanel": { "hidden": true },"spectraPanel": { "hidden": true }}}

output

%7B%22toolBarButtons%22%3A%20%7B%22import%22%3A%20true%2C%22exportAs%22%3A%20true%7D%2C%22panels%22%3A%20%7B%22multipleSpectraAnalysisPanel%22%3A%20%7B%20%22hidden%22%3A%20true%20%7D%2C%22spectraPanel%22%3A%20%7B%20%22hidden%22%3A%20true%20%7D%7D%7D%0A

for example
https://nmriumdev.nmrxiv.org/?workspace=default&preferences=%7B%22toolBarButtons%22%3A%20%7B%22import%22%3A%20true%2C%22exportAs%22%3A%20true%7D%2C%22panels%22%3A%20%7B%22multipleSpectraAnalysisPanel%22%3A%20%7B%20%22hidden%22%3A%20true%20%7D%2C%22spectraPanel%22%3A%20%7B%20%22hidden%22%3A%20true%20%7D%7D%7D%0A

Cannot reload nmrium data

When I save the data as *.nmrium and want to use it, it cannot be reloaded.
Could you check whether this file is correct or not?
I zipped this file for upload on github purpose
220204-5-H202.zip
Thank you!

Suggestion: allow to skip origin checks

We are planning to use this service i a dynamic environment where we can not foresee the origin URLs upfront. Would it be possible to allow skipping the origin checks altogether, if, for example, an environment variable is set? Obviously the service would then be publicly available, but in our case, we are fine with this or can handle it through origin checks in the network infrastructure.

I suggest something to the extend of replacing

if (!ALLOWED_ORIGINS.includes(parseOrigin(origin))) {

with:

const skip_origin_check = "SKIP_ORIGIN_CHECK" in process.env && process.env.SKIP_ORIGIN_CHECK == 1
if (!skip_origin_check && !ALLOWED_ORIGINS.includes(parseOrigin(origin)) ) {
...

Update readme.md

Provide details of the new schema for event calls
Group the events

  • Load
    URL
    NMRium JSON data
    File buffer
  • Action requests details
    Image export as Blob
  • Action response details
    Registering event listeners - message

Make use of URL interface to parse origins

I would suggest to optimize this code a bit and make use of the native URL interface.

function parseOrigin(origin: string) {
let url: string | null = '';
const urlSegments = origin.split('://');
if (isIPAddress(origin)) {
url = origin;
} else {
const hostSegments = urlSegments[1].split('.');
const startIndex = hostSegments.length > 2 ? 1 : 0;
url = `${urlSegments[0]}://${hostSegments
.slice(hostSegments.length > 1 ? startIndex : 0)
.join('.')}`;
}
return url;
}

It makes the parsing easier and probably more future-proof/safe (i.e. handles IPv6 addresses, which your code doesn't do as of now)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.