1 | import org.codehaus.groovy.grails.commons.GrailsApplication |
---|
2 | import grails.util.GrailsUtil |
---|
3 | import dbnp.studycapturing.* |
---|
4 | |
---|
5 | import dbnp.data.Ontology |
---|
6 | import dbnp.data.Term |
---|
7 | |
---|
8 | /** |
---|
9 | * Application Bootstrapper |
---|
10 | * @Author Jeroen Wesbeek |
---|
11 | * @Since 20091021 |
---|
12 | * |
---|
13 | * Revision information: |
---|
14 | * $Rev: 136 $ |
---|
15 | * $Author: keesvb $ |
---|
16 | * $Date: 2010-01-26 09:48:51 +0000 (di, 26 jan 2010) $ |
---|
17 | */ |
---|
18 | class BootStrap { |
---|
19 | def init = {servletContext -> |
---|
20 | |
---|
21 | if (GrailsUtil.environment == GrailsApplication.ENV_DEVELOPMENT) { |
---|
22 | printf("development bootstrapping....\n\n"); |
---|
23 | |
---|
24 | // ontologies |
---|
25 | def speciesOntology = new Ontology( |
---|
26 | name: 'NCBI Taxonomy', |
---|
27 | shortName: 'Taxon', |
---|
28 | url: 'http://www.obofoundry.org/cgi-bin/detail.cgi?id=ncbi_taxonomy' |
---|
29 | ).save() |
---|
30 | |
---|
31 | // terms |
---|
32 | def mouseTerm = new Term( |
---|
33 | name: 'Mus musculus', |
---|
34 | ontology: speciesOntology, |
---|
35 | accession: '10090' |
---|
36 | ).save() |
---|
37 | def humanTerm = new Term( |
---|
38 | name: 'Homo sapiens', |
---|
39 | ontology: speciesOntology, |
---|
40 | accession: '9606' |
---|
41 | ).save() |
---|
42 | |
---|
43 | // create system user |
---|
44 | /* |
---|
45 | def systemUser = userService.createUser(InstanceGenerator.user( |
---|
46 | username: 'system', |
---|
47 | pass: 'system', |
---|
48 | passConfirm: 'system', |
---|
49 | enabled: true |
---|
50 | )) |
---|
51 | */ |
---|
52 | |
---|
53 | // Mouse template |
---|
54 | def mouseTemplate = new Template( |
---|
55 | name: 'Mouse' |
---|
56 | ).addToSubjectFields(new TemplateSubjectField( |
---|
57 | name: 'Genotype',type: TemplateFieldType.STRINGLIST)) |
---|
58 | .addToSubjectFields(new TemplateSubjectField( |
---|
59 | name: 'Age',type: TemplateFieldType.NUMBER) |
---|
60 | ).save() |
---|
61 | |
---|
62 | // studies |
---|
63 | def exampleStudy = new Study( |
---|
64 | title:"NuGO PPS3 mouse study leptin module", |
---|
65 | code:"PPS3_leptin_module", |
---|
66 | researchQuestion:"Leptin etc.", |
---|
67 | 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.", |
---|
68 | ecCode:"2007117.c", |
---|
69 | startDate: Date.parse('yyyy-MM-dd','2007-12-11')) |
---|
70 | def x=1 |
---|
71 | 12.times { |
---|
72 | exampleStudy.addToSubjects(new Subject( |
---|
73 | name: "A" + x++, |
---|
74 | species: mouseTerm, |
---|
75 | templateStringFields: ["Genotype" : "C57/Bl6j"], |
---|
76 | templateNumberFields: ["Age" : 17F] |
---|
77 | ))} |
---|
78 | exampleStudy.save() |
---|
79 | |
---|
80 | new Study(title:"example",code:"Excode",researchQuestion:"ExRquestion",description:"Exdescription",ecCode:"ExecCode",dateCreated:new Date(),lastUpdated:new Date(),startDate:new Date()).save() |
---|
81 | new Study(title:"testAgain",code:"testcode",researchQuestion:"testRquestion",description:"testdescription",ecCode:"testCode",dateCreated:new Date(),lastUpdated:new Date(),startDate:new Date()).save() |
---|
82 | new Study(title:"Exampletest",code:"Examplecode",researchQuestion:"ExampleRquestion",description:"Exampledescription",ecCode:"ExampleecCode",dateCreated:new Date(),lastUpdated:new Date(),startDate:new Date()).save() |
---|
83 | } |
---|
84 | } |
---|
85 | |
---|
86 | def destroy = { |
---|
87 | } |
---|
88 | } |
---|