Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mpo parser #33

Closed
wants to merge 9 commits into from
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
Changelog
=========

----
v0.4
----

- Disabling ``mv_store`` feature of H2.
- Fixing various bugs in ``H2ScoreDistributionReader`` and ``H2ScoreDistributionWriter``.

----
v0.3
----
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ A modern Java library for working with (biological) ontologies.

- **Language/Platform:** Java >=8
- **License:** BSD 3-Clause Clear
- **Version:** 0.3
- **Version:** 0.4
- **Authors:**
- Sebastian Bauer
- Peter N. Robinson
- Sebastian Koehler
- Max Schubach
- Manuel Holtgrewe
- **Availability:**
- Maven module `ontolib-core` for dealing with (biological) ontologies ([Javadoc via javadoc.io](http://javadoc.io/doc/com.github.phenomics/ontolib-core/0.3)).
- Maven module `ontolib-io` for reading ontologies from OBO files ([Javadoc via javadoc.io](http://javadoc.io/doc/com.github.phenomics/ontolib-io/0.3)).
- Maven module `ontolib-core` for dealing with (biological) ontologies ([Javadoc via javadoc.io](http://javadoc.io/doc/com.github.phenomics/ontolib-core/0.4)).
- Maven module `ontolib-io` for reading ontologies from OBO files ([Javadoc via javadoc.io](http://javadoc.io/doc/com.github.phenomics/ontolib-io/0.4)).
- Maven module `ontolib-cli` for performing empirical score distribution computation as a stand-alone program.
10 changes: 5 additions & 5 deletions ontolib-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<resources>
<resource>
<directory>src/main/resources</directory>
<!--Use filtering so that maven will replace placeholders with values
<!--Use filtering so that maven will replace placeholders with values
from the pom e.g. ${project.version} -->
<filtering>true</filtering>
</resource>
Expand All @@ -73,7 +73,7 @@
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<!-- set useUniqueVersions=false in order that the classpath
<!-- set useUniqueVersions=false in order that the classpath
has the SNAPSHOT instead of the build number prefixed to the dependency -->
<useUniqueVersions>false</useUniqueVersions>
<mainClass>com.github.phenomics.ontolib.cli.Main</mainClass>
Expand Down Expand Up @@ -105,7 +105,7 @@
</execution>
</executions>
</plugin>
<!-- Specify the resources which need to be made accessible to the
<!-- Specify the resources which need to be made accessible to the
user -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
Expand All @@ -122,7 +122,7 @@
<resources>
<resource>
<directory>src/resources</directory>
<!--Use filtering so that maven will replace placeholders
<!--Use filtering so that maven will replace placeholders
with values from the pom e.g. ${project.version} -->
<filtering>true</filtering>
<includes>
Expand All @@ -137,7 +137,7 @@
</execution>
</executions>
</plugin>
<!--This plugin assembles the various elements together into a redistributable
<!--This plugin assembles the various elements together into a redistributable
zip/tar.gz file -->
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
Expand Down
6 changes: 3 additions & 3 deletions ontolib-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<resources>
<resource>
<directory>src/main/resources</directory>
<!--Use filtering so that maven will replace placeholders with values
<!--Use filtering so that maven will replace placeholders with values
from the pom e.g. ${project.version} -->
<filtering>true</filtering>
</resource>
Expand Down Expand Up @@ -51,7 +51,7 @@
</executions>
</plugin>

<!-- Specify the resources which need to be made accessible to the
<!-- Specify the resources which need to be made accessible to the
user -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
Expand All @@ -68,7 +68,7 @@
<resources>
<resource>
<directory>src/main/resources</directory>
<!--Use filtering so that maven will replace placeholders
<!--Use filtering so that maven will replace placeholders
with values from the pom e.g. ${project.version} -->
<filtering>true</filtering>
<includes>
Expand Down
6 changes: 3 additions & 3 deletions ontolib-io/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<resources>
<resource>
<directory>src/main/resources</directory>
<!--Use filtering so that maven will replace placeholders with values
<!--Use filtering so that maven will replace placeholders with values
from the pom e.g. ${project.version} -->
<filtering>true</filtering>
</resource>
Expand Down Expand Up @@ -109,7 +109,7 @@
</executions>
</plugin>

<!-- Specify the resources which need to be made accessible to the
<!-- Specify the resources which need to be made accessible to the
user -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
Expand All @@ -126,7 +126,7 @@
<resources>
<resource>
<directory>src/main/resources</directory>
<!--Use filtering so that maven will replace placeholders
<!--Use filtering so that maven will replace placeholders
with values from the pom e.g. ${project.version} -->
<filtering>true</filtering>
<includes>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public MpoTerm constructTerm(Stanza stanza) {
final String creationDateStr =
(creationDateEntry == null) ? null : creationDateEntry.getValue();

final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
Date creationDate = null;
if (creationDateStr != null) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ public class H2ScoreDistributionReader implements ScoreDistributionReader {
private final Connection conn;

/** H2 query for selecting all term counts. */
private final static String H2_SELECT_TERM_COUNTS = "SELECT DISTINCT (term_count) from %s";
private final static String H2_SELECT_TERM_COUNTS = "SELECT DISTINCT (num_terms) from %s";

/** H2 query for selecting by term count. */
private final static String H2_SELECT_BY_TERM_COUNT_STATEMENT =
"SELECT (term_count, object_id, scores, p_values) FROM % WHERE (term_count = ?)";
"SELECT num_terms, entrez_id, sample_size, scores, p_values FROM %s WHERE (num_terms = ?)";

/** H2 query for selecting by term count and object ID. */
private final static String H2_SELECT_BY_TERM_COUNT_AND_OBJECT_STATEMENT =
"SELECT (term_count, object_id, scores, p_values) FROM % WHERE (term_count = ? AND object_id = ?)";
"SELECT num_terms, entrez_id, sample_size, scores, p_values FROM %s WHERE (num_terms = ? AND entrez_id = ?)";

/**
* Create new reader object.
Expand All @@ -74,7 +74,8 @@ private Connection openConnection() throws OntoLibException {
final Connection result;
try {
Class.forName("org.h2.Driver");
result = DriverManager.getConnection("jdbc:h2:" + pathDb, "", "");
result = DriverManager
.getConnection("jdbc:h2:" + pathDb + ";ACCESS_MODE_DATA=r;mv_store=false", "", "");
} catch (ClassNotFoundException e) {
throw new OntoLibException("H2 driver class could not be found", e);
} catch (SQLException e) {
Expand Down Expand Up @@ -110,7 +111,7 @@ public ObjectScoreDistribution readForTermCountAndObject(int termCount, int obje
}
} catch (SQLException e) {
throw new OntoLibException("Problem with getting object score distribution for termCount: "
+ termCount + ", objectId: " + objectId);
+ termCount + ", objectId: " + objectId, e);
}

throw new OntoLibException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private Connection openConnection(boolean resetTableIfExists) throws OntoLibExce
final Connection resultConn;
try {
Class.forName("org.h2.Driver");
resultConn = DriverManager.getConnection("jdbc:h2:" + pathDb, "", "");
resultConn = DriverManager.getConnection("jdbc:h2:" + pathDb + ";mv_store=false", "", "");
} catch (ClassNotFoundException e) {
throw new OntoLibException("H2 driver class could not be found", e);
} catch (SQLException e) {
Expand Down Expand Up @@ -190,6 +190,7 @@ private void writeObjectScoreDistribution(int numTerms, ObjectScoreDistribution
for (Entry<Double, Double> e : dist.getCumulativeFrequencies().entrySet()) {
scores[i] = e.getKey();
pValues[i] = e.getValue();
i += 1;
}
}

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>com.github.phenomics</groupId>
<artifactId>OntoLib</artifactId>
<packaging>pom</packaging>
<version>0.3</version>
<version>0.5-SNAPSHOT</version>

<name>${project.groupId}:${project.artifactId}</name>
<description>OntoLib contains data structures and algorithms for processing ontologies.</description>
Expand Down