Changeset 754 for trunk/grails-app/conf
- Timestamp:
- Jul 30, 2010, 3:05:41 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/conf/BootStrapStudies.groovy
r703 r754 167 167 ecCode:"2007117.c", 168 168 startDate: Date.parse('yyyy-MM-dd','2008-01-02'), 169 ) 170 .with { if (!validate()) { errors.each { println it} } else save()} 169 ).with { if (!validate()) { errors.each { println it} } else save()} 171 170 172 171 mouseStudy.setFieldValue('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." ) … … 179 178 ) 180 179 .setFieldValue( 'Diet','low fat') 181 .with { if (!validate()) { errors.each { println it} } else save()}182 180 183 181 def evHF = new Event( … … 187 185 ) 188 186 .setFieldValue( 'Diet','high fat' ) 189 .with { if (!validate()) { errors.each { println it} } else save()}190 187 191 188 def evBV = new Event( … … 195 192 ) 196 193 .setFieldValue( 'Control','true' ) 197 .with { if (!validate()) { errors.each { println it} } else save()}198 194 199 195 def evBL = new Event( … … 203 199 ) 204 200 .setFieldValue( 'Control','false' ) 205 .with { if (!validate()) { errors.each { println it} } else save()}206 201 207 202 def evLF4 = new Event( … … 211 206 ) 212 207 .setFieldValue( 'Diet','low fat') 213 .with { if (!validate()) { errors.each { println it} } else save()}214 208 215 209 def evHF4 = new Event( … … 219 213 ) 220 214 .setFieldValue( 'Diet','high fat' ) 221 .with { if (!validate()) { errors.each { println it} } else save()}222 215 223 216 def evBV4 = new Event( … … 227 220 ) 228 221 .setFieldValue( 'Control','true' ) 229 .with { if (!validate()) { errors.each { println it} } else save()}230 222 231 223 def evBL4 = new Event( … … 235 227 ) 236 228 .setFieldValue( 'Control','false' ) 237 .with { if (!validate()) { errors.each { println it} } else save()}238 229 239 230 def evS = new SamplingEvent( … … 242 233 template: liverSamplingEventTemplate) 243 234 .setFieldValue('Sample weight',5F) 244 .with { if (!validate()) { errors.each { println it} } else save()}245 235 246 236 def evS4 = new SamplingEvent( … … 249 239 template: liverSamplingEventTemplate) 250 240 .setFieldValue('Sample weight',5F) 251 .with { if (!validate()) { errors.each { println it} } else save()}252 241 253 242 // Add events to study … … 263 252 .addToSamplingEvents(evS) 264 253 .addToSamplingEvents(evS4) 265 .save() 254 .with { if (!validate()) { errors.each { println it} } else save()} 255 256 // Extra check if the SamplingEvents are saved correctly 257 evS.with { if (!validate()) { errors.each { println it} } else save()} 258 evS4.with { if (!validate()) { errors.each { println it} } else save()} 266 259 267 260 def LFBV1 = new EventGroup(name:"10% fat + vehicle for 1 week") 268 261 .addToEvents(evLF) 269 262 .addToEvents(evBV) 270 .addToEvents(evS) 271 .with { if (!validate()) { errors.each { println it} } else save()} 263 .addToSamplingEvents(evS) 272 264 273 265 def LFBL1 = new EventGroup(name:"10% fat + leptin for 1 week") 274 266 .addToEvents(evLF) 275 267 .addToEvents(evBL) 276 .addToEvents(evS) 277 .with { if (!validate()) { errors.each { println it} } else save()} 268 .addToSamplingEvents(evS) 278 269 279 270 def HFBV1 = new EventGroup(name:"45% fat + vehicle for 1 week") 280 271 .addToEvents(evHF) 281 272 .addToEvents(evBV) 282 .addToEvents(evS) 283 .with { if (!validate()) { errors.each { println it} } else save()} 273 .addToSamplingEvents(evS) 284 274 285 275 def HFBL1 = new EventGroup(name:"45% fat + leptin for 1 week") 286 276 .addToEvents(evHF) 287 277 .addToEvents(evBL) 288 .addToEvents(evS) 289 .with { if (!validate()) { errors.each { println it} } else save()} 278 .addToSamplingEvents(evS) 290 279 291 280 def LFBV4 = new EventGroup(name:"10% fat + vehicle for 4 weeks") 292 281 .addToEvents(evLF4) 293 282 .addToEvents(evBV4) 294 .addToEvents(evS4) 295 .with { if (!validate()) { errors.each { println it} } else save()} 283 .addToSamplingEvents(evS4) 296 284 297 285 def LFBL4 = new EventGroup(name:"10% fat + leptin for 4 weeks") 298 286 .addToEvents(evLF4) 299 287 .addToEvents(evBL4) 300 .addToEvents(evS4) 301 .with { if (!validate()) { errors.each { println it} } else save()} 288 .addToSamplingEvents(evS4) 302 289 303 290 def HFBV4 = new EventGroup(name:"45% fat + vehicle for 4 weeks") 304 291 .addToEvents(evHF4) 305 292 .addToEvents(evBV4) 306 .addToEvents(evS4) 307 .with { if (!validate()) { errors.each { println it} } else save()} 293 .addToSamplingEvents(evS4) 308 294 309 295 def HFBL4 = new EventGroup(name:"45% fat + leptin for 4 weeks") 310 296 .addToEvents(evHF4) 311 297 .addToEvents(evBL4) 312 .addToEvents(evS4) 313 .with { if (!validate()) { errors.each { println it} } else save()} 314 298 .addToSamplingEvents(evS4) 299 315 300 // Add subjects and samples and compose EventGroups 316 301 def x=1 317 20.times {302 80.times { 318 303 def currentSubject = new Subject( 319 304 name: "A" + x++, … … 325 310 .setFieldValue("Age", 17) 326 311 .setFieldValue("Cage", "" + (int)(x/2)) 327 .with { if (!validate()) { errors.each { println it} } else save(flush:true)}328 312 329 313 mouseStudy.addToSubjects(currentSubject) … … 344 328 name: currentSubject.name + '_B', 345 329 material: bloodTerm, 346 330 template: humanBloodSampleTemplate, 347 331 parentSubject: currentSubject, 348 332 parentEvent: x > 40 ? evS4 : evS 349 333 ); 350 currentSample.setFieldValue( "Text on vial", "T" + (Math.random() * 100L) ) 351 334 currentSample.setFieldValue( "Text on vial", "T" + (Math.random() * 100L) ) 352 335 mouseStudy.addToSamples(currentSample).with { if (!validate()) { errors.each { println it} } else save()} 353 336 } … … 363 346 .addToEventGroups(HFBV4) 364 347 .addToEventGroups(HFBL4) 348 .with { if (!validate()) { errors.each { println it} } else save()} 365 349 366 350 // Add persons and publications to study 367 def studyperson1 = new StudyPerson( person: person1, role: role1 ) .save();368 def studyperson2 = new StudyPerson( person: person2, role: role2 ) .save();351 def studyperson1 = new StudyPerson( person: person1, role: role1 ) 352 def studyperson2 = new StudyPerson( person: person2, role: role2 ) 369 353 370 354 mouseStudy … … 373 357 .addToPublications( publication1 ) 374 358 .addToPublications( publication2 ) 375 . save()359 .with { if (!validate()) { errors.each { println it} } else save()} 376 360 377 361 // Add example human study … … 406 390 407 391 rootGroup.addToEvents fastingEvent 408 rootGroup.addTo Events bloodSamplingEvent392 rootGroup.addToSamplingEvents bloodSamplingEvent 409 393 rootGroup.save() 410 394 … … 422 406 .setFieldValue("Weight", Math.random() * 150F) 423 407 .setFieldValue("BMI", 20 + Math.random() * 10F) 424 .with { if (!validate()) { errors.each { println it} } else save()}425 408 426 409 rootGroup.addToSubjects currentSubject 427 410 rootGroup.save() 428 411 429 412 def currentSample = new Sample( 430 413 name: currentSubject.name + '_B', 431 414 material: bloodTerm, 432 415 template: humanBloodSampleTemplate, 433 416 parentSubject: currentSubject, 434 417 parentEvent: bloodSamplingEvent 435 418 ); 436 currentSample.setFieldValue( "Text on vial", "T" + (Math.random() * 100L) ) 437 438 humanStudy.addToSubjects(currentSubject).addToSamples(currentSample).with { if (!validate()) { errors.each { println it} } else save()} 419 currentSample.setFieldValue( "Text on vial", "T" + (Math.random() * 100L) ) 420 421 humanStudy.addToSubjects(currentSubject).addToSamples(currentSample) 422 .with { if (!validate()) { errors.each { println it} } else save()} 439 423 } 440 424 … … 445 429 446 430 // Add persons to study 447 def studyperson3 = new StudyPerson( person: person1, role: role2 ) .save();431 def studyperson3 = new StudyPerson( person: person1, role: role2 ) 448 432 449 433 humanStudy 450 434 .addToPersons( studyperson3 ) 451 452 . save()435 .addToPublications( publication2 ) 436 .with { if (!validate()) { errors.each { println it} } else save()} 453 437 454 438 // Add clinical data ==> to be moved to SAM … … 519 503 } 520 504 521 505 mouseStudy.addToAssays(lipidAssayRef); 522 506 mouseStudy.save() 523 507
Note: See TracChangeset
for help on using the changeset viewer.