to be completed….
Json file for identification.
Notes about the Mnova .json files:
molecule.parameters.name
field in the molecule json.spectra.peaks.uuid
in the spectra json are used in the arrays spectra.multiplets.list.peaks
and molecule.assignments.shifts.assignedMultiplets
.node src/main.mjs
These three files are needed to add an import to one (or more) classes.
src/importMethod.js
src/importStatements.js
extraMethodsStatements.json
The method to read the external files and import them in object classes are in src/importMethod.js.
For convenience, the same method is used for all objects. The name of the class of any object is given by this.name
.
The method should have this structure with the if (this.name == ...
used to select which type of object is imported.
The name of the method specifies which importer should be used (the community may have developped different importers should not interfer with each other)
// Example import method // Should not minimize
import_Editordjeanner_Version1_SourceMnovaJson_IDnone(param, dataInput) {
if (!dataInput.origin) {
console.error("No origin data in dataInput", dataInput);
this.data = {};
process.exit(1);
}
this.origin = dataInput.origin;
this.conversionParameters = param;
if (this.name == "NMRspectrumObject") {
...
}
if (this.name == "JgraphObject") {
...
}
}
The list of import
statements should be in a separate file: src/importStatements.js so that they will apear in the header of the final class file.
The file listing the objects that should include the import is extraMethodsStatements.json. The listObject lists the objects and type which can be import
method (for readers of data), export
method (for writer of data) or viewer
. If necessary a list of .js files should be listed in the “jsLibrary” array.
These three files are used by the nmr-objects repository to import data objects is src/importMethod.js
When creating an object through the import method, pass a creatorParam
field equal to the one in ./extraMethodsStatements.json
:
const jGraph = new NMRspectrumObject({
creatorParam: {
editor: "djeanner",
version: "1",
source: "MnovaJson",
id: "none",
}}
, data);
The second parameter (data) should have a field called “jsonSpectrum” including the content of a .json file (including the string of validationFileString1000
within the first 1000 characters of the file) as the requiredInput
field of ./extraMethodsStatements.json
indicates:
"requiredInput": [
{
"dataPropertyName": "jsonSpectrum",
"label": "NMR file (.json)",
"type": "fileJson",
"validationFileString1000": "https://mestrelab.com/json-schemas/mnova/2023-07/01/nmr/spec"
}
]
– to be moved elsewhere –
The type
may be “float”, “int”, “string”, “bool”, or (NOT IMPLMEMENTED) “binaryFile” or “textFile”.