cheminfo / chromatography

Tools for storing, search and analyze GC/MS spectra
https://cheminfo.github.io/chromatography
MIT License
9 stars 6 forks source link

new API #4

Closed maasencioh closed 7 years ago

maasencioh commented 8 years ago

Unfinished work

The main goal is to have an API like the example:

const GCMS = require('chromatography');
let gcms = GCMS.fromJcamp(jcampReferenceMixture);

let kovatsConvertionTable = GCMS.getKovatsTable(gcms); // [{time, value}, ]
let convertionFunction = GCMS.kovatsConvertionFunction(kovatsConvertionTable, {});

let diesel = GCMS.fromJcamp(jcampOfDiesel);
let times = GCMS.rescaleTime(diesel.getTimes(), convertionFunction);
diesel.setTimes(times);
// diesel.rescaleTime(convertionFunction);

let peaks = GCMS.getPeaks(diesel, options);
let dieselJSON = diesel.toJSON(options); // [ time:12, height:12, width: 3, mass: [{mass, intensity}] ]
let gcms2 = GCMS.fromJSON(anotherDieselJSON);
let similarity = GCMS.similarity(gcms, gcms2, options)

// get a spectrum in another reference model
let revertConvertionFunction = GCMS.kovatsConvertionFunction(kovatsConvertionTable, {revert: true});

cc @lpatiny @targos any modification to this proposal before I continue on it?

coveralls commented 8 years ago

Coverage Status

Coverage decreased (-0.3%) to 99.688% when pulling 8848b4c8dd0c6a771e41691cc8764545221bd74a on development into 79efc71644065e047d91c0b17effbe1590717f27 on master.