Changeset 186 for trunk/grails-app/conf
- Timestamp:
- Feb 10, 2010, 1:55:45 PM (13 years ago)
- File:
-
- 1 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
Note: See TracChangeset
for help on using the changeset viewer.