Changeset 1561


Ignore:
Timestamp:
Mar 15, 2012, 11:09:36 AM (10 years ago)
Author:
Nicklas Nordborg
Message:

References #366: Import annotations and other information from Caliper output

  • Detect and handle problems with parsing numbers in the CSV file
  • Detect and report problems with duplicate measurements of the same well
  • Allow two GXD files. One for standard and one for hi-sense.
Location:
extensions/net.sf.basedb.reggie/trunk
Files:
3 edited

Legend:

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

    r1556 r1561  
    5555 
    5656  var url = getRoot() + 'filemanager/index.jsp?ID=<%=ID%>&cmd=SelectOne&callback=setFileCallback';
    57   url += '&resetTemporary=1&tmpfilter:STRING:name='+escape('%.' + extension);
     57  url += '&resetTemporary=1&tmpfilter:STRING:name='+escape('%.' + extension.substr(0, 3));
    5858  lastExtension = extension;
    5959  Main.openPopup(url, 'SelectFile', 1000, 700);
     
    8181  var frm = document.forms['reggie'];
    8282  var csvId = frm['csv.id'].value;
     83  var csvPath = frm['csv.path'].value;
    8384  if (!csvId) return;
    8485 
     
    9293  var response = JSON.parse(request.responseText); 
    9394 
    94   if (response.messages.length > 0)
     95  if (response.messages && response.messages.length > 0)
    9596  {
    9697    var messages = '<ul>';
     
    131132    setInputStatus('bioplate', 'Data has already been imported to this plate', 'warning');
    132133  }
     134  else
     135  {
     136    // Try to get date from the filename
     137    var dates = csvPath.match(/\d\d\d\d-\d\d-\d\d/);
     138    if (dates.length >= 1)
     139    {
     140      var date = dates[0];
     141      frm.qcRunDate.value = date.substr(0, 4)+date.substr(5, 2)+date.substr(8, 2);
     142      qcRunDateOnChange();
     143    }
     144   
     145  }
    133146  if (bioplate.QCOperator)
    134147  {
     
    147160  var frm = document.forms['reggie'];
    148161  var csvId = parseInt(frm['csv.id'].value);
    149   var gxdId = parseInt(frm['gxd.id'].value);
     162  var gxdStdId = parseInt(frm['gxd.std.id'].value);
     163  var gxdHiId = parseInt(frm['gxd.hi.id'].value);
    150164  var pdfId = parseInt(frm['pdf.id'].value);
    151165 
     
    163177
    164178  frm['csv.path'].disabled = true;
    165   frm['gxd.path'].disabled = true;
     179  frm['gxd.std.path'].disabled = true;
     180  frm['gxd.hi.path'].disabled = true;
    166181  frm['pdf.path'].disabled = true;
    167182  Main.addClass(document.getElementById('btnCsv'), 'disabled');
    168   Main.addClass(document.getElementById('btnGxd'), 'disabled');
     183  Main.addClass(document.getElementById('btnGxdStd'), 'disabled');
     184  Main.addClass(document.getElementById('btnGxdHi'), 'disabled');
    169185  Main.addClass(document.getElementById('btnPdf'), 'disabled');
    170186 
    171187  var submitInfo = new Object();
    172188  submitInfo.csv = csvId;
    173   submitInfo.gxd = gxdId;
     189  submitInfo.gxdStd = gxdStdId;
     190  submitInfo.gxdHi = gxdHiId;
    174191  submitInfo.pdf = pdfId;
    175192  submitInfo.QCRunDate = frm.qcRunDate.value;
     
    187204  var response = JSON.parse(request.responseText);
    188205 
    189   if (response.messages.length > 0)
     206  if (response.messages && response.messages.length > 0)
    190207  {
    191208    var msg = '<ul>';
     
    267284  <form name="reggie" onsubmit="return false;">
    268285    <input type="hidden" name="csv.id" value="">
    269     <input type="hidden" name="gxd.id" value="">
     286    <input type="hidden" name="gxd.std.id" value="">
     287    <input type="hidden" name="gxd.hi.id" value="">
    270288    <input type="hidden" name="pdf.id" value="">
    271289 
     
    280298      <table border="0" cellspacing="0" cellpadding="0" width="100%">
    281299      <tr valign="top">
    282         <td class="prompt">CSV file</td>
     300        <td class="prompt">Well table CSV</td>
    283301        <td class="input">
    284302              <table border="0" cellspacing="0" cellpadding="0">
     
    299317        <td class="status" id="csv.status"></td>
    300318        <td class="help"><span id="csv.message" class="message" style="display: none;"></span>
    301           Select the CSV file that contains the exported analysis result from the
     319          Select the <b>Well Table CSV file</b> that contains the exported analysis result from the
    302320          Caliper software.
    303321        </td>
    304322      </tr>
    305323      <tr valign="top">
    306         <td class="prompt">GXD file</td>
     324        <td class="prompt">GXD standard</td>
    307325        <td class="input">
    308326              <table border="0" cellspacing="0" cellpadding="0">
    309327              <tr>
    310328              <td><input class="text" type="text"
    311                 name="gxd.path" value=""
     329                name="gxd.std.path" value=""
    312330                size="50"></td>
    313331              <td style="padding-left: 4px;"><base:button
    314332                  title="Browse&hellip;"
    315                   onclick="browseOnClick('gxd')"
    316                   id="btnGxd"
     333                  onclick="browseOnClick('gxd.std')"
     334                  id="btnGxdStd"
    317335                  />
    318336              </td>
     
    321339         
    322340        </td>
    323         <td class="status" id="gxd.status"></td>
    324         <td class="help"><span id="gxd.message" class="message" style="display: none;"></span>
    325           Select the GXD file that contains the raw data from the Caliper machine.
     341        <td class="status" id="gxd.std.status"></td>
     342        <td class="help"><span id="gxd.std.message" class="message" style="display: none;"></span>
     343          Select the <b>Standard GXD file</b> that contains the raw data.
     344        </td>
     345      </tr>
     346      <tr valign="top">
     347        <td class="prompt">GXD high sense</td>
     348        <td class="input">
     349              <table border="0" cellspacing="0" cellpadding="0">
     350              <tr>
     351              <td><input class="text" type="text"
     352                name="gxd.hi.path" value=""
     353                size="50"></td>
     354              <td style="padding-left: 4px;"><base:button
     355                  title="Browse&hellip;"
     356                  onclick="browseOnClick('gxd.hi')"
     357                  id="btnGxdHi"
     358                  />
     359              </td>
     360              </tr>
     361              </table>
     362         
     363        </td>
     364        <td class="status" id="gxd.hi.status"></td>
     365        <td class="help"><span id="gxd.hi.message" class="message" style="display: none;"></span>
     366          Select the <b>High sense GXD file</b> that contains the raw data.
    326367        </td>
    327368      </tr>
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/plugins/CaliperPlateImporter.java

    r1556 r1561  
    142142    numImported = 0;
    143143    errorMessages.clear();
     144    Map<String,Integer> locations = new HashMap<String, Integer>();
    144145
    145146    FlatFileParser ffp = getFlatFileParser();
     
    207208      // Validate that the location is the same in BASE and the CSV
    208209      if (!checkLocation(dc, extract, location, lineNo)) continue; // with the next line
    209    
     210     
     211      // Check that the same location has not been seen before in this file
     212      if (locations.containsKey(location))
     213      {
     214        addErrorMessage("Line " + lineNo + ": Duplicate well '" + location + "' with extract '" + extractName + "'. Also found on line " + locations.get(location) + ".");
     215        continue; // with the next line
     216      }
     217      locations.put(location, lineNo);
     218     
    210219      // Load annotations
    211220      AnnotationSet as = extract.getAnnotationSet();
    212221      for (String col : annotations.keySet())
    213222      {
    214         Mapper m = amap.get(col);
    215         AnnotationType at = annotations.get(col);
    216        
    217         String sval = m.getValue(data);
    218         Object val = at.getValueType().parseString(sval);
    219        
    220         as.getAnnotation(at).setValue(val);
    221       }
     223        try
     224        {
     225          Mapper m = amap.get(col);
     226          AnnotationType at = annotations.get(col);
     227         
     228          String sval = m.getValue(data);
     229          Object val = at.getValueType().parseString(sval);
     230         
     231          as.getAnnotation(at).setValue(val);
     232        }
     233        catch (RuntimeException ex)
     234        {
     235          addErrorMessage("Line " + lineNo + ", column '" + col + "': " + ex.getClass().getSimpleName() + " " + ex.getMessage());
     236          errorOnThisLine = true;
     237        }
     238      }
     239      if (errorOnThisLine) continue; // with the next line
    222240     
    223241      numImported++;
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/RnaQcServlet.java

    r1560 r1561  
    369369
    370370        Number csvId = (Number)jsonReq.get("csv");
    371         Number gxdId = (Number)jsonReq.get("gxd");
     371        Number gxdStdId = (Number)jsonReq.get("gxdStd");
     372        Number gxdHiId = (Number)jsonReq.get("gxdHi");
    372373        Number pdfId = (Number)jsonReq.get("pdf");
    373374       
     
    389390         
    390391          // Attach the files we used to the bioplate
    391           cpi.attachFile(dc, csv, "CSV file");
     392          cpi.attachFile(dc, csv, "Well table CSV");
    392393          jsonMessages.add("Attached file '" + csv.getName() + "' to plate " + plate.getName());
    393           if (gxdId != null)
    394           {
    395             File gxd = File.getById(dc, gxdId.intValue());
    396             cpi.attachFile(dc, gxd, "LabView GX raw data");
     394          if (gxdStdId != null)
     395          {
     396            File gxd = File.getById(dc, gxdStdId.intValue());
     397            cpi.attachFile(dc, gxd, "LabView GX raw data (std)");
     398            jsonMessages.add("Attached file '" + gxd.getName() + "' to plate " + plate.getName());
     399          }
     400          if (gxdHiId != null)
     401          {
     402            File gxd = File.getById(dc, gxdHiId.intValue());
     403            cpi.attachFile(dc, gxd, "LabView GX raw data (hi)");
    397404            jsonMessages.add("Attached file '" + gxd.getName() + "' to plate " + plate.getName());
    398405          }
     
    418425          json.put("message", "Import failed from file: " + csv.getName());
    419426        }
    420        
    421       }
    422      
     427      }
    423428
    424429      json.put("messages", jsonMessages);
Note: See TracChangeset for help on using the changeset viewer.