Changeset 2077


Ignore:
Timestamp:
Oct 17, 2013, 8:18:36 AM (9 years ago)
Author:
Nicklas Nordborg
Message:

References #481: Register prepared flow cells

Implemented support for registering a failed clustering. The pools on the flow cells are flagged with ClusteringFailed annotation and put into the Flagged PooledLibrary biomaterial list. The "Create flow cells" wizard has been modified to ignore flagged pools unless they also have been annotated with AutoProcess=ReProcess.

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

Legend:

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

    r2073 r2077  
    214214    Main.hide('gonext');
    215215    Main.show('goregister');
    216     Main.hide('step.3.box');
    217216   
    218217    setInnerHTML('gonext.message', '<input type="checkbox" name="verifyFailure" onclick="verifyFailureOnClick()"> Check to verify registration of failure');
     
    393392  Main.addOrRemoveClass(frm['fc-0.comments'], 'required', failed);
    394393  Main.addOrRemoveClass(frm['fc-1.comments'], 'required', failed);
     394  if (failed)
     395  {
     396    Main.hide('step.3.box');
     397  }
     398  else
     399  {
     400    Main.showInline('step.3.box');
     401  }
    395402}
    396403
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/BiomaterialList.java

    r1867 r2077  
    3434      "auto-select wizard for further processing to mRNA. The most typical reason is " +
    3535      "that not enough RNA is available.");
     36
     37  /**
     38    The definition of the biomaterial list used for storing Pooled libraries that have been
     39    flagged due to failure to sequence the entire pool.
     40    @since 2.13
     41  */
     42  public static final BiomaterialList FLAGGED_POOL =
     43    new BiomaterialList("Flagged PooledLibrary", "net.sf.basedb.reggie.pool.flagged", Item.EXTRACT,
     44      "This list contains PooledLibrary items that have failed to be sequenced. Typically most pools "
     45      + "should have enough biomaterial left for trying again, otherwise a new pool may need to be "
     46      + "created from libraries or RNA.");
    3647
    3748
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/PooledLibrary.java

    r2052 r2077  
    1313import net.sf.basedb.core.ItemQuery;
    1414import net.sf.basedb.core.Type;
     15import net.sf.basedb.core.query.Annotations;
     16import net.sf.basedb.core.query.Expression;
    1517import net.sf.basedb.core.query.Expressions;
    1618import net.sf.basedb.core.query.Hql;
     
    4951  public static final String MIXING_STRATEGY_DYNAMIC = "dynamic";
    5052 
     53  /**
     54    Flag value for the {@link Annotationtype#FLAG} annotation when clustering
     55    a pooled library failed. This flag is normally attached to 'PooledLibrary'
     56    items, but may be found on RNA items if the pool runs out of biomaterial.
     57    @since 2.13
     58  */
     59  public static final String FLAG_CLUSTERING_FAILED = "ClusteringFailed";
     60
    5161 
    5262  /**
     
    172182    ItemQuery<Extract> query = Extract.getQuery();
    173183    query.setIncludes(Reggie.INCLUDE_IN_CURRENT_PROJECT);
    174     // Filter on Lysate subtype
     184    // Filter on Pooled library subtype
    175185    Subtype.POOLED_LIBRARY.addFilter(dc, query);
    176     // Filter on created date != null and original=remaining quantity
    177     query.restrict(Restrictions.neq(Hql.property("ce", "eventDate"), null));
    178     query.restrict(Restrictions.eq(Hql.property("originalQuantity"), Hql.property("remainingQuantity")));
    179    
     186
    180187    // Join the creation event
    181188    query.join(Hql.innerJoin(null, "creationEvent", "ce", true));
    182    
     189    // Filter on created date != null
     190    query.restrict(Restrictions.neq(Hql.property("ce", "eventDate"), null));
     191
     192    // Join AUTO_PROCESSING annotation
     193    query.join(Annotations.leftJoin(null, Annotationtype.AUTO_PROCESSING.load(dc), "ap"));
     194
     195    /* Create filter: AUTO_PROCESS==ReProcess OR (AUTO_PROCESS=null AND original=remaining quantity) */
     196    Expression autoProcessing = Hql.alias("ap");
     197    query.restrict(
     198      Restrictions.nullSafeOr(
     199        Restrictions.eq(autoProcessing, Expressions.string("ReProcess")),
     200        Restrictions.and(
     201          Restrictions.eq(autoProcessing, null),
     202          Restrictions.eq(Hql.property("originalQuantity"), Hql.property("remainingQuantity"))
     203        )
     204      )
     205    );
     206
    183207    // Sort by name
    184208    query.order(Orders.asc(Hql.property("name")));
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/FlowCellServlet.java

    r2062 r2077  
    55import java.util.Date;
    66import java.util.HashMap;
     7import java.util.HashSet;
    78import java.util.List;
    89import java.util.Map;
     10import java.util.Set;
    911
    1012import javax.servlet.ServletException;
     
    2022import net.sf.basedb.core.BioMaterialEvent;
    2123import net.sf.basedb.core.BioMaterialEventSource;
     24import net.sf.basedb.core.BioMaterialList;
    2225import net.sf.basedb.core.DbControl;
    2326import net.sf.basedb.core.DerivedBioAssay;
     
    3033import net.sf.basedb.core.SessionControl;
    3134import net.sf.basedb.core.query.Annotations;
     35import net.sf.basedb.core.query.Expression;
     36import net.sf.basedb.core.query.Expressions;
    3237import net.sf.basedb.core.query.Hql;
    3338import net.sf.basedb.core.query.Orders;
     
    3641import net.sf.basedb.reggie.Reggie;
    3742import net.sf.basedb.reggie.dao.Annotationtype;
     43import net.sf.basedb.reggie.dao.BiomaterialList;
    3844import net.sf.basedb.reggie.dao.FlowCell;
    3945import net.sf.basedb.reggie.dao.PooledLibrary;
     
    7884        query.setIncludes(Reggie.INCLUDE_IN_CURRENT_PROJECT);
    7985        Subtype.POOLED_LIBRARY.addFilter(dc, query);
    80         query.join(Hql.innerJoin("creationEvent", "ce"));
     86       
     87        // Join the creation event
     88        query.join(Hql.innerJoin(null, "creationEvent", "ce", true));
     89        // Filter on created date != null
    8190        query.restrict(Restrictions.neq(Hql.property("ce", "eventDate"), null));
    82         query.restrict(Restrictions.eq(Hql.property("originalQuantity"), Hql.property("remainingQuantity")));
     91
     92        // Join AUTO_PROCESSING annotation
     93        query.join(Annotations.leftJoin(null, Annotationtype.AUTO_PROCESSING.load(dc), "ap"));
     94
     95        /* Create filter: AUTO_PROCESS==ReProcess OR (AUTO_PROCESS=null AND original=remaining quantity) */
     96        Expression autoProcessing = Hql.alias("ap");
     97        query.restrict(
     98          Restrictions.nullSafeOr(
     99            Restrictions.eq(autoProcessing, Expressions.string("ReProcess")),
     100            Restrictions.and(
     101              Restrictions.eq(autoProcessing, null),
     102              Restrictions.eq(Hql.property("originalQuantity"), Hql.property("remainingQuantity"))
     103            )
     104          )
     105        );
     106       
    83107        query.setCacheResult(true);
    84108        long count = query.count(dc);
     
    318342        // Sequencing start -- only if not failed
    319343        DerivedBioAssay sequenceRun = null;
    320         if (!failed)
     344        BioMaterialList flaggedPools = null;
     345        Set<Extract> pools = null;
     346       
     347        int numFlagged = 0;
     348        if (failed)
     349        {
     350          flaggedPools = BiomaterialList.FLAGGED_POOL.load(dc);
     351          pools = new HashSet<Extract>();
     352        }
     353        else
    321354        {
    322355          Number sequencerId = (Number)jsonReq.get("sequencer");
     
    366399          if (failed)
    367400          {
    368             // TODO - How to mark the flow cells as failed???
    369             // Normally, it is not needed to flag RNA items for re-processing
    370             // since there is plenty of material left in the pool
     401            // If clustering failed, we flag the pools and add them to the 'Flagged pools' list.
     402            // Typically, most pools have enough material to try clustering again but that
     403            // the responsibility of another wizard
     404            ItemQuery<Extract> query = flowCell.getExtracts(0);
     405            for (Extract poolA : query.list(dc))
     406            {
     407              Extract pool = (Extract)poolA.getParent();
     408              if (!pools.contains(pool))
     409              {
     410                pools.add(pool);
     411                flaggedPools.add(pool);
     412                numFlagged++;
     413                Annotationtype.FLAG.setAnnotationValue(dc, pool, PooledLibrary.FLAG_CLUSTERING_FAILED);
     414                Annotationtype.AUTO_PROCESSING.setAnnotationValue(dc, pool, "Disable");
     415              }
     416            }
     417           
    371418            Annotationtype.PLATE_PROCESS_RESULT.setAnnotationValue(dc, flowCell, ReactionPlate.PROCESS_FAILED);
    372419            jsonMessages.add("Flow cell '" + flowCell.getName() + "' registered with status: " + (ReactionPlate.PROCESS_FAILED));
     
    383430        }
    384431
     432        if (numFlagged > 0)
     433        {
     434          jsonMessages.add("Added " + numFlagged + " pools to '" + flaggedPools.getName() + "' list.");
     435        }
     436       
    385437        dc.commit();
    386438      }
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/InstallServlet.java

    r2074 r2077  
    244244       
    245245        jsonChecks.add(checkAnnotationType(dc, Annotationtype.FLAG, 1,
    246             new ValueOptions(Rna.FLAG_NOT_ENOUGH_REMAINING_QUANTITY, Rna.FLAG_LOW_QUALITY_SCORE,
    247               Rna.FLAG_MANUAL,
     246            new ValueOptions(
     247              Rna.FLAG_NOT_ENOUGH_REMAINING_QUANTITY, Rna.FLAG_LOW_QUALITY_SCORE, Rna.FLAG_MANUAL,
    248248              Rna.FLAG_MRNA_PLATE_FAILED, Rna.FLAG_CDNA_PLATE_FAILED, Rna.FLAG_LIB_PLATE_FAILED,
    249               Rna.FLAG_EXCLUDED_FROM_POOL),
     249              Rna.FLAG_EXCLUDED_FROM_POOL,
     250              PooledLibrary.FLAG_CLUSTERING_FAILED),
    250251            effectiveOptions, createIfMissing));
    251252        jsonChecks.add(checkAnnotationType(dc, Annotationtype.AUTO_PROCESSING, 1,
     
    366367        jsonChecks.add(checkAnnotationTypeCategory(dc, Subtype.POOLED_LIBRARY, createIfMissing,
    367368            Annotationtype.POOL_MOLARITY, Annotationtype.POOL_CONC, Annotationtype.POOL_TARGET_VOLUME_PER_LIB,
    368             Annotationtype.POOL_MIXING_STRATEGY, Annotationtype.POOL_DATE, Annotationtype.OPERATOR));
     369            Annotationtype.POOL_MIXING_STRATEGY, Annotationtype.POOL_DATE, Annotationtype.OPERATOR,
     370            Annotationtype.FLAG, Annotationtype.AUTO_PROCESSING));
    369371
    370372        jsonChecks.add(checkAnnotationTypeCategory(dc, Subtype.FLOW_CELL, createIfMissing,
     
    394396        // Biomaterial lists
    395397        jsonChecks.add(checkBioMaterialList(dc, BiomaterialList.FLAGGED_RNA, effectiveOptions, createIfMissing));
     398        jsonChecks.add(checkBioMaterialList(dc, BiomaterialList.FLAGGED_POOL, effectiveOptions, createIfMissing));
    396399       
    397400        // MIME types
Note: See TracChangeset for help on using the changeset viewer.