Opened 15 years ago

Closed 15 years ago

Last modified 15 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 Changed 15 years ago by Nicklas Nordborg

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 Changed 15 years ago by Nicklas Nordborg

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 Changed 15 years ago by Johan Enell

Status: newassigned

comment:4 Changed 15 years ago by Johan Enell

Resolution: fixed
Status: assignedclosed

(In [2731]) fixes #380

comment:5 Changed 15 years ago by Johan Enell

(In [2734]) fixes #380

Note: See TracTickets for help on using tickets.