Changeset 1133


Ignore:
Timestamp:
Jun 18, 2009, 3:56:37 PM (12 years ago)
Author:
Martin Svensson
Message:

References #180 Created classes for the control summary plots.

Location:
plugins/base2/net.sf.basedb.illumina/trunk
Files:
3 added
2 edited

Legend:

Unmodified
Added
Removed
  • plugins/base2/net.sf.basedb.illumina/trunk/META-INF/extensions.xml

    r1097 r1133  
    2626<extensions xmlns="http://base.thep.lu.se/extensions.xsd">
    2727  <extension
    28     id="net.sf.basedb.illumina.extensions.overviewplots.plot"
     28    id="net.sf.basedb.illumina.extensions.overviewplots.illuminaPlots"
    2929    extends="net.sf.basedb.clients.web.bioassayset.overviewplots"
    3030    >
     
    3939        <width>400</width>
    4040        <height>300</height>
    41 <!--        <plotServlet>/views/experiments/plotter/plot</plotServlet>-->
     41        <plotServlet>/views/experiments/plotter/illuminaPlot</plotServlet>
    4242      </parameters>
    4343    </action-factory>
  • plugins/base2/net.sf.basedb.illumina/trunk/src/net/sf/basedb/illumina/extensions/plot/PlotFactory.java

    r1097 r1133  
    2424
    2525import net.sf.basedb.clients.web.extensions.AbstractJspActionFactory;
     26import net.sf.basedb.clients.web.extensions.ExtensionsControl;
    2627import net.sf.basedb.clients.web.extensions.plot.OverviewPlotAction;
    2728import net.sf.basedb.clients.web.extensions.plot.OverviewPlotBean;
    2829import net.sf.basedb.clients.web.extensions.plot.PlotGenerator;
    2930import net.sf.basedb.clients.web.extensions.plot.PlotGeneratorBean;
     31import net.sf.basedb.clients.web.servlet.PlotServlet;
    3032import net.sf.basedb.clients.web.util.HTML;
    31 import net.sf.basedb.core.BioAssay;
    3233import net.sf.basedb.core.BioAssaySet;
    33 import net.sf.basedb.core.DbControl;
    34 
    3534import net.sf.basedb.util.Values;
    3635import net.sf.basedb.util.extensions.InvokationContext;
     
    3837import net.sf.basedb.util.extensions.xml.VariableSetter;
    3938
     39import java.util.ArrayList;
    4040import java.util.List;
    4141
     
    5858{
    5959
    60   private String servletPath = "../plotter/plot";
     60  private String servletPath = ExtensionsControl.getHomeUrl("net.sf.basedb.illumina.extensions.overviewplots.illuminaPlots") + "/illuminaplot";
    6161  private int width = 400;
    6262  private int height = 300;
     
    7676  @VariableSetter
    7777  @PathSetter
    78   public void setPlotServler(String servletPath)
     78  public void setPlotServlet(String servletPath)
    7979  {
    8080    this.servletPath = servletPath;
     
    9090    this.height = Values.getInt(height, 300);
    9191  }
    92  
    93   /*
    94      TODO
    95      How to plot the data is not yet specified.
    96    */
    97  
     92
    9893  @Override
    9994  public OverviewPlotAction[] getActions(
     
    10297    // Get context information
    10398    String ID = context.getClientContext().getSessionControl().getId();
    104     DbControl dc = context.getClientContext().getDbControl();
     99    //DbControl dc = context.getClientContext().getDbControl();
    105100    BioAssaySet source = (BioAssaySet)context.getClientContext().getCurrentItem();
    106 //    boolean hasCfPlot = source.getTransformation().getSource() != null;
    107     List<BioAssay> bioAssays = source.getBioAssays().list(dc);
    108 //    OverviewPlotAction[] actions = new OverviewPlotAction[hasCfPlot ? 2 : 1];
    109101    OverviewPlotAction[] actions = new OverviewPlotAction[1];
    110102   
    111     // ? plot
    112     OverviewPlotBean maBean = new OverviewPlotBean();
    113     maBean.setTitle("MA plots");
    114     maBean.setDescription("MA plots for each bioassay in this bioassay set");
    115     maBean.setId("maplots");
    116 //    String M = HTML.urlEncode("log2(ch(1) / ch(2))");
    117 //    String A = HTML.urlEncode("log(ch(1) * ch(2)) / 2");
     103    // Control summary (perfect match) plot
     104    OverviewPlotBean overviewBean = new OverviewPlotBean();   
     105    overviewBean.setTitle("Control summary plots");
     106    overviewBean.setDescription("Control summary plots for this bioassay set.");
     107    overviewBean.setId("illuminaplots");
    118108   
    119     // TODO Change to a more useful plot function.
    120     String M = HTML.urlEncode("log2(ch(1))");
    121     String A = HTML.urlEncode("log(ch(1))");
    122     String maFilter = HTML.urlEncode("ch(1) > 0");
    123     PlotGenerator[] maGenerators = new PlotGenerator[bioAssays.size()];
    124     maBean.setPlotGenerators(maGenerators);
    125     actions[0] = maBean;
     109    List<String>  filters = new ArrayList<String>(2);
     110    filters.add(HTML.urlEncode("raw(mean)"));
     111    filters.add(HTML.urlEncode("raw(mean)"));
    126112   
    127     // Correction factor plot
    128 //    PlotGenerator[] cfGenerators = null;
    129 //    if (hasCfPlot)
    130 //    {
    131 //      OverviewPlotBean cfBean = new OverviewPlotBean();
    132 //      cfBean.setTitle("Correction factor plots");
    133 //      cfBean.setDescription("MA-plot of the parent bioassays together " +
    134 //          "with a correction factor for each spot in the current bioassayset.");
    135 //      cfBean.setId("cfplots");
    136 //      cfGenerators = new PlotGenerator[bioAssays.size()];
    137 //      cfBean.setPlotGenerators(cfGenerators);
    138 //      actions[1] = cfBean;
    139 //    }
     113    List<String> series = new ArrayList<String> (2);
     114    series.add(HTML.urlEncode("Perfect match"));
     115    series.add(HTML.urlEncode("House keeping"));
    140116   
     117    String columnFormula = HTML.urlEncode("ch(1)");
     118
     119    PlotGenerator[] plotGenerators = new PlotGenerator[1];
     120    overviewBean.setPlotGenerators(plotGenerators);
     121
     122    actions[0] = overviewBean;   
     123       
    141124    // Generate plot url:s for each bioassay
    142     String xLabel = HTML.urlEncode("X, log2(ch(1))"); //TODO
    143     String yLabel = HTML.urlEncode("Y, log(ch(1))"); //TODO
    144     int index = 0;
    145     for (BioAssay ba : bioAssays)
    146     {
    147       // ? plot
    148       PlotGeneratorBean maPlot = new PlotGeneratorBean();
    149       maPlot.setId("maplot." + ba.getId());
    150       maPlot.setWidth(width);
    151       maPlot.setHeight(height);
    152       maPlot.setTitle("MA plot for " + ba.getName());
    153       maPlot.setUrl(
    154           servletPath + "?ID=" + ID +
    155           "&bioassay_id=" + ba.getId() +
    156           "&type=scatter"+
    157           "&width="+width+"&height=" + height +
    158           "&cache=overview/bioassay." + ba.getId() + "/maplot.png" +
    159           "&x="+A+"&y="+M+
    160           "&xLabel="+xLabel+"&yLabel="+yLabel +
    161           "&filter="+maFilter +
    162           "&title="+HTML.urlEncode(ba.getName())
    163       );
    164       maGenerators[index] = maPlot;
    165       // Correction factor plot
    166 //      if (hasCfPlot)
    167 //      {
    168 //        PlotGeneratorBean cfPlot = new PlotGeneratorBean();
    169 //        cfPlot.setId("cfplot." + ba.getId());
    170 //        cfPlot.setWidth(width);
    171 //        cfPlot.setHeight(height);
    172 //        cfPlot.setTitle("Correction factor plot for " + ba.getName());
    173 //        cfPlot.setUrl(
    174 //            servletPath + "?ID=" + ID +
    175 //            "&bioassay_id=" + ba.getId() +
    176 //            "&type=cfplot"+
    177 //            "&width="+width+"&height=" + height +
    178 //            "&cache=overview/bioassay." + ba.getId() + "/cfplot.png" +
    179 //            "&xLabel="+xLabel+"&yLabel="+yLabel +
    180 //            "&title="+HTML.urlEncode(ba.getName())
    181 //        );
    182 //        cfGenerators[index] = cfPlot;
    183 //      }
    184       ++index;
    185     }
     125    String xLabel = HTML.urlEncode("Raw bioassay");
     126    String yLabel = HTML.urlEncode("Signal");
     127   
     128    PlotGeneratorBean overviewPlot = new PlotGeneratorBean();
     129    overviewPlot.setId("illuminaPlot");
     130    overviewPlot.setWidth(width);
     131    overviewPlot.setHeight(height);
     132    overviewPlot.setTitle("Control summary plot");
     133    overviewPlot.setUrl(
     134        servletPath + "?ID=" + ID +
     135        "&bioassayset_id=" + source.getId() +       
     136        "&width="+width+"&height=" + height +
     137        "&cache=overview/bioassayset." + source.getId() + "/controlsummaryplot.png" +
     138        "&xLabel="+xLabel+"&yLabel="+yLabel +
     139        "&filters="+filters +
     140        "&columnFormula="+columnFormula +
     141        "&series="+series +
     142        "&title="+HTML.urlEncode("Control summary plot")
     143    );
     144    plotGenerators[0] = overviewPlot;   
     145       
    186146    return actions;
    187147  }
Note: See TracChangeset for help on using the changeset viewer.