Changeset 4916


Ignore:
Timestamp:
Apr 30, 2009, 11:32:26 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

Fixes for spot data listings and experiment explorer.

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/clients/web/net/sf/basedb/clients/web/DynamicUtil.java

    r4889 r4916  
    3030import net.sf.basedb.core.Formula;
    3131import net.sf.basedb.core.Include;
     32import net.sf.basedb.core.IntensityTransform;
    3233import net.sf.basedb.core.ItemContext;
    3334import net.sf.basedb.core.ItemQuery;
     
    6566{
    6667
    67   public static void addSpotColumns(List<TableColumn> columns, DbControl dc, int channels)
    68   {
     68  public static void addSpotColumns(List<TableColumn> columns, DbControl dc,
     69    int channels, IntensityTransform transform)
     70  {
     71    if (transform == null) transform = IntensityTransform.NONE;
    6972    SessionControl sc = dc.getSessionControl();
    7073    Formatter<Number> numberFormatter = FormatterFactory.getNumberFormatter(sc);
     
    7376      "Position", "Spot position", "always", true, true, true,
    7477      Formula.AverageMethod.NONE, intFormatter));
     78    Formula.AverageMethod avgMethod = transform.getAverageMethod();
     79    String transformed = transform.isTransformed() ? "; " + transform.toString() : "";
    7580    for (int channel = 1; channel <= channels; ++channel)
    7681    {
    77       TableColumn tc = new TableColumn("ch"+channel, "%"+channel, "ch("+channel+")",
    78         Type.FLOAT, "Ch "+channel, "Channel " + channel + " intensity", "auto", true, true, true,
    79         Formula.AverageMethod.ARITHMETIC_MEAN, numberFormatter);
     82      TableColumn tc = new TableColumn("ch"+channel, "%"+channel, "rawCh("+channel+")",
     83        Type.FLOAT, "Ch "+channel, "Channel " + channel + " intensity" + transformed,
     84        "auto", true, true, true,
     85        avgMethod, numberFormatter);
    8086      columns.add(tc);
    8187    }
  • trunk/src/clients/web/net/sf/basedb/clients/web/ExperimentExplorer.java

    r4829 r4916  
    5050import net.sf.basedb.core.DynamicResultIterator;
    5151import net.sf.basedb.core.DynamicSpotQuery;
     52import net.sf.basedb.core.Formula;
    5253import net.sf.basedb.core.Include;
    5354import net.sf.basedb.core.Item;
     
    766767   
    767768    // Select channel intensities
     769    Formula.AverageMethod avgMethod = bioAssaySet.getIntensityTransform().getAverageMethod();
    768770    for (int ch = 1; ch <= channels; ++ch)
    769771    {
    770       Expression select = Dynamic.column(VirtualColumn.channel(ch));
     772      Expression select = Dynamic.column(VirtualColumn.channelRaw(ch));
    771773      if (positionIndex == SPOT_AVG)
    772774      {
    773         select = Aggregations.mean(select);
     775        select = avgMethod.getAverageExpression(select);
    774776      }
    775777      spotQuery.select(Selects.expression(select, "ch" + ch));
  • trunk/src/core/net/sf/basedb/core/IntensityTransform.java

    r4913 r4916  
    180180  /**
    181181    Does this intensity transformation represents a transformation that
    182     has modified the spot intensity values or not.
     182    has modified the spot intensity values or not?
    183183    @return TRUE if the intensity values are transformed, FALSE if they
    184184      are not
  • trunk/www/common/expression_builder.jsp

    r4912 r4916  
    7070
    7171    List<TableColumn> spotProperties = new LinkedList<TableColumn>();
    72     DynamicUtil.addSpotColumns(spotProperties, dc, channels);
     72    DynamicUtil.addSpotColumns(spotProperties, dc, channels, null);
    7373    List<TableColumn> rawProperties = new LinkedList<TableColumn>();
    7474    if (rawDataType != null)
  • trunk/www/views/experiments/explorer/view/view.jsp

    r4808 r4916  
    4242  import="net.sf.basedb.core.Annotation"
    4343  import="net.sf.basedb.core.Formula"
     44  import="net.sf.basedb.core.IntensityTransform"
    4445  import="net.sf.basedb.core.ItemQuery"
    4546  import="net.sf.basedb.core.ItemResultList"
     
    105106  final boolean hasRatio = channels == 2;
    106107  final int maxRawMappings = bioAssaySet.getMaxRawMappingsForSpot();
     108  final IntensityTransform transform = bioAssaySet.getIntensityTransform();
    107109 
    108110  final ExperimentExplorer explorer = ExperimentExplorer.getExplorer(bioAssaySet);
     
    173175  }
    174176  %>
    175 
    176177  <base:page title="<%=title%>">
    177178  <base:head scripts="table.js,tabcontrol.js" styles="table.css,headertabcontrol.css,path.css,explorer.css">
     
    600601          property="<%="%"+ch%>"
    601602          datatype="float"
    602           title="<%="Ch " + ch %>"
     603          title="<%="Ch " + ch%>"
     604          tooltip="<%=transform.isTransformed() ? transform.toString() : null %>"
    603605          sortable="true"
    604606          filterable="true"
     
    656658              if (hasRatio)
    657659              {
    658                 float logRatio = (float)Math.log(item.getFloat(3) / item.getFloat(4));
     660                float logRatio = (float)(Math.log(transform.unTransform(item.getFloat(3)) / transform.unTransform(item.getFloat(4))));
    659661                annotationGroup.addStatistics("logratio", logRatio);
    660662                annotationGroup.addStatistics("logratio2", logRatio * logRatio);
    661               }             %>
     663              }
     664              %>
    662665              <tbl:cell column="annotation" style="<%="background: "+annotationGroup.getColor()+";"%>">
    663666              <%=allValues%>
     
    673676            {
    674677              float intensity = item.getFloat(2+ch);
    675               if (annotationGroup != null) annotationGroup.addValue(ch, intensity);
     678              if (annotationGroup != null)
     679              {
     680                annotationGroup.addValue(ch, (float)transform.unTransform(intensity));
     681              }
    676682              %>
    677683              <tbl:cell column="<%="ch" + ch%>" value="<%=intensity%>" />
  • trunk/www/views/experiments/plotter/index.jsp

    r4511 r4916  
    3232  import="net.sf.basedb.core.RawDataProperty"
    3333  import="net.sf.basedb.core.Formula"
     34  import="net.sf.basedb.core.IntensityTransform"
    3435  import="net.sf.basedb.core.AnnotationType"
    3536  import="net.sf.basedb.core.ItemQuery"
     
    7778  Experiment experiment = bas.getExperiment();
    7879  int maxRawMappings = bas.getMaxRawMappingsForSpot();
     80  IntensityTransform transform = bas.getIntensityTransform();
    7981 
    8082  List<TableColumn> formulas = new LinkedList<TableColumn>();
    81   DynamicUtil.addSpotColumns(formulas, dc, rdt.getChannels());
     83  DynamicUtil.addSpotColumns(formulas, dc, rdt.getChannels(), transform);
    8284  DynamicUtil.addFormulaColumns(formulas, dc, rdt, Formula.Type.COLUMN_EXPRESSION, "", "", maxRawMappings == 1);
    8385  DynamicUtil.addExtraColumns(formulas, dc, bas, "ev", "#", "[Xtra] ");
     
    131133 
    132134  final boolean hasCreateFilePermission = sc.hasPermission(Permission.CREATE, Item.FILE);
    133  
    134135  %>
    135136  <base:page type="popup" title="<%=title%>">
  • trunk/www/views/experiments/spotdata/list_spotdata.jsp

    r4908 r4916  
    4040  import="net.sf.basedb.core.PluginDefinition"
    4141  import="net.sf.basedb.core.Formula"
     42  import="net.sf.basedb.core.IntensityTransform"
    4243  import="net.sf.basedb.core.plugin.GuiContext"
    4344  import="net.sf.basedb.core.plugin.Plugin"
     
    9596  final int experimentId = experiment.getId();
    9697  final RawDataType rawDataType = bioAssaySet.getRawDataType();
     98  final IntensityTransform transform = bioAssaySet.getIntensityTransform();
    9799 
    98100  final String subContext = rawDataType.getId();
     
    101103 
    102104  List<TableColumn> columns = new LinkedList<TableColumn>();
    103   DynamicUtil.addSpotColumns(columns, dc, rawDataType.getChannels());
     105  DynamicUtil.addSpotColumns(columns, dc, rawDataType.getChannels(), transform);
    104106  DynamicUtil.addFormulaColumns(columns, dc, rawDataType, Formula.Type.COLUMN_EXPRESSION, "frm.", "", true);
    105107  DynamicUtil.addExtraColumns(columns, dc, bioAssaySet, "ev", "#", "[Xtra] ");
     
    268270          id="<%=tc.getId()%>"
    269271          property="<%=tc.getProperty()%>"
     272          tooltip="<%=tc.getDescription()%>"
    270273          datatype="<%=tc.getDatatype().getStringValue()%>"
    271274          title="<%=HTML.encodeTags(tc.getTitle())%>"
Note: See TracChangeset for help on using the changeset viewer.