Changeset 2232


Ignore:
Timestamp:
Feb 17, 2014, 3:30:06 PM (9 years ago)
Author:
Nicklas Nordborg
Message:

References #575: Add sequencing information to case summary

Include some information about sequencing runs in the case summary.

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

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/trunk/resources/reports/case_summary.jsp

    r2159 r2232  
    780780    }
    781781  }
     782 
     783  var sequencingRuns = consentOk ? response.sequencingRun : null;
     784  if (sequencingRuns && sequencingRuns.length > 0)
     785  {
     786    var truncateAt = TRUNCATE_SIZE[Math.min(sequencingRuns.length-1, TRUNCATE_SIZE.length)];
     787    for (var i = 0; i < sequencingRuns.length; i++)
     788    {
     789      var sr = sequencingRuns[i];
     790      var fc = sr.flowCell;
     791      addColumn('sequencingRun.name', makeLink('DERIVEDBIOASSAY', sr));
     792      addColumn('sequencingRun.flowCell', makeLink('PHYSICALBIOASSAY', fc));
     793      addColumn('sequencingRun.result', (sr.result && sr.result != 'Successful') ? asFailInfo(sr.result, 'error.png') : null);
     794      addColumn('sequencingRun.clusterDate', formatDate(fc.clusterDate));
     795      addColumn('sequencingRun.startDate', formatDate(sr.startDate));
     796      addColumn('sequencingRun.endDate', formatDate(sr.endDate));
     797      addColumn('sequencingRun.comment', truncate(sr.comment, truncateAt));
     798    }
     799  }
     800  else
     801  {
     802    if (consentOk)
     803    {
     804      addColumn('sequencingRun.name', asNoInfo('No sequencing information has been registered'));
     805      Main.hide('sequencingRun-details');
     806    }
     807    else
     808    {
     809      Main.hide('sequencingRun-info');
     810    }
     811   
     812  }
    782813}
    783814
     
    847878    var details = document.getElementById(section.id+'-details');
    848879    // If the details section is 'forcibly' hidden (eg. no items of that type), ignore this call
    849     if (details.style.display != 'none')
     880    if (details && details.style.display != 'none')
    850881    {
    851882      var headerDiv = document.getElementById(section.id+'-header');
     
    15141545          </div>
    15151546        </div>
     1547 
     1548        <div class="info-section" id="sequencingRun-info">
     1549          <div>
     1550          <table class="info-table dynamic-columns">
     1551          <thead>
     1552            <tr id="sequencingRun.name">
     1553              <th id="sequencingRun-header">Sequencing runs</th>
     1554            </tr>
     1555          </thead>
     1556          <tbody id="sequencingRun-details" class="info-details">
     1557            <tr id="sequencingRun.flowCell">
     1558              <th>Flow cell</th>
     1559            </tr>
     1560            <tr id="sequencingRun.clusterDate">
     1561              <th>Cluster date</th>
     1562            </tr>
     1563            <tr id="sequencingRun.startDate">
     1564              <th>Start date</th>
     1565            </tr>
     1566            <tr id="sequencingRun.endDate">
     1567              <th>End date</th>
     1568            </tr>
     1569            <tr id="sequencingRun.result" class="dynamic-column">
     1570              <th>Sequencing result</th>
     1571            </tr>
     1572            <tr id="sequencingRun.comment" class="comment dynamic-column">
     1573              <th>Comment</th>
     1574            </tr>
     1575          </tbody>
     1576          </table>
     1577          </div>
     1578        </div>
    15161579       
    15171580      </div>
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/SequencingRun.java

    r2225 r2232  
    99import net.sf.basedb.core.DbControl;
    1010import net.sf.basedb.core.DerivedBioAssay;
     11import net.sf.basedb.core.Extract;
    1112import net.sf.basedb.core.ItemQuery;
     13import net.sf.basedb.core.Type;
    1214import net.sf.basedb.core.query.Expressions;
    1315import net.sf.basedb.core.query.Hql;
     
    5759  }
    5860 
     61 
     62  /**
     63    Find all sequencing runs that include the library with the given case name.
     64    This method will check for {@link Subtype#SEQUENCING_RUN} derived bioassays
     65    that have a parent flow cell that include pools that contains libraries
     66    with the given name.
     67    @since 2.15
     68  */
     69  public static List<SequencingRun> findByCaseName(DbControl dc, String name)
     70  {
     71    // Get rid of suffixes in the name (eg. 'C' which is used for pre-neoadjuvant forms)
     72    if (name.length() > 7) name = name.substring(0, 7);   
     73 
     74    // Find all 'Pooled library aliquot':s where the lib we are looking for is present
     75    ItemQuery<Extract> poolQuery = Extract.getQuery();
     76    Subtype.POOLED_LIBRARY_ALIQUOT.addFilter(dc, poolQuery);
     77    poolQuery.setIncludes(Reggie.INCLUDE_IN_CURRENT_PROJECT);
     78    poolQuery.join(Hql.innerJoin("parent", "pool"));
     79    poolQuery.join(Hql.innerJoin("pool", "creationEvent", "poolc"));
     80    poolQuery.join(Hql.innerJoin("poolc", "sources", "poolsrc"));
     81    poolQuery.join(Hql.innerJoin("poolsrc", "bioMaterial", "lib"));
     82    poolQuery.restrict(Restrictions.like(Hql.property("lib", "name"), Expressions.parameter("name", name+".%", Type.STRING)));
     83   
     84    // Find all Sequencing run items for flow cells that include any of the pools.
     85    ItemQuery<DerivedBioAssay> query = DerivedBioAssay.getQuery();
     86    Subtype.SEQUENCING_RUN.addFilter(dc, query);
     87    query.setIncludes(Reggie.INCLUDE_IN_CURRENT_PROJECT);
     88    query.join(Hql.innerJoin(null, "physicalBioAssays", "fc", true));
     89    query.join(Hql.innerJoin("fc", "creationEvent", "fcc", true));
     90    query.join(Hql.innerJoin("fcc", "sources", "src"));
     91    query.join(Hql.innerJoin("src", "bioMaterial", "poolA"));
     92    query.restrict(Restrictions.eq(Hql.alias("poolA"), Expressions.any(poolQuery)));
     93   
     94    return toList(query.list(dc));
     95  }
     96
    5997 
    6098  public static List<SequencingRun> findByFlowCell(DbControl dc, FlowCell fc)
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/CaseSummaryServlet.java

    r2185 r2232  
    2323import net.sf.basedb.core.BioWell;
    2424import net.sf.basedb.core.DbControl;
     25import net.sf.basedb.core.DerivedBioAssay;
    2526import net.sf.basedb.core.Extract;
    2627import net.sf.basedb.core.File;
     
    2930import net.sf.basedb.core.Permission;
    3031import net.sf.basedb.core.PermissionDeniedException;
     32import net.sf.basedb.core.PhysicalBioAssay;
    3133import net.sf.basedb.core.Sample;
    3234import net.sf.basedb.core.SessionControl;
     
    4042import net.sf.basedb.reggie.dao.Consent;
    4143import net.sf.basedb.reggie.dao.Dna;
     44import net.sf.basedb.reggie.dao.FlowCell;
    4245import net.sf.basedb.reggie.dao.FlowThrough;
    4346import net.sf.basedb.reggie.dao.Histology;
     
    4952import net.sf.basedb.reggie.dao.PooledLibrary;
    5053import net.sf.basedb.reggie.dao.Rna;
     54import net.sf.basedb.reggie.dao.SequencingRun;
    5155import net.sf.basedb.reggie.dao.SpecimenTube;
    5256import net.sf.basedb.reggie.dao.Subtype;
     
    331335          json.put("pooledlib", jsonPooledLib);
    332336        }
     337       
     338        List<SequencingRun> sequencingRuns = SequencingRun.findByCaseName(dc, caseName);
     339        if (sequencingRuns.size() > 0)
     340        {
     341          JSONArray jsonSequencingRun = new JSONArray();
     342          for (SequencingRun sr : sequencingRuns)
     343          {
     344            loadSequencingRunInfo(dc, sr);
     345            jsonSequencingRun.add(sr.asJSONObject());
     346          }
     347          jsonSections.add(loadSectionInfo(sc, "sequencingRun"));
     348          json.put("sequencingRun", jsonSequencingRun);
     349        }
     350       
    333351      }
    334352    }
     
    802820  }
    803821 
     822  private void loadSequencingRunInfo(DbControl dc, SequencingRun sr)
     823  {
     824    DerivedBioAssay dba = sr.getDerivedBioAssay();
     825   
     826    sr.setAnnotation("editable", dba.hasPermission(Permission.WRITE));
     827    sr.loadAnnotations(dc, "startDate", Annotationtype.SEQUENCING_START, Reggie.CONVERTER_DATE_TO_STRING);
     828    sr.loadAnnotations(dc, "endDate", Annotationtype.SEQUENCING_END, Reggie.CONVERTER_DATE_TO_STRING);
     829    sr.loadAnnotations(dc, "result", Annotationtype.SEQUENCING_RESULT, null);
     830    sr.setAnnotation("comment", dba.getDescription());
     831   
     832    FlowCell fc = FlowCell.getBySequencingRun(dc, sr);
     833    PhysicalBioAssay pba = fc.getPhysicalBioAssay();
     834   
     835    fc.setAnnotation("editable", pba.hasPermission(Permission.WRITE));
     836    fc.loadAnnotations(dc, "clusterDate", Annotationtype.CLUSTER_START, Reggie.CONVERTER_DATE_TO_STRING);
     837    sr.setAnnotation("flowCell", fc.asJSONObject());
     838  }
     839 
    804840  private BioPlate getBioPlate(MeasuredBioMaterial bioMaterial)
    805841  {
Note: See TracChangeset for help on using the changeset viewer.