Skip to content

Commit

Permalink
Merge pull request #22 from BackofenLab/develop
Browse files Browse the repository at this point in the history
v2.0.3
  • Loading branch information
martin-raden authored Feb 10, 2020
2 parents 560ae23 + e8b26bc commit a9251ca
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
hs_err_pid*
/bin
/versions
/gleice
21 changes: 21 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@

version 2.0.3

180927 MR :
* R/mica-functions.R :
* interpolateCurve() :
* bugfix interval length formula

180927 MR :
* controller/MicaR :
* getAlignedX() :
* getAlignedSlope() :
* getConsensusX() :
* getConsensusY() :
+ dedicated exception handling
* view/ViewCsvExpSettings :
* initForm() :
* default height increased to 190 (was 150) to avoid layouting issues
(thanks to Alexander Mattheis, solves PR #21)

version 2.0.2

180212 MR :
* view/View* :
Expand Down
10 changes: 5 additions & 5 deletions R/mica-functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ initMica <- function( micaJavaPath ) {

# check if all-in-one mica.jar available
allInOneJarAvailable = FALSE;
if (sum(file.access(paste(micaJavaPath ,"\\mica.jar",sep=""),4)) == 0 ) {
if (sum(file.access(paste(micaJavaPath, .Platform$file.sep, "mica.jar",sep=""),4)) == 0 ) {
allInOneJarAvailable = TRUE;
}
# check if dependencies are available
depJars = c("commons-lang3-3.4.jar","commons-math3-3.6.1.jar","java-hamcrest-2.0.0.0.jar");
for( depJar in depJars ) {
if (sum(file.access(paste(micaJavaPath,depJar,sep="\\"),4)) != 0 ) stop(paste("given micaJavaPath='",micaJavaPath,"' does not contain needed jar file '",depJar,"'",sep=""));
if (sum(file.access(paste(micaJavaPath,depJar,sep=.Platform$file.sep),4)) != 0 ) stop(paste("given micaJavaPath='",micaJavaPath,"' does not contain needed jar file '",depJar,"'",sep=""));
}

# initialize java interface
Expand All @@ -44,12 +44,12 @@ initMica <- function( micaJavaPath ) {

# extend classpath accordingly
if (allInOneJarAvailable) {
rJava::.jaddClassPath(paste(micaJavaPath ,"\\mica.jar",sep=""));
rJava::.jaddClassPath(paste(micaJavaPath,.Platform$file.sep,"mica.jar",sep=""));
} else {
rJava::.jaddClassPath(micaJavaPath)
}
for( depJar in depJars ) {
rJava::.jaddClassPath(paste(micaJavaPath,depJar,sep="\\"));
rJava::.jaddClassPath(paste(micaJavaPath,depJar,sep=.Platform$file.sep));
}

micaSetup$wasInitialized <<- TRUE;
Expand Down Expand Up @@ -273,7 +273,7 @@ interpolateCurve <- function( x, y, samples ) {
if (length(y)<3) stop("min length of y is 3");

# create x data to be interpolated
xNew <- x[1] + ((x[length(x)-x[1]])*((0:(samples-1))/(samples-1)));
xNew <- x[1] + ((x[length(x)]-x[1])*((0:(samples-1))/(samples-1)));

# create curve object
jCurve <- rJava::.jnew("de/uni_freiburg/bioinf/mica/algorithm/Curve","newCurve", x, y );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public interface MicaController {
/**
* Version information
*/
public static final String version = "2.0.1";
public static final String version = "2.0.3";

/**
* To describe on what basis the distance function is to be computed
Expand Down
29 changes: 19 additions & 10 deletions src/de/uni_freiburg/bioinf/mica/controller/MicaR.java
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,10 @@ public double[] getCurveSlope( int curveIdx ) {

if (isAligned()) {
return originalCurves.get(curveIdx).getCurveOriginal().getSlope();
} else {
// emergency handling
throw new IllegalStateException("no alignment available yet, did you call 'align' yet?");
}
// emergency handling
return new double[0];
}

/**
Expand All @@ -308,9 +309,12 @@ public double[] getAlignedSlope( int curveIdx ) {
return d.getCurve().getSlope();
}
}
// emergency handling
throw new RuntimeException("could not find the aligned data for curve"+String.valueOf(curveIdx));
} else {
// emergency handling
throw new IllegalStateException("no alignment available yet, did you call 'align' yet?");
}
// emergency handling
return new double[0];
}


Expand All @@ -333,9 +337,12 @@ public double[] getAlignedX( int curveIdx ) {
return d.getCurve().getX();
}
}
// emergency handling
throw new RuntimeException("could not find the aligned data for curve"+String.valueOf(curveIdx));
} else {
// emergency handling
throw new IllegalStateException("no alignment available yet, did you call 'align' yet?");
}
// emergency handling
return new double[0];
}

/**
Expand All @@ -353,9 +360,10 @@ public boolean isAligned() {
public double[] getConsensusX() {
if (isAligned()) {
return alignment.consensus.getCurve().getX();
} else {
// emergency handling
throw new IllegalStateException("no alignment available yet, did you call 'align' yet?");
}
// emergency handling
return new double[0];
}

/**
Expand All @@ -365,9 +373,10 @@ public double[] getConsensusX() {
public double[] getConsensusY() {
if (isAligned()) {
return alignment.consensus.getCurve().getY();
} else {
// emergency handling
throw new IllegalStateException("no alignment available yet, did you call 'align' yet?");
}
// emergency handling
return new double[0];
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/de/uni_freiburg/bioinf/mica/view/ViewCsvExpSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@ private void initForm() {

// Set the properties of this frame.
this.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
this.setMinimumSize(new Dimension(400, 150));
this.setMinimumSize(new Dimension(400, 190));
this.setResizable(false);
this.setLocationRelativeTo(null);

// Add listener if the user closes the window with the [x]
Expand Down

0 comments on commit a9251ca

Please sign in to comment.