Changeset 5131


Ignore:
Timestamp:
Nov 21, 2018, 2:05:29 PM (8 months ago)
Author:
Nicklas Nordborg
Message:

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

Added writer implementations for DNA and FlowThrough. They both have a single filter: DoNotUse=null. On the FlowThrough QiacubeBatchNo is the only annotations. DNA also has the same NanoDrop annotations as RNA but doens't have RNAQC.

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

Legend:

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

    r5107 r5131  
    8888  private List<Lysate> lysates;
    8989  private List<Rna> rna;
     90  private List<Extract> dna;
     91  private List<Extract> flowThrough;
    9092  private List<RnaQc> rnaQc;
    9193  private List<Library> libraries;
     
    313315    return rna;
    314316  }
     317 
     318  /**
     319    Get all DNA items that belong to this patient and have a valid Lysate.
     320    The DNA items must have DoNotUse=null.
     321    @since 4.21
     322  */
     323  public List<Extract> getDna()
     324  {
     325    if (dna == null)
     326    {
     327      ItemQuery<Extract> query = queryManager.getDnaQuery(getLysates());
     328      dna = query == null ? Collections.emptyList() : query.list(dc);
     329    }
     330    return dna;
     331  }
     332
     333  /**
     334    Get all FlowThrough items that belong to this patient and have a valid Lysate.
     335    The FlowThrough items must have DoNotUse=null.
     336    @since 4.21
     337  */
     338  public List<Extract> getFlowThrough()
     339  {
     340    if (flowThrough == null)
     341    {
     342      ItemQuery<Extract> query = queryManager.getFlowThroughQuery(getLysates());
     343      flowThrough = query == null ? Collections.emptyList() : query.list(dc);
     344    }
     345    return flowThrough;
     346  }
    315347
    316348  /**
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/plugins/release/QueryManager.java

    r5107 r5131  
    5555  private ItemQuery<Extract> lysateQuery;
    5656  private ItemQuery<Extract> rnaQuery;
     57  private ItemQuery<Extract> dnaQuery;
     58  private ItemQuery<Extract> flowThroughQuery;
    5759  private ItemQuery<Extract> libQuery;
    5860  private ItemQuery<DerivedBioAssay> mergedQuery;
     
    192194
    193195  /**
     196    Get a query that is returning all DNA items that are related
     197    to the given list of lysates. The query is filtered to only return
     198    DNA with DoNotUse=null.
     199    @return A query or null if the list is null or empty
     200  */
     201  public ItemQuery<Extract> getDnaQuery(List<Lysate> lysates)
     202  {
     203    if (lysates == null || lysates.isEmpty()) return null;
     204    if (dnaQuery == null)
     205    {
     206      dnaQuery = Extract.getQuery();
     207      initBioMaterialQuery(dnaQuery, Subtype.DNA, Subtype.LYSATE, ParentRestriction.LIST_ID);
     208      annotationEquals(dnaQuery, Annotationtype.DO_NOT_USE, null);
     209    }
     210    dnaQuery.setParameter("parents", idList(lysates), Type.INT);
     211    return dnaQuery;
     212  }
     213
     214  /**
     215    Get a query that is returning all FlowThrough items that are related
     216    to the given list of lysates. The query is filtered to only return
     217    FlowThrough with DoNotUse=null.
     218    @return A query or null if the list is null or empty
     219  */
     220  public ItemQuery<Extract> getFlowThroughQuery(List<Lysate> lysates)
     221  {
     222    if (lysates == null || lysates.isEmpty()) return null;
     223    if (flowThroughQuery == null)
     224    {
     225      flowThroughQuery = Extract.getQuery();
     226      initBioMaterialQuery(flowThroughQuery, Subtype.FLOW_THROUGH, Subtype.LYSATE, ParentRestriction.LIST_ID);
     227      annotationEquals(flowThroughQuery, Annotationtype.DO_NOT_USE, null);
     228    }
     229    flowThroughQuery.setParameter("parents", idList(lysates), Type.INT);
     230    return flowThroughQuery;
     231  }
     232
     233  /**
    194234    Get a query that is returning all Library items that are related to the
    195235    given list of RNA. The query is filtered to only return libraries
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/plugins/release/ReleaseExporter.java

    r5130 r5131  
    167167      jsonWriter.registerItemWriter(new LysateWriter(dc, options));
    168168      jsonWriter.registerItemWriter(new RnaWriter(dc, options));
     169      jsonWriter.registerItemWriter(new DnaWriter(dc, options));
     170      jsonWriter.registerItemWriter(new FlowThroughWriter(dc, options));
    169171      jsonWriter.registerItemWriter(new LibraryWriter(dc, options));
    170172      jsonWriter.registerItemWriter(new MergedWriter(dc, options, scriptWriter));
Note: See TracChangeset for help on using the changeset viewer.