Skip to content

Commit

Permalink
Extended the API, updated dependencies, bumped to v2.0.0-SNAPSHOT.
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorRodchenkov committed Sep 10, 2023
1 parent 84984e8 commit d907c14
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 31 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ jobs:
build-with-jdk17:
runs-on: ubuntu-latest
env:
_JAVA_OPTIONS: "--add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED"
JDK_JAVA_OPTIONS: "--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: 17
java-version: 20
distribution: 'temurin'
cache: maven
- name: Build with Maven and JDK-17
- name: Build with Maven and JDK-20
run: mvn --batch-mode --update-snapshots package
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# reconx-to-biopax
Originated from Arman's https://bitbucket.org/armish/gsoc14 and will continue here (ToDo).
Originated from Arman's https://bitbucket.org/armish/gsoc14

[![Java CI with Maven](https://github.com/PathwayCommons/reconx-to-biopax/actions/workflows/maven.yml/badge.svg)](https://github.com/PathwayCommons/reconx-to-biopax/actions/workflows/maven.yml)


## SBML to BioPAX Level3 converter, specific to the Recon2 data/model.
Although there already existed an
[SBML-to-BioPAX converter](https://sourceforge.net/apps/mediawiki/sbfc/index.php?title=Main_Page#SBML_to_BioPax),
Expand Down Expand Up @@ -38,12 +37,8 @@ The main class of this project, `ReconxToBiopax`, serves as an
example to show how to use this API:

//java
// ...
SBMLDocument sbmlDocument = SBMLReader.read(new File(sbmlFile));
SbmlToBiopaxConverter converter = new SbmlToBiopaxConverter();
Model bpModel = converter.convert(sbmlDocument);
// where bpModel is the BioPAX model
// ...
Model bpModel = converter.convert(new File(sbmlFile)); //can also be an InputStream

During implementation, we separated utility methods and main flow as
much as possible, so that we have all main conversion logic in the
Expand Down
37 changes: 24 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>pathwaycommons</groupId>
<artifactId>reconx-to-biopax</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
<name>reconx-to-biopax</name>

<description>
Expand Down Expand Up @@ -50,7 +50,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<paxtools.version>5.3.0-SNAPSHOT</paxtools.version>
<paxtools.version>6.0.0-SNAPSHOT</paxtools.version>
<github.global.server>github</github.global.server>
</properties>

Expand All @@ -59,9 +59,9 @@
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.11.0</version>
<configuration>
<release>8</release>
<release>17</release>
</configuration>
</plugin>
</plugins>
Expand All @@ -70,19 +70,19 @@
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>2.8</version>
<version>3.5.3</version>
</extension>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-scm</artifactId>
<version>2.8</version>
<version>3.5.3</version>
</extension>
</extensions>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.3.0</version>
<version>3.5.0</version>
<executions>
<execution>
<phase>package</phase>
Expand Down Expand Up @@ -113,14 +113,15 @@
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.8</version>
<version>1.6.13</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<executions>
Expand All @@ -133,8 +134,9 @@
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.1</version>
<version>3.5.0</version>
<executions>
<execution>
<id>attach-javadocs</id>
Expand All @@ -145,6 +147,7 @@
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
Expand Down Expand Up @@ -194,7 +197,7 @@
<dependency>
<groupId>org.sbml.jsbml</groupId>
<artifactId>jsbml-core</artifactId>
<version>1.3.1</version>
<version>1.6.1</version>
<exclusions>
<exclusion>
<groupId>org.apache.logging.log4j</groupId>
Expand All @@ -204,24 +207,32 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.woodstox</groupId>
<artifactId>woodstox-core</artifactId>
</exclusion>
<exclusion>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
<version>2.0.7</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<version>1.7.25</version>
<version>2.0.7</version>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.11</version>
<version>1.4.11</version>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
Expand Down
10 changes: 3 additions & 7 deletions src/main/java/org/humanmetabolism/ReconxToBiopax.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import org.biopax.paxtools.io.SimpleIOHandler;
import org.biopax.paxtools.model.BioPAXLevel;
import org.biopax.paxtools.model.Model;
import org.sbml.jsbml.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -28,17 +27,14 @@ public static void main(String[] args) throws IOException, XMLStreamException {

String sbmlFile = args[0];
String bpFile = args[1];
if(args.length > 2 && args[2].equals("--pathway"))
if(args.length > 2 && args[2].equals("--pathway")) {
makePathway = true;

log.info("Reading SBML file: " + sbmlFile);
SBMLDocument sbmlDocument = SBMLReader.read(new File(sbmlFile));
log.info("SBML model loaded: " + sbmlDocument.getModel().getNumReactions() + " reactions in it.");
}

log.info("Converting SBML model to BioPAX...");
SbmlToBiopaxConverter sbmlToBiopaxConverter = new SbmlToBiopaxConverter();
sbmlToBiopaxConverter.setMakePathway(makePathway);
Model bpModel = sbmlToBiopaxConverter.convert(sbmlDocument);
Model bpModel = sbmlToBiopaxConverter.convert(new File(sbmlFile));

log.info("Saving BioPAX model to " + bpFile);
SimpleIOHandler bpHandler = new SimpleIOHandler(BioPAXLevel.L3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.xml.stream.XMLStreamException;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;

public class SbmlToBiopaxConverter {
private static Logger log = LoggerFactory.getLogger(SbmlToBiopaxConverter.class);
private final SbmlToBiopaxUtils sbmlToBiopaxUtils = new SbmlToBiopaxUtils();
Expand All @@ -23,6 +28,14 @@ public void setMakePathway(boolean makePathway) {
this.makePathway = makePathway;
}

public Model convert(InputStream sbmlInputStream) throws XMLStreamException {
return convert(SBMLReader.read(sbmlInputStream));
}

public Model convert(File sbmlFile) throws XMLStreamException, IOException {
return convert(SBMLReader.read(sbmlFile));
}

public Model convert(SBMLDocument sbmlDocument) {
return convert(sbmlDocument.getModel());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.humanmetabolism.converter;

import org.biopax.paxtools.model.BioPAXElement;
import org.biopax.paxtools.model.BioPAXFactory;
import org.biopax.paxtools.model.BioPAXLevel;
import org.biopax.paxtools.model.Model;
Expand Down

0 comments on commit d907c14

Please sign in to comment.