chromatography
Advanced tools
Comparing version 4.0.0-1 to 4.0.0-2
@@ -1,6 +0,7 @@ | ||
export class ChromatogramSeries { | ||
export abstract class ChromatogramSeries<DataType> { | ||
getData(): DataType; | ||
is1D(): boolean; | ||
is2D(): boolean; | ||
toJSON(): { | ||
data: ChromatogramSeriesData; | ||
data: DataType; | ||
meta?: object; | ||
@@ -16,4 +17,4 @@ }; | ||
export class ChromatogramSeries1D extends ChromatogramSeries {} | ||
export class ChromatogramSeries2D extends ChromatogramSeries {} | ||
export class ChromatogramSeries1D extends ChromatogramSeries<number[]> {} | ||
export class ChromatogramSeries2D extends ChromatogramSeries<number[][]> {} | ||
@@ -215,6 +216,6 @@ export type ChromatogramSeriesData = number[] | number[][]; | ||
export interface GetClosestDataResult { | ||
export interface GetClosestDataResult<DataType> { | ||
rt: number; | ||
index: number; | ||
data: ChromatogramSeriesData; | ||
data: DataType; | ||
} | ||
@@ -303,5 +304,19 @@ | ||
*/ | ||
getSeries(seriesName: string): ChromatogramSeries; | ||
getSeries(seriesName: string): ChromatogramSeries<number[] | number[][]>; | ||
/** | ||
* Find the series from its name. | ||
* Throws an error if it is not a 1D series. | ||
* @param seriesName: string): Name of the series. | ||
*/ | ||
getSeries1D(seriesName: string): ChromatogramSeries1D; | ||
/** | ||
* Find the series from its name. | ||
* Throws an error if it is not a 2D series. | ||
* @param seriesName: string): Name of the series. | ||
*/ | ||
getSeries2D(seriesName: string): ChromatogramSeries2D; | ||
/** | ||
* Returns the names of all series. | ||
@@ -414,3 +429,3 @@ */ | ||
options?: CalculateForMassOptions, | ||
): ChromatogramSeries; | ||
): ChromatogramSeries1D; | ||
@@ -426,3 +441,3 @@ /** | ||
options?: CalculateForMFOptions, | ||
): ChromatogramSeries; | ||
): ChromatogramSeries1D; | ||
@@ -456,6 +471,6 @@ /** | ||
*/ | ||
getClosestData( | ||
getClosestData<DataType = number[]>( | ||
time: number, | ||
options?: GetClosestDataOptions, | ||
): GetClosestDataResult; | ||
): GetClosestDataResult<DataType>; | ||
@@ -475,3 +490,3 @@ /** | ||
options?: MeanFilterOptions, | ||
): ChromatogramSeries; | ||
): ChromatogramSeries2D; | ||
@@ -486,3 +501,3 @@ /** | ||
options?: PercentageFilterOptions, | ||
): ChromatogramSeries; | ||
): ChromatogramSeries2D; | ||
@@ -489,0 +504,0 @@ /** |
@@ -63,2 +63,6 @@ 'use strict'; | ||
getData() { | ||
return this.data; | ||
} | ||
is1D() { | ||
@@ -597,2 +601,18 @@ return this.dimension === 1; | ||
getSeries1D(seriesName) { | ||
const series = this.getSeries(seriesName); | ||
if (!series.is1D()) { | ||
throw new Error(`series ${seriesName} is not a 1D series`); | ||
} | ||
return series; | ||
} | ||
getSeries2D(seriesName) { | ||
const series = this.getSeries(seriesName); | ||
if (!series.is2D()) { | ||
throw new Error(`series ${seriesName} is not a 2D series`); | ||
} | ||
return series; | ||
} | ||
getSeriesNames() { | ||
@@ -599,0 +619,0 @@ return Object.keys(this.series); |
{ | ||
"name": "chromatography", | ||
"version": "4.0.0-1", | ||
"version": "4.0.0-2", | ||
"description": "Tools for storing, searching and analyzing GC/MS data", | ||
@@ -53,3 +53,3 @@ "main": "lib/index.js", | ||
"@babel/plugin-transform-modules-commonjs": "^7.8.3", | ||
"@types/jest": "^25.1.3", | ||
"@types/jest": "^25.1.4", | ||
"cheminfo-build": "^1.1.0", | ||
@@ -65,5 +65,6 @@ "eslint": "^6.8.0", | ||
"prettier": "^1.19.1", | ||
"rollup": "^2.0.0", | ||
"rollup": "^2.1.0", | ||
"spectrum-generator": "^3.2.0", | ||
"typedoc": "^0.16.11" | ||
"typedoc": "^0.17.1", | ||
"typescript": "^3.8.3" | ||
}, | ||
@@ -73,5 +74,5 @@ "dependencies": { | ||
"is-any-array": "0.1.0", | ||
"isotopic-distribution": "^1.0.1", | ||
"isotopic-distribution": "^1.1.0", | ||
"jcampconverter": "^4.1.0", | ||
"mf-parser": "^1.0.1", | ||
"mf-parser": "^1.1.0", | ||
"ml-array-max": "^1.1.2", | ||
@@ -78,0 +79,0 @@ "ml-array-mean": "^1.1.2", |
@@ -43,2 +43,18 @@ import isAnyArray from 'is-any-array'; | ||
getSeries1D(seriesName) { | ||
const series = this.getSeries(seriesName); | ||
if (!series.is1D()) { | ||
throw new Error(`series ${seriesName} is not a 1D series`); | ||
} | ||
return series; | ||
} | ||
getSeries2D(seriesName) { | ||
const series = this.getSeries(seriesName); | ||
if (!series.is2D()) { | ||
throw new Error(`series ${seriesName} is not a 2D series`); | ||
} | ||
return series; | ||
} | ||
getSeriesNames() { | ||
@@ -45,0 +61,0 @@ return Object.keys(this.series); |
@@ -16,2 +16,6 @@ /** | ||
getData() { | ||
return this.data; | ||
} | ||
is1D() { | ||
@@ -18,0 +22,0 @@ return this.dimension === 1; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
94078
2960
16
Updatedisotopic-distribution@^1.1.0
Updatedmf-parser@^1.1.0