Changeset 2166


Ignore:
Timestamp:
Dec 9, 2013, 4:08:44 PM (7 years ago)
Author:
olle
Message:

Refs #228. Refs #541. Average normalization updated to untransform logarithmic data before normalization, and then transform it back to logarithmic format before results are stored. Default averaging method will always be set to Formula.AverageMethod.GEOMETRIC_MEAN:

  1. Class/file AverageNormalization.java in src/net/sf/basedb/plugins/ in package net.sf.basedb.normalizers updates:
    a. Private method RequestInformation getConfiguredJobParameters() updated to always set the default averaging method to Formula.AverageMethod.GEOMETRIC_MEAN.
    b. Private method BioAssaySet normalize(DbControl dc, BioAssaySet source, Job job, float refValue, float minIntensity, ProgressReporter progress) updated to call public method double transform(double value) in class IntensityTransform to transform the normalized result back before storing it.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • plugins/base2/net.sf.basedb.normalizers/trunk/src/net/sf/basedb/plugins/AverageNormalization.java

    r2154 r2166  
    347347        parameters.add(getChildDescriptionParameter(null, null, null));
    348348        // Average normalization options       
    349         Formula.AverageMethod defaultAverageMethod = Formula.AverageMethod.ARITHMETIC_MEAN;
    350         IntensityTransform transform = bas.getIntensityTransform();
    351         if (transform == IntensityTransform.NONE)
    352         {
    353           defaultAverageMethod = Formula.AverageMethod.GEOMETRIC_MEAN;
    354         }
     349        // Default is always set to geometric mean, since averaging is performed on untransformed data
     350        Formula.AverageMethod defaultAverageMethod = Formula.AverageMethod.GEOMETRIC_MEAN;
    355351        StringParameterType spt = new StringParameterType
    356352        (
     
    399395    long numSpots;
    400396    long normalizedSpots = 0;
     397    IntensityTransform transform = source.getIntensityTransform();
    401398   
    402399    // Create Transformation
     
    489486        {
    490487          d.setNormalizableData(scaleFactor * d.getNormalizableData());
    491           batcher.insert(bioassayColumn, d.getPosition(), d.getChannelData());
     488          // Average is calculated for untransformed data, transform channel data before storing
     489          float[] channelDataArr = d.getChannelData();
     490          float[] transformedChannelDataArr = new float[channelDataArr.length];
     491          for (int i=0; i < channelDataArr.length; i++)
     492          {
     493            // d1 = untransormed value, d2 = transformed value (0 if d1 is out of range)
     494            float d1 = channelDataArr[i];
     495            float d2 = 0F;
     496            if (!Float.isNaN(d1) && !Float.isInfinite(d1))
     497            {
     498              d2 = (float) transform.transform(d1);
     499            }
     500            transformedChannelDataArr[i] = d2;
     501          }
     502          batcher.insert(bioassayColumn, d.getPosition(), transformedChannelDataArr);
    492503          normalizedSpots++;
    493504        }
     505        child.setIntensityTransform(transform);       
    494506        if (progress != null)
    495507          progress.display((int)((100L * normalizedSpots) / numSpots),
Note: See TracChangeset for help on using the changeset viewer.