Skip to content

Commit

Permalink
partial fix of #24, LPsolver working for single simulation.
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiaskoenig committed Jun 15, 2018
1 parent 399434e commit 7c5c155
Show file tree
Hide file tree
Showing 27 changed files with 68 additions and 437,846 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@ lib/nmi/scpsolver/1.0/GLPKSolverPack.jar
lib/nmi/scpsolver/1.0/LPSOLVESolverPack.jar
lib/cplex/cplex.jar
libglpkjni_x64.so
liblpsolve55j_x64.so

# log files
jsbml.log

# BiGG models
src/test/resources/bigg/

# sbml-test-suite
src/test/resources/sbml-test-suite/

# log files
*.log
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@
<dependency>
<groupId>scpsolver</groupId>
<artifactId>GLPKSolverPack</artifactId>
<version>4.35</version>
<version>4.35-v2</version>
<!--
<scope>system</scope>
<systemPath>${project.basedir}/src/lib/maven/scpsolver/GLPKSolverPack/4.35/GLPKSolverPack-4.35.jar</systemPath>
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1ae23211e87021726c7d4b13a6036c3f
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0b7918087973e45cf2919f878678c96920317bb0
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
<modelVersion>4.0.0</modelVersion>
<groupId>scpsolver</groupId>
<artifactId>GLPKSolverPack</artifactId>
<version>4.35</version>
<version>4.35-v2</version>
<description>POM was created from install:install-file</description>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
59d37a4875df9e926f7f9e07aca3a9a1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cda1c21f3fd00303a7e5a756737bbc43af945313

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
<groupId>scpsolver</groupId>
<artifactId>GLPKSolverPack</artifactId>
<versioning>
<release>4.35</release>
<release>4.35-v2</release>
<versions>
<version>4.35</version>
<version>4.35-v2</version>
</versions>
<lastUpdated>20180607172254</lastUpdated>
<lastUpdated>20180615082631</lastUpdated>
</versioning>
</metadata>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3f775ebce4626918f61cf6f615fe0237
3e42dcb9b56c33beefde85a78b26ab27
Original file line number Diff line number Diff line change
@@ -1 +1 @@
fa9d202205a54c144f583aa47dbf8569745cbe06
cf9a142fceeaf2a84215316d72d3711a81b632c5
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
<versions>
<version>5.5.2.5</version>
</versions>
<lastUpdated>20180607172256</lastUpdated>
<lastUpdated>20180615082633</lastUpdated>
</versioning>
</metadata>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7b23da631dfc1b8953db3fee6e396b41
9391f795769ea3afa2ee2b0f7632b8b6
Original file line number Diff line number Diff line change
@@ -1 +1 @@
b9db72a7774b34b209aa3f6af274e05fa42b9db8
b234d3bc10d47c6260ed41b6998585c9578fbe53
2 changes: 1 addition & 1 deletion src/lib/maven/scpsolver/SCPSolver/maven-metadata-local.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
<versions>
<version>1.0</version>
</versions>
<lastUpdated>20180607172253</lastUpdated>
<lastUpdated>20180615082630</lastUpdated>
</versioning>
</metadata>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
b945e57270f68bcc85c335776984ec8e
50d227a4bbd93a8074007f7a5b6fb712
Original file line number Diff line number Diff line change
@@ -1 +1 @@
263b5cbea47a739fad0d5110ed610f634ea38c6a
1fd83a36d7695bae7f5c84b9f8942d83269afd57
Binary file not shown.
2 changes: 1 addition & 1 deletion src/lib/register_maven_jars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ LIB_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )

# register
mvn org.apache.maven.plugins:maven-install-plugin:2.5.2:install-file -DgroupId=scpsolver -DartifactId=SCPSolver -Dversion=1.0 -Dfile=nmi/scpsolver/1.0/SCPSolver-1.0.jar -DlocalRepositoryPath=${LIB_DIR}/maven -Dpackaging=jar -DgeneratePom=true -DcreateChecksum=true
mvn org.apache.maven.plugins:maven-install-plugin:2.5.2:install-file -DgroupId=scpsolver -DartifactId=GLPKSolverPack -Dversion=4.35 -Dfile=nmi/scpsolver/1.0/GLPKSolverPack-4.35.jar -DlocalRepositoryPath=${LIB_DIR}/maven -Dpackaging=jar -DgeneratePom=true -DcreateChecksum=true
mvn org.apache.maven.plugins:maven-install-plugin:2.5.2:install-file -DgroupId=scpsolver -DartifactId=GLPKSolverPack -Dversion=4.35-v2 -Dfile=nmi/scpsolver/1.0/GLPKSolverPack-4.35-v2.jar -DlocalRepositoryPath=${LIB_DIR}/maven -Dpackaging=jar -DgeneratePom=true -DcreateChecksum=true
mvn org.apache.maven.plugins:maven-install-plugin:2.5.2:install-file -DgroupId=scpsolver -DartifactId=LPSOLVESolverPack -Dversion=5.5.2.5 -Dfile=nmi/scpsolver/1.0/LPSOLVESolverPack-5.5.2.5.jar -DlocalRepositoryPath=${LIB_DIR}/maven -Dpackaging=jar -DgeneratePom=true -DcreateChecksum=true
26 changes: 12 additions & 14 deletions src/test/java/org/simulator/fba/BiGGTest.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.simulator.fba;

import org.junit.Ignore;
import org.sbml.jsbml.JSBML;
import org.sbml.jsbml.SBMLDocument;
import org.sbml.jsbml.SBMLReader;
import org.simulator.TestUtils;
Expand All @@ -13,18 +12,16 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.xml.stream.XMLStreamException;
import java.io.*;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Map;
import java.util.zip.GZIPInputStream;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

/**
* Test cases for the BIGG models.
* bigg_models v1.5 (https://github.com/SBRG/bigg_models/releases)
*/
@RunWith(value = Parameterized.class)
public class BiGGTest {
Expand Down Expand Up @@ -75,6 +72,10 @@ public void testFBA() throws Exception {
logger.info(String.format("%s", resource));
System.out.println("BiGG Resource:" + resource);

if (resource.endsWith("Recon3D.xml.gz") || resource.endsWith("RECON1.xml.gz")){
return;
}

// read SBML
InputStream is = new FileInputStream(resource);
GZIPInputStream gzis = new GZIPInputStream(is);
Expand All @@ -83,17 +84,14 @@ public void testFBA() throws Exception {
logger.info(doc.toString());
assertNotNull(doc);

// TODO: solve FBA (
/*
COBRAsolver solver = new COBRAsolver(doc);
if (solver.solve()) {
System.out.println(resourceName);
System.out.println("Objective value:\t" + solver.getObjetiveValue());
System.out.println("Fluxes:\t" + Arrays.toString(solver.getValues()));
} else {
logger.error("\nSolver returned null for " + resourceName);
}
*/
boolean success = solver.solve();
assertNotNull(success);

double objectiveValue = solver.getObjetiveValue();
assertTrue(objectiveValue>=0.0);
double[] fluxes = solver.getValues();
assertNotNull(fluxes);

//TODO: check against reference solution
is.close();
Expand Down
41 changes: 34 additions & 7 deletions src/test/java/org/simulator/fba/CobraSolverTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@
import org.junit.Ignore;
import org.junit.Test;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.zip.GZIPInputStream;
import javax.xml.stream.XMLStreamException;

import org.sbml.jsbml.JSBML;
import org.sbml.jsbml.SBMLReader;
import org.sbml.jsbml.SBMLDocument;
import org.sbml.jsbml.validator.ModelOverdeterminedException;

import org.simulator.TestUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -22,13 +27,10 @@ public class CobraSolverTest {
private double COBRA_OBJ_VAL = 0.8739215069684307;

@Test
@Ignore
public void solveEColiCore() throws ModelOverdeterminedException, XMLStreamException {

String resourceName = "fba/e_coli_core.xml";
ClassLoader classloader = Thread.currentThread().getContextClassLoader();
InputStream is = classloader.getResourceAsStream(resourceName);
SBMLDocument doc = SBMLReader.read(is);
//@Ignore
public void solveEColiCore() throws ModelOverdeterminedException, XMLStreamException, IOException {
String path = TestUtils.getPathForTestResource("/fba/e_coli_core.xml");
SBMLDocument doc = JSBML.readSBML(path);
assertNotNull(doc);
logger.info(doc.toString());

Expand All @@ -40,4 +42,29 @@ public void solveEColiCore() throws ModelOverdeterminedException, XMLStreamExcep
// Objective value should math CobraPy answer with some tolerance
assertEquals(COBRA_OBJ_VAL, solver.getObjetiveValue(), eps);
}

@Test
@Ignore
public void solveEColiCoreGZ() throws ModelOverdeterminedException, XMLStreamException, IOException {
String path = TestUtils.getPathForTestResource("/fba/e_coli_core.xml.gz");

// read SBML
InputStream is = new FileInputStream(path);
GZIPInputStream gzis = new GZIPInputStream(is);

SBMLDocument doc = SBMLReader.read(gzis);
assertNotNull(doc);
logger.info(doc.toString());

COBRAsolver solver = new COBRAsolver(doc);

// Solver should return non-null object
assertNotNull(solver.solve());

// Objective value should math CobraPy answer with some tolerance
assertEquals(COBRA_OBJ_VAL, solver.getObjetiveValue(), eps);
gzis.close();
is.close();
}

}
Loading

0 comments on commit 7c5c155

Please sign in to comment.