Changeset 5211


Ignore:
Timestamp:
Jan 8, 2019, 4:12:00 PM (6 months ago)
Author:
Nicklas Nordborg
Message:

References #1081: The release exporter should export more data

Added original and remaining quanity (µg) and NanoDrop concentration to the BloodDNA exporter.

File:
1 edited

Legend:

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

    r5142 r5211  
    88import net.sf.basedb.core.DbControl;
    99import net.sf.basedb.core.Extract;
     10import net.sf.basedb.core.Item;
     11import net.sf.basedb.core.Quantity;
    1012import net.sf.basedb.core.Sample;
     13import net.sf.basedb.core.Type;
     14import net.sf.basedb.core.Unit;
     15import net.sf.basedb.reggie.dao.Annotationtype;
    1116import net.sf.basedb.reggie.dao.BloodDna;
     17import net.sf.basedb.reggie.json.FilteredJSONArray;
     18import net.sf.basedb.util.filter.NotNullFilter;
     19import net.sf.basedb.util.units.UnitUtil;
    1220
    1321/**
     
    4351      jsonDna.put("subtype", getName(dna.getItemSubtype()));
    4452      jsonDna.put("parent", blood.getExternalId());
     53     
     54      JSONArray jsonAnnotations = new FilteredJSONArray(new NotNullFilter<>(false));
     55      jsonDna.put("annotations", jsonAnnotations);
     56      jsonAnnotations.add(item.createAnnotationJSON("DNAOriginalQuantity", dna.getOriginalQuantity()));
     57      jsonAnnotations.add(item.createAnnotationJSON("DNARemainingQuantity", dna.getRemainingQuantity()));
     58      jsonAnnotations.add(item.getAnnotationJSON(Annotationtype.ND_CONC, dna, null));
     59     
    4560      json.add(jsonDna);
    4661    }
     
    4964  }
    5065
     66  @Override
     67  public List<CohortTypeDef> getTypeDefsInJSON()
     68  {
     69    DbControl dc = getDbControl();
     70    CohortTypeDefFactory dnaFactory = new CohortTypeDefFactory(dc, Item.EXTRACT, "BloodDNA");
     71
     72    Unit µg = UnitUtil.getUnit(dc, Quantity.MASS, "µg");
     73
     74    // DNA annotation
     75    dnaFactory.createAnnotationType("DNAOriginalQuantity", Type.FLOAT).setUnit(µg);
     76    dnaFactory.createAnnotationType("DNARemainingQuantity", Type.FLOAT).setUnit(µg).setProjectSpecificValues(true);
     77    dnaFactory.createAnnotationType(Annotationtype.ND_CONC).setUnit(UnitUtil.getUnit(dc, Quantity.DENSITY, "ng/µl"));
     78   
     79    return dnaFactory.allCreated();
     80  }
    5181
    5282}
Note: See TracChangeset for help on using the changeset viewer.