1 | package dbnp.configuration |
---|
2 | |
---|
3 | /** |
---|
4 | * @Author kees |
---|
5 | * @Since Jun 25, 2010 |
---|
6 | * |
---|
7 | * Revision information: |
---|
8 | * $Rev: 1588 $ |
---|
9 | * $Author: s.h.sikkema@gmail.com $ |
---|
10 | * $Date: 2011-03-04 11:30:52 +0000 (vr, 04 mrt 2011) $ |
---|
11 | */ |
---|
12 | |
---|
13 | import dbnp.studycapturing.* |
---|
14 | import org.dbnp.gdt.* |
---|
15 | import org.codehaus.groovy.grails.commons.GrailsApplication |
---|
16 | import grails.util.GrailsUtil |
---|
17 | import dbnp.rest.common.CommunicationManager |
---|
18 | import org.codehaus.groovy.grails.commons.* |
---|
19 | |
---|
20 | |
---|
21 | class ExampleStudies { |
---|
22 | |
---|
23 | /** |
---|
24 | * Add example studies. This function is meant to be called only in development mode |
---|
25 | */ |
---|
26 | public static void addExampleStudies(dbnp.authentication.SecUser owner, dbnp.authentication.SecUser otherUser) { |
---|
27 | "inserting initial studies".grom() |
---|
28 | |
---|
29 | // get configuration |
---|
30 | def config = ConfigurationHolder.config |
---|
31 | |
---|
32 | // Look up the used ontologies which should be in the database by now |
---|
33 | def speciesOntology = Ontology.getOrCreateOntologyByNcboId(1132) |
---|
34 | def brendaOntology = Ontology.getOrCreateOntologyByNcboId(1005) |
---|
35 | def nciOntology = Ontology.getOrCreateOntologyByNcboId(1032) |
---|
36 | def chebiOntology = Ontology.getOrCreateOntologyByNcboId(1007) |
---|
37 | |
---|
38 | // Look up the used templates which should also be in the database by now |
---|
39 | def studyTemplate = Template.findByName("Academic study") |
---|
40 | def mouseTemplate = Template.findByName("Mouse") |
---|
41 | def humanTemplate = Template.findByName("Human") |
---|
42 | def dietTreatmentTemplate = Template.findByName("Diet treatment") |
---|
43 | def boostTreatmentTemplate = Template.findByName("Compound challenge") |
---|
44 | def liverSamplingEventTemplate = Template.findByName("Liver extraction") |
---|
45 | def fastingTreatmentTemplate = Template.findByName("Fasting treatment") |
---|
46 | def bloodSamplingEventTemplate = Template.findByName("Blood extraction") |
---|
47 | def humanTissueSampleTemplate = Template.findByName("Human tissue sample") |
---|
48 | def humanBloodSampleTemplate = Template.findByName("Human blood sample") |
---|
49 | def ccAssayTemplate = Template.findByName("Clinical chemistry assay") |
---|
50 | def metAssayTemplate = Template.findByName("Metabolomics assay") |
---|
51 | |
---|
52 | // Add terms manually, to avoid having to do many HTTP requests to the BioPortal website |
---|
53 | def mouseTerm = new Term( |
---|
54 | name : 'Mus musculus', |
---|
55 | ontology : speciesOntology, |
---|
56 | accession : '10090' |
---|
57 | ).save(failOnError:true) |
---|
58 | |
---|
59 | def humanTerm = new Term( |
---|
60 | name : 'Homo sapiens', |
---|
61 | ontology : speciesOntology, |
---|
62 | accession : '9606' |
---|
63 | ).save(failOnError:true) |
---|
64 | |
---|
65 | def arabTerm = new Term( |
---|
66 | name : 'Arabidopsis thaliana', |
---|
67 | ontology : speciesOntology, |
---|
68 | accession : '3702' |
---|
69 | ).save(failOnError:true) |
---|
70 | |
---|
71 | def tomatoTerm = new Term( |
---|
72 | name : 'Solanum lycopersicum', |
---|
73 | ontology : speciesOntology, |
---|
74 | accession : '4081' |
---|
75 | ).save(failOnError:true) |
---|
76 | |
---|
77 | def potatoTerm = new Term( |
---|
78 | name : 'Solanum tuberosum', |
---|
79 | ontology : speciesOntology, |
---|
80 | accession : '0000' |
---|
81 | ).save(failOnError:true) |
---|
82 | |
---|
83 | def bloodTerm = new Term( |
---|
84 | name : 'blood plasma', |
---|
85 | ontology : brendaOntology, |
---|
86 | accession : 'BTO:0000131' |
---|
87 | ).save(failOnError:true) |
---|
88 | |
---|
89 | def c57bl6Term = new Term( |
---|
90 | name : 'C57BL/6 Mouse', |
---|
91 | ontology : nciOntology, |
---|
92 | accession : 'C14424' |
---|
93 | ).save(failOnError:true) |
---|
94 | |
---|
95 | def glucoseTerm = new Term( |
---|
96 | name : 'glucose', |
---|
97 | ontology : chebiOntology, |
---|
98 | accession : 'CHEBI:17234' |
---|
99 | ).save(failOnError:true) |
---|
100 | |
---|
101 | // Create a few persons, roles and Affiliations |
---|
102 | def affiliation1 = new PersonAffiliation( |
---|
103 | institute : "Science Institute NYC", |
---|
104 | department : "Department of Mathematics" |
---|
105 | ).save(failOnError:true) |
---|
106 | |
---|
107 | def affiliation2 = new PersonAffiliation( |
---|
108 | institute : "InfoStats GmbH, Hamburg", |
---|
109 | department : "Life Sciences" |
---|
110 | ).save(failOnError:true) |
---|
111 | |
---|
112 | def role1 = new PersonRole( |
---|
113 | name : "Principal Investigator" |
---|
114 | ).save(failOnError:true) |
---|
115 | |
---|
116 | def role2 = new PersonRole( |
---|
117 | name : "Statician" |
---|
118 | ).save(failOnError:true) |
---|
119 | |
---|
120 | // Create persons |
---|
121 | def person1 = new Person( |
---|
122 | lastName : "Scientist", |
---|
123 | firstName : "John", |
---|
124 | gender : "Male", |
---|
125 | initials : "J.R.", |
---|
126 | email : "john@scienceinstitute.com", |
---|
127 | phone : "1-555-3049", |
---|
128 | address : "First street 2,NYC" |
---|
129 | ).addToAffiliations(affiliation1).addToAffiliations(affiliation2).save(failOnError:true) |
---|
130 | |
---|
131 | def person2 = new Person( |
---|
132 | lastName : "Statician", |
---|
133 | firstName : "Jane", |
---|
134 | gender : "Female", |
---|
135 | initials : "W.J.", |
---|
136 | email : "jane@statisticalcompany.de", |
---|
137 | phone : "49-555-8291", |
---|
138 | address : "Dritten strasse 38, Hamburg, Germany" |
---|
139 | ).addToAffiliations(affiliation2).save(failOnError:true) |
---|
140 | |
---|
141 | // Create 30 persons to test pagination |
---|
142 | def personCounter = 1 |
---|
143 | 30.times { |
---|
144 | new Person( |
---|
145 | firstName : "Person #${personCounter}", |
---|
146 | lastName : "Testperson", |
---|
147 | email : "email${personCounter++}@testdomain.com" |
---|
148 | ).save(failOnError:true) |
---|
149 | } |
---|
150 | |
---|
151 | // Create a few publications |
---|
152 | def publication1 = new Publication( |
---|
153 | title : "Postnatal development of hypothalamic leptin receptors", |
---|
154 | authorsList : "Cottrell EC, Mercer JG, Ozanne SE.", |
---|
155 | pubMedID : "20472140", |
---|
156 | comments : "Not published yet", |
---|
157 | DOI : "unknown" |
---|
158 | ).save(failOnError:true) |
---|
159 | |
---|
160 | def publication2 = new Publication( |
---|
161 | title : "Induction of regulatory T cells decreases adipose inflammation and alleviates insulin resistance in ob/ob mice", |
---|
162 | authorsList : "Ilan Y, Maron R, Tukpah AM, Maioli TU, Murugaiyan G, Yang K, Wu HY, Weiner HL.", |
---|
163 | pubMedID : "20445103", |
---|
164 | comments : "", |
---|
165 | DOI : "" |
---|
166 | ).save(failOnError:true) |
---|
167 | |
---|
168 | // Add example mouse study |
---|
169 | def mouseStudy = new Study( |
---|
170 | template : studyTemplate, |
---|
171 | title : "NuGO PPS3 mouse study leptin module", |
---|
172 | 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.", |
---|
173 | code : "PPS3_leptin_module", |
---|
174 | researchQuestion: "Leptin etc.", |
---|
175 | ecCode : "2007117.c", |
---|
176 | startDate : Date.parse('yyyy-MM-dd', '2008-01-02'), |
---|
177 | owner : owner, |
---|
178 | readers : [otherUser] |
---|
179 | ).save(failOnError:true) |
---|
180 | |
---|
181 | def evLF = new Event( |
---|
182 | startTime : 3600, |
---|
183 | endTime : 3600 + 7 * 24 * 3600, |
---|
184 | template : dietTreatmentTemplate |
---|
185 | ).setFieldValue('Diet', 'low fat') |
---|
186 | |
---|
187 | def evHF = new Event( |
---|
188 | startTime : 3600, |
---|
189 | endTime : 3600 + 7 * 24 * 3600, |
---|
190 | template : dietTreatmentTemplate |
---|
191 | ).setFieldValue('Diet', 'high fat') |
---|
192 | |
---|
193 | def evBV = new Event( |
---|
194 | startTime : 3600, |
---|
195 | endTime : 3600 + 7 * 24 * 3600, |
---|
196 | template : boostTreatmentTemplate |
---|
197 | ).setFieldValue('Control', 'true') |
---|
198 | |
---|
199 | def evBL = new Event( |
---|
200 | startTime : 3600, |
---|
201 | endTime : 3600 + 7 * 24 * 3600, |
---|
202 | template : boostTreatmentTemplate |
---|
203 | ).setFieldValue('Control', 'false') |
---|
204 | |
---|
205 | def evLF4 = new Event( |
---|
206 | startTime : 3600, |
---|
207 | endTime : 3600 + 4 * 7 * 24 * 3600, |
---|
208 | template : dietTreatmentTemplate |
---|
209 | ).setFieldValue('Diet', 'low fat') |
---|
210 | |
---|
211 | def evHF4 = new Event( |
---|
212 | startTime : 3600, |
---|
213 | endTime : 3600 + 4 * 7 * 24 * 3600, |
---|
214 | template : dietTreatmentTemplate |
---|
215 | ).setFieldValue('Diet', 'high fat') |
---|
216 | |
---|
217 | def evBV4 = new Event( |
---|
218 | startTime : 3600, |
---|
219 | endTime : 3600 + 4 * 7 * 24 * 3600, |
---|
220 | template : boostTreatmentTemplate |
---|
221 | ).setFieldValue('Control', 'true') |
---|
222 | |
---|
223 | def evBL4 = new Event( |
---|
224 | startTime : 3600, |
---|
225 | endTime : 3600 + 4 * 7 * 24 * 3600, |
---|
226 | template : boostTreatmentTemplate |
---|
227 | ).setFieldValue('Control', 'false') |
---|
228 | |
---|
229 | def evS = new SamplingEvent( |
---|
230 | startTime : 3600 + 7 * 24 * 3600, |
---|
231 | template : liverSamplingEventTemplate, |
---|
232 | sampleTemplate: humanTissueSampleTemplate).setFieldValue('Sample weight', 5F) |
---|
233 | |
---|
234 | def evS4 = new SamplingEvent( |
---|
235 | startTime : 3600 + 7 * 24 * 3600, |
---|
236 | template : liverSamplingEventTemplate, |
---|
237 | sampleTemplate: humanTissueSampleTemplate).setFieldValue('Sample weight', 5F) |
---|
238 | |
---|
239 | // Add events to study |
---|
240 | mouseStudy.addToEvents(evLF).addToEvents(evHF).addToEvents(evBV).addToEvents(evBL).addToEvents(evLF4).addToEvents(evHF4).addToEvents(evBV4).addToEvents(evBL4).addToSamplingEvents(evS).addToSamplingEvents(evS4).save(failOnError:true) |
---|
241 | |
---|
242 | // Extra check if the SamplingEvents are saved correctly |
---|
243 | evS.save(failOnError:true) |
---|
244 | evS4.save(failOnError:true) |
---|
245 | |
---|
246 | def LFBV1 = new EventGroup(name: "10% fat + vehicle for 1 week").addToEvents(evLF).addToEvents(evBV).addToSamplingEvents(evS) |
---|
247 | |
---|
248 | def LFBL1 = new EventGroup(name: "10% fat + leptin for 1 week").addToEvents(evLF).addToEvents(evBL).addToSamplingEvents(evS) |
---|
249 | |
---|
250 | def HFBV1 = new EventGroup(name: "45% fat + vehicle for 1 week").addToEvents(evHF).addToEvents(evBV).addToSamplingEvents(evS) |
---|
251 | |
---|
252 | def HFBL1 = new EventGroup(name: "45% fat + leptin for 1 week").addToEvents(evHF).addToEvents(evBL).addToSamplingEvents(evS) |
---|
253 | |
---|
254 | def LFBV4 = new EventGroup(name: "10% fat + vehicle for 4 weeks").addToEvents(evLF4).addToEvents(evBV4).addToSamplingEvents(evS4) |
---|
255 | |
---|
256 | def LFBL4 = new EventGroup(name: "10% fat + leptin for 4 weeks").addToEvents(evLF4).addToEvents(evBL4).addToSamplingEvents(evS4) |
---|
257 | |
---|
258 | def HFBV4 = new EventGroup(name: "45% fat + vehicle for 4 weeks").addToEvents(evHF4).addToEvents(evBV4).addToSamplingEvents(evS4) |
---|
259 | |
---|
260 | def HFBL4 = new EventGroup(name: "45% fat + leptin for 4 weeks").addToEvents(evHF4).addToEvents(evBL4).addToSamplingEvents(evS4) |
---|
261 | |
---|
262 | // Add subjects and samples and compose EventGroups |
---|
263 | def x = 1 |
---|
264 | 80.times { |
---|
265 | def currentSubject = new Subject( |
---|
266 | name: "A" + x++, |
---|
267 | species: mouseTerm, |
---|
268 | template: mouseTemplate, |
---|
269 | ).setFieldValue("Gender", "Male").setFieldValue("Genotype", c57bl6Term).setFieldValue("Age", 17).setFieldValue("Cage", "" + (int) (x / 2)) |
---|
270 | |
---|
271 | // We have to save the subject first, otherwise the parentEvent property of the sample cannot be set |
---|
272 | // (this is possibly a Grails or Hibernate bug) |
---|
273 | mouseStudy.addToSubjects(currentSubject) |
---|
274 | |
---|
275 | currentSubject.save(failOnError:true) |
---|
276 | |
---|
277 | // Add subject to appropriate EventGroup |
---|
278 | def tmpEventGroup |
---|
279 | if (x > 70) { tmpEventGroup = HFBL4 } |
---|
280 | else if (x > 60) { tmpEventGroup = HFBV4 } |
---|
281 | else if (x > 50) { tmpEventGroup = LFBL4 } |
---|
282 | else if (x > 40) { tmpEventGroup = LFBV4 } |
---|
283 | else if (x > 30) { tmpEventGroup = HFBL1 } |
---|
284 | else if (x > 20) { tmpEventGroup = HFBV1 } |
---|
285 | else if (x > 10) { tmpEventGroup = LFBL1 } |
---|
286 | else { tmpEventGroup = LFBV1 } |
---|
287 | |
---|
288 | tmpEventGroup.addToSubjects(currentSubject) |
---|
289 | |
---|
290 | // Create sample |
---|
291 | def currentSample = new Sample( |
---|
292 | name: currentSubject.name + '_B', |
---|
293 | material: bloodTerm, |
---|
294 | template: humanBloodSampleTemplate, |
---|
295 | parentSubject: currentSubject, |
---|
296 | parentEvent: evS //x > 40 ? evS4 : evS |
---|
297 | ) |
---|
298 | |
---|
299 | mouseStudy.addToSamples(currentSample) |
---|
300 | currentSample.setFieldValue("Text on vial", "T" + (Math.random() * 100L)) |
---|
301 | currentSample.save(failOnError:true) |
---|
302 | } |
---|
303 | |
---|
304 | // Add EventGroups to study |
---|
305 | mouseStudy.addToEventGroups(LFBV1).addToEventGroups(LFBL1).addToEventGroups(HFBV1).addToEventGroups(HFBL1).addToEventGroups(LFBV4).addToEventGroups(LFBL4).addToEventGroups(HFBV4).addToEventGroups(HFBL4).save(failOnError:true) |
---|
306 | |
---|
307 | // Add persons and publications to study |
---|
308 | def studyperson1 = new StudyPerson(person: person1, role: role1) |
---|
309 | def studyperson2 = new StudyPerson(person: person2, role: role2) |
---|
310 | |
---|
311 | mouseStudy.addToPersons(studyperson1).addToPersons(studyperson2).addToPublications(publication1).addToPublications(publication2).save(failOnError:true) |
---|
312 | |
---|
313 | def humanStudy = new Study( |
---|
314 | template : studyTemplate, |
---|
315 | title : "NuGO PPS human study", |
---|
316 | code : "PPSH", |
---|
317 | researchQuestion: "How much are fasting plasma and urine metabolite levels affected by prolonged fasting ?", |
---|
318 | description : "Human study performed at RRI; centres involved: RRI, IFR, TUM, Maastricht U.", |
---|
319 | ecCode : "unknown", |
---|
320 | startDate : Date.parse('yyyy-MM-dd', '2008-01-14'), |
---|
321 | owner : owner |
---|
322 | ).addToWriters(otherUser).save(failOnError:true) |
---|
323 | |
---|
324 | def rootGroup = new EventGroup(name: 'Root group') |
---|
325 | |
---|
326 | def fastingEvent = new Event( |
---|
327 | startTime : 3 * 24 * 3600 + 22 * 3600, |
---|
328 | endTime : 3 * 24 * 3600 + 30 * 3600, |
---|
329 | template : fastingTreatmentTemplate).setFieldValue('Fasting period', '8h') |
---|
330 | |
---|
331 | def bloodSamplingEventBefore = new SamplingEvent( |
---|
332 | startTime : 0, |
---|
333 | template : bloodSamplingEventTemplate, |
---|
334 | sampleTemplate : humanBloodSampleTemplate).setFieldValue('Sample volume', 4.5F) |
---|
335 | |
---|
336 | def bloodSamplingEventAfter = new SamplingEvent( |
---|
337 | startTime : 3 * 24 * 3600 + 30 * 3600, |
---|
338 | template : bloodSamplingEventTemplate, |
---|
339 | sampleTemplate : humanBloodSampleTemplate).setFieldValue('Sample volume', 4.5F) |
---|
340 | |
---|
341 | rootGroup.addToEvents fastingEvent |
---|
342 | rootGroup.addToSamplingEvents bloodSamplingEventBefore |
---|
343 | rootGroup.addToSamplingEvents bloodSamplingEventAfter |
---|
344 | |
---|
345 | humanStudy.addToEvents(fastingEvent) |
---|
346 | humanStudy.addToSamplingEvents(bloodSamplingEventBefore) |
---|
347 | humanStudy.addToSamplingEvents(bloodSamplingEventAfter) |
---|
348 | humanStudy.addToEventGroups rootGroup |
---|
349 | |
---|
350 | humanStudy.save(failOnError:true) |
---|
351 | |
---|
352 | def y = 1 |
---|
353 | 11.times { |
---|
354 | def currentSubject = new Subject( |
---|
355 | name : "" + y++, |
---|
356 | species : humanTerm, |
---|
357 | template : humanTemplate |
---|
358 | ).setFieldValue("Gender", (Math.random() > 0.5) ? "Male" : "Female") |
---|
359 | //.setFieldValue("DOB", new java.text.SimpleDateFormat("dd-mm-yy").parse("01-02-19" + (10 + (int) (Math.random() * 80)))).setFieldValue("DOB", new Date().parse("dd/mm/yyyy", ((10 + (int) Math.random() * 18) + "/0" + (1 + (int) (Math.random() * 8)) + "/19" + (10 + (int) (Math.random() * 80))))).setFieldValue("Age", 30).setFieldValue("Height", Math.random() * 2F).setFieldValue("Weight", Math.random() * 150F).setFieldValue("BMI", 20 + Math.random() * 10F) |
---|
360 | |
---|
361 | humanStudy.addToSubjects(currentSubject) |
---|
362 | currentSubject.save(failOnError:true) |
---|
363 | |
---|
364 | rootGroup.addToSubjects currentSubject |
---|
365 | rootGroup.save(failOnError:true) |
---|
366 | |
---|
367 | def currentSample = new Sample( |
---|
368 | name : currentSubject.name + '_B', |
---|
369 | material : bloodTerm, |
---|
370 | template : humanBloodSampleTemplate, |
---|
371 | parentSubject: currentSubject, |
---|
372 | parentEvent : bloodSamplingEventBefore |
---|
373 | ) |
---|
374 | |
---|
375 | humanStudy.addToSamples(currentSample) |
---|
376 | currentSample.setFieldValue("Text on vial", "T" + (Math.random() * 100L)) |
---|
377 | currentSample.save(failOnError:true) |
---|
378 | |
---|
379 | currentSample = new Sample( |
---|
380 | name : currentSubject.name + '_A', |
---|
381 | material : bloodTerm, |
---|
382 | template : humanBloodSampleTemplate, |
---|
383 | parentSubject: currentSubject, |
---|
384 | parentEvent : bloodSamplingEventAfter |
---|
385 | ) |
---|
386 | |
---|
387 | humanStudy.addToSamples(currentSample) |
---|
388 | currentSample.setFieldValue("Text on vial", "T" + (Math.random() * 100L)) |
---|
389 | currentSample.save(failOnError:true) |
---|
390 | } |
---|
391 | |
---|
392 | // Add persons to study |
---|
393 | def studyperson3 = new StudyPerson(person: person1, role: role2) |
---|
394 | humanStudy.addToPersons(studyperson3).addToPublications(publication2).save(failOnError:true) |
---|
395 | |
---|
396 | // Add SAM assay reference |
---|
397 | def clinicalModule = new AssayModule( |
---|
398 | name: 'SAM module for clinical data', |
---|
399 | platform: 'clinical measurements', |
---|
400 | url: config.modules.sam.url.toString() |
---|
401 | ).save(failOnError:true) |
---|
402 | |
---|
403 | // Add metabolomics assay reference |
---|
404 | def metabolomicsModule = new AssayModule( |
---|
405 | name: 'Metabolomics module', |
---|
406 | platform: 'GCMS/LCMS', |
---|
407 | url: config.modules.metabolomics.url.toString() |
---|
408 | ).save(failOnError:true) |
---|
409 | |
---|
410 | // Add metabolomics assay reference |
---|
411 | def metagenomicsModule = new AssayModule( |
---|
412 | name: 'Metagenomics module', |
---|
413 | platform: 'High throughput sequencing', |
---|
414 | url: config.modules.metagenomics.url.toString() |
---|
415 | ).save(failOnError:true) |
---|
416 | |
---|
417 | def lipidAssayRef = new Assay( |
---|
418 | name: 'Lipid profiling', |
---|
419 | template: ccAssayTemplate, |
---|
420 | module: clinicalModule, |
---|
421 | externalAssayID: 'PPS3_SAM' |
---|
422 | ) |
---|
423 | |
---|
424 | def metAssayRef = new Assay( |
---|
425 | name: 'Lipidomics profile', |
---|
426 | template: metAssayTemplate, |
---|
427 | module: metabolomicsModule, |
---|
428 | externalAssayID: 'PPS3_Lipidomics' |
---|
429 | ).setFieldValue('Spectrometry technique', 'LC/MS') |
---|
430 | |
---|
431 | mouseStudy.samples*.each { |
---|
432 | lipidAssayRef.addToSamples(it) |
---|
433 | metAssayRef.addToSamples(it) |
---|
434 | } |
---|
435 | |
---|
436 | mouseStudy.addToAssays(lipidAssayRef); |
---|
437 | mouseStudy.addToAssays(metAssayRef); |
---|
438 | mouseStudy.save(failOnError:true) |
---|
439 | |
---|
440 | def glucoseAssayBRef = new Assay( |
---|
441 | name : 'Glucose assay before', |
---|
442 | template : ccAssayTemplate, |
---|
443 | module : clinicalModule, |
---|
444 | externalAssayID: 'PPSH-Glu-B' |
---|
445 | ) |
---|
446 | |
---|
447 | def glucoseAssayARef = new Assay( |
---|
448 | name : 'Glucose assay after', |
---|
449 | template : ccAssayTemplate, |
---|
450 | module : clinicalModule, |
---|
451 | externalAssayID: 'PPSH-Glu-A' |
---|
452 | ) |
---|
453 | |
---|
454 | def metAssayRefB = new Assay( |
---|
455 | name : 'Lipidomics profile before', |
---|
456 | template : metAssayTemplate, |
---|
457 | module : metabolomicsModule, |
---|
458 | externalAssayID: 'PPSH_Lipidomics_start' |
---|
459 | ).setFieldValue('Spectrometry technique', 'GC/MS') |
---|
460 | |
---|
461 | def metAssayRefA = new Assay( |
---|
462 | name : 'Lipidomics profile after', |
---|
463 | template : metAssayTemplate, |
---|
464 | module : metabolomicsModule, |
---|
465 | externalAssayID: 'PPSH_Lipidomics_end' |
---|
466 | ).setFieldValue('Spectrometry technique', 'GC/MS') |
---|
467 | |
---|
468 | |
---|
469 | // Add sequencing (metagenomics) assays |
---|
470 | def sequencingAssay16SRef = new Assay( |
---|
471 | name : '16S Sequencing assay', |
---|
472 | template : ccAssayTemplate, |
---|
473 | module : metagenomicsModule, |
---|
474 | externalAssayID: 'PPSH-SEQ-16S' |
---|
475 | ) |
---|
476 | |
---|
477 | // Add sequencing (metagenomics) assays |
---|
478 | def sequencingAssay18SRef = new Assay( |
---|
479 | name : '18S Sequencing assay', |
---|
480 | template : ccAssayTemplate, |
---|
481 | module : metagenomicsModule, |
---|
482 | externalAssayID: 'PPSH-SEQ-18S' |
---|
483 | ) |
---|
484 | |
---|
485 | humanStudy.samples*.each { |
---|
486 | if (it.parentEvent.startTime == 0) { |
---|
487 | glucoseAssayBRef.addToSamples(it) |
---|
488 | metAssayRefB.addToSamples(it) |
---|
489 | } |
---|
490 | else { |
---|
491 | glucoseAssayARef.addToSamples(it) |
---|
492 | metAssayRefA.addToSamples(it) |
---|
493 | sequencingAssay16SRef.addToSamples(it) |
---|
494 | sequencingAssay18SRef.addToSamples(it) |
---|
495 | } |
---|
496 | } |
---|
497 | |
---|
498 | humanStudy.addToAssays(sequencingAssay16SRef) |
---|
499 | humanStudy.addToAssays(sequencingAssay18SRef) |
---|
500 | humanStudy.addToAssays(glucoseAssayARef) |
---|
501 | humanStudy.addToAssays(glucoseAssayBRef) |
---|
502 | humanStudy.addToAssays(metAssayRefA) |
---|
503 | humanStudy.addToAssays(metAssayRefB) |
---|
504 | humanStudy.save(failOnError:true) |
---|
505 | } |
---|
506 | |
---|
507 | /** |
---|
508 | * Add test studies. This function is meant to be called only in test mode |
---|
509 | */ |
---|
510 | static addTestStudies() { |
---|
511 | |
---|
512 | final String testStudyName = "Test study" |
---|
513 | final String testStudyTemplateName = "Academic study" |
---|
514 | final String testStudyCode = "AAA-Test" |
---|
515 | final String testStudyDescription = "Description of Test Study" |
---|
516 | final Date testStudyStartDate = Date.parse('yyyy-MM-dd','2007-12-11') |
---|
517 | |
---|
518 | def studyTemplate = Template.findByName(testStudyTemplateName) |
---|
519 | assert studyTemplate |
---|
520 | |
---|
521 | def study = new Study( |
---|
522 | title: testStudyName, |
---|
523 | template: studyTemplate, |
---|
524 | startDate: testStudyStartDate, |
---|
525 | code: testStudyCode, |
---|
526 | description: testStudyDescription |
---|
527 | ) |
---|
528 | |
---|
529 | study.save(failOnError: true) |
---|
530 | |
---|
531 | } |
---|
532 | } |
---|
533 | |
---|
534 | //package dbnp.configuration |
---|
535 | // |
---|
536 | ///** |
---|
537 | // * @Author kees |
---|
538 | // * @Since Jun 25, 2010 |
---|
539 | // * |
---|
540 | // * Revision information: |
---|
541 | // * $Rev: 1588 $ |
---|
542 | // * $Author: s.h.sikkema@gmail.com $ |
---|
543 | // * $Date: 2011-03-04 11:30:52 +0000 (vr, 04 mrt 2011) $ |
---|
544 | // */ |
---|
545 | // |
---|
546 | //import dbnp.studycapturing.* |
---|
547 | //import org.dbnp.gdt.* |
---|
548 | //import org.codehaus.groovy.grails.commons.GrailsApplication |
---|
549 | //import grails.util.GrailsUtil |
---|
550 | //import dbnp.rest.common.CommunicationManager |
---|
551 | //import org.codehaus.groovy.grails.commons.* |
---|
552 | // |
---|
553 | // |
---|
554 | //class ExampleStudies { |
---|
555 | // |
---|
556 | // /** |
---|
557 | // * Add example studies. This function is meant to be called only in development mode |
---|
558 | // */ |
---|
559 | // public static void addExampleStudies(dbnp.authentication.SecUser owner, dbnp.authentication.SecUser otherUser) { |
---|
560 | // "inserting initial studies".grom() |
---|
561 | // |
---|
562 | // // get configuration |
---|
563 | // def config = ConfigurationHolder.config |
---|
564 | // |
---|
565 | // // Look up the used ontologies which should be in the database by now |
---|
566 | // def speciesOntology = Ontology.getOrCreateOntologyByNcboId(1132) |
---|
567 | // def brendaOntology = Ontology.getOrCreateOntologyByNcboId(1005) |
---|
568 | // def nciOntology = Ontology.getOrCreateOntologyByNcboId(1032) |
---|
569 | // def chebiOntology = Ontology.getOrCreateOntologyByNcboId(1007) |
---|
570 | // |
---|
571 | // // Look up the used templates which should also be in the database by now |
---|
572 | // def studyTemplate = Template.findByName("Academic study") |
---|
573 | // def mouseTemplate = Template.findByName("Mouse") |
---|
574 | // def humanTemplate = Template.findByName("Human") |
---|
575 | // def dietTreatmentTemplate = Template.findByName("Diet treatment") |
---|
576 | // def boostTreatmentTemplate = Template.findByName("Compound challenge") |
---|
577 | // def liverSamplingEventTemplate = Template.findByName("Liver extraction") |
---|
578 | // def fastingTreatmentTemplate = Template.findByName("Fasting treatment") |
---|
579 | // def bloodSamplingEventTemplate = Template.findByName("Blood extraction") |
---|
580 | // def humanTissueSampleTemplate = Template.findByName("Human tissue sample") |
---|
581 | // def humanBloodSampleTemplate = Template.findByName("Human blood sample") |
---|
582 | // def ccAssayTemplate = Template.findByName("Clinical chemistry assay") |
---|
583 | // def metAssayTemplate = Template.findByName("Metabolomics assay") |
---|
584 | // |
---|
585 | // // Add terms manually, to avoid having to do many HTTP requests to the BioPortal website |
---|
586 | // def mouseTerm = new Term( |
---|
587 | // name : 'Mus musculus', |
---|
588 | // ontology : speciesOntology, |
---|
589 | // accession : '10090' |
---|
590 | // ).with { if (!validate()) { errors.each { println it} } else save()} |
---|
591 | // |
---|
592 | // def humanTerm = new Term( |
---|
593 | // name : 'Homo sapiens', |
---|
594 | // ontology : speciesOntology, |
---|
595 | // accession : '9606' |
---|
596 | // ).with { if (!validate()) { errors.each { println it} } else save()} |
---|
597 | // |
---|
598 | // def arabTerm = new Term( |
---|
599 | // name : 'Arabidopsis thaliana', |
---|
600 | // ontology : speciesOntology, |
---|
601 | // accession : '3702' |
---|
602 | // ).with { if (!validate()) { errors.each { println it} } else save()} |
---|
603 | // |
---|
604 | // def tomatoTerm = new Term( |
---|
605 | // name : 'Solanum lycopersicum', |
---|
606 | // ontology : speciesOntology, |
---|
607 | // accession : '4081' |
---|
608 | // ).with { if (!validate()) { errors.each { println it} } else save()} |
---|
609 | // |
---|
610 | // def potatoTerm = new Term( |
---|
611 | // name : 'Solanum tuberosum', |
---|
612 | // ontology : speciesOntology, |
---|
613 | // accession : '0000' |
---|
614 | // ).with { if (!validate()) { errors.each { println it} } else save()} |
---|
615 | // |
---|
616 | // def bloodTerm = new Term( |
---|
617 | // name : 'blood plasma', |
---|
618 | // ontology : brendaOntology, |
---|
619 | // accession : 'BTO:0000131' |
---|
620 | // ).with { if (!validate()) { errors.each { println it} } else save()} |
---|
621 | // |
---|
622 | // def c57bl6Term = new Term( |
---|
623 | // name : 'C57BL/6 Mouse', |
---|
624 | // ontology : nciOntology, |
---|
625 | // accession : 'C14424' |
---|
626 | // ).with { if (!validate()) { errors.each { println it} } else save()} |
---|
627 | // |
---|
628 | // def glucoseTerm = new Term( |
---|
629 | // name : 'glucose', |
---|
630 | // ontology : chebiOntology, |
---|
631 | // accession : 'CHEBI:17234' |
---|
632 | // ).with { if (!validate()) { errors.each { println it} } else save()} |
---|
633 | // |
---|
634 | // // Create a few persons, roles and Affiliations |
---|
635 | // def affiliation1 = new PersonAffiliation( |
---|
636 | // institute : "Science Institute NYC", |
---|
637 | // department : "Department of Mathematics" |
---|
638 | // ).save(); |
---|
639 | // def affiliation2 = new PersonAffiliation( |
---|
640 | // institute : "InfoStats GmbH, Hamburg", |
---|
641 | // department : "Life Sciences" |
---|
642 | // ).save(); |
---|
643 | // def role1 = new PersonRole( |
---|
644 | // name : "Principal Investigator" |
---|
645 | // ).save(); |
---|
646 | // def role2 = new PersonRole( |
---|
647 | // name : "Statician" |
---|
648 | // ).save(); |
---|
649 | // |
---|
650 | // // Create persons |
---|
651 | // def person1 = new Person( |
---|
652 | // lastName : "Scientist", |
---|
653 | // firstName : "John", |
---|
654 | // gender : "Male", |
---|
655 | // initials : "J.R.", |
---|
656 | // email : "john@scienceinstitute.com", |
---|
657 | // phone : "1-555-3049", |
---|
658 | // address : "First street 2,NYC" |
---|
659 | // ).addToAffiliations(affiliation1).addToAffiliations(affiliation2).save(); |
---|
660 | // |
---|
661 | // def person2 = new Person( |
---|
662 | // lastName : "Statician", |
---|
663 | // firstName : "Jane", |
---|
664 | // gender : "Female", |
---|
665 | // initials : "W.J.", |
---|
666 | // email : "jane@statisticalcompany.de", |
---|
667 | // phone : "49-555-8291", |
---|
668 | // address : "Dritten strasse 38, Hamburg, Germany" |
---|
669 | // ).addToAffiliations(affiliation2).save(); |
---|
670 | // |
---|
671 | // // Create 30 persons to test pagination |
---|
672 | // def personCounter = 1; |
---|
673 | // 30.times { |
---|
674 | // new Person( |
---|
675 | // firstName : "Person #${personCounter}", |
---|
676 | // lastName : "Testperson", |
---|
677 | // email : "email${personCounter++}@testdomain.com" |
---|
678 | // ).save() |
---|
679 | // } |
---|
680 | // |
---|
681 | // // Create a few publications |
---|
682 | // def publication1 = new Publication( |
---|
683 | // title : "Postnatal development of hypothalamic leptin receptors", |
---|
684 | // authorsList : "Cottrell EC, Mercer JG, Ozanne SE.", |
---|
685 | // pubMedID : "20472140", |
---|
686 | // comments : "Not published yet", |
---|
687 | // DOI : "unknown" |
---|
688 | // ).save(); |
---|
689 | // |
---|
690 | // def publication2 = new Publication( |
---|
691 | // title : "Induction of regulatory T cells decreases adipose inflammation and alleviates insulin resistance in ob/ob mice", |
---|
692 | // authorsList : "Ilan Y, Maron R, Tukpah AM, Maioli TU, Murugaiyan G, Yang K, Wu HY, Weiner HL.", |
---|
693 | // pubMedID : "20445103", |
---|
694 | // comments : "", |
---|
695 | // DOI : "" |
---|
696 | // ).save(); |
---|
697 | // |
---|
698 | // // Add example mouse study |
---|
699 | // def mouseStudy = new Study( |
---|
700 | // template : studyTemplate, |
---|
701 | // title : "NuGO PPS3 mouse study leptin module", |
---|
702 | // 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.", |
---|
703 | // code : "PPS3_leptin_module", |
---|
704 | // researchQuestion: "Leptin etc.", |
---|
705 | // ecCode : "2007117.c", |
---|
706 | // startDate : Date.parse('yyyy-MM-dd', '2008-01-02'), |
---|
707 | // owner : owner, |
---|
708 | // readers : [otherUser] |
---|
709 | // ).with { if (!validate()) { errors.each { println it} } else save()} |
---|
710 | // |
---|
711 | // def evLF = new Event( |
---|
712 | // startTime : 3600, |
---|
713 | // endTime : 3600 + 7 * 24 * 3600, |
---|
714 | // template : dietTreatmentTemplate |
---|
715 | // ).setFieldValue('Diet', 'low fat') |
---|
716 | // |
---|
717 | // def evHF = new Event( |
---|
718 | // startTime : 3600, |
---|
719 | // endTime : 3600 + 7 * 24 * 3600, |
---|
720 | // template : dietTreatmentTemplate |
---|
721 | // ).setFieldValue('Diet', 'high fat') |
---|
722 | // |
---|
723 | // def evBV = new Event( |
---|
724 | // startTime : 3600, |
---|
725 | // endTime : 3600 + 7 * 24 * 3600, |
---|
726 | // template : boostTreatmentTemplate |
---|
727 | // ).setFieldValue('Control', 'true') |
---|
728 | // |
---|
729 | // def evBL = new Event( |
---|
730 | // startTime : 3600, |
---|
731 | // endTime : 3600 + 7 * 24 * 3600, |
---|
732 | // template : boostTreatmentTemplate |
---|
733 | // ).setFieldValue('Control', 'false') |
---|
734 | // |
---|
735 | // def evLF4 = new Event( |
---|
736 | // startTime : 3600, |
---|
737 | // endTime : 3600 + 4 * 7 * 24 * 3600, |
---|
738 | // template : dietTreatmentTemplate |
---|
739 | // ).setFieldValue('Diet', 'low fat') |
---|
740 | // |
---|
741 | // def evHF4 = new Event( |
---|
742 | // startTime : 3600, |
---|
743 | // endTime : 3600 + 4 * 7 * 24 * 3600, |
---|
744 | // template : dietTreatmentTemplate |
---|
745 | // ).setFieldValue('Diet', 'high fat') |
---|
746 | // |
---|
747 | // def evBV4 = new Event( |
---|
748 | // startTime : 3600, |
---|
749 | // endTime : 3600 + 4 * 7 * 24 * 3600, |
---|
750 | // template : boostTreatmentTemplate |
---|
751 | // ).setFieldValue('Control', 'true') |
---|
752 | // |
---|
753 | // def evBL4 = new Event( |
---|
754 | // startTime : 3600, |
---|
755 | // endTime : 3600 + 4 * 7 * 24 * 3600, |
---|
756 | // template : boostTreatmentTemplate |
---|
757 | // ).setFieldValue('Control', 'false') |
---|
758 | // |
---|
759 | // def evS = new SamplingEvent( |
---|
760 | // startTime : 3600 + 7 * 24 * 3600, |
---|
761 | // template : liverSamplingEventTemplate, |
---|
762 | // sampleTemplate: humanTissueSampleTemplate).setFieldValue('Sample weight', 5F) |
---|
763 | // |
---|
764 | // def evS4 = new SamplingEvent( |
---|
765 | // startTime : 3600 + 7 * 24 * 3600, |
---|
766 | // template : liverSamplingEventTemplate, |
---|
767 | // sampleTemplate: humanTissueSampleTemplate).setFieldValue('Sample weight', 5F) |
---|
768 | // |
---|
769 | // // Add events to study |
---|
770 | // mouseStudy.addToEvents(evLF).addToEvents(evHF).addToEvents(evBV).addToEvents(evBL).addToEvents(evLF4).addToEvents(evHF4).addToEvents(evBV4).addToEvents(evBL4).addToSamplingEvents(evS).addToSamplingEvents(evS4).with { if (!validate()) { errors.each { println it} } else save()} |
---|
771 | // |
---|
772 | // // Extra check if the SamplingEvents are saved correctly |
---|
773 | // evS.with { if (!validate()) { errors.each { println it} } else save()} |
---|
774 | // evS4.with { if (!validate()) { errors.each { println it} } else save()} |
---|
775 | // |
---|
776 | // def LFBV1 = new EventGroup(name: "10% fat + vehicle for 1 week").addToEvents(evLF).addToEvents(evBV).addToSamplingEvents(evS) |
---|
777 | // |
---|
778 | // def LFBL1 = new EventGroup(name: "10% fat + leptin for 1 week").addToEvents(evLF).addToEvents(evBL).addToSamplingEvents(evS) |
---|
779 | // |
---|
780 | // def HFBV1 = new EventGroup(name: "45% fat + vehicle for 1 week").addToEvents(evHF).addToEvents(evBV).addToSamplingEvents(evS) |
---|
781 | // |
---|
782 | // def HFBL1 = new EventGroup(name: "45% fat + leptin for 1 week").addToEvents(evHF).addToEvents(evBL).addToSamplingEvents(evS) |
---|
783 | // |
---|
784 | // def LFBV4 = new EventGroup(name: "10% fat + vehicle for 4 weeks").addToEvents(evLF4).addToEvents(evBV4).addToSamplingEvents(evS4) |
---|
785 | // |
---|
786 | // def LFBL4 = new EventGroup(name: "10% fat + leptin for 4 weeks").addToEvents(evLF4).addToEvents(evBL4).addToSamplingEvents(evS4) |
---|
787 | // |
---|
788 | // def HFBV4 = new EventGroup(name: "45% fat + vehicle for 4 weeks").addToEvents(evHF4).addToEvents(evBV4).addToSamplingEvents(evS4) |
---|
789 | // |
---|
790 | // def HFBL4 = new EventGroup(name: "45% fat + leptin for 4 weeks").addToEvents(evHF4).addToEvents(evBL4).addToSamplingEvents(evS4) |
---|
791 | // |
---|
792 | // // Add subjects and samples and compose EventGroups |
---|
793 | // def x = 1 |
---|
794 | // 80.times { |
---|
795 | // def currentSubject = new Subject( |
---|
796 | // name: "A" + x++, |
---|
797 | // species: mouseTerm, |
---|
798 | // template: mouseTemplate, |
---|
799 | // ).setFieldValue("Gender", "Male").setFieldValue("Genotype", c57bl6Term).setFieldValue("Age", 17).setFieldValue("Cage", "" + (int) (x / 2)) |
---|
800 | // |
---|
801 | // // We have to save the subject first, otherwise the parentEvent property of the sample cannot be set |
---|
802 | // // (this is possibly a Grails or Hibernate bug) |
---|
803 | // mouseStudy.addToSubjects(currentSubject) |
---|
804 | // currentSubject.with { if (!validate()) { errors.each { println it} } else save()} |
---|
805 | // |
---|
806 | // // Add subject to appropriate EventGroup |
---|
807 | // if (x > 70) { HFBL4.addToSubjects(currentSubject).save() } |
---|
808 | // else if (x > 60) { HFBV4.addToSubjects(currentSubject).save() } |
---|
809 | // else if (x > 50) { LFBL4.addToSubjects(currentSubject).save() } |
---|
810 | // else if (x > 40) { LFBV4.addToSubjects(currentSubject).save() } |
---|
811 | // else if (x > 30) { HFBL1.addToSubjects(currentSubject).save() } |
---|
812 | // else if (x > 20) { HFBV1.addToSubjects(currentSubject).save() } |
---|
813 | // else if (x > 10) { LFBL1.addToSubjects(currentSubject).save() } |
---|
814 | // else { LFBV1.addToSubjects(currentSubject).save() } |
---|
815 | // |
---|
816 | // // Create sample |
---|
817 | // def currentSample = new Sample( |
---|
818 | // name: currentSubject.name + '_B', |
---|
819 | // material: bloodTerm, |
---|
820 | // template: humanBloodSampleTemplate, |
---|
821 | // parentSubject: currentSubject, |
---|
822 | // parentEvent: evS //x > 40 ? evS4 : evS |
---|
823 | // ); |
---|
824 | // mouseStudy.addToSamples(currentSample) |
---|
825 | // currentSample.with { if (!validate()) { errors.each { println it} } else save()} |
---|
826 | // currentSample.setFieldValue("Text on vial", "T" + (Math.random() * 100L)) |
---|
827 | // } |
---|
828 | // |
---|
829 | // // Add EventGroups to study |
---|
830 | // mouseStudy.addToEventGroups(LFBV1).addToEventGroups(LFBL1).addToEventGroups(HFBV1).addToEventGroups(HFBL1).addToEventGroups(LFBV4).addToEventGroups(LFBL4).addToEventGroups(HFBV4).addToEventGroups(HFBL4).with { if (!validate()) { errors.each { println it} } else save()} |
---|
831 | // |
---|
832 | // // Add persons and publications to study |
---|
833 | // def studyperson1 = new StudyPerson(person: person1, role: role1) |
---|
834 | // def studyperson2 = new StudyPerson(person: person2, role: role2) |
---|
835 | // |
---|
836 | // mouseStudy.addToPersons(studyperson1).addToPersons(studyperson2).addToPublications(publication1).addToPublications(publication2).with { if (!validate()) { errors.each { println it} } else save()} |
---|
837 | // |
---|
838 | // def humanStudy = new Study( |
---|
839 | // template : studyTemplate, |
---|
840 | // title : "NuGO PPS human study", |
---|
841 | // code : "PPSH", |
---|
842 | // researchQuestion: "How much are fasting plasma and urine metabolite levels affected by prolonged fasting ?", |
---|
843 | // description : "Human study performed at RRI; centres involved: RRI, IFR, TUM, Maastricht U.", |
---|
844 | // ecCode : "unknown", |
---|
845 | // startDate : Date.parse('yyyy-MM-dd', '2008-01-14'), |
---|
846 | // owner : owner, |
---|
847 | // writers : [otherUser] |
---|
848 | // ).with { if (!validate()) { errors.each { println it} } else save()} |
---|
849 | // |
---|
850 | // def rootGroup = new EventGroup(name: 'Root group'); |
---|
851 | // |
---|
852 | // def fastingEvent = new Event( |
---|
853 | // startTime : 3 * 24 * 3600 + 22 * 3600, |
---|
854 | // endTime : 3 * 24 * 3600 + 30 * 3600, |
---|
855 | // template : fastingTreatmentTemplate).setFieldValue('Fasting period', '8h'); |
---|
856 | // |
---|
857 | // def bloodSamplingEventBefore = new SamplingEvent( |
---|
858 | // startTime : 0, |
---|
859 | // template : bloodSamplingEventTemplate, |
---|
860 | // sampleTemplate : humanBloodSampleTemplate).setFieldValue('Sample volume', 4.5F); |
---|
861 | // |
---|
862 | // def bloodSamplingEventAfter = new SamplingEvent( |
---|
863 | // startTime : 3 * 24 * 3600 + 30 * 3600, |
---|
864 | // template : bloodSamplingEventTemplate, |
---|
865 | // sampleTemplate : humanBloodSampleTemplate).setFieldValue('Sample volume', 4.5F); |
---|
866 | // |
---|
867 | // rootGroup.addToEvents fastingEvent |
---|
868 | // rootGroup.addToSamplingEvents bloodSamplingEventBefore |
---|
869 | // rootGroup.addToSamplingEvents bloodSamplingEventAfter |
---|
870 | // rootGroup.save() |
---|
871 | // |
---|
872 | // humanStudy.addToEvents(fastingEvent) |
---|
873 | // humanStudy.addToSamplingEvents(bloodSamplingEventBefore) |
---|
874 | // humanStudy.addToSamplingEvents(bloodSamplingEventAfter) |
---|
875 | // humanStudy.addToEventGroups rootGroup |
---|
876 | // |
---|
877 | // humanStudy.save() |
---|
878 | // |
---|
879 | // def y = 1 |
---|
880 | // 11.times { |
---|
881 | // def currentSubject = new Subject( |
---|
882 | // name : "" + y++, |
---|
883 | // species : humanTerm, |
---|
884 | // template : humanTemplate |
---|
885 | // ).setFieldValue("Gender", (Math.random() > 0.5) ? "Male" : "Female") |
---|
886 | // //.setFieldValue("DOB", new java.text.SimpleDateFormat("dd-mm-yy").parse("01-02-19" + (10 + (int) (Math.random() * 80)))).setFieldValue("DOB", new Date().parse("dd/mm/yyyy", ((10 + (int) Math.random() * 18) + "/0" + (1 + (int) (Math.random() * 8)) + "/19" + (10 + (int) (Math.random() * 80))))).setFieldValue("Age", 30).setFieldValue("Height", Math.random() * 2F).setFieldValue("Weight", Math.random() * 150F).setFieldValue("BMI", 20 + Math.random() * 10F) |
---|
887 | // |
---|
888 | // humanStudy.addToSubjects(currentSubject) |
---|
889 | // currentSubject.with { if (!validate()) { errors.each { println it} } else save()} |
---|
890 | // |
---|
891 | // rootGroup.addToSubjects currentSubject |
---|
892 | // rootGroup.save() |
---|
893 | // |
---|
894 | // def currentSample = new Sample( |
---|
895 | // name : currentSubject.name + '_B', |
---|
896 | // material : bloodTerm, |
---|
897 | // template : humanBloodSampleTemplate, |
---|
898 | // parentSubject: currentSubject, |
---|
899 | // parentEvent : bloodSamplingEventBefore |
---|
900 | // ); |
---|
901 | // |
---|
902 | // humanStudy.addToSamples(currentSample) |
---|
903 | // currentSample.with { if (!validate()) { errors.each { println it} } else save()} |
---|
904 | // currentSample.setFieldValue("Text on vial", "T" + (Math.random() * 100L)) |
---|
905 | // |
---|
906 | // currentSample = new Sample( |
---|
907 | // name : currentSubject.name + '_A', |
---|
908 | // material : bloodTerm, |
---|
909 | // template : humanBloodSampleTemplate, |
---|
910 | // parentSubject: currentSubject, |
---|
911 | // parentEvent : bloodSamplingEventAfter |
---|
912 | // ); |
---|
913 | // |
---|
914 | // humanStudy.addToSamples(currentSample) |
---|
915 | // currentSample.with { if (!validate()) { errors.each { println it} } else save()} |
---|
916 | // currentSample.setFieldValue("Text on vial", "T" + (Math.random() * 100L)) |
---|
917 | // } |
---|
918 | // |
---|
919 | // // Add persons to study |
---|
920 | // def studyperson3 = new StudyPerson(person: person1, role: role2) |
---|
921 | // humanStudy.addToPersons(studyperson3).addToPublications(publication2).with { if (!validate()) { errors.each { println it} } else save()} |
---|
922 | // |
---|
923 | // // Add SAM assay reference |
---|
924 | // def clinicalModule = new AssayModule( |
---|
925 | // name: 'SAM module for clinical data', |
---|
926 | // platform: 'clinical measurements', |
---|
927 | // url: config.modules.sam.url.toString() |
---|
928 | // ).with { if (!validate()) { errors.each { println it} } else save()} |
---|
929 | // |
---|
930 | // // Add metabolomics assay reference |
---|
931 | // def metabolomicsModule = new AssayModule( |
---|
932 | // name: 'Metabolomics module', |
---|
933 | // platform: 'GCMS/LCMS', |
---|
934 | // url: config.modules.metabolomics.url.toString() |
---|
935 | // ).with { if (!validate()) { errors.each { println it} } else save()} |
---|
936 | // |
---|
937 | // // Add metabolomics assay reference |
---|
938 | // def metagenomicsModule = new AssayModule( |
---|
939 | // name: 'Metagenomics module', |
---|
940 | // platform: 'High throughput sequencing', |
---|
941 | // url: config.modules.metagenomics.url.toString() |
---|
942 | // ).with { if (!validate()) { errors.each { println it} } else save()} |
---|
943 | // |
---|
944 | // def lipidAssayRef = new Assay( |
---|
945 | // name: 'Lipid profiling', |
---|
946 | // template: ccAssayTemplate, |
---|
947 | // module: clinicalModule, |
---|
948 | // externalAssayID: 'PPS3_SAM' |
---|
949 | // ) |
---|
950 | // |
---|
951 | // def metAssayRef = new Assay( |
---|
952 | // name: 'Lipidomics profile', |
---|
953 | // template: metAssayTemplate, |
---|
954 | // module: metabolomicsModule, |
---|
955 | // externalAssayID: 'PPS3_Lipidomics' |
---|
956 | // ).setFieldValue('Spectrometry technique', 'LC/MS') |
---|
957 | // |
---|
958 | // mouseStudy.samples*.each { |
---|
959 | // lipidAssayRef.addToSamples(it) |
---|
960 | // metAssayRef.addToSamples(it) |
---|
961 | // } |
---|
962 | // |
---|
963 | // mouseStudy.addToAssays(lipidAssayRef); |
---|
964 | // mouseStudy.addToAssays(metAssayRef); |
---|
965 | // mouseStudy.save() |
---|
966 | // |
---|
967 | // def glucoseAssayBRef = new Assay( |
---|
968 | // name : 'Glucose assay before', |
---|
969 | // template : ccAssayTemplate, |
---|
970 | // module : clinicalModule, |
---|
971 | // externalAssayID: 'PPSH-Glu-B' |
---|
972 | // ) |
---|
973 | // |
---|
974 | // def glucoseAssayARef = new Assay( |
---|
975 | // name : 'Glucose assay after', |
---|
976 | // template : ccAssayTemplate, |
---|
977 | // module : clinicalModule, |
---|
978 | // externalAssayID: 'PPSH-Glu-A' |
---|
979 | // ) |
---|
980 | // |
---|
981 | // def metAssayRefB = new Assay( |
---|
982 | // name : 'Lipidomics profile before', |
---|
983 | // template : metAssayTemplate, |
---|
984 | // module : metabolomicsModule, |
---|
985 | // externalAssayID: 'PPSH_Lipidomics_start' |
---|
986 | // ).setFieldValue('Spectrometry technique', 'GC/MS') |
---|
987 | // |
---|
988 | // def metAssayRefA = new Assay( |
---|
989 | // name : 'Lipidomics profile after', |
---|
990 | // template : metAssayTemplate, |
---|
991 | // module : metabolomicsModule, |
---|
992 | // externalAssayID: 'PPSH_Lipidomics_end' |
---|
993 | // ).setFieldValue('Spectrometry technique', 'GC/MS') |
---|
994 | // |
---|
995 | // |
---|
996 | // // Add sequencing (metagenomics) assays |
---|
997 | // def sequencingAssay16SRef = new Assay( |
---|
998 | // name : '16S Sequencing assay', |
---|
999 | // template : ccAssayTemplate, |
---|
1000 | // module : metagenomicsModule, |
---|
1001 | // externalAssayID: 'PPSH-SEQ-16S' |
---|
1002 | // ) |
---|
1003 | // |
---|
1004 | // // Add sequencing (metagenomics) assays |
---|
1005 | // def sequencingAssay18SRef = new Assay( |
---|
1006 | // name : '18S Sequencing assay', |
---|
1007 | // template : ccAssayTemplate, |
---|
1008 | // module : metagenomicsModule, |
---|
1009 | // externalAssayID: 'PPSH-SEQ-18S' |
---|
1010 | // ) |
---|
1011 | // |
---|
1012 | // humanStudy.samples*.each { |
---|
1013 | // if (it.parentEvent.startTime == 0) { |
---|
1014 | // glucoseAssayBRef.addToSamples(it) |
---|
1015 | // metAssayRefB.addToSamples(it) |
---|
1016 | // } |
---|
1017 | // else { |
---|
1018 | // glucoseAssayARef.addToSamples(it) |
---|
1019 | // metAssayRefA.addToSamples(it) |
---|
1020 | // sequencingAssay16SRef.addToSamples(it) |
---|
1021 | // sequencingAssay18SRef.addToSamples(it) |
---|
1022 | // } |
---|
1023 | // } |
---|
1024 | // |
---|
1025 | // humanStudy.addToAssays(sequencingAssay16SRef) |
---|
1026 | // humanStudy.addToAssays(sequencingAssay18SRef) |
---|
1027 | // humanStudy.addToAssays(glucoseAssayARef) |
---|
1028 | // humanStudy.addToAssays(glucoseAssayBRef) |
---|
1029 | // humanStudy.addToAssays(metAssayRefA) |
---|
1030 | // humanStudy.addToAssays(metAssayRefB) |
---|
1031 | // humanStudy.save() |
---|
1032 | // } |
---|
1033 | //} |
---|