Changeset 186
- Timestamp:
- Feb 10, 2010, 1:55:45 PM (12 years ago)
- Location:
- trunk/grails-app
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/conf/BootStrap.groovy
r177 r186 32 32 33 33 34 def humanBodyOntology = new Ontology( 35 name: 'Foundational Model of Anatomy', 36 shortName: 'HumanBody', 37 url: 'http://bioportal.bioontology.org/ontologies/39966' 38 ).with { if (!validate()) { errors.each { println it} } else save()} 39 34 40 // terms 35 41 def mouseTerm = new Term( … … 44 50 ).with { if (!validate()) { errors.each { println it} } else save()} 45 51 52 def bloodTerm = new Term( 53 name: 'Portion of blood', 54 ontology: humanBodyOntology, 55 accession: '9670' 56 ).with { if (!validate()) { errors.each { println it} } else save()} 57 46 58 def madmaxOntology = new Ontology( 47 59 name: 'Madmax ontology', … … 57 69 58 70 71 59 72 def treatmentProtocol = new Protocol( 60 73 name: 'MADMAX Experimental Protocol', … … 69 82 ).with { if (!validate()) { errors.each { println it} } else save()} 70 83 71 72 73 84 treatmentProtocol 74 85 .addToParameters(new ProtocolParameter( … … 93 104 listEntries: ['99% fat (crude oil)','1% fat (palm oil)'])) 94 105 .addToParameters(new ProtocolParameter( 95 name: 'Compound', 96 type: ProtocolParameterType.STRINGLIST, 97 listEntries: ['Vehicle','Leptin'])) 98 .addToParameters(new ProtocolParameter( 99 name: 'Administration', 106 name: 'BackgroundDiet', 100 107 type: ProtocolParameterType.STRING)) 101 108 .save() 102 109 103 110 // sampling event protocols 111 112 def liverSamplingProtocol = new Protocol( 113 name: 'Liver sampling' 114 ).with { if (!validate()) { errors.each { println it} } else save()} 115 116 liverSamplingProtocol 117 .addToParameters(new ProtocolParameter( 118 name: 'Sample weight', 119 unit: 'mg', 120 type: ProtocolParameterType.FLOAT)) 121 .save() 122 123 def bloodSamplingProtocol = new Protocol( 124 name: 'Liver sampling' 125 ).with { if (!validate()) { errors.each { println it} } else save()} 126 127 bloodSamplingProtocol 128 .addToParameters(new ProtocolParameter( 129 name: 'Sample volume', 130 unit: 'ml', 131 type: ProtocolParameterType.FLOAT)) 132 .save() 104 133 105 134 // create system user … … 113 142 */ 114 143 144 def genderField = new TemplateSubjectField( 145 name: 'Gender',type: TemplateFieldType.STRINGLIST, 146 listEntries: ['Male','Female']) 147 .with { if (!validate()) { errors.each { println it} } else save()} 148 115 149 // Mouse template 116 150 def mouseTemplate = new Template( … … 119 153 name: 'Genotype',type: TemplateFieldType.STRINGLIST, 120 154 listEntries: ['C57/Bl6j','wild type'])) 121 .addToSubjectFields(new TemplateSubjectField( 122 name: 'Gender',type: TemplateFieldType.STRINGLIST, 123 listEntries: ['Male','Female'])) 155 .addToSubjectFields(genderField) 124 156 .addToSubjectFields(new TemplateSubjectField( 125 157 name: 'Age',type: TemplateFieldType.INTEGER)) … … 128 160 .with { if (!validate()) { errors.each { println it} } else save()} 129 161 162 // Human template 163 def humanTemplate = new Template( 164 name: 'Human') 165 .addToSubjectFields(genderField) 166 .with { if (!validate()) { errors.each { println it} } else save()} 130 167 131 168 //events … … 134 171 description: 'Experimental Treatment Protocol NuGO PPS3 leptin module', 135 172 classification: treatmentTerm, 136 protocol: treatmentProtocol 137 ).with { if (!validate()) { errors.each { println it} } else save()} 173 protocol: treatmentProtocol, 174 isSamplingEvent: false 175 ).with { if (!validate()) { errors.each { println it} } else save()} 176 177 def samplingEvent = new EventDescription( 178 name: 'Liver extraction', 179 description: 'Liver sampling for transcriptomics arrays', 180 protocol: liverSamplingProtocol, 181 isSamplingEvent: true 182 ).with { if (!validate()) { errors.each { println it} } else save()} 183 184 def bloodSamplingEvent = new EventDescription( 185 name: 'Blood extraction', 186 description: 'Blood extraction targeted at lipid assays', 187 protocol: bloodSamplingProtocol, 188 isSamplingEvent: true 189 ).with { if (!validate()) { errors.each { println it} } else save()} 190 138 191 139 192 def eventTreatment2 = new EventDescription( 140 name: 'Treatment2', 141 description: 'Treatment Protocol NuGO PPS1', 142 classification: treatmentTerm, 143 protocol: treatmentProtocol2 144 ).with { if (!validate()) { errors.each { println it} } else save()} 193 name: 'Diet treatment', 194 description: 'Treatment Protocol NuGO PPSH', 195 protocol: treatmentProtocol2, 196 isSamplingEvent: false 197 ).with { if (!validate()) { errors.each { println it} } else save()} 198 199 println('Adding PPS3 study...') 145 200 146 201 // studies … … 172 227 eventDescription: eventTreatment, 173 228 parameterStringValues: ['Diet':'10% fat (palm oil)','Compound':'Vehicle','Administration':'intraperitoneal injection']) 174 ).with { if (!validate()) { errors.each { println it} } else save()} 229 ) 230 .addToSamplingEvents(new SamplingEvent( 231 subject: currentSubject, 232 startTime: Date.parse('yyyy-MM-dd','2008-01-14'), 233 endTime: Date.parse('yyyy-MM-dd','2008-01-14'), 234 eventDescription: samplingEvent, 235 parameterFloatValues: ['Sample weight':5F]) 236 ) 237 .with { if (!validate()) { errors.each { println it} } else save()} 175 238 } 176 239 177 240 178 def secondStudy = new Study( 179 title:"NuGO PPS1 mouse study leptin module", 180 code:"PPS1", 241 println 'Adding PPSH study...' 242 243 def humanStudy = new Study( 244 title:"NuGO PPS human study", 245 code:"PPSH", 181 246 researchQuestion:"etc.", 182 description:" C57Bl/6 mice were fed a high fat (45 en%) or low fat (10 en%) diet after a four week run-in on low fat diet. After 1 week 10 mice that received a low fat diet were given an IP leptin challenge and 10 mice of the low-fat group received placebo injections. The same procedure was performed with mice that were fed the high-fat diet. After 4 weeks the procedure was repeated. In total 80 mice were culled.",183 ecCode:" 2007.c",184 startDate: Date.parse('yyyy-MM-dd','200 7-12-11'),185 template: mouseTemplate247 description:"Human study", 248 ecCode:"unknown", 249 startDate: Date.parse('yyyy-MM-dd','2008-01-11'), 250 template: humanTemplate 186 251 ).with { if (!validate()) { errors.each { println it} } else save()} 187 252 … … 190 255 def currentSubject = new Subject( 191 256 name: "A" + y++, 192 species: mouseTerm, 193 template: mouseTemplate, 194 templateStringFields: ["Genotype" : "C57/Bl6j", "Gender" : "Male"], 195 templateIntegerFields: ["Age" : 17, "Cage" : (int)(y/2)] 196 ).with { if (!validate()) { errors.each { println it} } else save()} 197 198 secondStudy.addToSubjects(currentSubject) 199 .addToEvents(new SamplingEvent( 257 species: humanTerm, 258 template: humanTemplate, 259 templateStringFields: ["Gender" : "Male"], 260 ).with { if (!validate()) { errors.each { println it} } else save()} 261 262 humanStudy.addToSubjects(currentSubject) 263 .addToEvents(new Event( 200 264 subject: currentSubject, 201 startTime: Date.parse('yyyy-MM-dd','2008-01- 07'),265 startTime: Date.parse('yyyy-MM-dd','2008-01-14'), 202 266 endTime: Date.parse('yyyy-MM-dd','2008-01-14'), 203 267 eventDescription: eventTreatment2, 204 parameterStringValues: ['Diet':'10% fat (palm oil)','Compound':'Vehicle','Administration':'intraperitoneal injection']) 268 parameterStringValues: ['Diet':'99% fat (crude oil)','BackgroundDiet':'Mediterranean diet']) 269 ) 270 .addToSamplingEvents(new SamplingEvent( 271 subject: currentSubject, 272 startTime: Date.parse('yyyy-MM-dd','2008-01-14'), 273 endTime: Date.parse('yyyy-MM-dd','2008-01-14'), 274 eventDescription: bloodSamplingEvent, 275 parameterFloatValues: ['Sample volume':4.5F]) 276 .addToSamples(new Sample( 277 name: currentSubject.name + '_B', 278 material: bloodTerm 279 )) 205 280 ).with { if (!validate()) { errors.each { println it} } else save()} 206 281 } … … 209 284 // new Study(title:"testAgain",code:"testcode",researchQuestion:"testRquestion",description:"testdescription",ecCode:"testCode",dateCreated:new Date(),lastUpdated:new Date(),startDate:new Date()).save() 210 285 // new Study(title:"Exampletest",code:"Examplecode",researchQuestion:"ExampleRquestion",description:"Exampledescription",ecCode:"ExampleecCode",dateCreated:new Date(),lastUpdated:new Date(),startDate:new Date()).save() 211 } 286 287 // Add clinical data 288 289 def lipidAssay = new dbnp.clinicaldata.ClinicalAssay( 290 name: 'Lipid profile', 291 approved: true 292 ).with { if (!validate()) { errors.each { println it} } else save()} 293 294 def ldlMeasurement = new dbnp.clinicaldata.ClinicalMeasurement( 295 name: 'LDL', 296 unit: 'mg/dL', 297 type: dbnp.clinicaldata.ClinicalMeasurementType.NUMBER, 298 referenceValues: '100 mg/dL', 299 detectableLimit: 250, 300 isDrug: false, isIntake: true, inSerum: true 301 ).with { if (!validate()) { errors.each { println it} } else save()} 302 303 def hdlMeasurement = new dbnp.clinicaldata.ClinicalMeasurement( 304 name: 'HDL', 305 unit: 'mg/dL', 306 type: dbnp.clinicaldata.ClinicalMeasurementType.NUMBER, 307 referenceValues: '50 mg/dL', 308 detectableLimit: 100, 309 isDrug: false, isIntake: true, inSerum: true 310 ).with { if (!validate()) { errors.each { println it} } else save()} 311 312 lipidAssay.addToMeasurements ldlMeasurement 313 lipidAssay.addToMeasurements hdlMeasurement 314 315 def lipidAssayInstance = new dbnp.clinicaldata.ClinicalAssayInstance( 316 assay: lipidAssay 317 ).with { if (!validate()) { errors.each { println it} } else save()} 318 319 humanStudy.giveSamples()*.each { 320 new dbnp.clinicaldata.ClinicalFloatData( 321 assay: lipidAssayInstance, 322 measurement: ldlMeasurement, 323 sample: it.name, 324 value: Math.round(Math.random()*ldlMeasurement.detectableLimit) 325 ).with { if (!validate()) { errors.each { println it} } else save()} 326 327 new dbnp.clinicaldata.ClinicalFloatData( 328 assay: lipidAssayInstance, 329 measurement: hdlMeasurement, 330 sample: it.name, 331 value: Math.round(Math.random()*hdlMeasurement.detectableLimit) 332 ).with { if (!validate()) { errors.each { println it} } else save()} 333 } 334 335 // Add assay to study capture module 336 337 def clinicalModule = new AssayModule( 338 name: 'Clinical data', 339 type: AssayType.CLINICAL_DATA, 340 platform: 'clinical measurements', 341 url: 'http://localhost:8080/gscf' 342 ).with { if (!validate()) { errors.each { println it} } else save()} 343 344 def lipidAssayRef = new Assay( 345 name: 'Lipid profiling', 346 module: clinicalModule, 347 externalAssayId: lipidAssayInstance.id 348 ).with { if (!validate()) { errors.each { println it} } else save()} 349 350 humanStudy.giveSamples()*.each { 351 lipidAssayRef.addToSamples(it) 352 } 353 lipidAssayRef.save() 354 355 } 356 212 357 } 213 358 -
trunk/grails-app/controllers/SandboxController.groovy
r176 r186 29 29 subject.setFieldValue('name','hallo') 30 30 println subject.name 31 31 32 println Study.get(2).giveSamples()*.name 33 34 32 35 // Specify which variables we want to be available in the controller (implicit return statement) 33 36 [fields: f, subjects: st.subjects] -
trunk/grails-app/domain/dbnp/clinicaldata/ClinicalAssay.groovy
r162 r186 14 14 15 15 static constraints = { 16 reference(nullable: true, blank: true) 17 appliedMethod(nullable: true, blank: true) 18 SOP(nullable: true, blank: true) 16 19 } 17 20 } -
trunk/grails-app/domain/dbnp/clinicaldata/ClinicalAssayInstance.groovy
r162 r186 3 3 class ClinicalAssayInstance { 4 4 5 long externalAssayID // in the future, we might do a more sophisticated mapping to the study capture part, as multiple metadata instances might exist 5 // The (auto-generated) id of this instance will be used in the study capture module to refer to the assay 6 6 7 ClinicalAssay assay 7 8 -
trunk/grails-app/domain/dbnp/clinicaldata/ClinicalFloatData.groovy
r162 r186 6 6 class ClinicalFloatData { 7 7 8 long assayID // external or internal assay ID? the latter approach seems better 9 long sampleID // same question 8 ClinicalAssayInstance assay 10 9 ClinicalMeasurement measurement 10 String sample // universal sample ID 11 11 float value 12 12 -
trunk/grails-app/domain/dbnp/clinicaldata/ClinicalMeasurement.groovy
r162 r186 13 13 14 14 static constraints = { 15 referenceValues(nullable: true, blank: true) 16 detectableLimit(nullable: true) 17 correctionMethod(nullable: true, blank: true) 15 18 } 16 19 } -
trunk/grails-app/domain/dbnp/studycapturing/Assay.groovy
r184 r186 10 10 String name 11 11 AssayModule module 12 long externalAssayId 12 long externalAssayId // the assay ID the assay has in the external module 13 13 14 14 static hasMany = [samples : Sample] -
trunk/grails-app/domain/dbnp/studycapturing/AssayType.groovy
r162 r186 7 7 TRANSCRIPTOMICS('Transcriptomics'), 8 8 METABOLOMICS('Metabolomics'), 9 CLINICAL_ CHEMISTRY('Clinical Chemistry')9 CLINICAL_DATA('Clinical data') 10 10 11 11 String name … … 16 16 17 17 static list() { 18 [TRANSCRIPTOMICS, METABOLOMICS, CLINICAL_ CHEMISTRY]18 [TRANSCRIPTOMICS, METABOLOMICS, CLINICAL_DATA] 19 19 } 20 20 -
trunk/grails-app/domain/dbnp/studycapturing/EventDescription.groovy
r162 r186 10 10 class EventDescription { 11 11 12 String name 13 String description 14 Term classification 15 Protocol protocol 12 String name 13 String description 14 Term classification 15 Protocol protocol 16 boolean isSamplingEvent 16 17 17 static constraints = { 18 } 18 static constraints = { 19 classification(nullable: true) 20 } 21 19 22 } -
trunk/grails-app/domain/dbnp/studycapturing/Protocol.groovy
r184 r186 15 15 16 16 static hasMany = [parameters : ProtocolParameter, compounds: Compound] 17 static constraints = { } 17 static constraints = { 18 reference(nullable: true) 19 } 18 20 19 21 -
trunk/grails-app/domain/dbnp/studycapturing/Study.groovy
r184 r186 51 51 return template.studyFields; 52 52 } 53 54 def giveSamples() { 55 return samplingEvents*.samples; 56 } 53 57 } -
trunk/grails-app/domain/dbnp/studycapturing/TemplateSubjectField.groovy
r162 r186 11 11 class TemplateSubjectField extends TemplateField { 12 12 static constraints = { 13 name(unique: true) 13 14 } 14 15
Note: See TracChangeset
for help on using the changeset viewer.