Changeset 5132


Ignore:
Timestamp:
Nov 21, 2018, 3:51:06 PM (5 months ago)
Author:
Nicklas Nordborg
Message:

References #1075: Change the release exporter to work with list of patients

Changed the DNA and FlowThrough writers to work with specific dao objects instead of generic extracts. This should be safer.

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

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/plugins/release/CohortItem.java

    r5131 r5132  
    4343import net.sf.basedb.reggie.dao.Datafiletype;
    4444import net.sf.basedb.reggie.dao.DemuxedSequences;
     45import net.sf.basedb.reggie.dao.Dna;
     46import net.sf.basedb.reggie.dao.FlowThrough;
    4547import net.sf.basedb.reggie.dao.Histology;
    4648import net.sf.basedb.reggie.dao.Library;
     
    8890  private List<Lysate> lysates;
    8991  private List<Rna> rna;
    90   private List<Extract> dna;
    91   private List<Extract> flowThrough;
     92  private List<Dna> dna;
     93  private List<FlowThrough> flowThrough;
    9294  private List<RnaQc> rnaQc;
    9395  private List<Library> libraries;
     
    321323    @since 4.21
    322324  */
    323   public List<Extract> getDna()
     325  public List<Dna> getDna()
    324326  {
    325327    if (dna == null)
    326328    {
    327329      ItemQuery<Extract> query = queryManager.getDnaQuery(getLysates());
    328       dna = query == null ? Collections.emptyList() : query.list(dc);
     330      dna = query == null ? Collections.emptyList() : Dna.toDna(query.list(dc));
    329331    }
    330332    return dna;
     
    336338    @since 4.21
    337339  */
    338   public List<Extract> getFlowThrough()
     340  public List<FlowThrough> getFlowThrough()
    339341  {
    340342    if (flowThrough == null)
    341343    {
    342344      ItemQuery<Extract> query = queryManager.getFlowThroughQuery(getLysates());
    343       flowThrough = query == null ? Collections.emptyList() : query.list(dc);
     345      flowThrough = query == null ? Collections.emptyList() : FlowThrough.toFlowThrough(query.list(dc));
    344346    }
    345347    return flowThrough;
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/plugins/release/DnaWriter.java

    r5131 r5132  
    1515import net.sf.basedb.reggie.Reggie;
    1616import net.sf.basedb.reggie.dao.Annotationtype;
     17import net.sf.basedb.reggie.dao.Dna;
     18import net.sf.basedb.reggie.dao.Lysate;
    1719import net.sf.basedb.reggie.json.FilteredJSONArray;
    1820import net.sf.basedb.util.filter.NotNullFilter;
     
    3638  public JSONArray toJSONObjects(CohortItem item)
    3739  {
    38     List<Extract> dnaList = item.getDna();
     40    List<Dna> dnaList = item.getDna();
    3941    if (dnaList.size() == 0) return null;
    4042   
    4143    JSONArray json = new JSONArray();
    42     for (Extract dna : dnaList)
     44    for (Dna d : dnaList)
    4345    {
    44       Extract lys = (Extract)dna.getParent();
     46      Extract dna = d.getExtract();
     47      Lysate lys = d.getLysate();
    4548     
    4649      DbControl dc = item.getDbControl();
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/plugins/release/FlowThroughWriter.java

    r5131 r5132  
    1414import net.sf.basedb.reggie.Reggie;
    1515import net.sf.basedb.reggie.dao.Annotationtype;
     16import net.sf.basedb.reggie.dao.FlowThrough;
     17import net.sf.basedb.reggie.dao.Lysate;
    1618import net.sf.basedb.reggie.json.FilteredJSONArray;
    1719import net.sf.basedb.util.filter.NotNullFilter;
     
    3436  public JSONArray toJSONObjects(CohortItem item)
    3537  {
    36     List<Extract> ftList = item.getFlowThrough();
     38    List<FlowThrough> ftList = item.getFlowThrough();
    3739    if (ftList.size() == 0) return null;
    3840   
    3941    JSONArray json = new JSONArray();
    40     for (Extract ft : ftList)
     42    for (FlowThrough ft : ftList)
    4143    {
    42       Extract lys = (Extract)ft.getParent();
     44      Extract flowThrough = ft.getExtract();
     45      Lysate lys = ft.getLysate();
    4346     
    4447      DbControl dc = item.getDbControl();
     
    4649     
    4750      JSONObject jsonFt = new JSONObject();
    48       jsonFt.put("name", item.toReleaseId(ft.getName()));
    49       jsonFt.put("type", ft.getType().name());
    50       jsonFt.put("subtype", getName(ft.getItemSubtype()));
     51      jsonFt.put("name", item.toReleaseId(flowThrough.getName()));
     52      jsonFt.put("type", flowThrough.getType().name());
     53      jsonFt.put("subtype", getName(flowThrough.getItemSubtype()));
    5154      jsonFt.put("parent", item.toReleaseId(lys.getName()));
    5255     
     
    5457      jsonFt.put("annotations", jsonAnnotations);
    5558     
    56       String qiacubeDate = Reggie.CONVERTER_DATE_TO_STRING.convert((Date)item.getAnnotationValue(Annotationtype.QIACUBE_DATE, ft));
    57       Integer qiacubeRunNo = (Integer)item.getAnnotationValue(Annotationtype.QIACUBE_RUN_NO, ft);
     59      String qiacubeDate = Reggie.CONVERTER_DATE_TO_STRING.convert((Date)item.getAnnotationValue(Annotationtype.QIACUBE_DATE, flowThrough));
     60      Integer qiacubeRunNo = (Integer)item.getAnnotationValue(Annotationtype.QIACUBE_RUN_NO, flowThrough);
    5861      qiacubeDate += qiacubeRunNo == null ? ":0" : ":"+qiacubeRunNo;
    5962
Note: See TracChangeset for help on using the changeset viewer.