Changeset 187
- Timestamp:
- Feb 10, 2010, 4:09:52 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 6 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/conf/BootStrap.groovy
r186 r187 295 295 name: 'LDL', 296 296 unit: 'mg/dL', 297 type: dbnp. clinicaldata.ClinicalMeasurementType.NUMBER,297 type: dbnp.data.FeatureType.QUANTITATIVE, 298 298 referenceValues: '100 mg/dL', 299 299 detectableLimit: 250, … … 304 304 name: 'HDL', 305 305 unit: 'mg/dL', 306 type: dbnp. clinicaldata.ClinicalMeasurementType.NUMBER,306 type: dbnp.data.FeatureType.QUANTITATIVE, 307 307 referenceValues: '50 mg/dL', 308 308 detectableLimit: 100, -
trunk/grails-app/controllers/SandboxController.groovy
r186 r187 1 1 import dbnp.studycapturing.* 2 import dbnp.clinicaldata.ClinicalFloatData 3 import dbnp.clinicaldata.ClinicalMeasurement 2 4 3 5 // The sandbox is meant for internal communication over code examples etc. 4 6 5 7 class SandboxController { 8 9 def clinicalDataLayerService 6 10 7 11 def index = { … … 22 26 23 27 //Let's get a certain field for a certain subject 24 def subject = Subject.findByName('A1') 28 /*def subject = st.subjects.get(1) 29 30 if (subject) { 25 31 println st.template.getSubjectFieldType('Age') 26 32 println subject.getFieldValue('Genotype') … … 28 34 println subject.getFieldValue('Genotype') 29 35 subject.setFieldValue('name','hallo') 30 println subject.name 36 println subject.name }*/ 31 37 32 println Study.get(2).giveSamples()*.name 33 38 39 // Demonstration of querying mechanism 40 println clinicalDataLayerService.getFeaturesQuantitative(1) 41 clinicalDataLayerService.getDataQuantitative('LDL',1,['A1_B','A3_B'] as String[]) 34 42 35 43 // Specify which variables we want to be available in the controller (implicit return statement) 36 44 [fields: f, subjects: st.subjects] 45 } 37 46 } 38 } -
trunk/grails-app/domain/dbnp/clinicaldata/ClinicalMeasurement.groovy
r186 r187 1 1 package dbnp.clinicaldata 2 3 import dbnp.data.FeatureType 2 4 3 5 class ClinicalMeasurement 4 6 extends dbnp.data.FeatureBase { 5 7 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 7 12 String referenceValues 8 13 float detectableLimit … … 13 18 14 19 static constraints = { 20 name(unique:true) 15 21 referenceValues(nullable: true, blank: true) 16 22 detectableLimit(nullable: true) 17 23 correctionMethod(nullable: true, blank: true) 18 24 } 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 } 19 44 } -
trunk/grails-app/domain/dbnp/data/FeatureBase.groovy
r162 r187 5 5 String name 6 6 String unit 7 FeatureType type 7 8 8 9 static hasMany = [ -
trunk/grails-app/domain/dbnp/data/FeatureType.groovy
r186 r187 1 package dbnp. studycapturing1 package dbnp.data 2 2 3 3 /** 4 4 * Enum describing the different assay types (aka omics submodules). 5 5 */ 6 public enum AssayType { 7 TRANSCRIPTOMICS('Transcriptomics'), 8 METABOLOMICS('Metabolomics'), 9 CLINICAL_DATA('Clinical data') 6 public enum FeatureType { 7 QUANTITATIVE('Quantitative'), 8 QUALITATIVE('Qualitative'), 9 PAIRED('Paired'), 10 DIFFERENTIAL('Differential') 10 11 11 12 String name 12 13 13 AssayType(String name) {14 FeatureType(String name) { 14 15 this.name = name 15 16 } 16 17 17 18 static list() { 18 [ TRANSCRIPTOMICS, METABOLOMICS, CLINICAL_DATA]19 [QUANTITATIVE, QUALITATIVE, PAIRED, DIFFERENTIAL] 19 20 } 20 21 -
trunk/grails-app/services/dbnp/clinicaldata/ClinicalDataLayerService.groovy
r106 r187 5 5 boolean transactional = false 6 6 7 String getAssayDescription(long assayID) { 8 return ""; 7 Map getDataQuantitative(String feature, long assayID, String[] sampleIDs) { 8 def measurement = ClinicalMeasurement.findByName(feature) 9 if (!measurement) throw new NoSuchFieldException("Feature ${feature} not found") 10 measurement.getValues(assayID,sampleIDs) 9 11 } 10 12 11 String[] getFeatureNames(long assayID) { 12 return new String[0]; 13 } 14 15 Map getFeatureData(long assayID, long[] sampleIDs) { 16 return null; 17 } 18 19 Map getFeatureDataDifferential(long assayID, long[] sampleIDs1, long[] sampleIDs2) { 20 return null; 13 String[] getFeaturesQuantitative(long assayID) { 14 return ClinicalAssayInstance.get(assayID).assay.measurements*.name; 21 15 } 22 16 } -
trunk/src/java/dbnp/data/CleanDataLayer.java
r106 r187 8 8 public interface CleanDataLayer { 9 9 10 public String getAssayDescription(long assayID); 11 public String[] getFeatureNames(long assayID); 12 public Map getFeatureData(long assayID, long[] sampleIDs); 13 public Map getFeatureDataDifferential(long assayID, long[] sampleIDs1, long[] sampleIDs2); 10 /** 11 * Get the names of all quantitative features that are available for a certain assay 12 * @param assayID the module internal ID for the assay 13 * @return 14 */ 15 public String[] getFeaturesQuantitative(long assayID); 16 17 /** 18 * Get the data for a quantitative feature for a certain assay for a certain set of samples 19 * @param feature 20 * @param assayID 21 * @param sampleIDs 22 * @return 23 */ 24 public Map getDataQuantitative(String feature, long assayID, String[] sampleIDs); 14 25 15 26 }
Note: See TracChangeset
for help on using the changeset viewer.