Changeset 6207


Ignore:
Timestamp:
Apr 12, 2021, 2:50:47 PM (13 months ago)
Author:
Nicklas Nordborg
Message:

References #1295: Registration of specimen handled by external lab

Added code for creating RNA, DNA, FlowThrough and Lysate items.

Location:
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie
Files:
4 added
4 edited

Legend:

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

    r4107 r6207  
    9292  }
    9393
     94  public static RnaQc get(Extract extract)
     95  {
     96    return new RnaQc(extract);
     97  }
     98 
    9499  RnaQc(Extract extract)
    95100  {
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/plugins/FutureSpecimenImporter.java

    r6205 r6207  
    66
    77import net.sf.basedb.core.BioMaterialEvent;
     8import net.sf.basedb.core.BioMaterialEventSource;
    89import net.sf.basedb.core.BioPlate;
    910import net.sf.basedb.core.BioWell;
     
    1718import net.sf.basedb.reggie.dao.BioplateType;
    1819import net.sf.basedb.reggie.dao.DemuxedSequences;
     20import net.sf.basedb.reggie.dao.Dna;
    1921import net.sf.basedb.reggie.dao.FlowCell;
     22import net.sf.basedb.reggie.dao.FlowThrough;
    2023import net.sf.basedb.reggie.dao.Library;
    2124import net.sf.basedb.reggie.dao.Lysate;
     
    2528import net.sf.basedb.reggie.dao.ReactionPlate;
    2629import net.sf.basedb.reggie.dao.Rna;
     30import net.sf.basedb.reggie.dao.RnaQc;
    2731import net.sf.basedb.reggie.dao.SequencingRun;
    2832import net.sf.basedb.reggie.dao.SpecimenTube;
    2933import net.sf.basedb.reggie.dao.Subtype;
    3034import net.sf.basedb.reggie.plugins.cmd.DemuxInfo;
     35import net.sf.basedb.reggie.plugins.cmd.DnaInfo;
    3136import net.sf.basedb.reggie.plugins.cmd.FlowCellInfo;
     37import net.sf.basedb.reggie.plugins.cmd.FlowThroughInfo;
    3238import net.sf.basedb.reggie.plugins.cmd.JsonFile;
    3339import net.sf.basedb.reggie.plugins.cmd.JsonSection;
    3440import net.sf.basedb.reggie.plugins.cmd.LibraryInfo;
     41import net.sf.basedb.reggie.plugins.cmd.LysateInfo;
    3542import net.sf.basedb.reggie.plugins.cmd.MergeInfo;
    3643import net.sf.basedb.reggie.plugins.cmd.PoolInfo;
     44import net.sf.basedb.reggie.plugins.cmd.RnaInfo;
    3745import net.sf.basedb.reggie.plugins.cmd.SequencingRunInfo;
    3846import net.sf.basedb.util.MD5;
     
    8795   
    8896    JsonSection jsonSpecimen = jsonFile.getRequiredSection("Specimen");
    89     JsonSection jsonLysate = jsonFile.getRequiredSection("Lysate");
    90     JsonSection jsonRNA = jsonFile.getRequiredSection("RNA");
    91     JsonSection jsonDNA = jsonFile.getRequiredSection("DNA");
    92     JsonSection jsonFT = jsonFile.getRequiredSection("FlowThrough");
    93    
     97   
     98    LysateInfo lysateInfo = jsonFile.getLysate();
     99    RnaInfo rnaInfo = jsonFile.getRna();
     100    DnaInfo dnaInfo = jsonFile.getDna();
     101    FlowThroughInfo ftInfo = jsonFile.getFlowThroughInfo();
    94102    LibraryInfo libInfo = jsonFile.getLibrary();
    95103    PoolInfo poolInfo = jsonFile.getPool();
     
    103111    SpecimenTube specimen = importToSpecimen(dc, sample, jsonSpecimen);
    104112   
    105     if (jsonLysate == null) return;
    106     Lysate lysate = createLysate(dc, specimen, jsonLysate);
    107    
    108     if (jsonRNA == null) return;
    109     Rna rna = createRNA(dc, lysate, jsonRNA);
     113    if (specimen == null || !lysateInfo.valid) return;
     114    Lysate lysate = createLysate(dc, specimen, lysateInfo);
     115   
     116    if (lysate == null || !rnaInfo.valid || !dnaInfo.valid || !ftInfo.valid) return;
     117    Rna rna = createRna(dc, lysate, rnaInfo);
     118    RnaQc rnaQc = rna != null ? createRnaQc(dc, rna, rnaInfo) : null;
     119    Dna dna = createDna(dc, lysate, dnaInfo);
     120    FlowThrough ft = createFlowThrough(dc, lysate, ftInfo);
    110121   
    111122    if (rna == null || !libInfo.valid) return;
     
    153164  }
    154165 
    155   private Lysate createLysate(DbControl dc, SpecimenTube specimen, JsonSection jsonLysate)
     166  private Lysate createLysate(DbControl dc, SpecimenTube specimen, LysateInfo lysateInfo)
    156167  {
    157168    Extract lysate = Extract.getNew(dc);
    158169    lysate.setItemSubtype(Subtype.LYSATE.get(dc));
    159170    lysate.setName(specimen.getNextLysateName(dc));
     171
    160172    BioMaterialEvent creationEvent = lysate.getCreationEvent();
    161     creationEvent.setSource(specimen.getItem());
    162 
     173    BioMaterialEventSource specSrc = creationEvent.setSource(specimen.getItem());
     174    creationEvent.setEventDate(lysateInfo.lysateDate);
     175    if (lysateInfo.protocol != null) addDebugMessage("Found: " + lysateInfo.protocol.getName());
     176    creationEvent.setProtocol(lysateInfo.protocol);
     177    creationEvent.setHardware(null);
     178   
     179    Annotationtype.PARTITION_DATE.setAnnotationValue(dc, lysate, lysateInfo.partitionDate);
     180
     181    lysate.setOriginalQuantity(lysateInfo.originalVolume);
     182    specSrc.setUsedQuantity(lysateInfo.usedFromSpecimen);
     183   
     184    // TODO -- box/tube information
     185   
    163186    dc.saveItem(lysate);
    164187   
     
    167190  }
    168191 
    169   private Rna createRNA(DbControl dc, Lysate lysate, JsonSection jsonRNA)
     192  private Rna createRna(DbControl dc, Lysate lysate, RnaInfo rnaInfo)
    170193  {
    171194    Extract rna = Extract.getNew(dc);
    172195    rna.setItemSubtype(Subtype.RNA.get(dc));
    173196    rna.setName(lysate.getNextChildName(dc, Subtype.RNA));
     197
    174198    BioMaterialEvent creationEvent = rna.getCreationEvent();
    175     creationEvent.setSource(lysate.getItem());
    176 
     199    BioMaterialEventSource lysSrc = creationEvent.setSource(lysate.getItem());
     200    creationEvent.setEventDate(rnaInfo.qiacubeDate);
     201    if (rnaInfo.protocol != null) addDebugMessage("Found: " + rnaInfo.protocol.getName());
     202    creationEvent.setProtocol(rnaInfo.protocol);
     203    creationEvent.setHardware(null);
     204
     205    Annotationtype.QIACUBE_DATE.setAnnotationValue(dc, rna, rnaInfo.qiacubeDate);
     206    Annotationtype.QIACUBE_RUN_NO.setAnnotationValue(dc, rna, rnaInfo.qiacubeRunNumber);
     207    Annotationtype.QIACUBE_POSITION.setAnnotationValue(dc, rna, rnaInfo.qiacubePos);
     208    Annotationtype.QIACUBE_OPERATOR.setAnnotationValue(dc, rna, rnaInfo.operator);
     209   
     210    // TODO -- concentrations and quantities
     211    Annotationtype.QUBIT_CONC.setAnnotationValue(dc, rna, rnaInfo.qubitConc);
     212    rna.setOriginalQuantity(null);
     213    lysSrc.setUsedQuantity(null);
     214   
     215    // TODO -- box/tube information
     216   
    177217    dc.saveItem(rna);
    178218   
    179219    addDebugMessage("Created: "+ rna.getName());
    180220    return Rna.get(rna);
     221  }
     222 
     223  private Dna createDna(DbControl dc, Lysate lysate, DnaInfo dnaInfo)
     224  {
     225    Extract dna = Extract.getNew(dc);
     226    dna.setItemSubtype(Subtype.DNA.get(dc));
     227    dna.setName(lysate.getNextChildName(dc, Subtype.DNA));
     228
     229    BioMaterialEvent creationEvent = dna.getCreationEvent();
     230    BioMaterialEventSource lysSrc = creationEvent.setSource(lysate.getItem());
     231    creationEvent.setEventDate(dnaInfo.qiacubeDate);
     232    if (dnaInfo.protocol != null) addDebugMessage("Found: " + dnaInfo.protocol.getName());
     233    creationEvent.setProtocol(dnaInfo.protocol);
     234    creationEvent.setHardware(null);
     235
     236    Annotationtype.QIACUBE_DATE.setAnnotationValue(dc, dna, dnaInfo.qiacubeDate);
     237    Annotationtype.QIACUBE_RUN_NO.setAnnotationValue(dc, dna, dnaInfo.qiacubeRunNumber);
     238    Annotationtype.QIACUBE_POSITION.setAnnotationValue(dc, dna, dnaInfo.qiacubePos);
     239    Annotationtype.QIACUBE_OPERATOR.setAnnotationValue(dc, dna, dnaInfo.operator);
     240   
     241    // TODO -- concentrations and quantities
     242    Annotationtype.QUBIT_CONC.setAnnotationValue(dc, dna, dnaInfo.qubitConc);
     243    dna.setOriginalQuantity(null);
     244    lysSrc.setUsedQuantity(null);
     245   
     246    // TODO -- box/tube information
     247   
     248    dc.saveItem(dna);
     249   
     250    addDebugMessage("Created: "+ dna.getName());
     251    return Dna.get(dna);
     252  }
     253
     254  private FlowThrough createFlowThrough(DbControl dc, Lysate lysate, FlowThroughInfo ftInfo)
     255  {
     256    Extract ft = Extract.getNew(dc);
     257    ft.setItemSubtype(Subtype.FLOW_THROUGH.get(dc));
     258    ft.setName(lysate.getNextChildName(dc, Subtype.FLOW_THROUGH));
     259
     260    BioMaterialEvent creationEvent = ft.getCreationEvent();
     261    BioMaterialEventSource lysSrc = creationEvent.setSource(lysate.getItem());
     262    creationEvent.setEventDate(ftInfo.qiacubeDate);
     263    if (ftInfo.protocol != null) addDebugMessage("Found: " + ftInfo.protocol.getName());
     264    creationEvent.setProtocol(ftInfo.protocol);
     265    creationEvent.setHardware(null);
     266
     267    Annotationtype.QIACUBE_DATE.setAnnotationValue(dc, ft, ftInfo.qiacubeDate);
     268    Annotationtype.QIACUBE_RUN_NO.setAnnotationValue(dc, ft, ftInfo.qiacubeRunNumber);
     269    Annotationtype.QIACUBE_POSITION.setAnnotationValue(dc, ft, ftInfo.qiacubePos);
     270    Annotationtype.QIACUBE_OPERATOR.setAnnotationValue(dc, ft, ftInfo.operator);
     271   
     272    // TODO -- quantities
     273    ft.setOriginalQuantity(null);
     274    lysSrc.setUsedQuantity(null);
     275   
     276    // TODO -- box/tube information
     277   
     278    dc.saveItem(ft);
     279   
     280    addDebugMessage("Created: "+ ft.getName());
     281    return FlowThrough.get(ft);
     282  }
     283
     284  private RnaQc createRnaQc(DbControl dc, Rna rna, RnaInfo rnaInfo)
     285  {
     286    Extract rnaQc = Extract.getNew(dc);
     287    rnaQc.setItemSubtype(Subtype.RNAQC.get(dc));
     288    rnaQc.setName(rna.getNextRnaQcName(dc));
     289   
     290    BioMaterialEvent creationEvent = rnaQc.getCreationEvent();
     291    creationEvent.setSource(rna.getItem());
     292    // TODO -- do we need more information about RNAQC
     293    // creationEvent.setEventDate(rnaInfo.qcDate);
     294    creationEvent.setEventDate(rnaInfo.qiacubeDate);
     295   
     296    // TODO -- BA_RIN or CA_RQS
     297    Annotationtype.CA_RQS.setAnnotationValue(dc, rnaQc, rnaInfo.rinOrRqs);
     298   
     299    dc.saveItem(rnaQc);
     300    addDebugMessage("Created: "+ rnaQc.getName());
     301    return RnaQc.get(rnaQc);
    181302  }
    182303 
     
    188309    Pipeline.RNA_SEQ.setAnnotation(dc, lib);
    189310    BioMaterialEvent creationEvent = lib.getCreationEvent();
    190     creationEvent.setSource(rna.getItem());
     311    BioMaterialEventSource rnaSrc = creationEvent.setSource(rna.getItem());
     312    // TODO -- used quantity from source
     313    rnaSrc.setUsedQuantity(null);
    191314
    192315    // Library annotations
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/plugins/cmd/JsonFile.java

    r6205 r6207  
    8080
    8181  private FastqInfo fastqInfo;
     82  private LysateInfo lysateInfo;
     83  private RnaInfo rnaInfo;
     84  private DnaInfo dnaInfo;
     85  private FlowThroughInfo flowThroughInfo;
    8286  private LibraryInfo libInfo;
    8387  private PoolInfo poolInfo;
     
    225229      if (fastqInfo.valid) fastqInfo.loadFileInfo(session, rootDir);
    226230
     231      lysateInfo = new LysateInfo(getRequiredSection("Lysate"));
     232      dnaInfo = new DnaInfo(getRequiredSection("DNA"));
     233      rnaInfo = new RnaInfo(getRequiredSection("RNA"));
     234      flowThroughInfo = new FlowThroughInfo(getRequiredSection("FlowThrough"));
    227235      libInfo = new LibraryInfo(getRequiredSection("Library"));
    228236      poolInfo = new PoolInfo(getRequiredSection("Pool"), libInfo);
     
    250258  }
    251259 
     260  public LysateInfo getLysate()
     261  {
     262    return lysateInfo;
     263  }
     264 
     265  public RnaInfo getRna()
     266  {
     267    return rnaInfo;
     268  }
     269 
     270  public DnaInfo getDna()
     271  {
     272    return dnaInfo;
     273  }
     274 
     275  public FlowThroughInfo getFlowThroughInfo()
     276  {
     277    return flowThroughInfo;
     278  }
     279 
    252280  public LibraryInfo getLibrary()
    253281  {
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/plugins/cmd/PlateWellValidator.java

    r6201 r6207  
    2424  */
    2525  public static final PlateWellValidator PLATE_8x12 = new PlateWellValidator(8, 12);
     26 
     27  /**
     28    Validator fow Qiacube positions which are represented as 6 rows with 2 columns.
     29  */
     30  public static final PlateWellValidator QIACUBE = new PlateWellValidator(6, 2);
    2631
    2732  private final Pattern pattern;
Note: See TracChangeset for help on using the changeset viewer.