INNER CODE UNIT · Python
get_mol_png
sirius-ms/sirius · affinity_selection_ms/src/main/resources/makeMirrorSpectrumPlot.py:75
def get_mol_png(smi, atom_indices):
mol = Chem.MolFromSmiles(smi)
return Draw._moltoimg(mol, (400, 400), atom_indices, "", returnPNG=True)
# parse the JSON file and extract all data
jsonRoot = json.load(open(sys.argv[1], 'r'))
smiles = jsonRoot['smiles']
molecule = Chem.MolFromSmiles(smiles)
spectra_dict = process_spectra_json_node(jsonRoot)
dropdown_options = list(spectra_dict.keys())
color_dict = dict(annotated_matched='green', not_annotated_matched='orange', annotated_not_matched='purple', not_annotated_not_matched='black')
# create the dash app:
app = Dash(__name__, title='Measured vs. predicted Spectrum')
graph = dcc.Graph(id='mirror_plot', clear_on_unhover=True, config=dict(scrollZoom=True))