diff --git a/build.gradle b/build.gradle index d327431..165f613 100755 --- a/build.gradle +++ b/build.gradle @@ -107,17 +107,26 @@ dependencies { implementation("org.sbml.jsbml:jsbml:1.6.1") { exclude group: "org.apache.logging.log4j", module: "log4j-core" exclude group: "org.apache.logging.log4j", module: "log4j-api" - exclude group: "org.apache.logging.log4j", module: "log4j-1.2-api " + exclude group: "org.apache.logging.log4j", module: "log4j-1.2-api" exclude group: "org.apache.logging.log4j", module: "log4j-slf4j-impl" exclude group: "org.apache.commons", module: "logging" } // ontology support within BioJava - implementation "org.biojava:biojava-ontology:7.1.1" + implementation("org.biojava:biojava-ontology:7.1.1") { + exclude group: "org.apache.logging.log4j", module: "log4j-core" + exclude group: "org.apache.logging.log4j", module: "log4j-slf4j-impl" + } // handle Combine Archives (packages of biological models) implementation "de.uni-rostock.sbi:CombineArchive:1.4.1" // interacting with MATLAB files implementation 'us.hebi.matlab.mat:mfl-core:0.5.15' + implementation "org.slf4j:slf4j-api:2.0.9" + implementation "org.slf4j:jul-to-slf4j:2.0.9" + implementation "org.slf4j:jcl-over-slf4j:2.0.9" + implementation "org.slf4j:log4j-over-slf4j:2.0.9" + implementation "org.slf4j:osgi-over-slf4j:2.0.9" + // JDBC connection pool implementation "com.zaxxer:HikariCP:5.1.0" // https://mvnrepository.com/artifact/commons-io/commons-io @@ -275,4 +284,4 @@ tasks.register('uberjar', Jar) { */ application { mainClass.set('ModelPolisher') -} \ No newline at end of file +} diff --git a/src/main/java/edu/ucsd/sbrg/parameters/FixingParameters.java b/src/main/java/edu/ucsd/sbrg/parameters/FixingParameters.java new file mode 100644 index 0000000..897cc58 --- /dev/null +++ b/src/main/java/edu/ucsd/sbrg/parameters/FixingParameters.java @@ -0,0 +1,38 @@ +package edu.ucsd.sbrg.parameters; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + +public class FixingParameters { + + @JsonProperty("dont-fix") + private boolean dontFix = false; + + public FixingParameters() { + } + + public boolean dontFix() { + return dontFix; + } + + @Override + public String toString() { + return "FixingParameters{" + + "dontFix=" + dontFix + + '}'; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + FixingParameters that = (FixingParameters) o; + return dontFix == that.dontFix; + } + + @Override + public int hashCode() { + return Objects.hashCode(dontFix); + } +} diff --git a/src/main/java/edu/ucsd/sbrg/parameters/Parameters.java b/src/main/java/edu/ucsd/sbrg/parameters/Parameters.java index 61a1d70..b60f486 100644 --- a/src/main/java/edu/ucsd/sbrg/parameters/Parameters.java +++ b/src/main/java/edu/ucsd/sbrg/parameters/Parameters.java @@ -6,6 +6,8 @@ public class Parameters { + @JsonProperty("fixing") + private final FixingParameters fixing = new FixingParameters(); @JsonProperty("polishing") private final PolishingParameters polishing = new PolishingParameters(); @JsonProperty("annotation") @@ -39,15 +41,8 @@ public ModelPolisherOptions.OutputType outputType() { return outputType; } - @Override - public String toString() { - return "Parameters{" + - "polishing=" + polishing + - ", annotation=" + annotation + - ", sboTerms=" + sboTerms + - ", sbmlValidation=" + sbmlValidation + - ", outputType=" + outputType + - '}'; + public FixingParameters fixing() { + return fixing; } @Override @@ -55,11 +50,24 @@ public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Parameters that = (Parameters) o; - return sbmlValidation == that.sbmlValidation && Objects.equals(polishing, that.polishing) && Objects.equals(annotation, that.annotation) && Objects.equals(sboTerms, that.sboTerms) && outputType == that.outputType; + return sbmlValidation == that.sbmlValidation && Objects.equals(fixing, that.fixing) && Objects.equals(polishing, that.polishing) && Objects.equals(annotation, that.annotation) && Objects.equals(sboTerms, that.sboTerms) && outputType == that.outputType; } @Override public int hashCode() { - return Objects.hash(polishing, annotation, sboTerms, sbmlValidation, outputType); + return Objects.hash(fixing, polishing, annotation, sboTerms, sbmlValidation, outputType); } + + @Override + public String toString() { + return "Parameters{" + + "fixing=" + fixing + + ", polishing=" + polishing + + ", annotation=" + annotation + + ", sboTerms=" + sboTerms + + ", sbmlValidation=" + sbmlValidation + + ", outputType=" + outputType + + '}'; + } + } diff --git a/src/main/java/edu/ucsd/sbrg/parameters/PolishingParameters.java b/src/main/java/edu/ucsd/sbrg/parameters/PolishingParameters.java index 1cba746..dcb7dc2 100644 --- a/src/main/java/edu/ucsd/sbrg/parameters/PolishingParameters.java +++ b/src/main/java/edu/ucsd/sbrg/parameters/PolishingParameters.java @@ -7,6 +7,8 @@ public class PolishingParameters { + @JsonProperty("polish-even-if-model-invalid") + private boolean polishEvenIfModelInvalid = false; @JsonProperty("reactions") private ReactionPolishingParameters reactionPolishingParameters = new ReactionPolishingParameters(); @JsonProperty("flux-objectives") @@ -15,9 +17,11 @@ public class PolishingParameters { public PolishingParameters() { } public PolishingParameters(ReactionPolishingParameters reactionPolishingParameters, - FluxObjectivesPolishingParameters fluxObjectivesPolishingParameters) { + FluxObjectivesPolishingParameters fluxObjectivesPolishingParameters, + boolean polishEvenIfModelInvalid) { this.reactionPolishingParameters = reactionPolishingParameters; this.fluxObjectivesPolishingParameters = fluxObjectivesPolishingParameters; + this.polishEvenIfModelInvalid = polishEvenIfModelInvalid; } public PolishingParameters(SBProperties args) throws IllegalArgumentException { @@ -33,12 +37,8 @@ public FluxObjectivesPolishingParameters fluxObjectivesPolishingParameters() { return fluxObjectivesPolishingParameters; } - @Override - public String toString() { - return "PolishingParameters{" + - "reactionPolishingParameters=" + reactionPolishingParameters + - ", fluxObjectivesPolishingParameters=" + fluxObjectivesPolishingParameters + - '}'; + public boolean polishEvenIfModelInvalid() { + return polishEvenIfModelInvalid; } @Override @@ -46,11 +46,21 @@ public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; PolishingParameters that = (PolishingParameters) o; - return Objects.equals(reactionPolishingParameters, that.reactionPolishingParameters) && Objects.equals(fluxObjectivesPolishingParameters, that.fluxObjectivesPolishingParameters); + return polishEvenIfModelInvalid == that.polishEvenIfModelInvalid && Objects.equals(reactionPolishingParameters, that.reactionPolishingParameters) && Objects.equals(fluxObjectivesPolishingParameters, that.fluxObjectivesPolishingParameters); } @Override public int hashCode() { - return Objects.hash(reactionPolishingParameters, fluxObjectivesPolishingParameters); + return Objects.hash(polishEvenIfModelInvalid, reactionPolishingParameters, fluxObjectivesPolishingParameters); } + + @Override + public String toString() { + return "PolishingParameters{" + + "polishEvenIfModelInvalid=" + polishEvenIfModelInvalid + + ", reactionPolishingParameters=" + reactionPolishingParameters + + ", fluxObjectivesPolishingParameters=" + fluxObjectivesPolishingParameters + + '}'; + } + } diff --git a/src/test/java/edu/ucsd/sbrg/fixing/fbc/ListOfObjectivesFixerTest.java b/src/test/java/edu/ucsd/sbrg/fixing/fbc/ListOfObjectivesFixerTest.java index 0ed0138..ac4832f 100644 --- a/src/test/java/edu/ucsd/sbrg/fixing/fbc/ListOfObjectivesFixerTest.java +++ b/src/test/java/edu/ucsd/sbrg/fixing/fbc/ListOfObjectivesFixerTest.java @@ -43,7 +43,8 @@ public void argumentsAreUsedToInferFluxObjectives() { null, new FluxObjectivesPolishingParameters( null, - List.of("objective_reaction1", "objective_reaction2"))); + List.of("objective_reaction1", "objective_reaction2")), + false); new ListOfObjectivesFixer(parameters, fbcPlugin).fix(fbcPlugin.getListOfObjectives(), 0); diff --git a/src/test/java/edu/ucsd/sbrg/polishing/fbc/ObjectivesPolisherTest.java b/src/test/java/edu/ucsd/sbrg/polishing/fbc/ObjectivesPolisherTest.java index de33523..7bf8a82 100644 --- a/src/test/java/edu/ucsd/sbrg/polishing/fbc/ObjectivesPolisherTest.java +++ b/src/test/java/edu/ucsd/sbrg/polishing/fbc/ObjectivesPolisherTest.java @@ -34,7 +34,8 @@ public void activeObjectiveRemainsUnchangedIfItHasFluxObjective() { null, new FluxObjectivesPolishingParameters( null, - List.of(" objective_reaction1 "))); + List.of(" objective_reaction1 ")), + false); m.createReaction("objective_reaction1"); m.createReaction("yadda_Biomass_yadda");