Ignore:
Timestamp:
Feb 10, 2010, 4:09:52 PM (10 years ago)
Author:
keesvb
Message:

changed definition of clean data layer, implemented it for the clinical data module, added demonstration to the sandbox

Location:
trunk/grails-app/domain/dbnp
Files:
1 deleted
2 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/domain/dbnp/clinicaldata/ClinicalMeasurement.groovy

    r186 r187  
    11package dbnp.clinicaldata
     2
     3import dbnp.data.FeatureType
    24
    35class ClinicalMeasurement
    46 extends dbnp.data.FeatureBase {
    57
    6         ClinicalMeasurementType type
     8        // For now, let's assume that quantitative values are stored as float,
     9        // and qualitative values as string
     10        // We can always add an additional ClinicalMeasurementType datatype (FLOAT, INTEGER etc.) later (as was here until rev 186)
     11
    712        String referenceValues
    813        float detectableLimit
     
    1318
    1419        static constraints = {
     20                name(unique:true)
    1521                referenceValues(nullable: true, blank: true)
    1622                detectableLimit(nullable: true)
    1723                correctionMethod(nullable: true, blank: true)
    1824        }
     25
     26        Map getValues(long assayID, String[] sampleIDs) {
     27                FeatureType featureType = type
     28                switch(featureType) {
     29                        case FeatureType.QUANTITATIVE:
     30                                def values = ClinicalFloatData.withCriteria {
     31                                        assay { eq("id",assayID) }
     32                                        eq("measurement",this)
     33                                        'in'("sample",sampleIDs)
     34                                }
     35                                def result = new HashMap<String,Float>();
     36                                values.each {
     37                                        result.put(it.sample,it.value)
     38                                }
     39                                return result
     40                        default:
     41                                throw new NoSuchFieldException("Feature type ${featureType} not supported")
     42                }
     43        }
    1944}
  • trunk/grails-app/domain/dbnp/data/FeatureBase.groovy

    r162 r187  
    55        String name
    66        String unit
     7        FeatureType type
    78
    89        static hasMany = [
  • trunk/grails-app/domain/dbnp/data/FeatureType.groovy

    r186 r187  
    1 package dbnp.studycapturing
     1package dbnp.data
    22
    33/**
    44 * Enum describing the different assay types (aka omics submodules).
    55 */
    6 public enum AssayType {
    7     TRANSCRIPTOMICS('Transcriptomics'),
    8     METABOLOMICS('Metabolomics'),
    9     CLINICAL_DATA('Clinical data')
     6public enum FeatureType {
     7    QUANTITATIVE('Quantitative'),
     8    QUALITATIVE('Qualitative'),
     9    PAIRED('Paired'),
     10    DIFFERENTIAL('Differential')
    1011
    1112    String name
    1213
    13     AssayType(String name) {
     14    FeatureType(String name) {
    1415     this.name = name
    1516    }
    1617
    1718    static list() {
    18      [TRANSCRIPTOMICS, METABOLOMICS, CLINICAL_DATA]
     19     [QUANTITATIVE, QUALITATIVE, PAIRED, DIFFERENTIAL]
    1920    }
    2021
Note: See TracChangeset for help on using the changeset viewer.