Changeset 6212


Ignore:
Timestamp:
Apr 14, 2021, 2:44:22 PM (13 months ago)
Author:
Nicklas Nordborg
Message:

References #1295: Registration of specimen handled by external lab

Added possibility to select an "Operator" when importing that override values from the JSON files.

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

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/trunk/resources/batch/import-external-specimen.js

    r6211 r6212  
    5454    html += '<th>FASTQ files</th>';
    5555    html += '<th class="icon"></th>'
    56     html += '<th class="dottedleft"></th>';
    57     html += '<th class="dottedleft">Import</th>';
     56    html += '<th class="valid dottedleft" colspan="2">Import</th>';
    5857    html += '</tr>';
    5958    html += '</thead>';
     
    7776      html += '<td>'+(Strings.encodeTags(item.itemType) || '-')+'</td>';
    7877      html += '<td class="dottedleft">'+(Strings.encodeTags(item.name) || '-')+'</td>';
    79       html += '<td class="dottedleft">';
     78      html += '<td class="dottedleft" style="white-space: nowrap;">';
    8079      if (jsonFile)
    8180      {
     
    8483      }
    8584      html += '</td>';
    86       html += '<td class="fastq">';
     85      html += '<td class="fastq" style="white-space: nowrap;">';
    8786      if (jsonFile && jsonFile.fastq)
    8887      {
     
    9190          var fq = jsonFile.fastq[fqNo];
    9291          html += Strings.encodeTags(fq.name);
     92          html += ' <span class="file-data">('
    9393          if (fq.size > 0)
    9494          {
    95             html += '; ' + Numbers.formatBytes(fq.size)+'; '+Reggie.reformatDate(fq.lastModified);
     95            html += Numbers.formatBytes(fq.size)+'; '+Reggie.reformatDate(fq.lastModified);
    9696          }
    9797          else
    9898          {
    99             html += ' (missing)';
     99            html += 'missing';
    100100          }
    101           html += '<br>';
     101          html += ')</span><br>';
    102102        }
    103103      }
     
    106106      if (icon) html+= '<img src="../images/'+icon+'">';
    107107      html += '</td>';
    108       html += '<td class="valid dottedleft">';
     108      html += '<td class="import dottedleft">';
     109      if (canImport)
     110      {
     111        html += '<input type="checkbox" id="import.'+itemNo+'" checked>';
     112      }
     113      html += '</td>';
     114      html += '<td class="valid">';
    109115      var startNo = 1;
    110116      if (jsonFile && jsonFile.errors)
     
    128134        startNo += jsonFile.warnings.length;
    129135      }
    130       html += '</td>';
    131       html += '<td class="dottedleft">';
    132       html += '<input type="checkbox" id="import.'+itemNo+'" '+(canImport?'checked':'disabled')+'>';
     136      if (canImport && startNo == 1)
     137      {
     138        html += 'Import';
     139      }
    133140      html += '</td>';
    134141      html += '</tr>';
     
    168175    for (var itemNo = 0; itemNo < importItems.length; itemNo++)
    169176    {
    170       if (frm['import.'+itemNo].checked) return;
     177      var chk = frm['import.'+itemNo];
     178      if (chk && chk.checked) return;
    171179    }
    172180    Wizard.showGoNextConfirmation(false, 'Please select at least one item!');
     
    281289    var frm = document.forms['reggie'];
    282290    var submitInfo = {};
     291    submitInfo.operator = frm.operator.value;
    283292   
    284293    var items = [];
     
    286295    for (var itemNo = 0; itemNo < importItems.length; itemNo++)
    287296    {
    288       if (frm['import.'+itemNo].checked)
     297      var chk = frm['import.'+itemNo];
     298      if (chk && chk.checked)
    289299      {
    290300        var item = importItems[itemNo]
  • extensions/net.sf.basedb.reggie/trunk/resources/batch/import-external-specimen.jsp

    r6211 r6212  
    4949}
    5050
     51#importItemsTable th
     52{
     53  padding: 4px;
     54}
     55
    5156#importItemsTable td
    5257{
     
    6065}
    6166
    62 #importItemsTable td.icon
     67#importItemsTable td.icon, #importItemsTable td.import
    6368{
    6469  width: 20px;
     
    6974{
    7075  text-align: left;
     76}
     77
     78.file-data
     79{
     80  font-style: italic;
     81  opacity: 0.5;
    7182}
    7283
     
    94105    <div class="step" id="step-2">
    95106      <div class="step-no">2</div>
    96       <div class="step-title">FASTQ import options</div>
     107      <div class="step-title">Import options</div>
    97108      <div class="step-content">
    98109 
    99110        <table class="step-form">
    100111        <tbody>
     112          <tr>
     113            <td class="prompt">Operator</td>
     114            <td class="input">
     115              <select name="operator" id="operator">
     116                <option value="CMD">CMD
     117                <option value="">- Use JSON -
     118              </option>
     119            </td>
     120            <td class="status" id="operator.status"></td>
     121            <td class="help">
     122              <span id="operator.message" class="message"></span>
     123              The external operator. If the <i>Use JSON</i> option is selected
     124              the operator information is taken from the JSON file.
     125            </td>
     126          </tr>
     127        </tbody>
     128        <tbody>
     129          <tr class="section-header">
     130            <td colspan="4">FASTQ Import</td>
     131          </tr>
    101132          <tr>
    102133            <td class="subprompt">Auto-analyze</td>
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/plugins/cmd/DnaInfo.java

    r6207 r6212  
    3232      PlateCoordinate tmp = section.getRequiredEntry("Qiacube position", PlateWellValidator.QIACUBE);
    3333      if (tmp != null) qiacubePos = 6*tmp.getColumn()+tmp.getRow()+1;
    34       operator = section.getRequiredEntry("Qiacube operator");
     34      operator = section.getOptionalEntry("Qiacube operator", null);
    3535     
    3636      // TODO - qiacube run number
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/plugins/cmd/FlowCellInfo.java

    r6209 r6212  
    5353      size = section.getRequiredEntry("Size", IntValidator.FLOWCELL_SIZE_2_OR_4);
    5454      sequencingCycles = section.getRequiredEntry("SequencingCycles", PatternValidator.SEQUENCING_CYCLES);
    55       operator = section.getRequiredEntry("Operator");
     55      operator = section.getOptionalEntry("Operator", null);
    5656    }
    5757    valid = section != null && !section.hasError();
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/plugins/cmd/FlowThroughInfo.java

    r6207 r6212  
    3131      PlateCoordinate tmp = section.getRequiredEntry("Qiacube position", PlateWellValidator.QIACUBE);
    3232      if (tmp != null) qiacubePos = 6*tmp.getColumn()+tmp.getRow()+1;
    33       operator = section.getRequiredEntry("Qiacube operator");
     33      operator = section.getOptionalEntry("Qiacube operator", null);
    3434     
    3535      // TODO - qiacube run number
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/plugins/cmd/JsonFile.java

    r6210 r6212  
    8080  private final List<String> debugMessages;
    8181
     82  private String operator;
     83 
    8284  private String rawData;
    8385  private JSONObject json;
     
    203205 
    204206  /**
     207    Override the "Operator" (and similar) information in the JSON file
     208    with the value specified here. This can be called before
     209    or after parsing the JSON file.
     210   */
     211  public void setOperator(String operator)
     212  {
     213    this.operator = operator;
     214    if (dnaInfo != null) dnaInfo.operator = operator;
     215    if (rnaInfo != null) rnaInfo.operator = operator;
     216    if (flowThroughInfo != null) flowThroughInfo.operator = operator;
     217    if (libInfo != null) libInfo.operator = operator;
     218    if (poolInfo != null) poolInfo.operator = operator;
     219    if (flowCellInfo != null) flowCellInfo.operator = operator;
     220    if (seqRunInfo != null) seqRunInfo.operator = operator;
     221  }
     222 
     223  /**
    205224    Download and parse the JSON file from the remote server.
    206225  */
     
    243262      demuxInfo = new DemuxInfo(getRequiredSection("DemuxedSequences"), seqRunInfo, flowCellInfo);
    244263      mergeInfo = new MergeInfo(getRequiredSection("MergedSequences"));
     264     
     265      if (operator != null) setOperator(operator);
    245266    }
    246267    catch (Exception ex)
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/plugins/cmd/JsonSection.java

    r6201 r6212  
    8787
    8888  /**
    89     Get a required entry from the JSON file.
    90     No other validation is performed.
     89    Get an optional entry from the JSON file. A validator is
     90    optional, but if a validator is given it will be called
     91    also for null values.
    9192  */
    9293  @SuppressWarnings("unchecked")
    93   public <T> T getRequiredEntry(String key)
     94  public <T, F> T getOptionalEntry(String key, ValueValidator<F, T> validator)
    9495  {
    95     T val = (T)json.get(key);
    96     if (val == null)
     96    Object val = json.get(key);
     97    T result = null;
     98    if (validator != null)
    9799    {
    98       addErrorMessage("Missing entry in JSON: "+section+"."+key);
     100      if (val != null && !validator.getExpectedClass().isInstance(val))
     101      {
     102        addErrorMessage("Invalid entry in JSON: "+section+"."+key+"="+val+
     103          " (expected "+validator.getExpectedClass().getSimpleName()+", got " + val.getClass().getSimpleName()+")");
     104      }
     105      else
     106      {
     107        try
     108        {
     109          result = validator.isValid(file.dc(), (F)val, this, section+"."+key);
     110        }
     111        catch (Exception ex)
     112        {
     113          addErrorMessage("Invalid entry in JSON: "+section+"."+key+"="+val+" ("+ex.getMessage()+")");
     114        }
     115      }
    99116    }
    100     return val;
     117    else
     118    {
     119      result = (T)val;
     120    }
     121    return result;
    101122  }
    102123 
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/plugins/cmd/LibraryInfo.java

    r6206 r6212  
    6767      libMolarity = section.getRequiredEntry("Library molarity", FloatValidator.POSITIVE);
    6868      qubitConc = section.getRequiredEntry("Qubit concentration (ng/ul)", FloatValidator.POSITIVE);
    69       operator = section.getRequiredEntry("Operator");
     69      operator = section.getOptionalEntry("Operator", null);
    7070     
    7171      barcode = section.getRequiredEntry("Barcode", BarcodeValidator.INSTANCE);
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/plugins/cmd/PoolInfo.java

    r6206 r6212  
    4747      }
    4848      poolDate = section.getRequiredEntry("Date", DateValidator.YYYY_MM_DD.warnIfFutureOrOlder(365));
    49       operator = section.getRequiredEntry("Operator");
     49      operator = section.getOptionalEntry("Operator", null);
    5050    }
    5151    valid = section != null && !section.hasError();
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/plugins/cmd/RnaInfo.java

    r6207 r6212  
    3333      PlateCoordinate tmp = section.getRequiredEntry("Qiacube position", PlateWellValidator.QIACUBE);
    3434      if (tmp != null) qiacubePos = 6*tmp.getColumn()+tmp.getRow()+1;
    35       operator = section.getRequiredEntry("Qiacube operator");
     35      operator = section.getOptionalEntry("Qiacube operator", null);
    3636     
    3737      // TODO - qiacube run number
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/plugins/cmd/SequencingRunInfo.java

    r6206 r6212  
    5151      startDate = section.getRequiredEntry("StartDate", DateValidator.YYMMDD.warnIfFutureOrOlder(365));
    5252      endDate = section.getRequiredEntry("EndDate", DateValidator.YYMMDD_HH_MM_SS.warnIfFutureOrOlder(startDate));
    53       operator = section.getRequiredEntry("Operator");
     53      operator = section.getOptionalEntry("Operator", null);
    5454      if (flowCellInfo.flowCell != null)
    5555      {
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/FutureSpecimenServlet.java

    r6211 r6212  
    4747import net.sf.basedb.reggie.plugins.FutureSpecimenImporter.ImportedItems;
    4848import net.sf.basedb.reggie.plugins.cmd.JsonFile;
     49import net.sf.basedb.util.Values;
    4950import net.sf.basedb.util.error.ThrowableUtil;
    5051
     
    196197        JSONArray jsonItems = (JSONArray)jsonReq.get("items");
    197198        JSONObject jsonAutoAnalyze = (JSONObject)jsonReq.get("autoAnalyze");
     199        String operator = Values.getStringOrNull((String)jsonReq.get("operator"));
    198200
    199201        OpenGridCluster cluster = null;
     
    242244            JsonFile jsonFile = new JsonFile(dc, (String)jsonItem.get("jsonFile"));
    243245            jsonFile.downloadAndParse(dc, gatewaySession, gatewayRoot);
     246            if (operator != null) jsonFile.setOperator(operator);
    244247           
    245248            Sample specimen = Sample.getById(dc, itemId.intValue());
     
    276279           
    277280            jsonMessages.addAll(prefix("[Warning]["+jsonFile.getName()+"] ", jsonFile.getWarningMessages()));
    278             // jsonMessages.addAll(prefix("[Debug]["+jsonFile.getName()+"] ", jsonFile.getDebugMessages()));
     281            //jsonMessages.addAll(prefix("[Debug]["+jsonFile.getName()+"] ", jsonFile.getDebugMessages()));
    279282          }
    280283         
Note: See TracChangeset for help on using the changeset viewer.