Changeset 364
- Timestamp:
- Apr 21, 2010, 12:02:29 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/conf/BootStrap.groovy
r360 r364 1 import org.codehaus.groovy.grails.commons.GrailsApplication2 import grails.util.GrailsUtil3 1 import dbnp.studycapturing.* 4 2 5 3 import dbnp.data.Ontology 6 4 import dbnp.data.Term 7 import java.text.SimpleDateFormat8 5 9 6 /** … … 26 23 println ".development bootstrapping..."; 27 24 28 // adding the academic 25 // add NCBI species ontology 26 println ".adding NCBI species ontology" 27 def speciesOntology = new Ontology( 28 name: 'NCBI organismal classification', 29 description: 'A taxonomic classification of living organisms and associated artifacts for their controlled description within the context of databases.', 30 url: 'http://www.ncbi.nlm.nih.gov/Taxonomy/taxonomyhome.html/', 31 versionNumber: '1.2', 32 ncboId: '1132', 33 ncboVersionedId: '38802' 34 ).with { if (!validate()) { errors.each { println it} } else save()} 35 36 // add TERMS 37 println ".adding mouse term" 38 def mouseTerm = new Term( 39 name: 'Mus musculus', 40 ontology: speciesOntology, 41 accession: '10090' 42 ).with { if (!validate()) { errors.each { println it} } else save()} 43 println ".adding human term" 44 def humanTerm = new Term( 45 name: 'Homo sapiens', 46 ontology: speciesOntology, 47 accession: '9606' 48 ).with { if (!validate()) { errors.each { println it} } else save()} 49 50 51 /* COMMENTED OUT BECAUSE IT BREAKS EVERYTHING AFTER REFACTORING THE DATAMODEL 52 53 // ontologies 54 def speciesOntology = new Ontology( 55 name: 'NCBI Taxonomy', 56 shortName: 'Taxon', 57 url: 'http://www.obofoundry.org/cgi-bin/detail.cgi?id=ncbi_taxonomy' 58 ).with { if (!validate()) { errors.each { println it} } else save()} 59 60 def humanBodyOntology = new Ontology( 61 name: 'Foundational Model of Anatomy', 62 shortName: 'HumanBody', 63 url: 'http://bioportal.bioontology.org/ontologies/39966' 64 ).with { if (!validate()) { errors.each { println it} } else save()} 65 66 def nciOntology = new Ontology( 67 name: 'NCI Thesaurus', 68 shortName: 'NCI', 69 url: 'http://bioportal.bioontology.org/ontologies/42331' 70 ).with { if (!validate()) { errors.each { println it} } else save()} 71 72 // terms 73 def mouseTerm = new Term( 74 name: 'Mus musculus', 75 ontology: speciesOntology, 76 accession: '10090' 77 ).with { if (!validate()) { errors.each { println it} } else save()} 78 def humanTerm = new Term( 79 name: 'Homo sapiens', 80 ontology: speciesOntology, 81 accession: '9606' 82 ).with { if (!validate()) { errors.each { println it} } else save()} 83 def arabTerm = new Term( 84 name: 'Arabidopsis thaliana', 85 ontology: speciesOntology, 86 accession: '3702' 87 ).with { if (!validate()) { errors.each { println it} } else save()} 88 89 def bloodTerm = new Term( 90 name: 'Portion of blood', 91 ontology: humanBodyOntology, 92 accession: '9670' 93 ).with { if (!validate()) { errors.each { println it} } else save()} 94 95 def c57bl6Term = new Term( 96 name: 'C57BL/6 Mouse', 97 ontology: nciOntology, 98 accession: 'C14424' 99 ).with { if (!validate()) { errors.each { println it} } else save()} 100 101 def madmaxOntology = new Ontology( 102 name: 'Madmax ontology', 103 shortName: 'MDMX', 104 url: 'madmax.bioinformatics.nl' 105 ).with { if (!validate()) { errors.each { println it} } else save()} 106 107 def treatmentTerm = new Term( 108 name: 'ExperimentalProtocol', 109 ontology: madmaxOntology, 110 accession: 'P-MDMXGE-264' 111 ).with { if (!validate()) { errors.each { println it} } else save()} 112 113 def dietProtocol = new Protocol( 114 name: 'Diet treatment Protocol NuGO PPS3 leptin module', 115 reference: treatmentTerm 116 ).with { if (!validate()) { errors.each { println it} } else save()} 117 118 def boostProtocol = new Protocol( 119 name: 'Boost treatment Protocol NuGO PPS3 leptin module', 120 reference: treatmentTerm 121 ).with { if (!validate()) { errors.each { println it} } else save()} 122 123 def fastingProtocol = new Protocol( 124 name: 'Fasting', 125 reference: treatmentTerm 126 ).with { if (!validate()) { errors.each { println it} } else save()} 127 128 129 // ParameterStringListItems 130 def oil10= new ParameterStringListItem( 131 name: '10% fat (palm oil)' 132 ).with { if (!validate()) { errors.each { println it} } else save()} 133 def oil45= new ParameterStringListItem( 134 name: '45% fat (palm oil)' 135 ).with { if (!validate()) { errors.each { println it} } else save()} 136 def vehicle= new ParameterStringListItem( 137 name: 'Vehicle' 138 ).with { if (!validate()) { errors.each { println it} } else save()} 139 def leptin= new ParameterStringListItem( 140 name: 'Leptin' 141 ).with { if (!validate()) { errors.each { println it} } else save()} 142 143 144 dietProtocol 145 .addToParameters(new ProtocolParameter( 146 name: 'Diet', 147 type: ProtocolParameterType.STRINGLIST, 148 listEntries: [oil10,oil45])) 149 .save() 150 151 boostProtocol 152 .addToParameters(new ProtocolParameter( 153 name: 'Compound', 154 type: ProtocolParameterType.STRINGLIST, 155 listEntries: [vehicle,leptin])) 156 .save() 157 158 fastingProtocol 159 .addToParameters(new ProtocolParameter( 160 name: 'Fasting period', 161 type: ProtocolParameterType.STRING)) 162 .save() 163 164 165 // sampling event protocols 166 167 def liverSamplingProtocol = new Protocol( 168 name: 'Liver sampling' 169 ).with { if (!validate()) { errors.each { println it} } else save()} 170 171 liverSamplingProtocol 172 .addToParameters(new ProtocolParameter( 173 name: 'Sample weight', 174 unit: 'mg', 175 type: ProtocolParameterType.FLOAT)) 176 .save() 177 178 def bloodSamplingProtocol = new Protocol( 179 name: 'Blood sampling' 180 ).with { if (!validate()) { errors.each { println it} } else save()} 181 182 bloodSamplingProtocol 183 .addToParameters(new ProtocolParameter( 184 name: 'Sample volume', 185 unit: 'ml', 186 type: ProtocolParameterType.FLOAT)) 187 .save() 188 */ 189 // create system user 190 191 /*def systemUser = userService.createUser(InstanceGenerator.user( 192 username: 'system', 193 pass: 'system', 194 passConfirm: 'system', 195 enabled: true 196 ))*/ 197 198 199 def genderField = new TemplateField( 200 name: 'Gender',type: TemplateFieldType.STRINGLIST, 201 listEntries: [new TemplateFieldListItem(name:'Male'),new TemplateFieldListItem(name: 'Female')]) 202 .with { if (!validate()) { errors.each { println it} } else save()} 203 204 def ageField = new TemplateField( 205 name: 'Age (years)',type: TemplateFieldType.INTEGER,unit: 'years') 206 .with { if (!validate()) { errors.each { println it} } else save()} 207 208 def genotypeField = new TemplateField( 209 name: 'Genotype', type: TemplateFieldType.ONTOLOGYTERM) 210 .with { if (!validate()) { errors.each { println it} } else save()} 211 212 def genotypeTypeField = new TemplateField( 213 name: 'Genotype type',type: TemplateFieldType.STRINGLIST, 214 listEntries: [new TemplateFieldListItem(name:'transgenic'), 215 new TemplateFieldListItem(name:'knock-out'), 216 new TemplateFieldListItem(name:'knock-in')]) 217 .with { if (!validate()) { errors.each { println it} } else save()} 218 219 220 // Nutritional study template 221 29 222 println ".adding academic study template..." 30 223 def studyTemplate = new Template( … … 38 231 .with { if (!validate()) { errors.each { println it} } else save()} 39 232 40 233 // Mouse template 41 234 println ".adding mouse subject template..." 42 def mouseTemplate = new Template(43 name: 'Mouse', entity: dbnp.studycapturing.Subject)44 .addToFields(new TemplateField(45 name: 'Strain', type: TemplateFieldType.ONTOLOGYTERM))46 //.addToFields(genotypeField)47 //.addToFields(genotypeTypeField)48 //.addToFields(genderField)49 .addToFields(new TemplateField(50 name: 'Age (weeks)', type: TemplateFieldType.INTEGER, unit: 'weeks'))51 .addToFields(new TemplateField(52 name: 'Age type',type: TemplateFieldType.STRINGLIST,53 listEntries: [new TemplateFieldListItem(name:'postnatal'),new TemplateFieldListItem(name:'embryonal')]))54 .addToFields(new TemplateField(55 name: 'Cage',type: TemplateFieldType.STRING))56 .addToFields(new TemplateField(57 name: '#Mice in cage',type: TemplateFieldType.INTEGER))58 .addToFields(new TemplateField(59 name: 'Litter size',type: TemplateFieldType.INTEGER))60 .addToFields(new TemplateField(61 name: 'Weight (g)', type: TemplateFieldType.DOUBLE, unit: 'gram'))62 .with { if (!validate()) { errors.each { println it} } else save()}63 64 // Human template65 println ".adding human subject template..."66 def humanTemplate = new Template(67 name: 'Human', entity: dbnp.studycapturing.Subject)68 //.addToFields(genderField)69 //.addToFields(ageField)70 .addToFields(new TemplateField(71 name: 'DOB',type: TemplateFieldType.DATE))72 .addToFields(new TemplateField(73 name: 'Height',type: TemplateFieldType.DOUBLE, unit: 'm'))74 .addToFields(new TemplateField(75 name: 'Weight (kg)',type: TemplateFieldType.DOUBLE, unit: 'kg'))76 .addToFields(new TemplateField(77 name: 'BMI',type: TemplateFieldType.DOUBLE, unit: 'kg/m2'))78 .addToFields(new TemplateField(79 name: 'Race',type: TemplateFieldType.STRING))80 .addToFields(new TemplateField(81 name: 'Waist circumference',type: TemplateFieldType.FLOAT, unit: 'cm'))82 .addToFields(new TemplateField(83 name: 'Hip circumference',type: TemplateFieldType.FLOAT, unit: 'cm'))84 .addToFields(new TemplateField(85 name: 'Systolic blood pressure',type: TemplateFieldType.FLOAT, unit: 'mmHg'))86 .addToFields(new TemplateField(87 name: 'Diastolic blood pressure',type: TemplateFieldType.FLOAT, unit: 'mmHg'))88 .addToFields(new TemplateField(89 name: 'Heart rate',type: TemplateFieldType.FLOAT, unit: 'beats/min'))90 .addToFields(new TemplateField(91 name: 'Run-in-food',type: TemplateFieldType.TEXT))92 .with { if (!validate()) { errors.each { println it} } else save()}93 94 // add NCBI species ontology95 println ".adding NCBI species ontology"96 def speciesOntology = new Ontology(97 name: 'NCBI organismal classification',98 description: 'A taxonomic classification of living organisms and associated artifacts for their controlled description within the context of databases.',99 url: 'http://www.ncbi.nlm.nih.gov/Taxonomy/taxonomyhome.html/',100 versionNumber: '1.2',101 ncboId: '1132',102 ncboVersionedId: '38802'103 ).with { if (!validate()) { errors.each { println it} } else save()}104 105 // add TERMS106 println ".adding mouse term"107 def mouseTerm = new Term(108 name: 'Mus musculus',109 ontology: speciesOntology,110 accession: '10090'111 ).with { if (!validate()) { errors.each { println it} } else save()}112 println ".adding human term"113 def humanTerm = new Term(114 name: 'Homo sapiens',115 ontology: speciesOntology,116 accession: '9606'117 ).with { if (!validate()) { errors.each { println it} } else save()}118 119 120 /* COMMENTED OUT BECAUSE IT BREAKS EVERYTHING AFTER REFACTORING THE DATAMODEL121 122 // ontologies123 def speciesOntology = new Ontology(124 name: 'NCBI Taxonomy',125 shortName: 'Taxon',126 url: 'http://www.obofoundry.org/cgi-bin/detail.cgi?id=ncbi_taxonomy'127 ).with { if (!validate()) { errors.each { println it} } else save()}128 129 def humanBodyOntology = new Ontology(130 name: 'Foundational Model of Anatomy',131 shortName: 'HumanBody',132 url: 'http://bioportal.bioontology.org/ontologies/39966'133 ).with { if (!validate()) { errors.each { println it} } else save()}134 135 def nciOntology = new Ontology(136 name: 'NCI Thesaurus',137 shortName: 'NCI',138 url: 'http://bioportal.bioontology.org/ontologies/42331'139 ).with { if (!validate()) { errors.each { println it} } else save()}140 141 // terms142 def mouseTerm = new Term(143 name: 'Mus musculus',144 ontology: speciesOntology,145 accession: '10090'146 ).with { if (!validate()) { errors.each { println it} } else save()}147 def humanTerm = new Term(148 name: 'Homo sapiens',149 ontology: speciesOntology,150 accession: '9606'151 ).with { if (!validate()) { errors.each { println it} } else save()}152 def arabTerm = new Term(153 name: 'Arabidopsis thaliana',154 ontology: speciesOntology,155 accession: '3702'156 ).with { if (!validate()) { errors.each { println it} } else save()}157 158 def bloodTerm = new Term(159 name: 'Portion of blood',160 ontology: humanBodyOntology,161 accession: '9670'162 ).with { if (!validate()) { errors.each { println it} } else save()}163 164 def c57bl6Term = new Term(165 name: 'C57BL/6 Mouse',166 ontology: nciOntology,167 accession: 'C14424'168 ).with { if (!validate()) { errors.each { println it} } else save()}169 170 def madmaxOntology = new Ontology(171 name: 'Madmax ontology',172 shortName: 'MDMX',173 url: 'madmax.bioinformatics.nl'174 ).with { if (!validate()) { errors.each { println it} } else save()}175 176 def treatmentTerm = new Term(177 name: 'ExperimentalProtocol',178 ontology: madmaxOntology,179 accession: 'P-MDMXGE-264'180 ).with { if (!validate()) { errors.each { println it} } else save()}181 182 def dietProtocol = new Protocol(183 name: 'Diet treatment Protocol NuGO PPS3 leptin module',184 reference: treatmentTerm185 ).with { if (!validate()) { errors.each { println it} } else save()}186 187 def boostProtocol = new Protocol(188 name: 'Boost treatment Protocol NuGO PPS3 leptin module',189 reference: treatmentTerm190 ).with { if (!validate()) { errors.each { println it} } else save()}191 192 def fastingProtocol = new Protocol(193 name: 'Fasting',194 reference: treatmentTerm195 ).with { if (!validate()) { errors.each { println it} } else save()}196 197 198 // ParameterStringListItems199 def oil10= new ParameterStringListItem(200 name: '10% fat (palm oil)'201 ).with { if (!validate()) { errors.each { println it} } else save()}202 def oil45= new ParameterStringListItem(203 name: '45% fat (palm oil)'204 ).with { if (!validate()) { errors.each { println it} } else save()}205 def vehicle= new ParameterStringListItem(206 name: 'Vehicle'207 ).with { if (!validate()) { errors.each { println it} } else save()}208 def leptin= new ParameterStringListItem(209 name: 'Leptin'210 ).with { if (!validate()) { errors.each { println it} } else save()}211 212 213 dietProtocol214 .addToParameters(new ProtocolParameter(215 name: 'Diet',216 type: ProtocolParameterType.STRINGLIST,217 listEntries: [oil10,oil45]))218 .save()219 220 boostProtocol221 .addToParameters(new ProtocolParameter(222 name: 'Compound',223 type: ProtocolParameterType.STRINGLIST,224 listEntries: [vehicle,leptin]))225 .save()226 227 fastingProtocol228 .addToParameters(new ProtocolParameter(229 name: 'Fasting period',230 type: ProtocolParameterType.STRING))231 .save()232 233 234 // sampling event protocols235 236 def liverSamplingProtocol = new Protocol(237 name: 'Liver sampling'238 ).with { if (!validate()) { errors.each { println it} } else save()}239 240 liverSamplingProtocol241 .addToParameters(new ProtocolParameter(242 name: 'Sample weight',243 unit: 'mg',244 type: ProtocolParameterType.FLOAT))245 .save()246 247 def bloodSamplingProtocol = new Protocol(248 name: 'Blood sampling'249 ).with { if (!validate()) { errors.each { println it} } else save()}250 251 bloodSamplingProtocol252 .addToParameters(new ProtocolParameter(253 name: 'Sample volume',254 unit: 'ml',255 type: ProtocolParameterType.FLOAT))256 .save()257 */258 // create system user259 260 /*def systemUser = userService.createUser(InstanceGenerator.user(261 username: 'system',262 pass: 'system',263 passConfirm: 'system',264 enabled: true265 ))*/266 267 /*268 def genderField = new TemplateField(269 name: 'Gender',type: TemplateFieldType.STRINGLIST,270 listEntries: [new TemplateFieldListItem(name:'Male'),new TemplateFieldListItem(name: 'Female')])271 .with { if (!validate()) { errors.each { println it} } else save()}272 273 def ageField = new TemplateField(274 name: 'Age (years)',type: TemplateFieldType.INTEGER,unit: 'years')275 .with { if (!validate()) { errors.each { println it} } else save()}276 277 def genotypeField = new TemplateField(278 name: 'Genotype', type: TemplateFieldType.ONTOLOGYTERM)279 .with { if (!validate()) { errors.each { println it} } else save()}280 281 def genotypeTypeField = new TemplateField(282 name: 'Genotype type',type: TemplateFieldType.STRINGLIST,283 listEntries: [new TemplateFieldListItem(name:'transgenic'),284 new TemplateFieldListItem(name:'knock-out'),285 new TemplateFieldListItem(name:'knock-in')])286 .with { if (!validate()) { errors.each { println it} } else save()}287 288 289 // Nutritional study template290 291 println "Adding academic study template..."292 def studyTemplate = new Template(293 name: 'Academic study', entity: dbnp.studycapturing.Study)294 .addToFields(new TemplateField(name: 'Consortium',type: TemplateFieldType.STRING))295 .addToFields(new TemplateField(name: 'Cohort name',type: TemplateFieldType.STRING))296 .addToFields(new TemplateField(name: 'Time zone',type: TemplateFieldType.STRING))297 .addToFields(new TemplateField(name: 'Responsible scientist',type: TemplateFieldType.STRING))298 .addToFields(new TemplateField(name: 'Lab code',type: TemplateFieldType.STRING))299 .addToFields(new TemplateField(name: 'Institute',type: TemplateFieldType.STRING))300 .with { if (!validate()) { errors.each { println it} } else save()}301 302 // Mouse template303 235 def mouseTemplate = new Template( 304 236 name: 'Mouse', entity: dbnp.studycapturing.Subject) … … 324 256 325 257 // Human template 258 println ".adding human subject template..." 326 259 def humanTemplate = new Template( 327 260 name: 'Human', entity: dbnp.studycapturing.Subject) … … 426 359 427 360 361 /* 428 362 //events 429 363 def eventDiet = new EventDescription( … … 466 400 467 401 println('Adding PPS3 study...') 468 402 */ 469 403 // studies 470 404 def exampleStudy = new Study( … … 488 422 ).with { if (!validate()) { errors.each { println it} } else save()} 489 423 490 def evLF = new Event(424 /*def evLF = new Event( 491 425 startTime: Date.parse('yyyy-MM-dd','2008-01-07'), 492 426 endTime: Date.parse('yyyy-MM-dd','2008-01-14'),
Note: See TracChangeset
for help on using the changeset viewer.