@copasi/copasijs 0.0.0-stage → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +25 -0
- package/README.md +23 -2
- package/copasi.d.ts +291 -0
- package/copasi.js +1367 -0
- package/copasijs.js +8293 -0
- package/copasijs.wasm +0 -0
- package/index.d.ts +9 -0
- package/index.js +3 -0
- package/package.json +34 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
BSD 2-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024, Frank T. Bergmann
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
and/or other materials provided with the distribution.
|
|
15
|
+
|
|
16
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
17
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
18
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
19
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
20
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
21
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
22
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
23
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
24
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
25
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @copasi/copasijs
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Browser build of [COPASI.js](https://github.com/copasi/COPASI.js) for Vite, webpack, and Rollup.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install @copasi/copasijs
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```javascript
|
|
10
|
+
import createCpsModule, { COPASI } from "@copasi/copasijs";
|
|
11
|
+
|
|
12
|
+
const module = await createCpsModule();
|
|
13
|
+
const copasi = new COPASI(module);
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
The same function is also a named export:
|
|
17
|
+
|
|
18
|
+
```javascript
|
|
19
|
+
import { createCpsModule, COPASI } from "@copasi/copasijs";
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
`copasijs.wasm` is published next to the generated glue. The glue loads it with `new URL("copasijs.wasm", import.meta.url)`. Pass `locateFile` only when a bundler does not rewrite that URL.
|
|
23
|
+
|
|
24
|
+
Script-tag pages and Node keep using the zip archives from the COPASI.js releases. This package is the web build for bundlers.
|
package/copasi.d.ts
ADDED
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import type exp from "constants";
|
|
2
|
+
|
|
3
|
+
export interface SimResult {
|
|
4
|
+
num_variables: number;
|
|
5
|
+
recorded_steps: number;
|
|
6
|
+
titles: string[];
|
|
7
|
+
columns?: number[][];
|
|
8
|
+
status?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface SimulationMatrix {
|
|
12
|
+
rows: number;
|
|
13
|
+
cols: number;
|
|
14
|
+
data: Float64Array;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface SpeciesInfo {
|
|
18
|
+
compartment: string;
|
|
19
|
+
concentration: number;
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
initial_concentration: number;
|
|
23
|
+
initial_particle_number: number;
|
|
24
|
+
particle_number: number;
|
|
25
|
+
type: string;
|
|
26
|
+
initial_expression: string;
|
|
27
|
+
expression: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface CompartmentInfo {
|
|
31
|
+
id: string;
|
|
32
|
+
name: string;
|
|
33
|
+
size: number;
|
|
34
|
+
type: string;
|
|
35
|
+
initial_expression: string;
|
|
36
|
+
expression: string;
|
|
37
|
+
}
|
|
38
|
+
export interface LocalParamterInfo {
|
|
39
|
+
name: string;
|
|
40
|
+
value: number;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface ReactionInfo {
|
|
44
|
+
id: string;
|
|
45
|
+
name: string;
|
|
46
|
+
reversible: boolean;
|
|
47
|
+
scheme: string;
|
|
48
|
+
local_paramters: LocalParamterInfo[];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface ModelName
|
|
52
|
+
{
|
|
53
|
+
name: string;
|
|
54
|
+
notes: string;
|
|
55
|
+
time_unit: string;
|
|
56
|
+
volume_unit: string;
|
|
57
|
+
quantity_unit: string;
|
|
58
|
+
area_unit: string;
|
|
59
|
+
length_unit: string;
|
|
60
|
+
initial_time: number;
|
|
61
|
+
avogadro: number;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface GlobalParamterInfo {
|
|
65
|
+
name: string;
|
|
66
|
+
value: number;
|
|
67
|
+
initial_value: number;
|
|
68
|
+
id: string;
|
|
69
|
+
type: string;
|
|
70
|
+
initial_expression: string;
|
|
71
|
+
expression: string;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface EventInfo {
|
|
75
|
+
id: string;
|
|
76
|
+
name: string;
|
|
77
|
+
trigger: string;
|
|
78
|
+
delay: string;
|
|
79
|
+
priority: string;
|
|
80
|
+
assignments: string;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export type ModelChangeOp = "update" | "create" | "delete";
|
|
84
|
+
|
|
85
|
+
export interface ModelChangeAssignment {
|
|
86
|
+
target: string;
|
|
87
|
+
expression: string;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface SpeciesChange {
|
|
91
|
+
op?: ModelChangeOp;
|
|
92
|
+
name?: string;
|
|
93
|
+
id?: string;
|
|
94
|
+
new_name?: string;
|
|
95
|
+
new_id?: string;
|
|
96
|
+
compartment?: string;
|
|
97
|
+
initial_concentration?: number;
|
|
98
|
+
initial_particle_number?: number;
|
|
99
|
+
type?: string;
|
|
100
|
+
initial_expression?: string;
|
|
101
|
+
expression?: string;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface CompartmentChange {
|
|
105
|
+
op?: ModelChangeOp;
|
|
106
|
+
name?: string;
|
|
107
|
+
id?: string;
|
|
108
|
+
new_name?: string;
|
|
109
|
+
new_id?: string;
|
|
110
|
+
size?: number;
|
|
111
|
+
type?: string;
|
|
112
|
+
initial_expression?: string;
|
|
113
|
+
expression?: string;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface LocalParameterChange {
|
|
117
|
+
name: string;
|
|
118
|
+
value: number;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface ReactionChange {
|
|
122
|
+
op?: ModelChangeOp;
|
|
123
|
+
name?: string;
|
|
124
|
+
id?: string;
|
|
125
|
+
new_name?: string;
|
|
126
|
+
new_id?: string;
|
|
127
|
+
scheme?: string;
|
|
128
|
+
reversible?: boolean;
|
|
129
|
+
local_parameters?: LocalParameterChange[];
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export interface ParameterChange {
|
|
133
|
+
op?: ModelChangeOp;
|
|
134
|
+
name?: string;
|
|
135
|
+
id?: string;
|
|
136
|
+
new_name?: string;
|
|
137
|
+
new_id?: string;
|
|
138
|
+
value?: number;
|
|
139
|
+
initial_value?: number;
|
|
140
|
+
type?: string;
|
|
141
|
+
initial_expression?: string;
|
|
142
|
+
expression?: string;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface EventChange {
|
|
146
|
+
op?: ModelChangeOp;
|
|
147
|
+
name?: string;
|
|
148
|
+
id?: string;
|
|
149
|
+
new_name?: string;
|
|
150
|
+
new_id?: string;
|
|
151
|
+
trigger?: string;
|
|
152
|
+
delay?: string;
|
|
153
|
+
priority?: string;
|
|
154
|
+
assignments?: ModelChangeAssignment[] | string;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export interface ModelChanges {
|
|
158
|
+
model?: Partial<ModelName> & { model_type?: string };
|
|
159
|
+
species?: SpeciesChange[];
|
|
160
|
+
compartments?: CompartmentChange[];
|
|
161
|
+
reactions?: ReactionChange[];
|
|
162
|
+
global_parameters?: ParameterChange[];
|
|
163
|
+
events?: EventChange[];
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export interface ModelInfo {
|
|
167
|
+
species: SpeciesInfo[];
|
|
168
|
+
compartments: CompartmentInfo[];
|
|
169
|
+
reactions: ReactionInfo[];
|
|
170
|
+
global_parameters: GlobalParamterInfo[];
|
|
171
|
+
events: EventInfo[];
|
|
172
|
+
model : ModelName;
|
|
173
|
+
time: number;
|
|
174
|
+
status: string;
|
|
175
|
+
messages: string;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export default class COPASI {
|
|
179
|
+
constructor(module: any);
|
|
180
|
+
reset(): void;
|
|
181
|
+
resetAll(): void;
|
|
182
|
+
readonly version: string;
|
|
183
|
+
autoUpdateModel: boolean;
|
|
184
|
+
_vectorToArray(v: any): any[];
|
|
185
|
+
loadExample(path: string) : ModelInfo;
|
|
186
|
+
loadModel(modelCode: string): ModelInfo;
|
|
187
|
+
newModel(): ModelInfo;
|
|
188
|
+
loadFromFile(modelFile: string): ModelInfo;
|
|
189
|
+
loadCombineArchive(modelFile: string): ModelInfo;
|
|
190
|
+
applyModelChanges(changes: ModelChanges | string): ModelInfo;
|
|
191
|
+
selectionList: string[];
|
|
192
|
+
readonly selectedValues: number[];
|
|
193
|
+
resetSelectionList(): void;
|
|
194
|
+
readonly modelInfo: ModelInfo;
|
|
195
|
+
simulate(includeData?: boolean) : object;
|
|
196
|
+
simulate2D() : number[][];
|
|
197
|
+
simulateEx(startTime : number, endTime : number, numPoints : number, includeData?: boolean) : SimResult;
|
|
198
|
+
simulateEx2D(startTime : number, endTime : number, numPoints : number) : number[][];
|
|
199
|
+
simulateYaml(yamlProcessingOptions : string|object, includeData?: boolean) : SimResult;
|
|
200
|
+
simulateYaml2D(yamlProcessingOptions : string|object) : SimResult;
|
|
201
|
+
readonly simulationMatrix: SimulationMatrix;
|
|
202
|
+
getValue(nameOrId: string): number;
|
|
203
|
+
setValue(nameOrId: string, value: number): void;
|
|
204
|
+
readonly floatingSpeciesConcentrations : number[];
|
|
205
|
+
readonly ratesOfChange : number[];
|
|
206
|
+
readonly floatingSpeciesNames : string[];
|
|
207
|
+
readonly floatingSpeciesIds : string[];
|
|
208
|
+
readonly boundarySpeciesConcentrations : number[];
|
|
209
|
+
readonly boundarySpeciesNames : string[];
|
|
210
|
+
readonly boundarySpeciesIds : string[];
|
|
211
|
+
readonly reactionNames : string[];
|
|
212
|
+
readonly reactionIds : string[];
|
|
213
|
+
readonly reactionRates : number[];
|
|
214
|
+
readonly compartmentNames : string[];
|
|
215
|
+
readonly compartmentIds : string[];
|
|
216
|
+
readonly compartmentSizes : number[];
|
|
217
|
+
readonly globalParameterNames : string[];
|
|
218
|
+
readonly globalParameterIds : string[];
|
|
219
|
+
readonly globalParameterValues : number[];
|
|
220
|
+
readonly localParameterNames : string[];
|
|
221
|
+
readonly localParameterValues : number[];
|
|
222
|
+
readonly jacobian: object;
|
|
223
|
+
readonly jacobian2D: number[][];
|
|
224
|
+
readonly eigenValues2D: number[][];
|
|
225
|
+
readonly reducedJacobian: object;
|
|
226
|
+
readonly reducedJacobian2D: number[][];
|
|
227
|
+
readonly eigenValuesReduced2D: number[][];
|
|
228
|
+
|
|
229
|
+
readonly stoichiometryMatrix: object;
|
|
230
|
+
readonly reducedStoichiometryMatrix: object;
|
|
231
|
+
readonly linkMatrix: object;
|
|
232
|
+
|
|
233
|
+
readonly optSettings: object;
|
|
234
|
+
readonly fitSettings: object;
|
|
235
|
+
|
|
236
|
+
readonly simulationResults: object;
|
|
237
|
+
|
|
238
|
+
getFluxControlCoefficients(scaled: boolean): object;
|
|
239
|
+
getFluxControlCoefficients2D(scaled: boolean): number[][];
|
|
240
|
+
getConcentrationControlCoefficients(scaled: boolean): object;
|
|
241
|
+
getConcentrationControlCoefficients2D(scaled: boolean): number[][];
|
|
242
|
+
getElasticities(scaled: boolean): object;
|
|
243
|
+
getElasticities2D(scaled: boolean): number[][];
|
|
244
|
+
|
|
245
|
+
setMethod(taskName: string, methodName: string): boolean;
|
|
246
|
+
getAvailableMethods(taskName: string): string[];
|
|
247
|
+
steadyState(stabilityAnalysis?: boolean, updateModel?: boolean): number;
|
|
248
|
+
computeMca(performSteadyState?: boolean, updateModel?: boolean): boolean;
|
|
249
|
+
getSteadyStateProtocol(): string;
|
|
250
|
+
getSteadyStateStatus(): string;
|
|
251
|
+
getStabilityAnalysis(): string;
|
|
252
|
+
getTaskSettings(taskName: string): object;
|
|
253
|
+
setTaskSettings(taskName: string, settings: object): void;
|
|
254
|
+
getLNAResults(scaled?: boolean): object;
|
|
255
|
+
runLNA(useInitialValues?: boolean): boolean;
|
|
256
|
+
|
|
257
|
+
runOptimization(useInitialValues?: boolean): boolean;
|
|
258
|
+
readonly optItems: object;
|
|
259
|
+
readonly optSolution: object;
|
|
260
|
+
readonly optStatistic: object;
|
|
261
|
+
|
|
262
|
+
runParameterEstimation(useInitialValues?: boolean): boolean;
|
|
263
|
+
readonly correlationMatrix: object;
|
|
264
|
+
readonly fischerInformationMatrix: object;
|
|
265
|
+
readonly indent: number;
|
|
266
|
+
readonly fitSolution: object;
|
|
267
|
+
readonly fitItems: object;
|
|
268
|
+
readonly fitStatistic: object;
|
|
269
|
+
|
|
270
|
+
runTask(taskName: string, useInitialValues?: boolean): boolean;
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
readonly experimentNames: string[];
|
|
274
|
+
readonly experimentDefinitions: object;
|
|
275
|
+
|
|
276
|
+
getCurrentFit(computeCurrentSolution?: boolean): object;
|
|
277
|
+
|
|
278
|
+
setExperimentDefinition(experimentName: string, experimentDefinition: object): boolean;
|
|
279
|
+
getExperimentDefinition(experimentName: string): object;
|
|
280
|
+
setExperimentFilename(experimentName: string, experimentFilename: string): boolean;
|
|
281
|
+
|
|
282
|
+
convertToIrreversible(): object;
|
|
283
|
+
|
|
284
|
+
mcaSettings: object;
|
|
285
|
+
mcaProtocol: string;
|
|
286
|
+
|
|
287
|
+
lnaSettings: object;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
export {COPASI};
|
|
291
|
+
export default COPASI;
|