Opened 18 years ago

Closed 18 years ago

Last modified 18 years ago

#380 closed defect (fixed)

Bug in Lowess

Reported by: David Waring <dwaring@…> Owned by: Johan Enell
Priority: critical Milestone: BASE 2.0.2
Component: coreplugins Version: 2.0
Keywords: Cc:

Description

There is a bug in the Lowess plugin. Looping through the blocks misses the last block, in cases where (maxblock % blockGroupSize == 0) which is of course all cases where blockGroupSize is 1.

the loop statement is

          for (int i = 0; i < maxBlock; i += blockGroupSize)

           {

             Restriction blockRestriction = Restrictions.between
             (
               Expressions.selected(Dynamic.selectRawData("block")),
               Expressions.integer(i),
               Expressions.integer(i+blockGroupSize)
             );

the Between expression is converted to (i<=block AND block < i +blockGroupSize) Note the lack of inclusivity on the end

if there is one block (like Agilent) nothing is ever captured in this loop if there are 10 blocks and a block size of 5 it does 0-4 and 5-9

Since as far as I know blocks are always number 1... (never 0) the following should work

 for (int i = 1; i <= maxBlock; i += blockGroupSize)

Change History (5)

comment:1 by Nicklas Nordborg, 18 years ago

I think it is possible that there are blocks with a block number of 0. This means that we should select both maxBlock and minBlock in the query and then iterate as:

query.select(Selects.expression(Aggregations.max(Dynamic.rawData("block")), "max"));
query.select(Selects.expression(Aggregations.min(Dynamic.rawData("block")), "min"));
...
for (int i = minBlock; i <= maxBlock; i += blockGroupSize)

comment:2 by Nicklas Nordborg, 18 years ago

I just noticed that the MedianRatioNormalization plugin has a similar loop as in the Lowess plugin. It should probably be changed there as well.

comment:3 by Johan Enell, 18 years ago

Status: newassigned

comment:4 by Johan Enell, 18 years ago

Resolution: fixed
Status: assignedclosed

(In [2731]) fixes #380

comment:5 by Johan Enell, 18 years ago

(In [2734]) fixes #380

Note: See TracTickets for help on using tickets.