Changeset 5944


Ignore:
Timestamp:
May 20, 2020, 9:30:46 AM (2 weeks ago)
Author:
Nicklas Nordborg
Message:

References #1239: Include Single Sample Predictor models in the StringTie? pipeline

Added a "Preset" selection list for selecting which models to run. The selection list is populated with existing plug-in configurations for the Single Sample Predictor plug-in.

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

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/trunk/resources/analysis/ssp_start.js

    r5941 r5944  
    2222    // Step 2
    2323    Events.addEventHandler('step-2', 'wizard-initialize', ssp.initializeStep2);
     24    Events.addEventHandler('presets', 'change', ssp.presetOnChange);
    2425    Events.addEventHandler('step-2', 'wizard-validate', ssp.validateStep2);
    2526   
     
    229230  ssp.modelsLoaded = function(response)
    230231  {
     232    var frm = document.forms['reggie'];
     233
    231234    models = response.models;
    232    
    233235    if (models.length == 0)
    234236    {
     
    236238    }
    237239   
     240    var presets = response.presets;
     241    for (var pNo = 0; pNo < presets.length; pNo++)
     242    {
     243      var preset = presets[pNo];
     244      var option = new Option(preset.name);
     245      option.preset = preset;
     246      frm.presets[frm.presets.length] = option;
     247    }
     248   
    238249    var html = '';
    239250    for (var mNo = 0; mNo < models.length; mNo++)
    240251    {
    241252      var model = models[mNo];
    242       html += '<tr class="align-top">';
     253      html += '<tr class="align-top" id="modelrow.'+mNo+'">';
    243254      html += '<td class="subprompt"><label for="model.'+mNo+'">'+Strings.encodeTags(model.name)+'</label></td>';
    244255      html += '<td style="width: 2em;"><input type="checkbox" name="model.'+mNo+'" id="model.'+mNo+'"></td>';
     
    257268      if (model.error)
    258269      {
    259         Wizard.setInputStatus('model.'+mNo, 'warning', model.error);
     270        Wizard.setInputStatus('model.'+mNo, 'warning', Reggie.softLineBreaks(model.error));
    260271        checkbox.disabled = true;
    261272      }
     
    274285  }
    275286 
     287  ssp.presetOnChange = function()
     288  {
     289    var frm = document.forms['reggie'];
     290    var preset = frm.presets[frm.presets.selectedIndex].preset;
     291   
     292    for (var mNo = 0; mNo < models.length; mNo++)
     293    {
     294      var model = models[mNo];
     295      if (!frm['model.'+mNo].disabled)
     296      {
     297        frm['model.'+mNo].checked = !preset || preset.models.indexOf(model.name) >= 0;
     298      }
     299    }
     300    ssp.onModelSelected();
     301  }
     302 
    276303  ssp.onModelSelected = function()
    277304  {
     
    281308    {
    282309      if (frm['model.'+mNo].checked) numModelsSelected++;
     310      Doc.addOrRemoveClass('modelrow.'+mNo, 'selected', frm['model.'+mNo].checked);
    283311    }
    284312   
  • extensions/net.sf.basedb.reggie/trunk/resources/analysis/ssp_start.jsp

    r5941 r5944  
    3333.modeldescription
    3434{
     35  padding-bottom: 0.25em;
    3536  font-style: italic;
    36   padding-bottom: 0.25em;
     37  color: #999999;
    3738}
     39
     40.selected .modeldescription
     41{
     42  font-style: normal;
     43  color: initial;
     44}
     45
    3846</style>
    3947</base:head>
     
    8290      <table class="step-form">
    8391        <td class="prompt">Models</td>
    84         <td class="input" colspan="2"></td>
     92        <td class="input" colspan="2">
     93          <select name="presets" id="presets">
     94            <option value="">All
     95          </select>
     96        </td>
    8597        <td class="status" id="models.status"></td>
    8698        <td class="help"><span id="models.message" class="message"></span>
    87           Select one or more SSP models to run.
     99          Select one or more SSP models to run. Presets can be configured
     100          by creating <b>Plug-in configurations</b> for the
     101          <b>Single Sample Predictor</b> plug-in.
    88102        </td>
    89103      </tr>
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/SspServlet.java

    r5943 r5944  
    1818import net.sf.basedb.core.ItemQuery;
    1919import net.sf.basedb.core.Job;
     20import net.sf.basedb.core.PluginConfiguration;
    2021import net.sf.basedb.core.RawBioAssay;
    2122import net.sf.basedb.core.SessionControl;
     23import net.sf.basedb.core.query.Expressions;
    2224import net.sf.basedb.core.query.Hql;
    2325import net.sf.basedb.core.query.Orders;
     26import net.sf.basedb.core.query.Restrictions;
    2427import net.sf.basedb.core.snapshot.SnapshotManager;
    2528import net.sf.basedb.reggie.JsonUtil;
     
    144147        }
    145148        json.put("models", jsonModels);
     149       
     150        // Load presets -- eg. PluginConfigurations
     151        ItemQuery<PluginConfiguration> query = PluginConfiguration.getQuery();
     152        query.setIncludes(Reggie.INCLUDE_IN_CURRENT_PROJECT);
     153        query.join(Hql.innerJoin("pluginDefinition", "p"));
     154        query.restrict(Restrictions.eq(Hql.property("p", "className"), Expressions.string(SspPlugin.class.getName())));
     155        query.order(Orders.asc(Hql.property("name")));
     156       
     157        JSONArray jsonPresets = new JSONArray();
     158        for (PluginConfiguration config : query.list(dc))
     159        {
     160          JSONObject jsonPreset = new JSONObject();
     161          jsonPreset.put("name", config.getName());
     162          JSONArray jsonPresetModels = new JSONArray();
     163          jsonPresetModels.addAll(config.getParameterValues("models"));
     164          jsonPreset.put("models", jsonPresetModels);
     165          jsonPresets.add(jsonPreset);
     166        }
     167        json.put("presets", jsonPresets);
    146168      }
    147169
Note: See TracChangeset for help on using the changeset viewer.