Changeset 2094


Ignore:
Timestamp:
Oct 21, 2013, 2:49:46 PM (9 years ago)
Author:
Nicklas Nordborg
Message:

References #481 and #501. Make selection of flow cells easier by including the names of the pools in the selection list.

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

Legend:

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

    r2063 r2094  
    2929<script language="JavaScript">
    3030
    31 var debug = false;
     31var debug = 0;
    3232
    3333function init()
     
    4343    {
    4444      var flowCell = flowCells[i];
    45       var option = new Option(flowCell.name, flowCell.id, i < 2);
    46       option.comments = flowCell.comments;
     45      var name = flowCell.name +': ';
     46
     47      var numPools = flowCell.pools.length;
     48      var firstPoolNum = getPoolNum(flowCell.pools[0].name);
     49      var lastPoolNum = getPoolNum(flowCell.pools[flowCell.pools.length-1].name);
     50
     51      if (lastPoolNum - firstPoolNum == numPools - 1)
     52      {
     53        // Display: PoolN -- PoolY
     54        name += flowCell.pools[0].name + ' — ' + flowCell.pools[flowCell.pools.length-1].name;
     55      }
     56      else
     57      {
     58        // Display: PoolN + x more...
     59        name += flowCell.pools[0].name + ' + ' + (numPools-1) + ' more...';
     60      }
     61
     62      // Tooltip is always all pools
     63      var title = '';
     64      for (var poolNo=0; poolNo < numPools; poolNo++)
     65      {
     66        var pool = flowCell.pools[poolNo];
     67        if (poolNo > 0) title += ', ';
     68        title += pool.name;
     69      }
     70
     71      var option = new Option(name, flowCell.id, i < 2);
     72      option.title = title;
     73      option.flowCell = flowCell;
    4774      fcells.options[fcells.length] = option;
    4875    }
    4976    flowCellIsValid = true;
    5077    Main.show('gocreate');
    51     //flowCellOnChange();
    5278  }
    5379  else
     
    6086  // All is ok
    6187  frm.flowcells.focus();
     88}
     89
     90function getPoolNum(poolName)
     91{
     92  var num = poolName.match(/Pool(\d+)/);
     93  return num ? parseInt(num[1], 10) : null;
    6294}
    6395
     
    233265      <tr valign="top">
    234266        <td class="prompt">Flow cells</td>
    235         <td class="input"><select class="required" style="width:90%;"
     267        <td class="input"><select class="required" style="width:100%;"
    236268            name="flowcells" id="flowcells" multiple size="4"></select>
    237269        </td>
  • extensions/net.sf.basedb.reggie/trunk/resources/libprep/flowcell_registration.jsp

    r2089 r2094  
    5050    {
    5151      var flowCell = flowCells[i];
    52       var option = new Option(flowCell.name, flowCell.id, i < 2);
     52      var name = flowCell.name +': ';
     53
     54      var numPools = flowCell.pools.length;
     55      var firstPoolNum = getPoolNum(flowCell.pools[0].name);
     56      var lastPoolNum = getPoolNum(flowCell.pools[flowCell.pools.length-1].name);
     57
     58      if (lastPoolNum - firstPoolNum == numPools - 1)
     59      {
     60        // Display: PoolN -- PoolY
     61        name += flowCell.pools[0].name + ' — ' + flowCell.pools[flowCell.pools.length-1].name;
     62      }
     63      else
     64      {
     65        // Display: PoolN + x more...
     66        name += flowCell.pools[0].name + ' + ' + (numPools-1) + ' more...';
     67      }
     68
     69      // Tooltip is always all pools
     70      var title = '';
     71      for (var poolNo=0; poolNo < numPools; poolNo++)
     72      {
     73        var pool = flowCell.pools[poolNo];
     74        if (poolNo > 0) title += ', ';
     75        title += pool.name;
     76      }
     77     
     78      var option = new Option(name, flowCell.id, i < 2);
     79      option.title = title;
    5380      option.flowCell = flowCell;
    5481      frm.flowcells.options[frm.flowcells.length] = option;
     
    6895}
    6996
     97function getPoolNum(poolName)
     98{
     99  var num = poolName.match(/Pool(\d+)/);
     100  return num ? parseInt(num[1], 10) : null;
     101}
    70102
    71103function goNextAuto()
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/PooledLibrary.java

    r2090 r2094  
    101101  }
    102102 
     103  /**
     104    Load pools used on the flow cell.
     105  */
     106  public static List<PooledLibrary> getByFlowCell(DbControl dc, FlowCell flowCell)
     107  {
     108    ItemQuery<Extract> poolQuery = Extract.getQuery();
     109    Subtype.POOLED_LIBRARY.addFilter(dc, poolQuery);
     110    poolQuery.include(Reggie.INCLUDE_IN_CURRENT_PROJECT);
     111    poolQuery.setDistinct(true);
     112   
     113    // Join intermediate aliquot
     114    poolQuery.join(Hql.innerJoin("childCreationEvents", "cce1"));
     115    poolQuery.join(Hql.innerJoin("cce1", "event", "evt1"));
     116    poolQuery.join(Hql.innerJoin("evt1", "bioMaterial", "pa"));
     117   
     118    // Join flow cell
     119    poolQuery.join(Hql.innerJoin("pa", "childCreationEvents", "cce2"));
     120    poolQuery.join(Hql.innerJoin("cce2", "event", "evt2"));
     121    poolQuery.join(Hql.innerJoin("evt2", "physicalBioAssay", "fc"));
     122    poolQuery.restrict(Restrictions.eq(Hql.alias("fc"), Hql.entity(flowCell.getItem())));
     123   
     124    poolQuery.order(Orders.asc(Hql.property("name")));
     125   
     126    List<Extract> tmp = poolQuery.list(dc);
     127
     128    return toList(tmp);
     129  }
     130
    103131 
    104132  public static List<PooledLibrary> toList(Collection<Extract> extracts)
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/FlowCellServlet.java

    r2090 r2094  
    169169          fc.loadAnnotations(dc, "externalId", Annotationtype.FLOWCELL_ID, null);
    170170          fc.setAnnotation("comments", fc.getPhysicalBioAssay().getDescription());
     171         
     172          JSONArray jsonPools = new JSONArray();
     173          List<PooledLibrary> pools = PooledLibrary.getByFlowCell(dc, fc);
     174          for (PooledLibrary pool : pools)
     175          {
     176            jsonPools.add(pool.asJSONObject());
     177          }
     178          fc.setAnnotation("pools", jsonPools);
    171179          jsonFlowCells.add(fc.asJSONObject());
    172180        }
Note: See TracChangeset for help on using the changeset viewer.