diff --git a/.gitignore b/.gitignore index 40a7bfc9..26cc66b7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,21 +1,23 @@ +*.class +*.dump +.classpath .gradle/ .idea/ -.settings/ -.classpath .project -/build/ -/target/ -src/main/resources/edu/ucsd/sbrg/identifiersOrgRegistry/IdentifiersOrg-Registry.json -/src/scripts/ModelPolisherTemplate.* -ModelPolisher.iml -jsbml.log +.settings/ /.DS_Store +/.vscode/ +/bin +/build/ +/gradle +/lib /minimalSysBio.xml /model_polisher.log /out /src/main/resources/edu/ucsd/sbrg/example_models/output +/src/scripts/ModelPolisherTemplate.* /src/test/resources/edu/ucsd/sbrg/bigg/e_coli_core.zip -*.class -/bin -/.vscode/ -*.dump \ No newline at end of file +/target/ +ModelPolisher.iml +jsbml.log +src/main/resources/edu/ucsd/sbrg/identifiersOrgRegistry/IdentifiersOrg-Registry.json \ No newline at end of file diff --git a/docker/java_docker/Dockerfile b/Dockerfile similarity index 57% rename from docker/java_docker/Dockerfile rename to Dockerfile index 4d416238..c141a8ca 100644 --- a/docker/java_docker/Dockerfile +++ b/Dockerfile @@ -1,15 +1,11 @@ -FROM openjdk:11-slim +FROM openjdk:17-slim # Set the maintainer email for the image -LABEL maintainer="zajac.thomas1992@gmail.com" +LABEL maintainer="dario.eltzner@student.uni-tuebingen.de" # Copy the ModelPolisher jar file into the root directory of the image COPY ModelPolisher-2.1.jar / -# Create necessary directories for Java preferences and set permissions -# Reference: https://stackoverflow.com/a/23961144 -RUN mkdir -p /.java/.systemPrefs && mkdir /.java/.userPrefs && chmod -R 777 /.java - # Set the container to run the ModelPolisher jar file as the default executable ENTRYPOINT ["java", "-jar", "/ModelPolisher-2.1.jar"] diff --git a/README.md b/README.md index e3b2d88d..2ffdc9c6 100644 --- a/README.md +++ b/README.md @@ -1,93 +1,103 @@ # ModelPolisher **Annotating Systems Biology Models** - + -*Authors:* [Andreas Dräger](https://github.com/draeger/), [Thomas J. Zajac](https://github.com/mephenor/), [Matthias König](https://github.com/matthiaskoenig), [Kaustubh Trivedi](https://github.com/codekaust) - -[![Build Status](https://travis-ci.org/draeger-lab/ModelPolisher.svg?branch=master?style=plastic)](https://travis-ci.org/draeger-lab/ModelPolisher) -[![Stable version](https://img.shields.io/badge/Stable_version-2.0-brightgreen.svg?style=plastic)](https://github.com/draeger-lab/ModelPolisher/releases/) +[![Stable version](https://img.shields.io/badge/Stable_version-2.1-brightgreen.svg?style=plastic)](https://github.com/draeger-lab/ModelPolisher/releases/) [![DOI](http://img.shields.io/badge/DOI-10.1371%20%2F%20journal.pone.0149263-blue.svg?style=plastic)](https://doi.org/10.1371/journal.pone.0149263) [![License (MIT)](https://img.shields.io/badge/license-MIT-blue.svg?style=plastic)](http://opensource.org/licenses/MIT) -ModelPolisher accesses the [BiGG Models knowledgebase](http://bigg.ucsd.edu) to annotate and autocomplete [SBML](http://sbml.org) models. -Thereby, the program mainly relies on [BiGG identifiers](https://github.com/SBRG/bigg_models/wiki/BiGG-Models-ID-Specification-and-Guidelines) for model components. -Moreover, it fixes some apparent errors in the models and uses mappings from [AnnotateDB](https://github.com/matthiaskoenig/annotatedb) to further add annotations. +ModelPolisher is a simple single-purpose automated curation tool for SBML models. +It + +- improves the adherence to FAIR data standards as practiced in the SBML modelling community, +- implements non-binding best practices as defined by the [SBML specification]() documents, +- adds MIRIAM-style semantic annotations to models, using the [BiGG Models knowledgebase](http://bigg.ucsd.edu) and [AnnotateDB](). + +You can find comprehensive documentation on what ModelPolisher does in [our Wiki](https://github.com/draeger-lab/ModelPolisher/wiki). + +Furthermore, it can, on a best effort basis, attempt to perform minimal fixes on a model to make it valid with regards to the [SBMLValidator](). +Note however, that it will not perform curation on a model that cannot be brought into a valid state. + +Again, you find comprehensive documentation on this in [our Wiki](https://github.com/draeger-lab/ModelPolisher/wiki). + +Currently supported versions of the SBML standard are: -ModelPolisher is primarily a command-line based tool. You can run ModelPolisher locally [using `Docker`](#using-docker) or using your installation of BiGG Models database (see https://github.com/SBRG/bigg_models). +- Version 3 Level 1 + - FBC Version 2 + +You can use ModelPolisher as a tool via its [Python API client]() to our HTTP server, or locally using Docker or as a Standalone JAR. + +ModelPolisher can also be used as a Java library, building on the [JSBML]() project. # Table of Contents -* [Usage Notes](#run-ModelPolisher) +* [Performance](#performance) +* [Using ModelPolisher as a Tool](#using-modelpolisher-as-a-tool) + * [Parameters](#parameters) + * [Using the Python API package](#using-the-python-api-client- + package) * [Using Docker](#using-docker) - * [Using ModelPolisher jar](#using-jar) -* [How to cite ModelPolisher?](#cite-ModelPolisher) + * [Using ModelPolisher Jar](#using-modepolisher-jar) +* [Using ModelPolisher as a Java library](#using-modelpolisher-as-a-java-library) +* [How to cite ModelPolisher](#how-to-cite-ModelPolisher) * [Licenses](#licenses) -# Usage Notes +# Performance +We have run ModelPolisher on all models in the BiGG Database and on 3000 models available on Biomodels. Furthermore, we have evaluated it's performance on newly generated models using [CarveMe](), [Reconstructor]() and the [KBase Create Metabolic Model App](), with regards to [MEMOTE]() scores. -We recommend users to run ModelPolisher [using `docker`](#using-docker), though ModelPolisher can be run [from ModelPolisher `jar`](#using-jar), which is preferred for developers. +Here you can see a brief overview of its impact: -NOTE: ModelPolisher provides various command line arguments which can be seen using arguments `-?` and `--help`: -``` -java -jar /ModelPolisher/target/ModelPolisher-2.1.jar -? -``` +You can find a more detailed analysis in [our Wiki](). -See further documentation on the most important arguments here [here](https://github.com/draeger-lab/ModelPolisher/wiki/Command-Line-Arguments). +# Using ModelPolisher as a Tool +We recommend users to either use the [Python API client package](#using-the-python-api-client-package) or run ModelPolisher [using `docker`](#using-docker). -## Using Docker -ModelPolisher can be run in docker containers. This allows user to skip the build process, and database setup required to run ModelPolisher. Please install `docker` and `docker-compose`, if not installed already. +However, ModelPolisher can also be run [from the ModelPolisher `Jar`](#using-jar). -Clone ModelPolisher and change directory to ModelPolisher/: -``` -git clone https://github.com/draeger-lab/ModelPolisher/ -cd /ModelPolisher -``` -Now, bring up docker containers required for ModelPolisher(NOTE: You must be in `ModelPolisher/` directory): -``` -docker-compose up -``` +## Using the Python API client package +If you don't want to process large numbers of models and have an internet connection available, this is the recommended usage. -We recommend using docker-compose in non-detached mode when building containers for first time. If you have previously built ModelPolisher containers use `docker-compose up --detach`. +ModelPolisher is hosted as an HTTP server at [biodata.informatik.uni-halle.de/modelling/polisher](biodata.informatik.uni-halle.de/modelling/polisher). -NOTE: Once database backend is set-up by `docker-compose`, the databases are also available at following ports for `localhost`: -- AnnotateDB: `1013` -- BiGGDB: `1310` +We provide a [Python API client package](https://github.com/draeger-lab/MPClient) (available on PyPI) for interaction with the server. All documentation regarding usage of the API client can be found in that repository. -On running these commands, databases will be restored in respective containers. After databases are successfully set up, use the following command (in `ModelPolisher/` directory) to run ModelPolisher: -``` -docker-compose run -v :/models/ polisher --input=/models/ --output=/models/output/ --annotate-with-bigg=true --add-adb-annotations=true --output-combine=true -``` +## Using ModelPolisher Locally +ModelPolisher can also be run locally. -Note: You must pass *absolute path for host directory*. This command will mount volume `` to `/models/` in container. Thus, outputs will be produced in directory `/output`. +If you want to process a large number of models, or you don't feel comfortable using the Python API client package, this is the recommendend usage. -User may use `-u ` with `docker-compose run` in above command to generate output with correct ownership. Preferably use uid (obtained by `id -u `) due to some existing bugs in docker. +### Parameters +Parameters can be passed via a [json file](https://github.com/draeger-lab/ModelPolisher/wiki/Parameters#json-file) or as [command line arguments]((https://github.com/draeger-lab/ModelPolisher/wiki/Parameters#command-line-arguments)). -To bring down the containers, you can run `docker-compose stop`. This will only stop the containers but won't delete them. Otherwise, you can use `docker-compose down -v` to stop and remove all containers and related volumes. +### Using Docker +ModelPolisher is provided as a [Docker image](). -Note: `docker-compose down -v` will cause all databases to be restored again on running `docker-compose up`, as restored databases exist in containers not in images. +This repository contains a [`docker-compose.yml`](./docker-compose.yml) which also sets up [BiGG DB]() and [AnnotateDB]() as Docker containers, to support the [annotation functionality](https://github.com/draeger-lab/ModelPolisher/wiki/Annotation). -Using `docker` might cause system space to be filled up, and `docker-compose up` may fail due to insufficient space. Use the following commands if there is need to empty space used by ModelPolisher_docker: -``` -docker stop modelpolisher_biggdb modelpolisher_adb modelpolisher_java -docker rm modelpolisher_biggdb modelpolisher_adb modelpolisher_java -docker rmi modelpolisher_java:latest modelpolisher_adb:latest modelpolisher_biggdb:latest postgres:11.4 openjdk:11-slim -docker volume prune +For a single model file, you can use +``` shell +docker-compose run \ + -v :/models/ \ + polisher \ + --input=/models/ \ + --output=/models/output/ \ + --annotate-with-bigg=true \ + --add-adb-annotations=true \ + --output-combine=true ``` -#### Using a non-release jar with Docker +Output will be produced in directory `/output`. -Building using `gradle devel` builds a container with the local ModelPolisher jar. -This container can be used analogously to the release version, though either `-f docker-compose.devel.yml` needs to be -passed to each invocation of `docker-compose` or the `COMPOSE_FILE` environment variable needs to be set so it points -to `docker-compose.devel.yml`, e.g. using `export COMPOSE_FILE=docker-compose.devel.yml` for sh or bash. +*Note*: It is always recommended to [run Docker as your current user](https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user) and not as root. Running as root will produce root-owned output. Users can use `-u ` with `docker-compose run` to generate output with correct ownership in this case. -## Using ModelPolisher jar -For polishing models, you essentially need to run ModelPolisher using `jar` produced from [build instructions](#build-instructions). +### Using ModelPolisher Jar +You can run ModelPolisher using its `Jar `. +See [Releases](https://github.com/draeger-lab/ModelPolisher/releases/latest) for downloads of stable versions of standalone Jars and the [Parameters](https://github.com/draeger-lab/ModelPolisher/wiki/Parameters) Wiki page for documentation of the input parameters. -User needs to host the [BiGG](https://github.com/SBRG/bigg_models) Database & [AnnotateDB](https://github.com/matthiaskoenig/annotatedb) on `PostgreSQL` on your local system. +If the [annotation functionality](https://github.com/draeger-lab/ModelPolisher/wiki/Annotation) is required, users need to provide connections to the [BiGG](https://github.com/SBRG/bigg_models) Database and/or [AnnotateDB](https://github.com/matthiaskoenig/annotatedb) as `PostgreSQL` databases. -Now, you can run the following command in general: +This can be achieved like this: ``` java -jar "/ModelPolisher/target/ModelPolisher-2.1.jar" \ --input= \ @@ -107,22 +117,18 @@ java -jar "/ModelPolisher/target/ModelPolisher-2.1.jar" \ --adb-passwd= ``` -We understand problems in setting-up database backend and that a developer would need to build ModelPolisher multiple times and making required changes in `java` Dockerfile will be a tedious task. -We recommend the following practice for developers: -1. Set up required databases by running `docker-compose up`. -2. After making required changes in codebase build `jar` by `gradle fatJar`. -3. Run the newly build jar using: -``` -java -jar ./target/ModelPolisher-2.1.jar --input= --output= --output-combine=true --annotate-with-bigg=true --bigg-host=0.0.0.0 --bigg-port=1310 --add-adb-annotations=true --adb-host=0.0.0.0 --adb-port=1013 -``` -Note: All above commands must be run in `/ModelPolisher/` directory and you must have installed Java `version >= 8` and Gradle `version >= 5.0`. -# How to cite ModelPolisher? +Note: ModelPolisher requires Java `version >= 17`. + +# Using ModelPolisher as a Java library +ModelPolisher and all its dependencies are hosted on [Maven Central](). You can see our [GitHub Pages](http://draeger-lab.github.io/ModelPolisher/) for its Javadocs. +# How to cite ModelPolisher The online version of ModelPolisher is described in this article: http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0149263 The article ["BiGG Models: A platform for integrating, standardizing and sharing genome-scale models"](https://nar.oxfordjournals.org/content/44/D1/D515) describes BiGG Models knowledge-base including ModelPolisher. -# Licenses - +# Licenses ModelPolisher is distributed under the MIT License (see LICENSE). -An Overview of all dependencies is provided in [THIRD-PARTY.txt](https://github.com/draeger-lab/ModelPolisher/blob/master/THIRD-PARTY.txt), their respective licenses can be found in the licenses folder. +An Overview of all dependencies is provided in [THIRD-PARTY.txt](https://github.com/draeger-lab/ModelPolisher/blob/master/THIRD-PARTY.txt), their respective licenses can be found in the [licenses](./licenses) folder. + + diff --git a/build.gradle b/build.gradle old mode 100644 new mode 100755 index 9cf7972a..c1044a15 --- a/build.gradle +++ b/build.gradle @@ -35,14 +35,14 @@ licenseReport { /** === Java plugin configuration === **/ // sourceCompatibility defines the version of Java for compiling the source code. -// Ensures that the Java compiler will accept Java 18 language features. -sourceCompatibility = JavaVersion.VERSION_18 +// Ensures that the Java compiler will accept Java 17 language features. +sourceCompatibility = JavaVersion.VERSION_17 // targetCompatibility defines the version of Java bytecode to be generated. // Ensures that the compiled bytecode is compatible with Java 18 JVMs. -// Implication: The generated bytecode will run on Java 18 and newer JVMs, +// Implication: The generated bytecode will run on Java 17 and newer JVMs, // but not on older versions. -targetCompatibility = JavaVersion.VERSION_18 +targetCompatibility = JavaVersion.VERSION_17 /* Logical grouping of source files and resources. @@ -220,7 +220,7 @@ processResources.dependsOn(downloadMIRIAM) // create distributable standalone JAR that includes // not only the project's compiled classes but also all the dependencies' classes -tasks.register('uberJar', Jar) { +tasks.register('uberjar', Jar) { duplicatesStrategy = DuplicatesStrategy.EXCLUDE from sourceSets.main.output @@ -230,41 +230,6 @@ tasks.register('uberJar', Jar) { } } -// build a Docker container image after rebuilding the JAR -tasks.register('buildDockerContainer', Exec) { - commandLine "sh", "-c", "cp target/ModelPolisher-" + project.version + ".jar docker/java_docker && " + - "export COMPOSE_FILE=docker-compose.devel.yml && " + - "docker-compose pull && " + - "docker-compose build && " + - "rm docker/java_docker/ModelPolisher-" + project.version + ".jar" - dependsOn uberJar -} - -// bump jar version in ModelPolisher.sh -if (project.file( "src/scripts/ModelPolisher.sh").exists()) { - tasks.register('bumpVersionMP') { - replaceVersion(rootProject.projectDir.toString() + "/docker/java_docker/Dockerfile") - replaceVersion(rootProject.projectDir.toString() + "/README.md") - replaceVersion(rootProject.projectDir.toString() + "/src/scripts/ModelPolisher.sh") - } - processResources.dependsOn bumpVersionMP -} - -def replaceVersion(String path) { - ArrayList content = new ArrayList<>() - File file = new File(path) - String MPVersion = /ModelPolisher-(.*?)\d{1,2}(.\d{1,2}){1,2}(-beta)?.jar/ - file.eachLine { - line -> - content.add(line.replaceAll(MPVersion, "ModelPolisher-" + "${version}.jar")) - } - BufferedWriter writer = new BufferedWriter(new FileWriter(file)) - content.each { - line -> writer.writeLine(line) - } - writer.close() -} - /* === Application Plugin configuration */ diff --git a/dependency-licenses.txt b/dependency-licenses.txt deleted file mode 100644 index 00a37347..00000000 --- a/dependency-licenses.txt +++ /dev/null @@ -1,3 +0,0 @@ -License information for dependencies can be created by running 'gradle generateLicenseReport' -and is located in build/reports/dependency-license/index.html. -This functionality is provided by the 'Gradle License Report' plugin (https://github.com/jk1/Gradle-License-Report). diff --git a/development/docker-compose.databases.yml b/development/docker-compose.databases.yml index b5d55ad9..6c11a975 100644 --- a/development/docker-compose.databases.yml +++ b/development/docker-compose.databases.yml @@ -1,17 +1,27 @@ networks: modelpolisher: - driver: bridge + +volumes: + pgadmin-data: + +configs: + pgadmin-server-config: + file: ./pgadmin-servers.json + services: + biggdb: image: schmirgel/bigg_db:1.6 container_name: modelpolisher_pgadmin_biggdb networks: - modelpolisher + adb: image: schmirgel/annotatedb:0.1.1 container_name: modelpolisher_pgadmin_adb networks: - modelpolisher + pgadmin: image: dpage/pgadmin4 container_name: modelpolisher_pgadmin @@ -19,12 +29,16 @@ services: - biggdb - adb environment: - - PGADMIN_DEFAULT_USER=admin - - PGADMIN_DEFAULT_EMAIL=admin@example.com - - PGADMIN_DEFAULT_PASSWORD=admin + DEFAULT_SERVER_PORT: 80 + PGADMIN_DEFAULT_EMAIL: admin@example.com + PGADMIN_DEFAULT_PASSWORD: admin + PGADMIN_SERVER_JSON_FILE: /pgadmin4/servers.json volumes: - - ./servers.json:/pgadmin4/servers.json - networks: - - modelpolisher + - pgadmin-data:/var/lib/pgadmin + configs: + - source: pgadmin-server-config + target: /pgadmin4/servers.json ports: - "127.0.0.1:5050:80" + networks: + - modelpolisher diff --git a/development/docker-compose.local-jar.yml b/development/docker-compose.local-jar.yml index ceec582c..7940287a 100644 --- a/development/docker-compose.local-jar.yml +++ b/development/docker-compose.local-jar.yml @@ -1,21 +1,19 @@ -# ------------------------------------------------ -# docker-compose for ModelPolisher development -# run gradle devel first and then docker-compose -f docker-compose.devel.yml run ... or export COMPOSE_FILE and run normally -# ------------------------------------------------ -version: '3' services: + biggdb: image: schmirgel/bigg_db:1.6 container_name: modelpolisher_biggdb ports: - - 1310:5432 + - 127.0.0.1:1310:5432 + adb: image: schmirgel/annotatedb:0.1.1 container_name: modelpolisher_adb ports: - - 1013:5432 + - 127.0.0.1:1013:5432 + polisher: - build: ./docker/java_docker + build: ../Dockerfile container_name: modelpolisher_java depends_on: - biggdb diff --git a/development/servers.json b/development/pgadmin-servers.json similarity index 100% rename from development/servers.json rename to development/pgadmin-servers.json diff --git a/docker/adb_docker/Dockerfile b/docker/adb_docker/Dockerfile deleted file mode 100644 index 5586bc70..00000000 --- a/docker/adb_docker/Dockerfile +++ /dev/null @@ -1,23 +0,0 @@ -FROM postgres:latest AS builder - -LABEL maintainer="dario.eltzner@student.uni-tuebingen.de" - -RUN apt-get update && apt-get upgrade -y -COPY ./adb-v0.1.1.dump /adb.dump -COPY ./restore_adb.sh /docker-entrypoint-initdb.d/restore_adb.sh - -RUN mkdir -p /var/lib/postgresql-static/data -ENV PGDATA=/var/lib/postgresql-static/data -ENV POSTGRES_USER=postgres -ENV POSTGRES_PASSWORD=postgres - -RUN ["sed", "-i", "s/exec \"$@\"/echo \"skipping...\"/", "/usr/local/bin/docker-entrypoint.sh"] - -RUN ["/usr/local/bin/docker-entrypoint.sh", "postgres"] - -FROM postgres:latest - -COPY --from=builder /var/lib/postgresql-static/data $PGDATA - -EXPOSE 5432 - diff --git a/docker/adb_docker/restore_adb.sh b/docker/adb_docker/restore_adb.sh deleted file mode 100644 index 46e19623..00000000 --- a/docker/adb_docker/restore_adb.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -psql -c "DROP DATABASE IF EXISTS adb"; -psql -c "CREATE DATABASE adb"; -bash -c "pg_restore -O -d adb --verbose /adb.dump"; - diff --git a/docker/bigg_docker/Dockerfile b/docker/bigg_docker/Dockerfile deleted file mode 100644 index 6be5201a..00000000 --- a/docker/bigg_docker/Dockerfile +++ /dev/null @@ -1,23 +0,0 @@ -FROM postgres:latest AS builder - -LABEL maintainer="dario.eltzner@student.uni-tuebingen.de" - -RUN apt-get update && apt-get upgrade -y -COPY ./bigg_database.dump /bigg_database.dump -COPY ./restore_biggdb.sh /docker-entrypoint-initdb.d/restore_biggdb.sh - -RUN mkdir -p /var/lib/postgresql-static/data -ENV PGDATA=/var/lib/postgresql-static/data -ENV POSTGRES_USER=postgres -ENV POSTGRES_PASSWORD=postgres - -RUN ["sed", "-i", "s/exec \"$@\"/echo \"skipping...\"/", "/usr/local/bin/docker-entrypoint.sh"] - -RUN ["/usr/local/bin/docker-entrypoint.sh", "postgres"] - -FROM postgres:latest - -COPY --from=builder /var/lib/postgresql-static/data $PGDATA - -EXPOSE 5432 - diff --git a/docker/bigg_docker/restore_biggdb.sh b/docker/bigg_docker/restore_biggdb.sh deleted file mode 100644 index dc1b3c03..00000000 --- a/docker/bigg_docker/restore_biggdb.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -psql -c 'DROP DATABASE IF EXISTS bigg' -psql -c 'CREATE DATABASE bigg' -bash -c 'pg_restore -O -d bigg --verbose /bigg_database.dump' diff --git a/docs/allclasses-index.html b/docs/allclasses-index.html index f3ea6ad7..ca3e5f93 100644 --- a/docs/allclasses-index.html +++ b/docs/allclasses-index.html @@ -1,7 +1,7 @@ - + All Classes and Interfaces (ModelPolisher 2.1 API) @@ -9,12 +9,17 @@ + -