Changeset 2067


Ignore:
Timestamp:
Oct 15, 2013, 11:40:43 AM (9 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #516: Include empty rows in list view of pool protocol

The fix uses the POOL_SCHEMA from the library plate to find out which wells that are part of the pool. Skipped wells are detected by the createMissingRows function. It's important that the ordering of rows is not changed.

File:
1 edited

Legend:

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

    r2053 r2067  
    7676 
    7777  // Loaded from servlet when getting Library information
    78   var POOL_SCHEMA;
    79   var POOL_BARCODE_VARIANT;
     78  var POOL_CURRENT_SCHEMA;
     79  var POOL_CURRENT_BARCODE_VARIANT;
    8080 
    8181  function init()
     
    110110     
    111111      libPlate = response.libPlate;
    112       POOL_SCHEMA = PoolSchema.getById(libPlate.poolSchema);
    113       POOL_BARCODE_VARIANT = PoolSchema.getBarcodeVariantByName(POOL_SCHEMA, libPlate.barcodeVariant);
     112      POOL_CURRENT_SCHEMA = PoolSchema.getById(libPlate.poolSchema);
     113      POOL_CURRENT_BARCODE_VARIANT = PoolSchema.getBarcodeVariantByName(POOL_CURRENT_SCHEMA, libPlate.barcodeVariant);
     114      Plate.init(8, 12, POOL_CURRENT_SCHEMA, WellPainter);
    114115      <%
    115116    }
     
    123124    {
    124125      showLoadingAnimation('Loading pooled library information...');
    125       var url = '../Pool.servlet?ID=<%=ID%>&cmd=GetLibraryInfoForPools&pools='+pools.join(',');   
     126      var url = '../Pool.servlet?ID=<%=ID%>&cmd=GetLibraryInfoForPools&pools='+pools.join(',')+'&bioplate=<%=libPlateId%>';   
    126127      request.open("GET", url, false);
    127128      request.send(null);
     
    159160      for (var j = 0; j < pool.libraries.length; j++)
    160161      {
    161         checkAndPreProcessLibrary(pool.libraries[j], pool, POOL_SCHEMA, POOL_BARCODE_VARIANT, '<%=view%>');       
     162        checkAndPreProcessLibrary(pool.libraries[j], pool, POOL_CURRENT_SCHEMA, POOL_CURRENT_BARCODE_VARIANT, '<%=view%>');       
    162163      }
    163164     
     
    173174    {
    174175      %>
    175       viewAsList(pools, POOL_SCHEMA, POOL_BARCODE_VARIANT);
     176      viewAsList(pools, POOL_CURRENT_SCHEMA, POOL_CURRENT_BARCODE_VARIANT);
    176177      <%
    177178    }
     
    179180    {
    180181      %>
    181       viewAsPlate(pools, POOL_SCHEMA, POOL_BARCODE_VARIANT);
     182      viewAsPlate(pools, POOL_CURRENT_SCHEMA, POOL_CURRENT_BARCODE_VARIANT);
    182183      <%
    183184    }
     
    246247  function viewAsList(pools, schema, barcodeVariant)
    247248  {
    248     var lastPoolNum = -1;
    249249    for (var i = 0; i < pools.length; i++)
    250250    {
    251251      var pool = pools[i];
     252      var wellsInPool = POOL_CURRENT_SCHEMA ? Plate.getPool(i) : null;
    252253     
    253254      var html = '';
    254255      var tbody = document.getElementById('listview.'+pool.id+'.body');
    255256     
     257      var wellIndex = 0;
    256258      for (var j = 0; j < pool.libraries.length; j++)
    257259      {
    258260        var lib = pool.libraries[j];
    259261        var well = lib.bioWell;
     262       
     263        if (POOL_CURRENT_SCHEMA)
     264        {
     265          wellIndex = createMissingRows(tbody, wellsInPool, wellIndex, well, barcodeVariant);
     266        }
    260267       
    261268        var tr = document.createElement('tr');
     
    294301        tbody.appendChild(tr);
    295302      }
     303      if (POOL_CURRENT_SCHEMA)
     304      {
     305        createMissingRows(tbody, wellsInPool, wellIndex, null, barcodeVariant);
     306      }
     307     
    296308      var poolData = '<div class="pool-data">';
    297309      poolData += pool.libraries.length + ' libs; ';
     
    305317  }
    306318 
     319  function createMissingRows(table, wellsInPool, wellIndex, well, barcodeVariant)
     320  {
     321    var wellAtIndex = wellsInPool[wellIndex]; // Empty??
     322    if (!well) well = {'row': -1, 'column': -1};
     323    while (wellAtIndex.row != well.row || wellAtIndex.column != well.column)
     324    {
     325      var tr = document.createElement('tr');
     326      tr.className = 'empty';
     327      if (barcodeVariant)
     328      {
     329        var indexSet = barcodeVariant.indexSets[wellAtIndex.column];
     330        if (indexSet) tr.className += ' ' + indexSet.color;
     331      }
     332     
     333      addColumn(tr, 'lib', 'not pooled');
     334      addColumn(tr, 'remain', '');
     335      addColumn(tr, 'molarity', '');
     336      addColumn(tr, 'workplate', WELL_ALPHA[wellAtIndex.row] + (wellAtIndex.column+1));
     337      addColumn(tr, 'volume', '');
     338      addColumn(tr, 'eb', '');
     339      addColumn(tr, 'remarks', '');
     340      table.appendChild(tr);
     341      wellIndex++;
     342      if (wellIndex >= wellsInPool.length) break;
     343      wellAtIndex = wellsInPool[wellIndex];
     344    }
     345    return wellIndex+1;
     346  }
     347 
    307348  function addColumn(tr, className, html)
    308349  {
     
    314355 
    315356  function viewAsPlate(pools, schema, barcodeVariant)
    316   {
    317     Plate.init(8, 12, schema, WellPainter);
    318    
     357  {
    319358    for (var poolNo = 0; poolNo < pools.length; poolNo++)
    320359    {
Note: See TracChangeset for help on using the changeset viewer.