Changeset 5869


Ignore:
Timestamp:
Mar 19, 2020, 9:54:30 AM (21 months ago)
Author:
Nicklas Nordborg
Message:

References #1231: Add support for sequencing with NovaSeq?

Fixed auto-confirmation and the manual "Register sequencing ended" wizard so that they are compatible with the external NovaSeq pipeline.

On the library and pool level there are lots of annotations with missing values. Most of them are related to lab-specific things such as concentrations, volumes, etc.

Several items have an emtpy 'XxxxOperator?' annotation. We could maybe use this to specify the external lab (eg. 'CTG').

We need to check if some of the missing annotations are used by the release exporter, and if so, if they are affecting things. For example, we use dates to order items to get a "batch index". We would not like this to break.

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

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/trunk/resources/sequencing/sequencing_ended.js

    r5857 r5869  
    305305    var seqRun = frm.seqRuns[frm.seqRuns.selectedIndex].seqRun;
    306306    var fc = seqRun.flowCell;
    307     var numReads = fc.SequencingCycles.split('-').length;
    308    
    309307    var doc;
    310308    var info = {};
     
    327325        info.ScanNumber = parseInt(sequencing.getTextValue(doc, 'RunNumber'));
    328326        info.FlowCellID = sequencing.getTextValue(doc, 'FlowCellSerial');
    329         if (numReads == 4)
    330         {
    331           info.SequencingCycles = sequencing.getTextValue(doc, 'Read1') + '-' + sequencing.getTextValue(doc, 'Index1Read') + '-' + sequencing.getTextValue(doc, 'Index2Read') + '-' + sequencing.getTextValue(doc, 'Read2');
    332         }
    333         else
    334         {
    335           info.SequencingCycles = sequencing.getTextValue(doc, 'Read1') + '-' + sequencing.getTextValue(doc, 'Index1Read') + '-' + sequencing.getTextValue(doc, 'Read2');
    336         }
     327       
     328        var read1 = sequencing.getTextValue(doc, 'Read1');
     329        var index1 = sequencing.getTextValue(doc, 'Index1Read');
     330        var index2 = sequencing.getTextValue(doc, 'Index2Read');
     331        var read2 = sequencing.getTextValue(doc, 'Read2');
     332        info.SequencingCycles = sequencing.getSequencingCycles(read1, index1, index2, read2);
    337333        info.SequencingStart = '20'+sequencing.getTextValue(doc, 'RunStartDate');
    338334      }
     
    345341        info.ScanNumber = parseInt(sequencing.getTextValue(doc, 'ScanNumber'));
    346342        info.FlowCellID = sequencing.getTextValue(doc, 'Barcode');
    347         if (numReads == 4)
    348         {
    349           info.SequencingCycles = sequencing.getTextValue(doc, 'Read1') + '-' + sequencing.getTextValue(doc, 'IndexRead1') + '-' + sequencing.getTextValue(doc, 'IndexRead2') + '-' + sequencing.getTextValue(doc, 'Read2');
    350         }
    351         else
    352         {
    353           info.SequencingCycles = sequencing.getTextValue(doc, 'Read1') + '-' + sequencing.getTextValue(doc, 'IndexRead1') + '-' + sequencing.getTextValue(doc, 'Read2');
    354         }
     343
     344        var read1 = sequencing.getTextValue(doc, 'Read1');
     345        var index1 = sequencing.getTextValue(doc, 'Index1Read');
     346        var index2 = sequencing.getTextValue(doc, 'Index2Read');
     347        var read2 = sequencing.getTextValue(doc, 'Read2');
     348        info.SequencingCycles = sequencing.getSequencingCycles(read1, index1, index2, read2);
    355349        info.SequencingStart = '20'+sequencing.getTextValue(doc, 'RunStartDate');
    356350      }
     
    363357        info.ScanNumber = parseInt(sequencing.getTextValue(doc, 'RunNumber'));
    364358        info.FlowCellID = sequencing.getTextValue(doc, 'RfidsInfo>FlowCellSerialBarcode');
    365         if (numReads == 4)
    366         {
    367           info.SequencingCycles = sequencing.getTextValue(doc, 'Read1NumberOfCycles') + '-' + sequencing.getTextValue(doc, 'IndexRead1NumberOfCycles') + '-' + sequencing.getTextValue(doc, 'IndexRead2NumberOfCycles') + '-' + sequencing.getTextValue(doc, 'Read2NumberOfCycles');
    368         }
    369         else
    370         {
    371           info.SequencingCycles = sequencing.getTextValue(doc, 'Read1NumberOfCycles') + '-' + sequencing.getTextValue(doc, 'IndexRead1NumberOfCycles') + '-' + sequencing.getTextValue(doc, 'Read2NumberOfCycles');
    372         }
     359        var read1 = sequencing.getTextValue(doc, 'Read1NumberOfCycles');
     360        var index1 = sequencing.getTextValue(doc, 'IndexRead1NumberOfCycles');
     361        var index2 = sequencing.getTextValue(doc, 'IndexRead2NumberOfCycles');
     362        var read2 = sequencing.getTextValue(doc, 'Read2NumberOfCycles');
     363        info.SequencingCycles = sequencing.getSequencingCycles(read1, index1, index2, read2);
    373364        info.SequencingStart = '20'+sequencing.getTextValue(doc, 'RunStartDate');
    374        
    375365      }
    376366    }
     
    393383    }
    394384    return el.textContent;
     385  }
     386 
     387  sequencing.getSequencingCycles = function(read1, index1, index2, read2)
     388  {
     389    return read1+'-'+index1+'-'+(index2=='0'?'':index2+'-')+read2;
    395390  }
    396391
     
    419414    // Seq run info
    420415    Doc.element('startDate').innerHTML = Reggie.reformatDate(info.SequencingStart) || '';
    421     if (seqRun.SequencingStart != info.SequencingStart)
     416    if (seqRun.SequencingStart && seqRun.SequencingStart != info.SequencingStart)
    422417    {
    423418      Wizard.setInputStatus('startDate', 'warning', 'Not same as registered start date ('+Reggie.reformatDate(seqRun.SequencingStart)+').');
    424419    }
    425420    Doc.element('sequencingCycles').innerHTML = info.SequencingCycles || '';
    426     if (fc.SequencingCycles != info.SequencingCycles)
     421    if (fc.SequencingCycles && fc.SequencingCycles != info.SequencingCycles)
    427422    {
    428423      Wizard.setInputStatus('sequencingCycles', 'warning', 'Not same as planned SequencingCycles ('+Strings.encodeTags(fc.SequencingCycles)+').');
    429424    }
    430425    Doc.element('position').innerHTML = info.HiSeqPosition || '';
    431     if (seqRun.HiSeqPosition != info.HiSeqPosition)
     426    if (seqRun.HiSeqPosition && seqRun.HiSeqPosition != info.HiSeqPosition)
    432427    {
    433428      Wizard.setInputStatus('position', 'warning', 'Not same as planned position ('+Strings.encodeTags(seqRun.HiSeqPosition)+').');
    434429    }
    435430
    436     if (info.ScannerID && seqRun.sequencer)
    437     {
    438       if (seqRun.sequencer.SerialNumber != info.ScannerID)
     431    if (info.ScannerID && (!seqRun.sequencer || seqRun.sequencer.SerialNumber != info.ScannerID))
     432    {
     433      if (seqRun.sequencer && seqRun.sequencer.SerialNumber != info.ScannerID)
    439434      {
    440435        Doc.element('sequencer').innerHTML = info.ScannerID;
    441436        Wizard.setInputStatus('sequencer', 'warning', 'Not same as registered sequencer ('+Strings.encodeTags(seqRun.sequencer.name)+').');
    442         // Try to find the sequencer
    443         if (sequencers && sequencers.length)
     437      }
     438     
     439      // Try to find the sequencer
     440      if (sequencers && sequencers.length)
     441      {
     442        for (var i = 0; i < sequencers.length; i++)
    444443        {
    445           for (var i = 0; i < sequencers.length; i++)
     444          var seq = sequencers[i];
     445          if (seq.SerialNumber == info.ScannerID)
    446446          {
    447             var seq = sequencers[i];
    448             if (seq.SerialNumber == info.ScannerID)
    449             {
    450               Doc.element('sequencer').innerHTML = Strings.encodeTags(seq.name + ' ('+seq.SerialNumber + ')');
    451               info.sequencer = seq;
    452             }
     447            Doc.element('sequencer').innerHTML = Strings.encodeTags(seq.name + ' ('+seq.SerialNumber + ')');
     448            info.sequencer = seq;
     449            break;
    453450          }
    454451        }
    455        
    456452      }
    457453    }
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/activity/ActivityDef.java

    r5845 r5869  
    131131  public static final ActivityDef MIPS_SEQUENCING_STARTED = new ActivityDef("sequencing-started-mips", "MIPs sequencing started for {NAME}");
    132132  /**
     133    External sequencing of a flow cell started. Use {@link #create(String, int)} with name of flow cell.
     134    @since 4.26
     135  */
     136  public static final ActivityDef EXTERNAL_SEQUENCING_STARTED = new ActivityDef("sequencing-started-external", "External sequencing started for {NAME}");
     137  /**
    133138    Sequencing of a flow cell ended. Use {@link #create(String, int)} with name of flow cell.
    134139  */
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/SequencingRunServlet.java

    r5867 r5869  
    907907        Annotationtype.FLOWCELL_ID.setAnnotationValue(dc, flowCell, flowCellId);
    908908        Annotationtype.FLOWCELL_TYPE.setAnnotationValue(dc, flowCell, flowCellType);
     909        Annotationtype.PLATE_PROCESS_RESULT.setAnnotationValue(dc, flowCell, ReactionPlate.PROCESS_SUCCESSFUL);
    909910        dc.saveItem(flowCell);
    910911        jsonMessages.add("Created " + flowCell.getName() + " with " + numLanes + " lanes");
    911912
    912         // SequencingCycles ??
    913        
    914913        // Create pool aliquots
    915914        BioMaterialEvent flowCellEvent = flowCell.getCreationEvent();
     
    980979       
    981980        jsonMessages.add("Created " + seqRun.getName());
    982        
     981        ActivityDef.EXTERNAL_SEQUENCING_STARTED.create(dc, flowCell.getName(), 1);
     982        if (sequencingJob != null)
     983        {
     984          Annotationtype.AUTO_PROCESSING.setAnnotationValue(dc, seqRun, "AutoConfirm");
     985          jsonMessages.add("Auto-analyze enabled on " + sequencingJob.getServer());
     986        }
     987     
    983988        dc.commit();
    984989      }
     
    11911196       
    11921197        String flowCelltype = (String)Annotationtype.FLOWCELL_TYPE.getAnnotationValue(dc, flowCell);
    1193         String sequencingCycles = (String)Annotationtype.SEQUENCING_CYCLES.getAnnotationValue(dc, flowCell);
    1194         String flowCellBarcode = (String)Annotationtype.FLOWCELL_ID.getAnnotationValue(dc, flowCell);
    1195 
     1198
     1199        String sequencingCycles = null;
     1200        String flowCellBarcode = null;
    11961201        Date startDate = null;
    11971202        String hiSeqPosition = "A";
    11981203        String dataFilesFolder = null;
    11991204        int runNumber = 0;
     1205        String scannerId = null;
    12001206        if (FlowCell.FLOW_CELL_TYPE_HISEQ.equals(flowCelltype))
    12011207        {
     
    12101216          dataFilesFolder = runParameters.getConfig("Setup/RunID");
    12111217          hiSeqPosition = runParameters.getConfig("Setup/FCPosition");
     1218          scannerId = runParameters.getConfig("Setup/ScannerID");
    12121219        }
    12131220        else if (FlowCell.FLOW_CELL_TYPE_NOVASEQ.equals(flowCelltype))
     
    12231230          dataFilesFolder = runParameters.getConfig("RunId");
    12241231          hiSeqPosition = runParameters.getConfig("Side");
     1232          scannerId = runParameters.getConfig("InstrumentName");
    12251233        }
    12261234        else if (FlowCell.FLOW_CELL_TYPE_NEXTSEQ.equals(flowCelltype))
     
    12361244          runNumber = Values.getInt(runParameters.getConfig("RunNumber"));
    12371245          dataFilesFolder = runParameters.getConfig("RunID");
     1246          scannerId = runParameters.getConfig("InstrumentID");
    12381247        }
    12391248       
     
    12511260        Annotationtype.SEQUENCING_RUN_NUMBER.setAnnotationValue(dc, seqRun, runNumber);
    12521261        Annotationtype.DATA_FILES_FOLDER.setAnnotationValue(dc, seqRun, dataFilesFolder);
     1262        if (scannerId != null)
     1263        {
     1264          Hardware sequencer = findSequencer(dc, scannerId);
     1265          if (sequencer != null)
     1266          {
     1267            seqRun.setHardware(sequencer);
     1268            flowCell.getCreationEvent().setHardware(sequencer);
     1269          }
     1270        }
    12531271        ActivityDef.SEQUENCING_ENDED.create(dc, fc.getName(), 1).setUser("Auto-confirm");
    12541272
     
    12751293    }
    12761294   
     1295    private Hardware findSequencer(DbControl dc, String serialNumber)
     1296    {
     1297      ItemQuery<Hardware> query = Hardware.getQuery();
     1298      query.setIncludes(Reggie.INCLUDE_IN_CURRENT_PROJECT);
     1299      Subtype.SEQUENCER.addFilter(dc, query);
     1300      query.join(Annotations.innerJoin(Annotationtype.SERIAL_NUMBER.load(dc), "sn"));
     1301      query.restrict(Restrictions.eq(Hql.alias("sn"), Expressions.string(serialNumber)));
     1302      List<Hardware> result = query.list(dc);
     1303      return result.size() > 0 ? result.get(0) : null;
     1304    }
     1305   
    12771306  }
    12781307}
Note: See TracChangeset for help on using the changeset viewer.