Changeset 1564


Ignore:
Timestamp:
Mar 16, 2012, 9:44:17 AM (10 years ago)
Author:
Nicklas Nordborg
Message:

References #370: Export run parameters to Caliper XML file

Added entry point to the run parameters exporter in the reggie wizard.

Location:
extensions/net.sf.basedb.reggie/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/trunk/resources/index.jsp

    r1544 r1564  
    235235            <ul>
    236236            <li><a href="rnaqc_aliquot.jsp?ID=<%=ID%>">Create aliquots on Bioanalyzer/Caliper plates</a>
    237             <li><a href="rnaqc_plate_export.jsp?ID=<%=ID%>">Export Caliper sample name file</a>
    238             <li><a href="rnaqc_plate_import.jsp?ID=<%=ID%>">Import RQS scores from Caliper data file</a>
     237            <li><a href="rnaqc_plate_export.jsp?ID=<%=ID%>">Export Caliper sample names and run parameters</a>
     238            <li><a href="rnaqc_plate_import.jsp?ID=<%=ID%>">Import RQS scores from Caliper well table file</a>
    239239            </ul>
    240240          </dd>
  • extensions/net.sf.basedb.reggie/trunk/resources/rnaqc_plate_export.jsp

    r1550 r1564  
    3939var debug = false;
    4040var rnaQcBioPlates = null
     41var runParameterConfigurations = null;
    4142
    4243function init()
     
    6061    setFatalError(msg);
    6162  }
    62 }
    63 
     63 
     64  getConfigurationsForRunParametersExporter();
     65  var exportHtml = makeButton('Sample names (csv)', "goExport('SAMPLE_NAMES')");
     66  for (var i = 0; i < runParameterConfigurations.length; i++)
     67  {
     68    var config = runParameterConfigurations[i];
     69    exportHtml += makeButton('Run parameters: '+config.name + ' (xml)', "goExport('"+config.id+"')");
     70  }
     71 
     72  setInnerHTML('export', exportHtml);
     73}
     74
     75
     76function makeButton(title, onClick)
     77{
     78  var btn = '';
     79  btn += '<span class="link" onclick="'+onClick+'">';
     80  btn += '<img src="images/export.png">&nbsp;';
     81  btn += title+'</span><br>\n';
     82  return btn;
     83}
     84
     85function getConfigurationsForRunParametersExporter()
     86{
     87  var request = Ajax.getXmlHttpRequest();
     88  var url = 'RnaQc.servlet?ID=<%=ID%>&cmd=GetConfigurationsForRunParametersExporter';   
     89  request.open("GET", url, false);
     90  request.send(null);
     91
     92  if (debug) Main.debug(request.responseText);
     93  var response = JSON.parse(request.responseText); 
     94  if (response.status != 'ok')
     95  {
     96    setFatalError(response.message);
     97    return false;
     98  }
     99 
     100  runParameterConfigurations = response.configurations;
     101}
    64102
    65103function getActiveRnaQcBioPlates()
     
    84122
    85123
    86 function goExport()
     124function goExport(exporter)
    87125{
    88126  var frm = document.forms['reggie'];
    89127  var bioPlateId = frm.bioPlates[frm.bioPlates.selectedIndex].value;
    90   var url = 'RnaQc.servlet?ID=<%=ID%>&cmd=ExportSampleNamesForCaliper&bioPlateId='+bioPlateId;
     128 
     129  var url;
     130  if (exporter == 'SAMPLE_NAMES')
     131  {
     132    url = 'RnaQc.servlet?ID=<%=ID%>&cmd=ExportSampleNamesForCaliper&bioPlateId='+bioPlateId;
     133  }
     134  else
     135  {
     136    url = 'RnaQc.servlet?ID=<%=ID%>&cmd=ExportRunParameters&bioPlateId='+bioPlateId+'&configurationId='+exporter;
     137  }
    91138  window.location = url;
    92139}
     
    100147  <p:path><p:pathelement
    101148    title="Reggie" href="<%="index.jsp?ID="+ID%>"
    102     /><p:pathelement title="RNA quality control - Export Caliper sample names"
     149    /><p:pathelement title="RNA quality control - Export Caliper sample names and run parameters"
    103150    /></p:path>
    104151
     
    134181        <td class="status" id="bioplates.status"></td>
    135182        <td class="help"><span id="bioplates.message" class="message" style="display: none;"></span>
    136           Select the bioplate to export sample names from.
     183          Select the bioplate to export sample names or run parameters from.
    137184          <p>
    138185          The list contain RNAQC bioplates without quality score data (determined by
    139           absence of QCRunDate annotation). 
     186          absence of QCRunDate annotation).
    140187          <p>
    141188          Tip! You can run the exporter for any bioplate as a regular plug-in by selecting
    142189          a bioplate from the list at <a
    143190          href="<%=request.getContextPath()%>/biomaterials/bioplates/index.jsp?ID=<%=ID%>"
    144           >Biomaterial LIMS › Bioplates</a> and then use the <b>Export</b> button.
     191          >Biomaterial LIMS › Bioplates</a> and then use the <b>Export</b> button.
     192        </td>
     193      </tr>
     194     
     195      <tr valign="top">
     196        <td class="prompt">Export</td>
     197        <td class="input" id="export" style="white-space: nowrap;">
     198         
     199        </td>
     200        <td class="status" id="export.status"></td>
     201        <td class="help"><span id="export.message" class="message" style="display: none;"></span>
     202          Select what to export. Typically, you'll need the sample name file and the standard and
     203          high sensitivity run files.
    145204        </td>
    146205      </tr>
     
    150209  </table>
    151210 
    152  
    153211  <div class="messagecontainer error" id="errorMessage" style="display: none; width: 800px; margin-left: 20px; margin-bottom: 0px;"></div>
    154212 
    155213  <div id="done" class="success" style="display: none; width: 800px; margin-left: 20px; margin-top: 20px;"></div>
    156  
    157   <table style="margin-left: 20px; margin-top: 10px;" class="navigation">
    158     <tr>
    159       <td><base:button id="goexport" title="Export" image="<%=home+"/images/export.png"%>" onclick="goExport()"/></td>
    160       <td id="gonext.message" class="message"></td>
    161     </tr>
    162   </table>
     214
    163215  </form>
    164216  </div>
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/RnaQcServlet.java

    r1561 r1564  
    3333import net.sf.basedb.core.Path;
    3434import net.sf.basedb.core.PlateGeometry;
     35import net.sf.basedb.core.PluginConfiguration;
     36import net.sf.basedb.core.PluginDefinition;
    3537import net.sf.basedb.core.Protocol;
    3638import net.sf.basedb.core.SessionControl;
     39import net.sf.basedb.core.plugin.ParameterValues;
     40import net.sf.basedb.core.query.Hql;
     41import net.sf.basedb.core.query.Orders;
    3742import net.sf.basedb.reggie.Reggie;
    3843import net.sf.basedb.reggie.dao.BioplateType;
     
    4146import net.sf.basedb.reggie.dao.Subtype;
    4247import net.sf.basedb.reggie.plugins.CaliperPlateImporter;
     48import net.sf.basedb.reggie.plugins.CaliperRunParametersExporter;
    4349import net.sf.basedb.reggie.plugins.CaliperSampleNameExporter;
    4450import net.sf.basedb.util.Coordinate;
     
    184190        json.put("bioPlate", plate.asJSONObject());
    185191      }
     192      else if ("GetConfigurationsForRunParametersExporter".equals(cmd))
     193      {
     194        /*
     195          Get all configurations for the CaliperRunParametersExporter plugin
     196        */
     197        dc = sc.newDbControl();
     198        PluginDefinition plugin = PluginDefinition.getByClassName(dc, CaliperRunParametersExporter.class.getName());
     199        ItemQuery<PluginConfiguration> query = plugin.getPluginConfigurations();
     200        query.setIncludes(Reggie.INCLUDE_IN_CURRENT_PROJECT);
     201        query.order(Orders.asc(Hql.property("name")));
     202       
     203        JSONArray jsonConfigurations = new JSONArray();
     204        for (PluginConfiguration p : query.list(dc))
     205        {
     206          JSONObject jsonConfiguration = new JSONObject();
     207          jsonConfiguration.put("id", p.getId());
     208          jsonConfiguration.put("name", p.getName());
     209          jsonConfigurations.add(jsonConfiguration);
     210        }
     211       
     212        json.put("configurations", jsonConfigurations);
     213      }
    186214      else if ("ExportSampleNamesForCaliper".equals(cmd))
    187215      {
     
    200228        exporter.exportSampleNames(dc, plate, out);
    201229 
     230        out.flush();
     231        out.close();
     232      }
     233      else if ("ExportRunParameters".equals(cmd))
     234      {
     235        /*
     236          Generate run parameter XML file for the Caliper software
     237        */
     238        int bioPlateId = Values.getInt(req.getParameter("bioPlateId"));
     239        int configurationId = Values.getInt(req.getParameter("configurationId"));
     240       
     241        dc = sc.newDbControl();
     242        BioPlate plate = BioPlate.getById(dc, bioPlateId);
     243        PluginConfiguration config = PluginConfiguration.getById(dc, configurationId);
     244        ParameterValues parameters = config.getParameterValues(config.getParameterVersion());
     245        boolean hiSense = "High".equals(parameters.getValue("sensitivity"));
     246       
     247        resp.setHeader("Content-Disposition", "attachment; filename=" + Path.makeSafeFilename(plate.getName(), "") + (hiSense ? "_hi" : "_std") + ".xml");
     248        resp.setContentType("application/xml");
     249        resp.setCharacterEncoding("UTF-8");
     250        Writer out = resp.getWriter();
     251       
     252        CaliperRunParametersExporter exporter = new CaliperRunParametersExporter();
     253        exporter.exportRunParameters(dc, plate, hiSense, parameters, out);
     254       
    202255        out.flush();
    203256        out.close();
     
    388441          BioPlate plate = cpi.getBioPlate();
    389442          jsonMessages.add("Imported data to " + cpi.getNumImported() + " extracts on plate " + plate.getName());
     443         
     444          if (cpi.hasWarning())
     445          {
     446            jsonMessages.addAll(cpi.getWarningMessages());
     447          }
    390448         
    391449          // Attach the files we used to the bioplate
Note: See TracChangeset for help on using the changeset viewer.