Changeset 2224


Ignore:
Timestamp:
Feb 12, 2014, 11:09:09 AM (9 years ago)
Author:
Nicklas Nordborg
Message:

References #562: Re-design clustering and sequencing startup wizards

First version of a new 'sequencing startup' wizard. The wizard get most of the required information from the 'runParameters.xml' file that is created by the HiSeq?. The intention is that the registration should be done immediately after the sequencing has started, but it should work to register already finished sequencing runs as well. There is a check so that the same sequencing run is not registered twice (defined by output folder for data files).

A SequencingRun item now always linked to a single FlowCell, but due to restarts a FlowCell may have more than one SequencingRun. If a flow cell is restarted and this results in a new data file folder is created, the wizard should (must!) be used twice.

This update also shifts around some annotations:

  • HiSeqPosition: Moved from FlowCell to SequencingRun.
  • SequencingCycles: Also used on SequencingRun (parsed from 'runParameters.xml'). The value on FlowCell is manually entered in the design phase.
  • SequencingRunNumber: Parsed from 'runParameters.xml' and stored with SequencingRun.
  • DataFilesFolder: Parsed from 'runParameters.xml' and stored with SequencingRun.
Location:
extensions/net.sf.basedb.reggie/trunk
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/Annotationtype.java

    r2196 r2224  
    667667
    668668  /**
    669     The "SequencingCycles" annotation, used for physical bioassays (FlowCell).
     669    The "SequencingCycles" annotation, used for physical bioassays and
     670    (FlowCell) derived bioassays (SequencingRun).
    670671    @since 2.13
    671672  */
    672673  public static final Annotationtype SEQUENCING_CYCLES =
    673     new Annotationtype("SequencingCycles", Type.STRING, Item.PHYSICALBIOASSAY);
    674 
    675  
    676   /**
    677     The "HiSeqPosition" annotation, used for physical bioassays (FlowCell).
     674    new Annotationtype("SequencingCycles", Type.STRING, Item.PHYSICALBIOASSAY, Item.DERIVEDBIOASSAY);
     675
     676 
     677  /**
     678    The "HiSeqPosition" annotation, used for derived bioassays (SequencingRun).
    678679    It is an enumerated string annotation type with two options: A and B
    679680    @since 2.13
    680681  */
    681682  public static final Annotationtype HISEQ_POSITION =
    682     new Annotationtype("HiSeqPosition", Type.STRING, Item.PHYSICALBIOASSAY);
     683    new Annotationtype("HiSeqPosition", Type.STRING, Item.PHYSICALBIOASSAY, Item.DERIVEDBIOASSAY);
    683684
    684685 
     
    705706    new Annotationtype("SequencingEnd", Type.TIMESTAMP, Item.DERIVEDBIOASSAY);
    706707
    707  
     708  /**
     709    The "SequencingRunNumber" annotation, used for derived bioassays (SequencingRun).
     710    @since 2.15
     711  */
     712  public static final Annotationtype SEQUENCING_RUN_NUMBER =
     713    new Annotationtype("SequencingRunNumber", Type.INT, Item.DERIVEDBIOASSAY);
     714
    708715  /**
    709716    The "SequencingOperator" annotation, used for derived bioassays (SequencingRun).
     
    712719  public static final Annotationtype SEQUENCING_OPERATOR =
    713720    new Annotationtype("SequencingOperator", Type.STRING, Item.DERIVEDBIOASSAY);
     721
     722  /**
     723    The "DataFilesFolder" annotation, used for derived bioassays that
     724    are linked with data files on the server.
     725    @since 2.15
     726  */
     727  public static final Annotationtype DATA_FILES_FOLDER =
     728    new Annotationtype("DataFilesFolder", Type.STRING, Item.DERIVEDBIOASSAY);
    714729
    715730 
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/PooledLibrary.java

    r2094 r2224  
    6060  public static final String FLAG_CLUSTERING_FAILED = "ClusteringFailed";
    6161
     62  /**
     63    Flag value for the {@link Annotationtype#FLAG} annotation when sequencing
     64    a pooled library failed. This flag is normally attached to 'PooledLibrary'
     65    items, but may be found on RNA items if the pool runs out of biomaterial.
     66    @since 2.15
     67  */
     68  public static final String FLAG_SEQUENCING_FAILED = "SequencingFailed";
    6269 
    6370  /**
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/SequencingRun.java

    r2197 r2224  
    3535  }
    3636 
     37 
     38  public static List<SequencingRun> findByFlowCell(DbControl dc, FlowCell fc)
     39  {
     40    ItemQuery<DerivedBioAssay> query = fc.getItem().getRootDerivedBioAssays();
     41    Subtype.SEQUENCING_RUN.addFilter(dc, query);
     42    query.setIncludes(Reggie.INCLUDE_IN_CURRENT_PROJECT);
     43    query.order(Orders.asc(Hql.property("name")));
     44    return toList(query.list(dc));
     45  }
    3746 
    3847  public static List<SequencingRun> toList(Collection<DerivedBioAssay> bioassays)
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/FlowCellServlet.java

    r2222 r2224  
    2424import net.sf.basedb.core.BioMaterialList;
    2525import net.sf.basedb.core.DbControl;
    26 import net.sf.basedb.core.DerivedBioAssay;
    2726import net.sf.basedb.core.Extract;
    2827import net.sf.basedb.core.Hardware;
     
    404403        boolean failed = Boolean.TRUE.equals(jsonReq.get("failed"));
    405404
    406         // Sequencing start -- only if not failed
    407         DerivedBioAssay sequenceRun = null;
    408405        BioMaterialList flaggedPools = null;
    409406        Set<Extract> pools = null;
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/InstallServlet.java

    r2196 r2224  
    285285              Rna.FLAG_MRNA_PLATE_FAILED, Rna.FLAG_CDNA_PLATE_FAILED, Rna.FLAG_LIB_PLATE_FAILED,
    286286              Rna.FLAG_EXCLUDED_FROM_POOL,
    287               PooledLibrary.FLAG_CLUSTERING_FAILED),
     287              PooledLibrary.FLAG_CLUSTERING_FAILED, PooledLibrary.FLAG_SEQUENCING_FAILED),
    288288            effectivePermissionsUse, createIfMissing));
    289289        jsonChecks.add(checkAnnotationType(dc, Annotationtype.AUTO_PROCESSING, 1,
     
    330330        jsonChecks.add(checkAnnotationType(dc, Annotationtype.READ_STRING, 1, null, effectivePermissionsUse, createIfMissing));
    331331        jsonChecks.add(checkAnnotationType(dc, Annotationtype.SEQUENCING_CYCLES, 1, null, effectivePermissionsUse, createIfMissing));
     332
     333        jsonChecks.add(checkAnnotationType(dc, Annotationtype.SEQUENCING_START, 1, null, effectivePermissionsUse, createIfMissing));
     334        jsonChecks.add(checkAnnotationType(dc, Annotationtype.SEQUENCING_TURN_AROUND, 1, null, effectivePermissionsUse, createIfMissing));
     335        jsonChecks.add(checkAnnotationType(dc, Annotationtype.SEQUENCING_END, 1, null, effectivePermissionsUse, createIfMissing));
     336        jsonChecks.add(checkAnnotationType(dc, Annotationtype.SEQUENCING_RUN_NUMBER, 1, null, effectivePermissionsUse, createIfMissing));
     337        jsonChecks.add(checkAnnotationType(dc, Annotationtype.SEQUENCING_OPERATOR, 1, null, effectivePermissionsUse, createIfMissing));
    332338        jsonChecks.add(checkAnnotationType(dc, Annotationtype.HISEQ_POSITION, 1,
    333339            new ValueOptions("A", "B"),
    334340            effectivePermissionsUse, createIfMissing));
    335        
    336         jsonChecks.add(checkAnnotationType(dc, Annotationtype.SEQUENCING_START, 1, null, effectivePermissionsUse, createIfMissing));
    337         jsonChecks.add(checkAnnotationType(dc, Annotationtype.SEQUENCING_TURN_AROUND, 1, null, effectivePermissionsUse, createIfMissing));
    338         jsonChecks.add(checkAnnotationType(dc, Annotationtype.SEQUENCING_END, 1, null, effectivePermissionsUse, createIfMissing));
    339         jsonChecks.add(checkAnnotationType(dc, Annotationtype.SEQUENCING_OPERATOR, 1, null, effectivePermissionsUse, createIfMissing));
     341        jsonChecks.add(checkAnnotationType(dc, Annotationtype.DATA_FILES_FOLDER, 1, null, effectivePermissionsUse, createIfMissing));
    340342       
    341343        // Annotation type categories
     
    421423        jsonChecks.add(checkAnnotationTypeCategory(dc, Subtype.FLOW_CELL, createIfMissing,
    422424            Annotationtype.FLOWCELL_ID, Annotationtype.CLUSTER_START, Annotationtype.CLUSTER_OPERATOR,
    423             Annotationtype.SEQUENCING_CYCLES, Annotationtype.HISEQ_POSITION,
    424             Annotationtype.PLATE_PROCESS_RESULT));
     425            Annotationtype.SEQUENCING_CYCLES, Annotationtype.PLATE_PROCESS_RESULT));
    425426       
    426427        jsonChecks.add(checkAnnotationTypeCategory(dc, Subtype.SEQUENCING_RUN, createIfMissing,
    427428            Annotationtype.SEQUENCING_START, Annotationtype.SEQUENCING_TURN_AROUND, Annotationtype.SEQUENCING_END,
    428             Annotationtype.SEQUENCING_OPERATOR
     429            Annotationtype.SEQUENCING_OPERATOR, Annotationtype.SEQUENCING_RUN_NUMBER, Annotationtype.SEQUENCING_CYCLES,
     430            Annotationtype.HISEQ_POSITION, Annotationtype.DATA_FILES_FOLDER
    429431          ));
    430432       
     
    678680            {
    679681              json.put("status", "incomplete");
    680               jsonMessages.add("Doesn't have all options: " + valueOptions.getList());
     682              jsonMessages.add("Doesn't have all options: " + valueOptions.getList() + "!=" + at.getValues());
    681683            }
    682684          }
     
    10761078
    10771079  /**
    1078     We need to do this in a separate transaction.
    1079     @since 2.0
    1080   */
    1081   public void addAnnotionTypeToCategory(SessionControl sc, AnnotationType annotationType, AnnotationTypeCategory category)
    1082   {
    1083     DbControl dc = sc.newDbControl();
    1084     try
    1085     {
    1086       annotationType = AnnotationType.getById(dc, annotationType.getId());
    1087       category = AnnotationTypeCategory.getById(dc, category.getId());
    1088       annotationType.addCategory(category);
    1089       dc.commit();
    1090     }
    1091     finally
    1092     {
    1093       if (dc != null) dc.close();
    1094     }
    1095   }
    1096  
    1097   /**
    10981080    Check for an existing annotation type category.
    10991081    A JSONObject is returned with the result. The following
     
    11311113          {
    11321114            AnnotationType at = annotationType.load(dc);
    1133             if (at != null)
    1134             {
    1135               at.addCategory(cat);
    1136             }
     1115            at.addCategory(cat);
    11371116          }
    11381117        }
     
    11691148            if (createIfMissing)
    11701149            {
    1171               addAnnotionTypeToCategory(dc.getSessionControl(), at, cat);
     1150              at.addCategory(cat);
    11721151              if (jsonMessages.size() == 0) jsonMessages.add("Fixed");
    11731152            }
     
    19591938      for (Object opt : options)
    19601939      {
     1940        System.out.println(opt+":"+values.contains(opt));
    19611941        if (!values.contains(opt)) values.add(opt);
    19621942      }
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/SequencingRunServlet.java

    r2197 r2224  
    1717import net.sf.basedb.core.DbControl;
    1818import net.sf.basedb.core.DerivedBioAssay;
     19import net.sf.basedb.core.Hardware;
    1920import net.sf.basedb.core.ItemQuery;
    2021import net.sf.basedb.core.PhysicalBioAssay;
     22import net.sf.basedb.core.Protocol;
    2123import net.sf.basedb.core.SessionControl;
    2224import net.sf.basedb.core.query.Annotations;
     
    2931import net.sf.basedb.reggie.dao.SequencingRun;
    3032import net.sf.basedb.reggie.dao.Subtype;
     33import net.sf.basedb.util.Values;
    3134import net.sf.basedb.util.error.ThrowableUtil;
    3235
     
    111114        json.put("sequencingRuns", jsonRuns);
    112115      }
     116      else if ("GetSequencingRunsForFlowCell".equals(cmd))
     117      {
     118        dc = sc.newDbControl();
     119        int flowCellId = Values.getInt(req.getParameter("flowCell"));
     120
     121        FlowCell flowCell = FlowCell.getById(dc, flowCellId);
     122        List<SequencingRun> seqRuns = SequencingRun.findByFlowCell(dc, flowCell);
     123        JSONArray jsonSeqRuns = new JSONArray();
     124        for (SequencingRun seqRun : seqRuns)
     125        {
     126          seqRun.loadAnnotations(dc, "SequencingStart", Annotationtype.SEQUENCING_START, Reggie.CONVERTER_DATE_TO_STRING);
     127          seqRun.loadAnnotations(dc, "SequencingEnd", Annotationtype.SEQUENCING_END, Reggie.CONVERTER_DATE_TO_STRING);
     128          seqRun.loadAnnotations(dc, "DataFilesFolder", Annotationtype.DATA_FILES_FOLDER, null);
     129          jsonSeqRuns.add(seqRun.asJSONObject());
     130        }
     131        json.put("sequencingRuns", jsonSeqRuns);
     132      }
    113133    }
    114134    catch (Throwable t)
     
    146166    try
    147167    {
    148       if ("RegisterSequencingEnded".equals(cmd))
     168      if ("RegisterSequencingStarted".equals(cmd))
     169      {
     170        dc = sc.newDbControl();
     171        ReggieRole.checkPermission(dc, "'" + cmd + "' wizard", ReggieRole.LIBRARY_PREP, ReggieRole.ADMINISTRATOR);
     172       
     173        JSONObject jsonReq = (JSONObject)new JSONParser().parse(req.getReader());
     174        JSONObject jsonSeq = (JSONObject)jsonReq.get("sequencingRun");
     175        JSONObject jsonFlowCell = (JSONObject)jsonReq.get("flowCell");
     176        JSONObject jsonRunParameters = (JSONObject)jsonReq.get("runParameters");
     177
     178        Number sequencerId = (Number)jsonSeq.get("sequencer");
     179        Hardware sequencer = sequencerId == null ? null : Hardware.getById(dc, sequencerId.intValue());
     180        Number protocolId = (Number)jsonSeq.get("protocol");
     181        Protocol protocol = protocolId == null ? null : Protocol.getById(dc, protocolId.intValue());
     182        String sequencingComments = Values.getStringOrNull((String)jsonSeq.get("comments"));
     183        String sequencingOperator = Values.getStringOrNull((String)jsonSeq.get("operator"));
     184        Date startDate = Reggie.CONVERTER_STRING_TO_DATE.convert((String)jsonRunParameters.get("SequencingStart"));
     185
     186        // Create new SequencingRun item
     187        DerivedBioAssay sequenceRun = DerivedBioAssay.getNew(dc, true, null);
     188        sequenceRun.setItemSubtype(Subtype.SEQUENCING_RUN.get(dc));
     189        sequenceRun.setName(SequencingRun.generateNamesForBatch(dc, 1, 1).get(0));
     190        sequenceRun.setDescription(sequencingComments);
     191        sequenceRun.setHardware(sequencer);
     192        sequenceRun.setProtocol(protocol);
     193        dc.saveItem(sequenceRun);
     194        Annotationtype.SEQUENCING_OPERATOR.setAnnotationValue(dc, sequenceRun, sequencingOperator);
     195
     196        // Link to FlowCell
     197        Number flowCellId = (Number)jsonFlowCell.get("id");
     198        PhysicalBioAssay flowCell = PhysicalBioAssay.getById(dc, flowCellId.intValue());
     199        sequenceRun.addPhysicalBioAssay(flowCell);
     200       
     201        // Set run parameters
     202        Annotationtype.HISEQ_POSITION.setAnnotationValue(dc, sequenceRun, jsonRunParameters.get("HiSeqPosition"));
     203        Annotationtype.SEQUENCING_START.setAnnotationValue(dc, sequenceRun, startDate);
     204        Annotationtype.SEQUENCING_RUN_NUMBER.setAnnotationValue(dc, sequenceRun, jsonRunParameters.get("ScanNumber"));
     205        Annotationtype.SEQUENCING_CYCLES.setAnnotationValue(dc, sequenceRun, jsonRunParameters.get("SequencingCycles"));
     206        Annotationtype.DATA_FILES_FOLDER.setAnnotationValue(dc, sequenceRun, jsonRunParameters.get("RunID"));
     207        dc.commit();
     208       
     209        jsonMessages.add("Sequencing started for flow cell '" + flowCell.getName() + "': " + sequenceRun.getName());
     210       
     211      }
     212      else if ("RegisterSequencingEnded".equals(cmd))
    149213      {
    150214        dc = sc.newDbControl();
Note: See TracChangeset for help on using the changeset viewer.