Skip to content

Commit 1fce096

Browse files
committed
Merge branch 'hotfix-1.1.20'
2 parents a825e3e + 6d84f12 commit 1fce096

6 files changed

Lines changed: 53 additions & 18 deletions

File tree

pom.xml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<name>baseCode</name>
66
<groupId>baseCode</groupId>
77
<artifactId>baseCode</artifactId>
8-
<version>1.1.19</version>
8+
<version>1.1.20</version>
99
<inceptionYear>2003</inceptionYear>
1010
<description>
1111
<![CDATA[Data structures, math and statistics tools, and utilities that are often needed across projects.]]>
@@ -49,7 +49,7 @@
4949
<dependency>
5050
<groupId>org.apache.poi</groupId>
5151
<artifactId>poi</artifactId>
52-
<version>5.2.3</version>
52+
<version>5.2.5</version>
5353
</dependency>
5454
<dependency>
5555
<groupId>colt</groupId>
@@ -61,7 +61,7 @@
6161
<dependency>
6262
<groupId>commons-net</groupId>
6363
<artifactId>commons-net</artifactId>
64-
<version>3.9.0</version>
64+
<version>3.10.0</version>
6565
</dependency>
6666
<dependency>
6767
<groupId>org.apache.commons</groupId>
@@ -76,12 +76,12 @@
7676
<dependency>
7777
<groupId>org.apache.commons</groupId>
7878
<artifactId>commons-lang3</artifactId>
79-
<version>3.13.0</version>
79+
<version>3.14.0</version>
8080
</dependency>
8181
<dependency>
8282
<groupId>commons-io</groupId>
8383
<artifactId>commons-io</artifactId>
84-
<version>2.13.0</version>
84+
<version>2.15.1</version>
8585
</dependency>
8686
<dependency>
8787
<groupId>org.apache.commons</groupId>
@@ -228,7 +228,7 @@
228228
<dependency>
229229
<groupId>com.opencsv</groupId>
230230
<artifactId>opencsv</artifactId>
231-
<version>5.8</version>
231+
<version>5.9</version>
232232
<exclusions>
233233
<exclusion>
234234
<groupId>commons-beanutils</groupId>
@@ -267,13 +267,13 @@
267267
<dependency>
268268
<groupId>org.apache.logging.log4j</groupId>
269269
<artifactId>log4j-core</artifactId>
270-
<version>2.19.0</version>
270+
<version>2.21.1</version>
271271
<scope>test</scope>
272272
</dependency>
273273
<dependency>
274274
<groupId>org.apache.logging.log4j</groupId>
275275
<artifactId>log4j-slf4j-impl</artifactId>
276-
<version>2.19.0</version>
276+
<version>2.21.1</version>
277277
<scope>test</scope>
278278
</dependency>
279279
</dependencies>

src/ubic/basecode/math/linearmodels/DesignMatrix.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,9 +569,17 @@ private DoubleMatrix<String, String> buildDesign( int columnNum, List<?> factorV
569569
String contrastingValue = "";
570570
assert tmp != null;
571571
for ( int j = 0; j < tmp.rows(); j++ ) {
572-
boolean isBaseline = !factorValues.get( j ).equals( level );
572+
Object fv = factorValues.get(j);
573+
574+
if (fv == null) {
575+
// This happens if a factorvalue is not assigned somehwere, as in a DEExclude situation.
576+
// In Gemma we can reach this during batch correction.
577+
throw new IllegalArgumentException("Null value for factor " + factorName + " at row " + j);
578+
}
579+
580+
boolean isBaseline = !fv.equals( level );
573581
if ( !isBaseline ) {
574-
contrastingValue = ( String ) factorValues.get( j );
582+
contrastingValue = ( String ) fv;
575583
}
576584
tmp.set( j, currentColumn, isBaseline ? 0.0 : 1.0 );
577585
}

src/ubic/basecode/ontology/jena/AbstractOntologyResource.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,6 @@ public String getLabel() {
6565
if ( label == null ) {
6666
label = res.getLabel( null );
6767
}
68-
if ( label == null ) {
69-
label = res.getLocalName();
70-
}
71-
if ( label == null ) {
72-
label = res.getURI();
73-
}
7468
return label;
7569
}
7670

@@ -113,6 +107,12 @@ public int hashCode() {
113107
@Override
114108
public String toString() {
115109
String s = getLabel();
110+
if ( s == null ) {
111+
s = res.getLocalName();
112+
}
113+
if ( s == null ) {
114+
s = res.getURI();
115+
}
116116
if ( s == null ) {
117117
s = res.toString();
118118
}

src/ubic/basecode/ontology/jena/JenaUtils.java

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package ubic.basecode.ontology.jena;
22

3+
import com.hp.hpl.jena.ontology.ConversionException;
34
import com.hp.hpl.jena.ontology.OntClass;
45
import com.hp.hpl.jena.ontology.OntModel;
56
import com.hp.hpl.jena.ontology.Restriction;
@@ -42,7 +43,15 @@ private static Collection<OntClass> getParentsInternal( OntModel model, Collecti
4243
ontClasses = ontClasses.stream()
4344
.map( t -> t.inModel( model ) )
4445
.filter( t -> t.canAs( OntClass.class ) )
45-
.map( t -> t.as( OntClass.class ) )
46+
.map( t -> {
47+
try {
48+
return t.as( OntClass.class );
49+
} catch ( ConversionException e ) {
50+
log.error( "Conversion failed for " + t, e );
51+
return null;
52+
}
53+
} )
54+
.filter( Objects::nonNull )
4655
.collect( Collectors.toList() );
4756
if ( ontClasses.isEmpty() ) {
4857
return Collections.emptySet();
@@ -104,7 +113,15 @@ public static Collection<OntClass> getChildrenInternal( OntModel model, Collecti
104113
terms = terms.stream()
105114
.map( t -> t.inModel( model ) )
106115
.filter( t -> t.canAs( OntClass.class ) )
107-
.map( t -> t.as( OntClass.class ) )
116+
.map( t -> {
117+
try {
118+
return t.as( OntClass.class );
119+
} catch ( ConversionException e ) {
120+
log.error( "Conversion failed for " + t, e );
121+
return null;
122+
}
123+
} )
124+
.filter( Objects::nonNull )
108125
.collect( Collectors.toList() );
109126
if ( terms.isEmpty() ) {
110127
return Collections.emptySet();

src/ubic/basecode/ontology/model/OntologyResource.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,13 @@ public interface OntologyResource extends Comparable<OntologyResource> {
2828
/**
2929
* A label, if known, otherwise null.
3030
*/
31+
@Nullable
3132
String getLabel();
3233

3334
/**
3435
* A URI if known, otherwise null.
3536
*/
37+
@Nullable
3638
String getUri();
3739

3840
/**

test/ubic/basecode/math/TestStats.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,14 @@ public final void testNumberOfDistinctValues() {
146146
actualReturn = Stats.numberofDistinctValues( new DoubleArrayList( new double[] { 1.0, 1.0, 3.0, 4.0, 4.00001,
147147
5.0, 6.0 } ), 0.00001 );
148148
assertEquals( 6, actualReturn );
149+
150+
double[] rowAsList = new double[]{8.6154, 8.0668, 8.3417, 6.4633, 9.2136, 8.5676, 7.2155, 7.1609, 8.4329, 8.7668, 8.2165, 7.237, 9.3366,
151+
6.8416, 8.2402, 7.4053, 6.8839, 7.5707, 6.9576, -2.0648, -2.0648, 0.0407, -2.0648, -2.0648, -2.0648, -2.0648, -2.0648, -2.0648,
152+
-2.0648, -2.0648, -2.0648, -2.0648, -2.0648, -2.0648, -2.0648, -2.0648, -2.0648, -2.0648};
153+
Double r = Stats.fractionDistinctValuesNonNA(new DoubleArrayList(rowAsList), 0.001);
154+
155+
assertEquals(0.552, r, 0.01);
156+
149157
}
150158

151159

0 commit comments

Comments
 (0)