Changeset 2225


Ignore:
Timestamp:
Feb 13, 2014, 8:44:46 AM (9 years ago)
Author:
Nicklas Nordborg
Message:

References #533: Register sequencing as ended

New version of the 'sequencing ended' wizard. Added an option to specify if first base report failed. If so, the 'sequencing startup' wizard is enabled again for the flow cell. Other changes are mostly related to that there is only a single parent FlowCell for each SequencingRun.

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

Legend:

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

    r2198 r2225  
    124124  var seqRun = frm.seqRuns[frm.seqRuns.selectedIndex].seqRun;
    125125 
    126   setInnerHTML('startDate', formatDate(seqRun.sequencingStart));
    127  
    128   var html = '';
    129   for (var fcNo = 0; fcNo < seqRun.flowCells.length; fcNo++)
    130   {
    131     var fc = seqRun.flowCells[fcNo];
    132     if (fcNo > 0) html += '<br>';
    133     html += '<b>['+fc.HiSeqPosition+']</b> ' + fc.FlowCellID;
    134   }
     126  setInnerHTML('startDate', formatDate(seqRun.SequencingStart));
     127 
     128  var fc = seqRun.flowCell;
     129  var html = '<b>['+seqRun.HiSeqPosition+']</b> ' + fc.FlowCellID;
    135130 
    136131  setInnerHTML('flowCellsInRun', html);
     
    168163  setInnerHTML('step.2.title', seqRun.name);
    169164 
    170   // Flow cell comments
    171   var html = '';
    172   for (var fcNo = 0; fcNo < seqRun.flowCells.length; fcNo++)
    173   {
    174     var fc = seqRun.flowCells[fcNo];
    175    
    176     html += '<tr valign="top">';
    177     html += '<td class="prompt">Flow cell ['+fc.HiSeqPosition+']</td>';
    178     html += '<td class="input"><b>' + fc.FlowCellID + '</b></td>';
    179     html += '<td class="status"></td>';
    180     html += '<td class="help"></td>';
    181     html += '</tr>';
    182    
    183     html += '<tr valign="top">';
    184     html += '<td class="subprompt">Comments</td>';
    185     html += '<td class="input"><textarea rows="4" cols="50" style="width: 90%;" name="comments.'+fc.id+'" value=""></textarea></td>';
    186     html += '<td class="status"></td>';
    187     html += '<td class="help">Comments for the flow cell.</td>';
    188     html += '</tr>';
    189   }
    190  
    191   setInnerHTML('flowCells', html);
    192  
    193   for (var fcNo = 0; fcNo < seqRun.flowCells.length; fcNo++)
    194   {
    195     var fc = seqRun.flowCells[fcNo];
    196     frm['comments.'+fc.id].value = fc.comments;
    197   }
    198    
    199165  frm.turnAroundDate.focus();
    200166}
     
    322288  frm.endTime.disabled = true;
    323289  frm.sequencingComments.disabled = true;
    324  
    325  
    326   var seqRun = frm.seqRuns[frm.seqRuns.selectedIndex].seqRun;
    327   for (var fcNo = 0; fcNo < seqRun.flowCells.length; fcNo++)
    328   {
    329     var fc = seqRun.flowCells[fcNo];
    330     frm['comments.'+fc.id].disabled = true;
    331     fc.comments = frm['comments.'+fc.id].value;
    332   }
     290  frm.firstBaseReport[0].disabled = true;
     291  frm.firstBaseReport[1].disabled = true;
    333292 
    334293  Main.hide('goregister');
     
    336295  Main.hide('gonext.message');
    337296 
    338  
     297  var seqRun = frm.seqRuns[frm.seqRuns.selectedIndex].seqRun;
     298  seqRun.firstBaseReportFailed = document.getElementById('firstBaseReportFailed').checked;
    339299  seqRun.turnAroundDate = Main.trimString(frm.turnAroundDate.value + ' ' + frm.turnAroundTime.value);
    340300  seqRun.endDate = Main.trimString(frm.endDate.value + ' ' + frm.endTime.value);
     
    449409     
    450410      <tr valign="top">
    451         <td class="subprompt">- flow cells</td>
     411        <td class="subprompt">- flow cell</td>
    452412        <td class="input" id="flowCellsInRun"></td>
    453413        <td class="status"></td>
     
    471431      <table>
    472432      <tr valign="top">
     433        <td class="prompt">First base report</td>
     434        <td class="input">
     435          <label><input type="radio" name="firstBaseReport" id="firstBaseReportOk" value="1" checked>Ok</label>
     436          <label><input type="radio" name="firstBaseReport" id="firstBaseReportFailed" value="0">Failed</label>
     437        </td>
     438        <td class="status" id="firstBaseReport.status"></td>
     439        <td class="help"><span id="firstBaseReport.message" class="message" style="display: none;"></span>
     440          If first base report failed and a restart was possible a new 'sequencing start'
     441          must be registered.
     442        </td>
     443      </tr>
     444      <tr valign="top">
    473445        <td class="prompt">Turn-around date</td>
    474446        <td class="input"><input type="text" name="turnAroundDate" value="" size="12" maxlength="10"
     
    497469        <td class="help"><span id="sequencingComments.message" class="message" style="display: none;"></span>Comments about the sequencing.</td>
    498470      </tr>
    499 
    500       <tbody id="flowCells"></tbody>
    501      
    502471      </table>
    503472    </td>
  • extensions/net.sf.basedb.reggie/trunk/resources/libprep/sequencing_started.jsp

    r2224 r2225  
    254254      html += '<tr valign="top" class="fc-info">';
    255255      html += '<td class="subprompt">'+seqRun.name+'</td>';
    256       html += '<td class="input">'+formatDate(seqRun.SequencingStart, '(no start date)') + ' -- ' + formatDate(seqRun.SequencingEnd, '(no end date)')+'</td>';
    257       html += '<td class="status"></td>';
     256      html += '<td class="input" colspan="2">';
     257      html += formatDate(seqRun.SequencingStart, '(no start date)') + ' -- ' + formatDate(seqRun.SequencingEnd, '(no end date)');
     258      if (seqRun.SequencingResult)
     259      {
     260        html += ': ' + seqRun.SequencingResult;
     261      }
     262      html += '</td>';
    258263      html += '<td class="help"></td>';
    259264      html += '</tr>';
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/Annotationtype.java

    r2224 r2225  
    728728    new Annotationtype("DataFilesFolder", Type.STRING, Item.DERIVEDBIOASSAY);
    729729
    730  
     730  /**
     731    The "SequencingResult" annotation, used for derived bioassays (SequencingRun).
     732    A value of "Successful" typically means that the process can continue with
     733    next step (demux and merge). A value of "Failed" indicates a complete
     734    failure that require a new flow cell to be clustered. The pooled
     735    libraries on the current flow cell are flagged with "SequencingFailed".
     736    A value of "FirstBaseReportFailed" indicates that the first sequencing attempt
     737    failed but that it is possible to re-start with the same flow cell. The
     738    annotation is also copied to the flow cell.
     739    @since 2.15
     740  */
     741  public static final Annotationtype SEQUENCING_RESULT =
     742    new Annotationtype("SequencingResult", Type.STRING, Item.PHYSICALBIOASSAY, Item.DERIVEDBIOASSAY);
     743
    731744  /**
    732745    Get the annotation type by name of the static constant defined in this class.
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/FlowCell.java

    r2222 r2225  
    8080 
    8181  /**
    82     Load pools used on the flow cell.
     82    Load the flow cell on the sequening run.
    8383  */
    84   public static List<FlowCell> getBySequencingRun(DbControl dc, SequencingRun sequencingRun)
     84  public static FlowCell getBySequencingRun(DbControl dc, SequencingRun sequencingRun)
    8585  {
    8686    ItemQuery<PhysicalBioAssay> fcQuery = PhysicalBioAssay.getQuery();
     
    9696    List<PhysicalBioAssay> tmp = fcQuery.list(dc);
    9797 
    98     return toList(tmp);
     98    PhysicalBioAssay fc = null;
     99    if (tmp.size() > 1)
     100    {
     101      throw new InvalidDataException(
     102          "More than one flow cell was found on " + sequencingRun.getName() +
     103          "This wizard can't be used until that is corrected.");
     104    }
     105    else if (tmp.size() == 1)
     106    {
     107      fc = tmp.get(0);
     108    }
     109   
     110    return fc == null ? null : new FlowCell(fc);
    99111  }
    100112
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/SequencingRun.java

    r2224 r2225  
    2727{
    2828
     29  /**
     30    Value for the {@link Annotationtype#SEQUENCING_RESULT} annotation
     31    when the sequencing was successful.
     32    @since 2.15
     33  */
     34  public static final String SEQUENCING_SUCCESSFUL = "Successful";
     35 
     36  /**
     37    Value for the {@link Annotationtype#SEQUENCING_RESULT} annotation when
     38    the sequencing failed and a new flow cell must be used for re-sequencing.
     39    @since 2.15
     40  */
     41  public static final String SEQUENCING_FAILED = "Failed";
     42 
     43  /**
     44    Value for the {@link Annotationtype#SEQUENCING_RESULT} annotation when
     45    the first base report failed and the same flow cell can be used
     46    for re-sequencing.
     47    @since 2.15
     48  */
     49  public static final String SEQUENCING_FIRST_BASE_REPORT_FAILED = "FirstBaseReportFailed";
     50 
    2951  /**
    3052    Get a sequencing run when the id is known.
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/FlowCellServlet.java

    r2224 r2225  
    4545import net.sf.basedb.reggie.dao.ReactionPlate;
    4646import net.sf.basedb.reggie.dao.ReggieRole;
     47import net.sf.basedb.reggie.dao.SequencingRun;
    4748import net.sf.basedb.reggie.dao.Subtype;
    4849import net.sf.basedb.util.Values;
     
    250251        query.join(Annotations.leftJoin(null, Annotationtype.PLATE_PROCESS_RESULT.load(dc), "ppr"));
    251252        query.restrict(Restrictions.eq(Hql.alias("ppr"), Expressions.string(ReactionPlate.PROCESS_SUCCESSFUL)));
    252         // but no child SequencingRun items
     253        // but no child SequencingRun items (unless SequencingResult=FirstBaseReportFailed is set)
     254        query.join(Annotations.leftJoin(null, Annotationtype.SEQUENCING_RESULT.load(dc), "sqr"));
    253255        query.join(Hql.leftJoin("derivedBioAssays", "ssr"));
    254         query.restrict(Restrictions.eq(Hql.alias("ssr"), null));
    255        
     256        query.restrict(
     257          Restrictions.or(
     258            Restrictions.eq(Hql.alias("ssr"), null),
     259            Restrictions.eq(Hql.alias("sqr"), Expressions.string(SequencingRun.SEQUENCING_FIRST_BASE_REPORT_FAILED))
     260          ));
     261
    256262        long count = query.count(dc);
    257263        json.put("count", count);
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/InstallServlet.java

    r2224 r2225  
    6464import net.sf.basedb.reggie.dao.ReggieRole;
    6565import net.sf.basedb.reggie.dao.Rna;
     66import net.sf.basedb.reggie.dao.SequencingRun;
    6667import net.sf.basedb.reggie.dao.Subtype;
    6768import net.sf.basedb.reggie.plugins.CaliperLibPrepParametersExporter;
     
    340341            effectivePermissionsUse, createIfMissing));
    341342        jsonChecks.add(checkAnnotationType(dc, Annotationtype.DATA_FILES_FOLDER, 1, null, effectivePermissionsUse, createIfMissing));
     343        jsonChecks.add(checkAnnotationType(dc, Annotationtype.SEQUENCING_RESULT, 1,
     344            new ValueOptions(SequencingRun.SEQUENCING_SUCCESSFUL, SequencingRun.SEQUENCING_FIRST_BASE_REPORT_FAILED, SequencingRun.SEQUENCING_FAILED),
     345            effectivePermissionsUse, createIfMissing));
    342346       
    343347        // Annotation type categories
     
    423427        jsonChecks.add(checkAnnotationTypeCategory(dc, Subtype.FLOW_CELL, createIfMissing,
    424428            Annotationtype.FLOWCELL_ID, Annotationtype.CLUSTER_START, Annotationtype.CLUSTER_OPERATOR,
    425             Annotationtype.SEQUENCING_CYCLES, Annotationtype.PLATE_PROCESS_RESULT));
     429            Annotationtype.SEQUENCING_CYCLES, Annotationtype.PLATE_PROCESS_RESULT, Annotationtype.SEQUENCING_RESULT));
    426430       
    427431        jsonChecks.add(checkAnnotationTypeCategory(dc, Subtype.SEQUENCING_RUN, createIfMissing,
    428432            Annotationtype.SEQUENCING_START, Annotationtype.SEQUENCING_TURN_AROUND, Annotationtype.SEQUENCING_END,
    429433            Annotationtype.SEQUENCING_OPERATOR, Annotationtype.SEQUENCING_RUN_NUMBER, Annotationtype.SEQUENCING_CYCLES,
    430             Annotationtype.HISEQ_POSITION, Annotationtype.DATA_FILES_FOLDER
     434            Annotationtype.HISEQ_POSITION, Annotationtype.DATA_FILES_FOLDER, Annotationtype.SEQUENCING_RESULT
    431435          ));
    432436       
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/SequencingRunServlet.java

    r2224 r2225  
    9090        query.join(Annotations.leftJoin(null, Annotationtype.SEQUENCING_END.load(dc), "sse"));
    9191        query.restrict(Restrictions.eq(Hql.alias("sse"), null));
    92        
    93        
     92
    9493        JSONArray jsonRuns = new JSONArray();
    9594        List<SequencingRun> runs = SequencingRun.toList(query.list(dc));
    9695        for (SequencingRun run : runs)
    9796        {
    98           run.loadAnnotations(dc, "sequencingStart", Annotationtype.SEQUENCING_START, Reggie.CONVERTER_DATE_TO_STRING);
     97          run.loadAnnotations(dc, "SequencingStart", Annotationtype.SEQUENCING_START, Reggie.CONVERTER_DATE_TO_STRING);
     98          run.loadAnnotations(dc, "HiSeqPosition", Annotationtype.HISEQ_POSITION, null);
    9999          run.setAnnotation("comments", run.getDerivedBioAssay().getDescription());
    100100         
    101           JSONArray jsonFlowCells = new JSONArray();
    102           List<FlowCell> flowCells = FlowCell.getBySequencingRun(dc, run);
    103           for (FlowCell fc : flowCells)
    104           {
    105             fc.loadAnnotations(dc, "FlowCellID", Annotationtype.FLOWCELL_ID, null);
    106             fc.loadAnnotations(dc, "HiSeqPosition", Annotationtype.HISEQ_POSITION, null);
    107             fc.setAnnotation("comments", fc.getItem().getDescription());
    108             jsonFlowCells.add(fc.asJSONObject());
    109           }
    110           run.setAnnotation("flowCells", jsonFlowCells);
     101          FlowCell fc = FlowCell.getBySequencingRun(dc, run);
     102          fc.loadAnnotations(dc, "FlowCellID", Annotationtype.FLOWCELL_ID, null);
     103          fc.setAnnotation("comments", fc.getItem().getDescription());
     104         
     105          run.setAnnotation("flowCell", fc.asJSONObject());
    111106          jsonRuns.add(run.asJSONObject());
    112107        }
     
    126121          seqRun.loadAnnotations(dc, "SequencingStart", Annotationtype.SEQUENCING_START, Reggie.CONVERTER_DATE_TO_STRING);
    127122          seqRun.loadAnnotations(dc, "SequencingEnd", Annotationtype.SEQUENCING_END, Reggie.CONVERTER_DATE_TO_STRING);
     123          seqRun.loadAnnotations(dc, "SequencingResult", Annotationtype.SEQUENCING_RESULT, null);
    128124          seqRun.loadAnnotations(dc, "DataFilesFolder", Annotationtype.DATA_FILES_FOLDER, null);
    129125          jsonSeqRuns.add(seqRun.asJSONObject());
     
    197193        Number flowCellId = (Number)jsonFlowCell.get("id");
    198194        PhysicalBioAssay flowCell = PhysicalBioAssay.getById(dc, flowCellId.intValue());
     195        // Clear result of any previous sequencing runs (eg. FirstBaseReportFailed)
     196        Annotationtype.SEQUENCING_RESULT.setAnnotationValue(dc, flowCell, null);
    199197        sequenceRun.addPhysicalBioAssay(flowCell);
    200198       
     
    218216        JSONObject jsonReq = (JSONObject)new JSONParser().parse(req.getReader());
    219217        JSONObject jsonSeq = (JSONObject)jsonReq.get("sequencingRun");
    220         JSONArray jsonFlowCells = (JSONArray)jsonSeq.get("flowCells");
     218        JSONObject jsonFlowCell = (JSONObject)jsonSeq.get("flowCell");
    221219
    222220        Number seqId = (Number)jsonSeq.get("id");
    223221        DerivedBioAssay seqRun = DerivedBioAssay.getById(dc, seqId.intValue());
     222        Number flowCellId = (Number)jsonFlowCell.get("id");
     223        PhysicalBioAssay fc = PhysicalBioAssay.getById(dc, flowCellId.intValue());
    224224       
    225225        Date turnAroundDate = Reggie.CONVERTER_STRING_TO_DATETIME.convert((String)jsonSeq.get("turnAroundDate"));
     
    227227        Annotationtype.SEQUENCING_TURN_AROUND.setAnnotationValue(dc, seqRun, turnAroundDate);
    228228        Annotationtype.SEQUENCING_END.setAnnotationValue(dc, seqRun, endDate);
    229        
    230229        seqRun.setDescription((String)jsonSeq.get("comments"));
    231230       
    232         for (int fcNo = 0; fcNo < jsonFlowCells.size(); ++fcNo)
    233         {
    234           JSONObject jsonFlowCell = (JSONObject)jsonFlowCells.get(fcNo);
    235           Number fcId = (Number)jsonFlowCell.get("id");
    236 
    237           PhysicalBioAssay flowCell = PhysicalBioAssay.getById(dc, fcId.intValue());
    238           flowCell.setDescription((String)jsonFlowCell.get("comments"));
    239         }
    240        
    241         jsonMessages.add(seqRun.getName() + " registered as ended.");
     231        if (Boolean.TRUE.equals(jsonSeq.get("firstBaseReportFailed")))
     232        {
     233          Annotationtype.SEQUENCING_RESULT.setAnnotationValue(dc, seqRun, SequencingRun.SEQUENCING_FIRST_BASE_REPORT_FAILED);
     234          Annotationtype.SEQUENCING_RESULT.setAnnotationValue(dc, fc, SequencingRun.SEQUENCING_FIRST_BASE_REPORT_FAILED);
     235          jsonMessages.add(seqRun.getName() + " registered as ended with status: " + SequencingRun.SEQUENCING_FIRST_BASE_REPORT_FAILED);
     236        }
     237        else
     238        {
     239          Annotationtype.SEQUENCING_RESULT.setAnnotationValue(dc, fc, null);
     240          jsonMessages.add(seqRun.getName() + " registered as ended.");
     241        }
     242       
    242243        dc.commit();
    243244      }
Note: See TracChangeset for help on using the changeset viewer.