Skip to content

Commit

Permalink
intellij issues fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Schmoho committed Jul 22, 2024
1 parent ffeeab8 commit c041d0b
Show file tree
Hide file tree
Showing 22 changed files with 49 additions and 110 deletions.
80 changes: 41 additions & 39 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import com.github.jk1.license.filter.ExcludeTransitiveDependenciesFilter
import com.github.jk1.license.filter.LicenseBundleNormalizer
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
Expand All @@ -22,12 +24,12 @@ licenseReport {
/*
- Ensures that similar licenses are grouped together
*/
new com.github.jk1.license.filter.LicenseBundleNormalizer(),
new LicenseBundleNormalizer(),
/*
- Transitive dependencies are not included in the report
- Be aware that excluding transitive dependencies might omit some licenses from the report
*/
new com.github.jk1.license.filter.ExcludeTransitiveDependenciesFilter()
new ExcludeTransitiveDependenciesFilter()
]
}

Expand Down Expand Up @@ -136,43 +138,43 @@ dependencies {
/** === Configuration for pre-existing Tasks === **/

// config for all jar tasks
tasks.withType(Jar) {
tasks.withType(Jar).configureEach {
dependsOn test
destinationDirectory = file("$rootDir/target")
manifest {
attributes(
"Version": project.version,
"Implementation-Title": "ModelPolisher",
"Implementation-Version": project.version,
"Specification-Vendor": "University of California, San Diego",
"Specification-Title": "ModelPolisher",
"Implementation-Vendor-Id": "edu.ucsd.sbrg",
"Implementation-Vendor": "University of California, San Diego",
"Main-Class": "edu.ucsd.sbrg.ModelPolisherCLILauncher"
)
attributes(
"Version": project.version,
"Implementation-Title": "ModelPolisher",
"Implementation-Version": project.version,
"Specification-Vendor": "University of California, San Diego",
"Specification-Title": "ModelPolisher",
"Implementation-Vendor-Id": "edu.ucsd.sbrg",
"Implementation-Vendor": "University of California, San Diego",
"Main-Class": "edu.ucsd.sbrg.ModelPolisherCLILauncher"
)
}
}

// enable deprecation linter in compilation
tasks.withType(JavaCompile) {
tasks.withType(JavaCompile).configureEach {
options.compilerArgs << '-Xlint:deprecation'
}

// config for all test tasks
tasks.withType(Test) {
tasks.withType(Test).configureEach {
useJUnitPlatform()
testLogging {
showStandardStreams = true
events "passed", "skipped", "failed"
exceptionFormat TestExceptionFormat.FULL
showCauses true
showExceptions true
showStackTraces true
// showStandardStreams = false
// events "failed"
// showCauses false
// showExceptions false
// showStackTraces false
showStandardStreams = true
events "passed", "skipped", "failed"
exceptionFormat TestExceptionFormat.FULL
showCauses true
showExceptions true
showStackTraces true
// showStandardStreams = false
// events "failed"
// showCauses false
// showExceptions false
// showStackTraces false
}
}

Expand All @@ -193,7 +195,7 @@ tasks.javadoc {

/** === Custom Tasks === **/
// get latest version of MIRIAM registry
task downloadMIRIAM {
tasks.register('downloadMIRIAM') {
doLast {
def registryUrl = 'https://registry.api.identifiers.org/resolutionApi/getResolverDataset'
def parentDir = file('src/main/resources/edu/ucsd/sbrg/resolver/identifiersorg')
Expand All @@ -218,37 +220,37 @@ processResources.dependsOn(downloadMIRIAM)

// create distributable standalone JAR that includes
// not only the project's compiled classes but also all the dependencies' classes
task uberJar(type: Jar) {
tasks.register('uberJar', Jar) {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE

from sourceSets.main.output
dependsOn configurations.runtimeClasspath
from {
configurations.runtimeClasspath.findAll { it.name.endsWith('jar') }.collect { zipTree(it) }
configurations.runtimeClasspath.findAll { it.name.endsWith('jar') }.collect { zipTree(it) }
}
}

// build a Docker container image after rebuilding the JAR
task buildDockerContainer(type: Exec) {
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"
"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()) {
task bumpVersionMP() {
replaceVersion(rootProject.projectDir.toString() + "/docker/java_docker/Dockerfile")
replaceVersion(rootProject.projectDir.toString() + "/README.md")
replaceVersion(rootProject.projectDir.toString() + "/src/scripts/ModelPolisher.sh")
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(path) {
def replaceVersion(String path) {
ArrayList<String> content = new ArrayList<>()
File file = new File(path)
String MPVersion = /ModelPolisher-(.*?)\d{1,2}(.\d{1,2}){1,2}(-beta)?.jar/
Expand Down
1 change: 0 additions & 1 deletion src/main/java/edu/ucsd/sbrg/Parameters.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package edu.ucsd.sbrg;

import java.io.File;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Objects;
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/edu/ucsd/sbrg/annotation/AbstractAnnotator.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
package edu.ucsd.sbrg.annotation;

import edu.ucsd.sbrg.Parameters;
import edu.ucsd.sbrg.db.bigg.BiGGDB;
import edu.ucsd.sbrg.reporting.ProgressObserver;
import edu.ucsd.sbrg.reporting.ProgressUpdate;
import edu.ucsd.sbrg.reporting.ReportType;
import edu.ucsd.sbrg.resolver.Registry;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

public abstract class AbstractAnnotator<SBMLElement> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,14 @@
import edu.ucsd.sbrg.db.bigg.BiGGDBContract;
import edu.ucsd.sbrg.db.bigg.BiGGId;
import edu.ucsd.sbrg.reporting.ProgressObserver;
import edu.ucsd.sbrg.reporting.ProgressUpdate;
import edu.ucsd.sbrg.reporting.ReportType;
import edu.ucsd.sbrg.resolver.Registry;
import edu.ucsd.sbrg.resolver.RegistryURI;
import edu.ucsd.sbrg.resolver.identifiersorg.IdentifiersOrgURI;
import org.sbml.jsbml.Reaction;
import org.sbml.jsbml.Species;
import org.sbml.jsbml.ext.fbc.GeneProduct;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Stream;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
package edu.ucsd.sbrg.annotation.bigg;

import edu.ucsd.sbrg.db.bigg.BiGGDB;
import edu.ucsd.sbrg.db.bigg.BiGGDBContract;
import edu.ucsd.sbrg.db.bigg.BiGGId;
import edu.ucsd.sbrg.resolver.Registry;
import edu.ucsd.sbrg.resolver.RegistryURI;
import edu.ucsd.sbrg.resolver.identifiersorg.IdentifiersOrgURI;
import org.sbml.jsbml.Reaction;
import org.sbml.jsbml.Species;
import org.sbml.jsbml.ext.fbc.GeneProduct;

import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;

public class BiGGAnnotationUtils {


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import de.zbit.util.ResourceManager;
import edu.ucsd.sbrg.Parameters;
import edu.ucsd.sbrg.annotation.bigg.BiGGAnnotationUtils;
import edu.ucsd.sbrg.annotation.bigg.BiGGCVTermAnnotator;
import edu.ucsd.sbrg.db.bigg.BiGGId;
import edu.ucsd.sbrg.db.bigg.BiGGDB;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import javax.xml.stream.XMLStreamException;

import edu.ucsd.sbrg.resolver.Registry;
import edu.ucsd.sbrg.resolver.identifiersorg.IdentifiersOrg;
import edu.ucsd.sbrg.resolver.identifiersorg.IdentifiersOrgURI;
import org.sbml.jsbml.CVTerm;
import org.sbml.jsbml.Model;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import de.zbit.util.ResourceManager;
import edu.ucsd.sbrg.db.bigg.BiGGId;
import edu.ucsd.sbrg.resolver.Registry;
import edu.ucsd.sbrg.resolver.identifiersorg.IdentifiersOrg;
import edu.ucsd.sbrg.resolver.identifiersorg.IdentifiersOrgURI;
import org.sbml.jsbml.CVTerm;
import org.sbml.jsbml.Model;
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/edu/ucsd/sbrg/polishing/AbstractPolisher.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import edu.ucsd.sbrg.reporting.ProgressUpdate;
import edu.ucsd.sbrg.reporting.ReportType;
import edu.ucsd.sbrg.resolver.Registry;
import org.apache.commons.lang3.tuple.Pair;
import org.sbml.jsbml.AbstractSBase;

import java.util.*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

import edu.ucsd.sbrg.Parameters;
import edu.ucsd.sbrg.reporting.ProgressObserver;
import edu.ucsd.sbrg.reporting.ProgressUpdate;
import edu.ucsd.sbrg.reporting.ReportType;
import edu.ucsd.sbrg.resolver.Registry;
import org.sbml.jsbml.Compartment;
import org.sbml.jsbml.Model;
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/edu/ucsd/sbrg/polishing/ModelPolisher.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
import edu.ucsd.sbrg.Parameters;
import edu.ucsd.sbrg.polishing.fbc.FBCPolisher;
import edu.ucsd.sbrg.reporting.ProgressObserver;
import edu.ucsd.sbrg.reporting.ProgressUpdate;
import edu.ucsd.sbrg.reporting.ReportType;
import edu.ucsd.sbrg.resolver.Registry;
import org.sbml.jsbml.*;
import org.sbml.jsbml.ext.fbc.FBCConstants;
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/edu/ucsd/sbrg/polishing/ParametersPolisher.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import edu.ucsd.sbrg.Parameters;
import edu.ucsd.sbrg.reporting.ProgressObserver;
import edu.ucsd.sbrg.reporting.ProgressUpdate;
import edu.ucsd.sbrg.reporting.ReportType;
import edu.ucsd.sbrg.resolver.Registry;
import org.sbml.jsbml.Parameter;

Expand Down
2 changes: 0 additions & 2 deletions src/main/java/edu/ucsd/sbrg/polishing/ReactionsPolisher.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import de.zbit.kegg.AtomBalanceCheck.AtomCheckResult;
import edu.ucsd.sbrg.db.bigg.BiGGId;
import edu.ucsd.sbrg.Parameters;
import edu.ucsd.sbrg.reporting.ProgressUpdate;
import edu.ucsd.sbrg.reporting.ReportType;
import edu.ucsd.sbrg.resolver.Registry;
import edu.ucsd.sbrg.util.GPRParser;
import edu.ucsd.sbrg.reporting.ProgressObserver;
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/edu/ucsd/sbrg/polishing/SBMLPolisher.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@
import edu.ucsd.sbrg.Parameters;
import edu.ucsd.sbrg.reporting.ProgressObserver;
import edu.ucsd.sbrg.resolver.Registry;
import org.apache.commons.lang3.tuple.Pair;
import org.sbml.jsbml.Model;
import org.sbml.jsbml.SBMLDocument;
import org.sbml.jsbml.ext.fbc.converters.CobraToFbcV2Converter;
import org.sbml.jsbml.util.SBMLtools;
import org.sbml.jsbml.util.ValuePair;

import java.util.List;
import java.util.Map;
import java.util.ResourceBundle;
import java.util.logging.Logger;

Expand Down
2 changes: 0 additions & 2 deletions src/main/java/edu/ucsd/sbrg/polishing/SpeciesPolisher.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import edu.ucsd.sbrg.Parameters;
import edu.ucsd.sbrg.db.bigg.BiGGId;
import edu.ucsd.sbrg.reporting.ProgressObserver;
import edu.ucsd.sbrg.reporting.ProgressUpdate;
import edu.ucsd.sbrg.reporting.ReportType;
import edu.ucsd.sbrg.resolver.Registry;
import org.sbml.jsbml.*;

Expand Down
2 changes: 0 additions & 2 deletions src/main/java/edu/ucsd/sbrg/polishing/UnitPolisher.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package edu.ucsd.sbrg.polishing;

import edu.ucsd.sbrg.Parameters;
import edu.ucsd.sbrg.reporting.ProgressUpdate;
import edu.ucsd.sbrg.reporting.ReportType;
import edu.ucsd.sbrg.resolver.Registry;
import edu.ucsd.sbrg.resolver.identifiersorg.IdentifiersOrgURI;
import edu.ucsd.sbrg.reporting.ProgressObserver;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import edu.ucsd.sbrg.Parameters;
import edu.ucsd.sbrg.polishing.AbstractPolisher;
import edu.ucsd.sbrg.reporting.ProgressObserver;
import edu.ucsd.sbrg.reporting.ProgressUpdate;
import edu.ucsd.sbrg.reporting.ReportType;
import edu.ucsd.sbrg.resolver.Registry;
import edu.ucsd.sbrg.util.SBMLFix;
import org.sbml.jsbml.ext.fbc.FBCModelPlugin;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package edu.ucsd.sbrg.annotation.bigg;

import edu.ucsd.sbrg.Parameters;
import edu.ucsd.sbrg.db.bigg.BiGGDB;
import edu.ucsd.sbrg.resolver.identifiersorg.IdentifiersOrg;
import org.junit.jupiter.api.Test;
import org.sbml.jsbml.CVTerm;
Expand Down
21 changes: 5 additions & 16 deletions src/test/java/edu/ucsd/sbrg/db/bigg/BiGGIdTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import java.util.List;
import java.util.Map;

import edu.ucsd.sbrg.db.bigg.BiGGId;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -148,29 +146,23 @@ private static void prepareGeneProductId(String abbreviation, String id) {
@Test
public final void geneIdsValid() {
List<String> ids = biggIds.get("genes");
ids.forEach(id -> {
BiGGId.createGeneId(id).ifPresent(biggId -> {
assertTrue(BiGGId.isValid(biggId.toBiGGId()));
});
});
ids.forEach(id -> BiGGId.createGeneId(id).ifPresent(biggId -> {
assertTrue(BiGGId.isValid(biggId.toBiGGId()));
}));
}


@Test
public final void metaboliteIdsValid() {
List<String> ids = biggIds.get("metabolites");
ids.forEach(id -> BiGGId.createMetaboliteId(id).ifPresent(biggId -> {
assertTrue(BiGGId.isValid(biggId.toBiGGId()));
}));
ids.forEach(id -> BiGGId.createMetaboliteId(id).ifPresent(biggId -> assertTrue(BiGGId.isValid(biggId.toBiGGId()))));
}


@Test
public final void reactionIdsValid() {
List<String> ids = biggIds.get("reactions");
ids.forEach(id -> BiGGId.createReactionId(id).ifPresent(biggId -> {
assertTrue(BiGGId.isValid(biggId.toBiGGId()));
}));
ids.forEach(id -> BiGGId.createReactionId(id).ifPresent(biggId -> assertTrue(BiGGId.isValid(biggId.toBiGGId()))));
}


Expand Down Expand Up @@ -228,7 +220,4 @@ public final void testToBiGGIdReactions() {
}


@AfterAll
public static void cleanUp() {
}
}
6 changes: 0 additions & 6 deletions src/test/java/edu/ucsd/sbrg/io/SBMLFileUtilsTest.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
package edu.ucsd.sbrg.io;

import org.junit.jupiter.api.Test;

import java.io.File;

import static org.junit.jupiter.api.Assertions.assertEquals;

public class SBMLFileUtilsTest {

// @Test
Expand Down
Loading

0 comments on commit c041d0b

Please sign in to comment.