Skip to content

Commit

Permalink
- expose new functions through js
Browse files Browse the repository at this point in the history
  • Loading branch information
fbergmann committed Oct 2, 2024
1 parent fb26415 commit 6d8474c
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 0 deletions.
6 changes: 6 additions & 0 deletions js/copasi.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ export default class COPASI {
readonly reducedJacobian2D: number[][];
readonly eigenValuesReduced2D: number[][];

getFluxControlCoefficients(scaled: boolean): object;
getFluxControlCoefficients2D(scaled: boolean): number[][];
getConcentrationControlCoefficients(scaled: boolean): object;
getConcentrationControlCoefficients2D(scaled: boolean): number[][];
getElasticities(scaled: boolean): object;
getElasticities2D(scaled: boolean): number[][];

}

Expand Down
70 changes: 70 additions & 0 deletions js/copasi.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class COPASI {
this.getVersion = Module.getVersion
this.getMessages = Module.getMessages;
this.steadyState = Module.steadyState;
this.computeMca = Module.computeMca;
this.oneStep = Module.oneStep;
this.initCps = Module.initCps;
this.destroy = Module.destroy;
Expand Down Expand Up @@ -408,6 +409,75 @@ class COPASI {
get eigenValuesReduced2D() {
return this._vector2dToArray(this.Module.getEigenValuesReduced2D());
}

/**
* Retrieves the flux control coefficients for the model
*
* Note that computeMca must be called before this method
*
* @param {bool} scaled indicating whether the scaled (true) or unscaled coefficients should be returned
* @returns {object} the flux control coefficients as object
*/
getFluxControlCoefficients(scaled)
{
return JSON.parse(this.Module.getFluxControlCoefficients(scaled));
}

/**
* Retrieves the flux control coefficients for the model as 2d array
* @param {bool} scaled indicating whether the scaled (true) or unscaled coefficients should be returned
* @returns {number[][]} the flux control coefficients as 2D array
*/
getFluxControlCoefficients2D(scaled)
{
return this._vector2dToArray(this.Module.getFluxControlCoefficients2D(scaled));
}

/**
* Retrieves the concentration control coefficients for the model
*
* Note that computeMca must be called before this method
*
* @param {bool} scaled indicating whether the scaled (true) or unscaled coefficients should be returned
* @returns {object} the concentration control coefficients as object
*/
getConcentrationControlCoefficients(scaled)
{
return JSON.parse(this.Module.getConcentrationControlCoefficients(scaled));
}

/**
* Retrieves the concentration control coefficients for the model as 2d array
* @param {bool} scaled indicating whether the scaled (true) or unscaled coefficients should be returned
* @returns {number[][]} the concentration control coefficients as 2D array
*/
getConcentrationControlCoefficients2D(scaled)
{
return this._vector2dToArray(this.Module.getConcentrationControlCoefficients2D(scaled));
}

/**
* Retrieves the elasticities
*
* @param {bool} scaled indicating whether the scaled (true) or unscaled coefficients should be returned
* @returns {object} the elasticites as object
*/
getElasticities(scaled)
{
return JSON.parse(this.Module.getElasticities(scaled));
}

/**
* Retrieves the elasticities
*
* @param {bool} scaled indicating whether the scaled (true) or unscaled coefficients should be returned
* @returns {number[][]} the elasticities as 2D array
*/
getElasticities2D(scaled)
{
return this._vector2dToArray(this.Module.getElasticities2D(scaled));
}

}

// if module is defined, export the COPASI class
Expand Down

0 comments on commit 6d8474c

Please sign in to comment.