Changeset 4915


Ignore:
Timestamp:
Apr 30, 2009, 9:20:07 AM (13 years ago)
Author:
Nicklas Nordborg
Message:

References #1120: The dynamic part of BASE should keep track whether intensity data is in log space or not

Additional changes in the core and test program fixes.

Location:
trunk/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/net/sf/basedb/core/BioAssaySet.java

    r4912 r4915  
    11461146   [ AND flt.filter = <filter_no> ]
    11471147</pre>
    1148 
     1148    <p>
     1149    Note! If the bioassay set contains transformed intensities, the
     1150    default selection will un-transform the values.
     1151   
    11491152    @return A <code>DynamicSpotQuery</code> object
    11501153  */
  • trunk/src/core/net/sf/basedb/core/DynamicSpotQuery.java

    r4912 r4915  
    8383      for (int i = 1; i <= channels; ++i)
    8484      {
    85         defaultSelects[i+1] = Dynamic.select(VirtualColumn.channel(i));
     85        defaultSelects[i+1] = Dynamic.select(VirtualColumn.channelIntensity(i));
    8686      }
    8787    }
  • trunk/src/core/net/sf/basedb/core/PropertyFilter.java

    r4889 r4915  
    770770      {
    771771        int channel = Integer.parseInt(value.substring(2));
    772         parameter = Dynamic.column(VirtualColumn.channel(channel));
     772        parameter = Dynamic.column(VirtualColumn.channelRaw(channel));
    773773      }
    774774      else if (getOperator().isListOperator())
     
    784784              parameters = new ArrayList<Expression>();
    785785            }
    786             parameters.add(Dynamic.column(VirtualColumn.channel(channel)));
     786            parameters.add(Dynamic.column(VirtualColumn.channelRaw(channel)));
    787787          }
    788788        }
  • trunk/src/core/net/sf/basedb/core/VirtualTable.java

    r4889 r4915  
    7171      for (int i = 0; i < rdt.getChannels(); ++i)
    7272      {
    73         allColumns[i+columns.length] = VirtualColumn.channel(i+1);
     73        allColumns[i+columns.length] = VirtualColumn.channelRaw(i+1);
    7474      }
    7575      return allColumns;
  • trunk/src/core/net/sf/basedb/util/IntensityCalculatorUtil.java

    r4889 r4915  
    223223      for (int i = 0; i < intensities.length; ++i)
    224224      {
    225         query.select(Selects.expression(intensities[i], VirtualColumn.channel(i).getName()));
     225        query.select(Selects.expression(intensities[i], "ch" + i));
    226226      }
    227227      spotBatcher.insert(query);
  • trunk/src/test/TestExperiment.java

    r4889 r4915  
    2323*/
    2424import net.sf.basedb.core.*;
    25 import net.sf.basedb.core.query.Aggregations;
    2625import net.sf.basedb.core.query.Restrictions;
    2726import net.sf.basedb.core.query.Expressions;
     
    813812      for (int ch = 1; ch <= numChannels; ++ch)
    814813      {
    815         query.select(Dynamic.select(VirtualColumn.channel(ch)));
     814        query.select(Dynamic.select(VirtualColumn.channelRaw(ch)));
    816815      }
    817816      DynamicResultIterator it = query.iterate(dc);
     
    872871      BioAssaySet bas = t.newProduct(null, "new", true);
    873872      bas.setName("Second bioassayset");
     873      bas.setIntensityTransform(source.getIntensityTransform());
    874874      dc.saveItem(bas);
    875875
     
    883883        Selects.expression(
    884884          Expressions.multiply(
    885             Dynamic.column(VirtualColumn.channel(1)),
     885            Dynamic.column(VirtualColumn.channelRaw(1)),
    886886            Expressions.integer(2)
    887887          ),
     
    892892        Selects.expression(
    893893          Expressions.multiply(
    894             Dynamic.column(VirtualColumn.channel(2)),
     894            Dynamic.column(VirtualColumn.channelRaw(2)),
    895895            Expressions.integer(4)
    896896          ),
     
    951951      BioAssaySet bas = t.newProduct(null, null, true);
    952952      bas.setName("Filtered bioassayset");
     953      bas.setIntensityTransform(source.getIntensityTransform());
    953954      dc.saveItem(bas);
    954955
     
    958959      query.restrict(
    959960        Restrictions.gt(
    960           Dynamic.column(VirtualColumn.channel(1)),
     961          Dynamic.column(VirtualColumn.channelRaw(1)),
    961962          Expressions.multiply(
    962963            Expressions.parameter("factor"),
    963             Dynamic.column(VirtualColumn.channel(2))
     964            Dynamic.column(VirtualColumn.channelRaw(2))
    964965          )
    965966        )
     
    10451046      int column = spots.getIndex(VirtualColumn.COLUMN.getName());
    10461047      int position = spots.getIndex(VirtualColumn.POSITION.getName());
    1047       int ch1 = spots.getIndex(VirtualColumn.channel(1).getName());
    1048       int ch2 = spots.getIndex(VirtualColumn.channel(2).getName());
     1048      int ch1 = spots.getIndex(VirtualColumn.channelIntensity(1).getName());
     1049      int ch2 = spots.getIndex(VirtualColumn.channelIntensity(2).getName());
    10491050      int numSpots = 0;
    10501051      while (spots.hasNext())
     
    11081109      BioAssaySet bas = t.newProduct(null, null, true);
    11091110      bas.setName("Extra position values bioassayset");
     1111      IntensityTransform transform = source.getIntensityTransform();
     1112      bas.setIntensityTransform(transform);
    11101113      dc.saveItem(bas);
    11111114     
     
    11291132      }
    11301133
    1131       Expression avgCh1 = Aggregations.mean(Dynamic.column(VirtualColumn.channel(1)));
    1132       Expression avgCh2 = Aggregations.mean(Dynamic.column(VirtualColumn.channel(2)));
     1134      Formula.AverageMethod avgMethod = transform.getAverageMethod();
     1135      Expression avgCh1 = avgMethod.getAverageExpression(Dynamic.column(VirtualColumn.channelRaw(1)));
     1136      Expression avgCh2 = avgMethod.getAverageExpression(Dynamic.column(VirtualColumn.channelRaw(2)));
    11331137      Expression product = Expressions.multiply(avgCh1, avgCh2);
    11341138      DynamicSpotQuery query = source.getSpotData();
     
    13001304      query.select(Dynamic.select(VirtualColumn.COLUMN));
    13011305      query.select(Dynamic.select(VirtualColumn.POSITION));
    1302       query.select(Dynamic.select(VirtualColumn.channel(1)));
    1303       query.select(Dynamic.select(VirtualColumn.channel(2)));
     1306      query.select(Dynamic.select(VirtualColumn.channelRaw(1)));
     1307      query.select(Dynamic.select(VirtualColumn.channelRaw(2)));
    13041308      query.select(Dynamic.selectReporter("externalId"));
    13051309      query.select(Dynamic.selectRawData("x"));
     
    13231327      int column = spots.getIndex(VirtualColumn.COLUMN.getName());
    13241328      int position = spots.getIndex(VirtualColumn.POSITION.getName());
    1325       int ch1 = spots.getIndex(VirtualColumn.channel(1).getName());
    1326       int ch2 = spots.getIndex(VirtualColumn.channel(2).getName());
     1329      int ch1 = spots.getIndex(VirtualColumn.channelRaw(1).getName());
     1330      int ch2 = spots.getIndex(VirtualColumn.channelRaw(2).getName());
    13271331      int reporter = spots.getIndex("externalId");
    13281332      int x = spots.getIndex("x");
  • trunk/src/test/net/sf/basedb/test/merge/MergeTest.java

    r4514 r4915  
    4242import net.sf.basedb.core.FeatureIdentificationMethod;
    4343import net.sf.basedb.core.Formula;
     44import net.sf.basedb.core.IntensityTransform;
    4445import net.sf.basedb.core.ItemParameterType;
    4546import net.sf.basedb.core.Job;
     
    6263import net.sf.basedb.core.data.RawData;
    6364import net.sf.basedb.core.data.ReporterData;
    64 import net.sf.basedb.core.query.Aggregations;
    6565import net.sf.basedb.core.query.Dynamic;
    6666import net.sf.basedb.core.query.Expressions;
     
    331331    BioAssaySet child = t.newProduct("new", "new", false);
    332332    child.setName("Merged on reporter");
     333    IntensityTransform transform = root.getIntensityTransform();
     334    child.setIntensityTransform(transform);
    333335    dc.saveItem(child);
    334336   
     
    361363   
    362364    // Merge on reporter
     365    Formula.AverageMethod avgMethod = transform.getAverageMethod();
    363366    SpotBatcher spotBatcher = child.getSpotBatcher();
    364367    DynamicSpotQuery spotQuery = root.getSpotData();
     
    366369    spotQuery.select(Dynamic.select(VirtualTable.POSITION, VirtualColumn.REPORTER_ID));
    367370    spotQuery.select(Selects.expression(
    368       Aggregations.mean(Dynamic.column(VirtualColumn.channel(1))), "ch1"));
     371      avgMethod.getAverageExpression(Dynamic.column(VirtualColumn.channelRaw(1))), "ch1"));
    369372    spotQuery.select(Selects.expression(
    370       Aggregations.mean(Dynamic.column(VirtualColumn.channel(2))), "ch2"));
     373      avgMethod.getAverageExpression(Dynamic.column(VirtualColumn.channelRaw(2))), "ch2"));
    371374    spotQuery.group(Dynamic.column(VirtualColumn.COLUMN));
    372375    spotQuery.group(Dynamic.column(VirtualTable.POSITION, VirtualColumn.REPORTER_ID));
     
    422425    BioAssaySet child = t.newProduct("new", "new", false);
    423426    child.setName("Merged on bioassay");
     427    IntensityTransform transform = root.getIntensityTransform();
     428    child.setIntensityTransform(transform);
    424429    dc.saveItem(child);
    425430   
     
    438443   
    439444    // Merge on bioassay
     445    Formula.AverageMethod avgMethod = transform.getAverageMethod();
    440446    SpotBatcher spotBatcher = child.getSpotBatcher();
    441447    DynamicSpotQuery spotQuery = root.getSpotData();
     
    443449    spotQuery.select(Dynamic.select(VirtualColumn.POSITION));
    444450    spotQuery.select(Selects.expression(
    445       Aggregations.mean(Dynamic.column(VirtualColumn.channel(1))), "ch1"));
     451      avgMethod.getAverageExpression(Dynamic.column(VirtualColumn.channelRaw(1))), "ch1"));
    446452    spotQuery.select(Selects.expression(
    447       Aggregations.mean(Dynamic.column(VirtualColumn.channel(2))), "ch2"));
     453      avgMethod.getAverageExpression(Dynamic.column(VirtualColumn.channelRaw(2))), "ch2"));
    448454    spotQuery.group(Dynamic.column(VirtualColumn.POSITION));
    449455    spotBatcher.insert(spotQuery);
Note: See TracChangeset for help on using the changeset viewer.