1
1
# nmredata parser
2
+
2
3
<p align =" center " >
3
4
A tool for reading nmrRecords.
4
5
</p >
17
18
const nmredata = require (' nmredata' );
18
19
19
20
const path = ' pathToNMRRecordFile' ;
20
- var record = nmredata .readNMRRSync (path);
21
+ var record = nmredata .readNmrRecordSync (path);
21
22
/**
22
23
* record has all sdf files and spectra data inside of nmrRecord file.
23
24
*/
24
25
let nbSDFFiles = record .nbSamples ;
25
26
let sdfList = record .getSDFList (); // it's return ["wild_JCH_coupling","only_one_HH_coupling_in_Jtag","compound1.nmredata","compound1_with_jcamp.nmredata","with_char_10","compound1_special_labels.nmredata copy"]
26
27
/**
27
28
* if several sdf file exists
28
- * the first readed is set as activeElement, it means that you don't need
29
+ * the first readed is set as activeElement, it means that you don't need
29
30
* to pass a filename for each operation on the same SDF file.
30
31
* It's possible to get or set (filename or index) an activeElement.
31
32
*/
32
33
let activeElement = record .getActiveElement (); // should return 'wild_JCH_coupling'
33
34
record .setActiveElement (' only_one_HH_coupling_in_Jtag' );
34
35
35
36
/**
36
- * You can get the text of all tags of a specific sdf file (filename or index) with
37
- * getNMReDataTags, it returns an object where each tag is a property
38
- * with their value in text
37
+ * You can get the text of all tags of a specific sdf file (filename or index) with
38
+ * getNMReDataTags, it returns an object where each tag is a property
39
+ * with their value in text
39
40
**/
40
41
let allTags = record .getNMReDataTags (); // return the tags of 'only_one_HH_coupling_in_Jtag'
41
- // you can get a specific tag
42
+ // you can get a specific tag
42
43
let solvent = allTags[' SOLVENT' ]
43
44
// To get one list with the current's tags
44
45
let tagsList = Object .keys (allTags);
@@ -59,10 +60,10 @@ var record = nmredata.readNMRRSync(path);
59
60
60
61
// Asynchronously, to be used in the browser or another node packages
61
62
const nmredata = require (' nmredata' );
62
- const FS = require (' fs' );
63
- const path = ' pathToNMRRecordFile'
64
- var zipData = FS . readFileSync (path);
65
- nmredata .readNMRR (zipData).then (currentNMRrecord => {
63
+ const { readFileSync } = require (' fs' );
64
+ const path = ' pathToNMRRecordFile' ;
65
+ var zipData = readFileSync (path);
66
+ nmredata .readNmrRecord (zipData).then (currentNMRrecord => {
66
67
// you can do the same as above
67
68
});
68
69
@@ -71,5 +72,5 @@ nmredata.readNMRR(zipData).then(currentNMRrecord => {
71
72
```
72
73
73
74
## License
74
- [ MIT ] ( ./LICENSE )
75
-
75
+
76
+ [ MIT ] ( ./LICENSE )
0 commit comments