Skip to content

Commit

Permalink
Fixing a model=null exception and memory overuse during merge after i…
Browse files Browse the repository at this point in the history
…ndexed was done...
  • Loading branch information
IgorRodchenkov committed May 21, 2024
1 parent c1e9a2b commit 6b8abb1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main/java/cpath/service/ConsoleApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,10 @@ private void merge() {
LOG.info("Found {}...", service.settings().mainModelFile());
}

service.init(); // reload the model, index, blacklist if exists...

if(service.getBlacklist() == null) {
if(service.getModel()==null) {
service.init();
}
LOG.info("Generating the list of ubiquitous small molecules, {}...", service.settings().blacklistFile());
//Generate the blacklist.txt to exclude/keep ubiquitous small molecules (e.g. ATP)
//from graph query and output format converter results.
Expand Down Expand Up @@ -321,7 +322,9 @@ private void postmerge() throws IOException {
writer.close();
LOG.info("generated datasources.txt");

service.init(); // load/reload the main model, index, etc.
if(service.getModel() == null) {
service.init(); // load/reload the main model, index, etc.
}

//this was to integrate with UniProt portal/data - to add/update their external links to PathwayCommons apps...
LOG.info("creating the list of primary uniprot ACs...");
Expand Down
1 change: 1 addition & 0 deletions src/main/java/cpath/service/IndexImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ public void save(Model model) {
commit();
//force refreshing the index state (for new readers)
refresh();
setModel(model);
LOG.info("build(), all done.");
}

Expand Down
1 change: 1 addition & 0 deletions src/main/java/cpath/service/Merger.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public void merge() {
log.info("Merged, saved.");
log.info("Indexing...");
service.index().save(m); // create or update all the biopax elements index
service.setModel(m);
}

//remove bad unification and relationship xrefs, if any;
Expand Down

0 comments on commit 6b8abb1

Please sign in to comment.