Plotting

Plotting graphs works the same way for both Spec2Vec and MS2DeepScore.

Molecule Plot

The following example will plot the structures of the molecules.

from omigami.plotting import MoleculePlotter
from omigami.spectra_matching import Spec2Vec

client = Spec2Vec()
mgf_file_path = "path_to_file.mgf"
best_matches = client.match_spectra(mgf_file_path, n_best=10)

plotter = MoleculePlotter()
plots, legends = plotter.plot_molecule_structure(
    spectra_matches=best_matches[1],
    representation="smiles",
    draw_indices=True,
    img_size=(600, 600),
    substructure_highlight="C(=O)"
)
first_match = list(plots.values())[0]
first_match
print(legends[0])

ClassyFire Plot

The following code allows us to plot the results of the Classyfirearrow-up-right model API.

NPClassifier Plot

Furthermore, Omigami provides the possibility to use the NPClassifierarrow-up-right API.

Spectra Comparison Mirror Plot

The following code snippet will plot the Spectra Comparison Mirror Plot. It takes two spectra returned and creates a mirror plot with spectrum 1 on top (blue), and spectrum 2 on the bottom (red).

Last updated

Was this helpful?