Changeset 1643


Ignore:
Timestamp:
May 11, 2012, 2:49:35 PM (10 years ago)
Author:
Nicklas Nordborg
Message:

References #386: Qiacube/nanodrop wizard

Use the Qiacube position to order the sample names in the Sample ID file that should be imported to the NanoDrop? software.

Improved error handling when reading the file exported from the NanoDrop?. Checking well location agains sample names, checking for missing columns or missing values. Checking that values have been imported for all samples.

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

Legend:

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

    r1639 r1643  
    3232 
    3333<script language="JavaScript">
    34 var debug = true;
     34var debug = false;
    3535var currentStep = 1;
    3636var lysatesIsValid = false;
     
    188188  <table style="margin-left: 20px; margin-top: 10px;" class="navigation" id="navigation">
    189189    <tr>
    190       <td><base:button id="gocreate" title="Next" image="<%=home+"/images/gonext.png"%>" onclick="goCreate()" /></td>
     190      <td><base:button id="gocreate" title="Finish" image="<%=home+"/images/gonext.png"%>" onclick="goCreate()" /></td>
    191191      <td id="gonext.message" class="message"></td>
    192192    </tr>
  • extensions/net.sf.basedb.reggie/trunk/resources/extraction_registration.jsp

    r1642 r1643  
    5555.nondefault
    5656{
    57   background: #FFFF66;
     57  background: #FFF066;
    5858}
    5959.nondefault:after
     
    7575var DEFAULT_FT_VOLUME = 550;
    7676
    77 var debug = true;
     77var debug = false;
    7878var currentStep = 1;
    7979
     
    399399function editDnaRnaDetails(index)
    400400{
     401  if (currentStep != 3) return;
    401402  var url = 'edit_dnarna_details.jsp?ID=<%=ID%>&index='+index;
    402403  url += '&lysate=' + selectedLysates[index].name;
     
    421422      hasQiacubePosition[lysate.qiacubePosition] = true;
    422423    }
     424   
     425    // Calculate NanoDrop well from Qiacube position
     426    var row;
     427    var col;
     428    if (lysate.qiacubePosition > 8)
     429    {
     430      row = lysate.qiacubePosition - 9;
     431      col = 2;
     432    }
     433    else
     434    {
     435      row = lysate.qiacubePosition - 1;
     436      col = 1;
     437    }
     438    lysate.dna.well = WELL_ALPHA[row] + col;
     439    lysate.rna.well = WELL_ALPHA[row] + (col+2);
     440   
    423441    setInnerHTML('lysateTotal'+i, lysate.originalQuantity);
    424442    addOrRemoveClass('lysateTotal'+i, 'nondefault', lysate.originalQuantity != DEFAULT_LYSATE_VOLUME);
     
    448466  {
    449467    setInputStatus('details', 'Duplicate Qiacube position: ' + duplicatePosition, 'invalid');
    450   //  Main.show('tableError');
    451   //  setInnerHTML('tableError', 'Duplicate Qiacube position: ' + duplicatePosition);
    452468    qiacubePositionsAreValid = false;
    453469  }
     
    455471  {
    456472    setInputStatus('details', '', '');
    457     //Main.hide('tableError');
    458473    qiacubePositionsAreValid = true;
    459474  }
     
    474489  Main.hide('gocancel');
    475490  Main.addClass(document.getElementById('step.3.section'), 'disabled');
     491  currentStep = 4;
    476492 
    477493  var submitInfo = new Object();
     
    489505 
    490506  var request = Ajax.getXmlHttpRequest();
    491   var url = 'Extraction.servlet?ID=<%=ID%>&cmd=RegisterDnaRnaFt';
    492   request.open("POST", url, false);
    493   request.setRequestHeader("Content-Type", "application/json");
    494   request.send(JSON.stringify(submitInfo));
    495 
     507  try
     508  {
     509    showLoadingAnimation('Working...');
     510    var url = 'Extraction.servlet?ID=<%=ID%>&cmd=RegisterDnaRnaFt';
     511    request.open("POST", url, false);
     512    request.setRequestHeader("Content-Type", "application/json");
     513    request.send(JSON.stringify(submitInfo));
     514  }
     515  finally
     516  {
     517    hideLoadingAnimation();
     518  }
     519 
    496520  if (debug) Main.debug(request.responseText);
    497521 
     
    610634
    611635function downloadSampleIdFile()
    612 {
     636{
     637  if (!qiacubePositionsAreValid)
     638  {
     639    alert('Qiacube positions are not valid. Please fix before downloading the file.');
     640    return;
     641  }
     642 
     643  var lysateNames = new Array();
    613644  var frm = document.forms['reggie'];
    614645  var url = 'Extraction.servlet?ID=<%=ID%>&cmd=DownloadNanoDropSampleIdFile';
    615646  url += '&qiacubeDate='+frm.qiacubeDate.value;
    616647  url += '&qiacubeRunNo='+frm.qiacubeRunNo.value;
    617   url += '&lysateNames=';
    618   var separator = '';
     648 
    619649  for (var i = 0; i < selectedLysates.length; i++)
    620650  {
    621     url += separator + selectedLysates[i].name;
    622     separator = ',';
    623   }
     651    var lysate = selectedLysates[i];
     652    lysateNames[lysate.qiacubePosition-1] = lysate.name;
     653  }
     654  url += '&lysateNames=' + lysateNames.join(',');
    624655  window.location = url;
    625656}
     
    640671function nanoDropFileLoaded(event)
    641672{
    642   var lines = event.target.result.split(/\n/);
    643   var columns = lines[0].split(/\s*\t\s*/);
    644  
    645   var sampleIndex = findColumn(columns, 'Sample ID');
    646   if (sampleIndex == -1) return;
    647  
    648   var ndConcIndex = findColumn(columns, 'Conc.');
    649   if (ndConcIndex == -1) return;
    650  
    651   var nd260by280Index = findColumn(columns, '260/280');
    652   if (nd260by280Index == -1) return;
    653  
    654   var nd260by230Index = findColumn(columns, '260/230');
    655   if (nd260by230Index == -1) return;
    656 
    657   Main.debug('Sample ID='+sampleIndex + '; NDConc='+ndConcIndex + '; 260/280='+ nd260by280Index + '; 260/230='+nd260by230Index);
    658 
    659   for (var i = 1; i < lines.length; i++)
    660   {
    661     var row = lines[i].split(/\s*\t\s*/);
    662     if (row.length != columns.length) continue; // with the next line
    663    
    664     var sampleId = row[sampleIndex];
    665     if (!sampleId || sampleId == 'blank') continue; // with the next line
    666 
    667     var rnaOrDna = findRnaOrDna(sampleId, i+1);
    668     if (!rnaOrDna) return;  // This is an error condition
    669    
    670     var ndConc = getNumber(row[ndConcIndex]);
    671     // If there are multiple entries for the same item, keep the largest NDConc
    672     if (!rnaOrDna.ndConc || ndConc > rnaOrDna.ndConc)
    673     {
    674       rnaOrDna.ndConc = ndConc;
    675       rnaOrDna.nd260by280 = getNumber(row[nd260by280Index]);
    676       rnaOrDna.nd260by230 = getNumber(row[nd260by230Index]);
    677     }
    678   }
    679  
    680   setInputStatus('nanoDropFile', '', 'valid');
    681   nanoDropFileIsValid = true;
    682  
    683   updateDetailsTable();
     673  nanoDropFileIsValid = false;
     674
     675  try
     676  {
     677    // Reset the existing values
     678    for (var i = 0; i < selectedLysates.length; i++)
     679    {
     680      var lysate = selectedLysates[i];
     681      lysate.dna.ndConc = null;
     682      lysate.dna.nd260by280 = null;
     683      lysate.dna.nd260by230 = null;
     684      lysate.rna.ndConc = null;
     685      lysate.rna.nd260by280 = null;
     686      lysate.rna.nd260by230 = null;
     687    }
     688   
     689    var lines = event.target.result.split(/\n/);
     690    var columns = lines[0].split(/ *\t */);
     691   
     692    var sampleIndex = findColumn(columns, 'Sample ID');
     693    if (sampleIndex == -1) return;
     694   
     695    var wellIndex = findColumn(columns, 'Well');
     696    if (wellIndex == -1) return;
     697   
     698    var ndConcIndex = findColumn(columns, 'Conc.');
     699    if (ndConcIndex == -1) return;
     700   
     701    var nd260by280Index = findColumn(columns, '260/280');
     702    if (nd260by280Index == -1) return;
     703   
     704    var nd260by230Index = findColumn(columns, '260/230');
     705    if (nd260by230Index == -1) return;
     706 
     707    var numImported = 0;
     708    for (var i = 1; i < lines.length; i++)
     709    {
     710      if (lines[i].match(/^\s*$/)) continue; // Ignore empty lines
     711     
     712      var row = lines[i].split(/ *\t */);
     713      if (row.length != columns.length)
     714      {
     715        setInputStatus('nanoDropFile', 'On line ' + (i+1) + '; Unexpected number of columns: ' + row.length);
     716        return;
     717      }
     718     
     719      var sampleId = row[sampleIndex];
     720      if (!sampleId || sampleId == 'blank') continue; // with the next line
     721 
     722      var rnaOrDna = findRnaOrDna(sampleId, i+1);
     723      if (!rnaOrDna) return;  // This is an error condition
     724     
     725      if (rnaOrDna.well != row[wellIndex])
     726      {
     727        setInputStatus('nanoDropFile', 'On line ' + (i+1) + '; Expected to find "' + sampleId + '" in well [' + rnaOrDna.well + '] not ['  + row[wellIndex] + ']', 'invalid');
     728        return;
     729      }
     730     
     731      var ndConc = getNumber(row[ndConcIndex]);
     732      if (!ndConc)
     733      {
     734        setInputStatus('nanoDropFile', 'On line ' + (i+1) + '; No NDConc value for "' + sampleId + '"', 'invalid');
     735        return;
     736      }
     737     
     738      // If there are multiple entries for the same item, keep the largest NDConc
     739      if (!rnaOrDna.ndConc || ndConc > rnaOrDna.ndConc)
     740      {
     741        rnaOrDna.ndConc = ndConc;
     742        rnaOrDna.nd260by280 = getNumber(row[nd260by280Index]);
     743        if (!rnaOrDna.nd260by280)
     744        {
     745          setInputStatus('nanoDropFile', 'On line ' + (i+1) + '; No 260/280 value for "' + sampleId + '"', 'invalid');
     746          return;
     747        }
     748       
     749        rnaOrDna.nd260by230 = getNumber(row[nd260by230Index]);
     750        if (!rnaOrDna.nd260by230)
     751        {
     752          setInputStatus('nanoDropFile', 'On line ' + (i+1) + '; No 260/230 value for "' + sampleId + '"', 'invalid');
     753          return;
     754        }
     755
     756        numImported++;
     757      }
     758     
     759    }
     760 
     761    if (numImported != 24)
     762    {
     763      setInputStatus('nanoDropFile', 'Could not find values for all 24 samples: ' + numImported, 'invalid'); 
     764      return;
     765    }
     766
     767    setInputStatus('nanoDropFile', '', 'valid');
     768    nanoDropFileIsValid = true;
     769  }
     770  finally
     771  {
     772    updateDetailsTable();
     773  }
    684774 
    685775}
     
    691781  if (colIndex == -1)
    692782  {
    693     setInputStatus('nanoDropFile', 'Can\'t find "' + col + '" column', 'invalid');
     783    setInputStatus('nanoDropFile', 'On line 1; Can\'t find "' + col + '" column', 'invalid');
    694784  }
    695785  return colIndex;
     
    716806  }
    717807 
    718   setInputStatus('nanoDropFile', 'Can\'t find RNA/DNA with name "' + sampleId + "' on line " + lineNo, 'invalid');
     808  setInputStatus('nanoDropFile', 'On line ' + lineNo + '; Can\'t find RNA/DNA with name "' + sampleId + '"', 'invalid');
    719809}
    720810
     
    876966  <tr>
    877967    <td rowspan="2" class="stepno">3</td>
    878     <td class="steptitle">RNA/DNA/FlowThroguh details</td>
     968    <td class="steptitle">RNA/DNA/FlowThrough details</td>
    879969  </tr>
    880970  <tr>
    881971    <td class="stepfields">
     972      <div style="background: #E8E8E8; padding: 2px; border-bottom: 1px dotted #A0A0A0;">
     973        The table below show values from the Qiacube run.
     974        <span class="nondefault">Highlighted</span> values have been manually
     975        changed from their default values. If the Qiacube positions are not correct,
     976        they must be fixed before the <i>NanoDrop Sample ID</i> file is downloaded
     977        since the order in this file depends on the positions. The concentrations
     978        and other values are loaded from the file after the NanoDrop has been completed.
     979        <span id="details.status" class="status"></span>
     980        <span id="details.message" class="message"></span>
     981      </div>
     982
     983      <div id="detailsSection">
     984      </div>
     985
    882986      <table style="width: 100%; border-collapse: collapse;">
    883       <tr>
     987      <tr style="border-top: 1px dotted #A0A0A0;">
    884988        <td class="prompt">NanoDrop Sample ID</td>
    885989        <td class="input">
     
    890994        <td class="help"><span id="downloadSampleIdFile.message" class="message" style="display:none;"></span>
    891995          Download and import this file to the NanoDrop software before analyzing the DNA/RNA.
    892         </td>
    893       </tr>
    894       <tr style="border-bottom: 1px dotted #A0A0A0;">
     996          <b>Note that the samples are sorted by Qiacube position!</b>
     997        </td>
     998      </tr>
     999      <tr>
    8951000        <td class="prompt">NanoDrop values</td>
    8961001        <td class="input">
     
    9031008      </tr>
    9041009      </table>
    905      
    906       <div id="detailsSection">
    907       </div>
    908      
    909       <div style="background: #E8E8E8; padding: 2px; border-top: 1px dotted #A0A0A0;">
    910         <span id="details.status" class="status"></span>
    911         <span id="details.message" class="message"></span>
    912         Values inside <span class="nondefault">brackets</span> have been manually modified from their default values.
    913       </div>
    9141010    </td>
    9151011  </tr>
     
    9261022    <td><base:button id="gocancel" title="Cancel" onclick="goRestart(false)" style="display: none;"/></td>
    9271023    <td><base:button id="gonext" title="Next" image="<%=home+"/images/gonext.png"%>" onclick="goNext(true)"/></td>
    928     <td><base:button id="gocreate" title="Save" image="<%=home+"/images/gonext.png"%>" onclick="goCreate()" style="display: none;"/></td>
     1024    <td><base:button id="gocreate" title="Finish" image="<%=home+"/images/gonext.png"%>" onclick="goCreate()" style="display: none;"/></td>
    9291025    <td><base:button id="gorestart" title="Restart" image="<%=home+"/images/goback.png"%>" onclick="goRestart(true)" style="display: none;"/></td>
    9301026    <td id="gonext.message" class="message"></td>
  • extensions/net.sf.basedb.reggie/trunk/resources/reggie.js

    r1642 r1643  
     1
     2var WELL_ALPHA = [ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
     3
    14
    25/**
  • extensions/net.sf.basedb.reggie/trunk/resources/rnaqc_aliquot.jsp

    r1628 r1643  
    4545
    4646var bioPlateNameIsValid = false;
    47 
    48 var WELL_ALPHA = [ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
    4947
    5048function init()
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/ExtractionServlet.java

    r1642 r1643  
    151151        String[] lysateNames = req.getParameter("lysateNames").split(",");
    152152       
    153         resp.setHeader("Content-Disposition", "attachment; filename=nd-sample-id-" + qiacubeDate + "-" + qiacubeRunNo+ ".csv");
    154         resp.setContentType("text/csv");
     153        resp.setHeader("Content-Disposition", "attachment; filename=nd-sample-id-" + qiacubeDate + "-" + qiacubeRunNo+ ".txt");
     154        resp.setContentType("text/plain");
    155155        resp.setCharacterEncoding("UTF-8");
    156156       
     
    335335          dc.saveItem(ft);
    336336         
    337           jsonMessages.add("DNA, RNA and FT created from " + lysate.getName());
     337          jsonMessages.add("DNA, RNA and FlowThrough created from " + lysate.getName());
    338338        }
    339339       
Note: See TracChangeset for help on using the changeset viewer.