Skip to content

Commit 7c88e10

Browse files
committed
throw error when a factorvalue is missing; should make condition more obvious to curators
1 parent 53ef614 commit 7c88e10

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

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
}

0 commit comments

Comments
 (0)