1 | /** |
---|
2 | * @Author kees |
---|
3 | * @Since Jun 25, 2010 |
---|
4 | * |
---|
5 | * Revision information: |
---|
6 | * $Rev: 1456 $ |
---|
7 | * $Author: business@keesvanbochove.nl $ |
---|
8 | * $Date: 2011-01-31 12:27:30 +0000 (ma, 31 jan 2011) $ |
---|
9 | */ |
---|
10 | |
---|
11 | import dbnp.studycapturing.* |
---|
12 | import org.dbnp.gdt.* |
---|
13 | import org.codehaus.groovy.grails.commons.GrailsApplication |
---|
14 | import grails.util.GrailsUtil |
---|
15 | import dbnp.rest.common.CommunicationManager |
---|
16 | import org.codehaus.groovy.grails.commons.* |
---|
17 | |
---|
18 | |
---|
19 | class BootStrapStudies { |
---|
20 | |
---|
21 | /** |
---|
22 | * Add example studies. This function is meant to be called only in development mode |
---|
23 | */ |
---|
24 | public static void addExampleStudies(dbnp.authentication.SecUser owner, dbnp.authentication.SecUser otherUser) { |
---|
25 | "inserting initial studies".grom() |
---|
26 | |
---|
27 | // get configuration |
---|
28 | def config = ConfigurationHolder.config |
---|
29 | |
---|
30 | // Look up the used ontologies which should be in the database by now |
---|
31 | def speciesOntology = Ontology.getOrCreateOntologyByNcboId(1132) |
---|
32 | def brendaOntology = Ontology.getOrCreateOntologyByNcboId(1005) |
---|
33 | def nciOntology = Ontology.getOrCreateOntologyByNcboId(1032) |
---|
34 | def chebiOntology = Ontology.getOrCreateOntologyByNcboId(1007) |
---|
35 | |
---|
36 | // Look up the used templates which should also be in the database by now |
---|
37 | def studyTemplate = Template.findByName("Academic study") |
---|
38 | def mouseTemplate = Template.findByName("Mouse") |
---|
39 | def humanTemplate = Template.findByName("Human") |
---|
40 | def dietTreatmentTemplate = Template.findByName("Diet treatment") |
---|
41 | def boostTreatmentTemplate = Template.findByName("Compound challenge") |
---|
42 | def liverSamplingEventTemplate = Template.findByName("Liver extraction") |
---|
43 | def fastingTreatmentTemplate = Template.findByName("Fasting treatment") |
---|
44 | def bloodSamplingEventTemplate = Template.findByName("Blood extraction") |
---|
45 | def humanTissueSampleTemplate = Template.findByName("Human tissue sample") |
---|
46 | def humanBloodSampleTemplate = Template.findByName("Human blood sample") |
---|
47 | def ccAssayTemplate = Template.findByName("Clinical chemistry assay") |
---|
48 | def metAssayTemplate = Template.findByName("Metabolomics assay") |
---|
49 | |
---|
50 | // Add terms manually, to avoid having to do many HTTP requests to the BioPortal website |
---|
51 | def mouseTerm = new Term( |
---|
52 | name : 'Mus musculus', |
---|
53 | ontology : speciesOntology, |
---|
54 | accession : '10090' |
---|
55 | ).with { if (!validate()) { errors.each { println it} } else save()} |
---|
56 | |
---|
57 | def humanTerm = new Term( |
---|
58 | name : 'Homo sapiens', |
---|
59 | ontology : speciesOntology, |
---|
60 | accession : '9606' |
---|
61 | ).with { if (!validate()) { errors.each { println it} } else save()} |
---|
62 | |
---|
63 | def arabTerm = new Term( |
---|
64 | name : 'Arabidopsis thaliana', |
---|
65 | ontology : speciesOntology, |
---|
66 | accession : '3702' |
---|
67 | ).with { if (!validate()) { errors.each { println it} } else save()} |
---|
68 | |
---|
69 | def tomatoTerm = new Term( |
---|
70 | name : 'Solanum lycopersicum', |
---|
71 | ontology : speciesOntology, |
---|
72 | accession : '4081' |
---|
73 | ).with { if (!validate()) { errors.each { println it} } else save()} |
---|
74 | |
---|
75 | def potatoTerm = new Term( |
---|
76 | name : 'Solanum tuberosum', |
---|
77 | ontology : speciesOntology, |
---|
78 | accession : '0000' |
---|
79 | ).with { if (!validate()) { errors.each { println it} } else save()} |
---|
80 | |
---|
81 | def bloodTerm = new Term( |
---|
82 | name : 'blood plasma', |
---|
83 | ontology : brendaOntology, |
---|
84 | accession : 'BTO:0000131' |
---|
85 | ).with { if (!validate()) { errors.each { println it} } else save()} |
---|
86 | |
---|
87 | def c57bl6Term = new Term( |
---|
88 | name : 'C57BL/6 Mouse', |
---|
89 | ontology : nciOntology, |
---|
90 | accession : 'C14424' |
---|
91 | ).with { if (!validate()) { errors.each { println it} } else save()} |
---|
92 | |
---|
93 | def glucoseTerm = new Term( |
---|
94 | name : 'glucose', |
---|
95 | ontology : chebiOntology, |
---|
96 | accession : 'CHEBI:17234' |
---|
97 | ).with { if (!validate()) { errors.each { println it} } else save()} |
---|
98 | |
---|
99 | // Create a few persons, roles and Affiliations |
---|
100 | def affiliation1 = new PersonAffiliation( |
---|
101 | institute : "Science Institute NYC", |
---|
102 | department : "Department of Mathematics" |
---|
103 | ).save(); |
---|
104 | def affiliation2 = new PersonAffiliation( |
---|
105 | institute : "InfoStats GmbH, Hamburg", |
---|
106 | department : "Life Sciences" |
---|
107 | ).save(); |
---|
108 | def role1 = new PersonRole( |
---|
109 | name : "Principal Investigator" |
---|
110 | ).save(); |
---|
111 | def role2 = new PersonRole( |
---|
112 | name : "Statician" |
---|
113 | ).save(); |
---|
114 | |
---|
115 | // Create persons |
---|
116 | def person1 = new Person( |
---|
117 | lastName : "Scientist", |
---|
118 | firstName : "John", |
---|
119 | gender : "Male", |
---|
120 | initials : "J.R.", |
---|
121 | email : "john@scienceinstitute.com", |
---|
122 | phone : "1-555-3049", |
---|
123 | address : "First street 2,NYC" |
---|
124 | ).addToAffiliations(affiliation1).addToAffiliations(affiliation2).save(); |
---|
125 | |
---|
126 | def person2 = new Person( |
---|
127 | lastName : "Statician", |
---|
128 | firstName : "Jane", |
---|
129 | gender : "Female", |
---|
130 | initials : "W.J.", |
---|
131 | email : "jane@statisticalcompany.de", |
---|
132 | phone : "49-555-8291", |
---|
133 | address : "Dritten strasse 38, Hamburg, Germany" |
---|
134 | ).addToAffiliations(affiliation2).save(); |
---|
135 | |
---|
136 | // Create 30 persons to test pagination |
---|
137 | def personCounter = 1; |
---|
138 | 30.times { |
---|
139 | new Person( |
---|
140 | firstName : "Person #${personCounter}", |
---|
141 | lastName : "Testperson", |
---|
142 | email : "email${personCounter++}@testdomain.com" |
---|
143 | ).save() |
---|
144 | } |
---|
145 | |
---|
146 | // Create a few publications |
---|
147 | def publication1 = new Publication( |
---|
148 | title : "Postnatal development of hypothalamic leptin receptors", |
---|
149 | authorsList : "Cottrell EC, Mercer JG, Ozanne SE.", |
---|
150 | pubMedID : "20472140", |
---|
151 | comments : "Not published yet", |
---|
152 | DOI : "unknown" |
---|
153 | ).save(); |
---|
154 | |
---|
155 | def publication2 = new Publication( |
---|
156 | title : "Induction of regulatory T cells decreases adipose inflammation and alleviates insulin resistance in ob/ob mice", |
---|
157 | authorsList : "Ilan Y, Maron R, Tukpah AM, Maioli TU, Murugaiyan G, Yang K, Wu HY, Weiner HL.", |
---|
158 | pubMedID : "20445103", |
---|
159 | comments : "", |
---|
160 | DOI : "" |
---|
161 | ).save(); |
---|
162 | |
---|
163 | // Add example mouse study |
---|
164 | def mouseStudy = new Study( |
---|
165 | template : studyTemplate, |
---|
166 | title : "NuGO PPS3 mouse study leptin module", |
---|
167 | 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.", |
---|
168 | code : "PPS3_leptin_module", |
---|
169 | researchQuestion: "Leptin etc.", |
---|
170 | ecCode : "2007117.c", |
---|
171 | startDate : Date.parse('yyyy-MM-dd', '2008-01-02'), |
---|
172 | owner : owner, |
---|
173 | readers : [otherUser] |
---|
174 | ).with { if (!validate()) { errors.each { println it} } else save()} |
---|
175 | |
---|
176 | def evLF = new Event( |
---|
177 | startTime : 3600, |
---|
178 | endTime : 3600 + 7 * 24 * 3600, |
---|
179 | template : dietTreatmentTemplate |
---|
180 | ).setFieldValue('Diet', 'low fat') |
---|
181 | |
---|
182 | def evHF = new Event( |
---|
183 | startTime : 3600, |
---|
184 | endTime : 3600 + 7 * 24 * 3600, |
---|
185 | template : dietTreatmentTemplate |
---|
186 | ).setFieldValue('Diet', 'high fat') |
---|
187 | |
---|
188 | def evBV = new Event( |
---|
189 | startTime : 3600, |
---|
190 | endTime : 3600 + 7 * 24 * 3600, |
---|
191 | template : boostTreatmentTemplate |
---|
192 | ).setFieldValue('Control', 'true') |
---|
193 | |
---|
194 | def evBL = new Event( |
---|
195 | startTime : 3600, |
---|
196 | endTime : 3600 + 7 * 24 * 3600, |
---|
197 | template : boostTreatmentTemplate |
---|
198 | ).setFieldValue('Control', 'false') |
---|
199 | |
---|
200 | def evLF4 = new Event( |
---|
201 | startTime : 3600, |
---|
202 | endTime : 3600 + 4 * 7 * 24 * 3600, |
---|
203 | template : dietTreatmentTemplate |
---|
204 | ).setFieldValue('Diet', 'low fat') |
---|
205 | |
---|
206 | def evHF4 = new Event( |
---|
207 | startTime : 3600, |
---|
208 | endTime : 3600 + 4 * 7 * 24 * 3600, |
---|
209 | template : dietTreatmentTemplate |
---|
210 | ).setFieldValue('Diet', 'high fat') |
---|
211 | |
---|
212 | def evBV4 = new Event( |
---|
213 | startTime : 3600, |
---|
214 | endTime : 3600 + 4 * 7 * 24 * 3600, |
---|
215 | template : boostTreatmentTemplate |
---|
216 | ).setFieldValue('Control', 'true') |
---|
217 | |
---|
218 | def evBL4 = new Event( |
---|
219 | startTime : 3600, |
---|
220 | endTime : 3600 + 4 * 7 * 24 * 3600, |
---|
221 | template : boostTreatmentTemplate |
---|
222 | ).setFieldValue('Control', 'false') |
---|
223 | |
---|
224 | def evS = new SamplingEvent( |
---|
225 | startTime : 3600 + 7 * 24 * 3600, |
---|
226 | template : liverSamplingEventTemplate, |
---|
227 | sampleTemplate: humanTissueSampleTemplate).setFieldValue('Sample weight', 5F) |
---|
228 | |
---|
229 | def evS4 = new SamplingEvent( |
---|
230 | startTime : 3600 + 7 * 24 * 3600, |
---|
231 | template : liverSamplingEventTemplate, |
---|
232 | sampleTemplate: humanTissueSampleTemplate).setFieldValue('Sample weight', 5F) |
---|
233 | |
---|
234 | // Add events to study |
---|
235 | 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()} |
---|
236 | |
---|
237 | // Extra check if the SamplingEvents are saved correctly |
---|
238 | evS.with { if (!validate()) { errors.each { println it} } else save()} |
---|
239 | evS4.with { if (!validate()) { errors.each { println it} } else save()} |
---|
240 | |
---|
241 | def LFBV1 = new EventGroup(name: "10% fat + vehicle for 1 week").addToEvents(evLF).addToEvents(evBV).addToSamplingEvents(evS) |
---|
242 | |
---|
243 | def LFBL1 = new EventGroup(name: "10% fat + leptin for 1 week").addToEvents(evLF).addToEvents(evBL).addToSamplingEvents(evS) |
---|
244 | |
---|
245 | def HFBV1 = new EventGroup(name: "45% fat + vehicle for 1 week").addToEvents(evHF).addToEvents(evBV).addToSamplingEvents(evS) |
---|
246 | |
---|
247 | def HFBL1 = new EventGroup(name: "45% fat + leptin for 1 week").addToEvents(evHF).addToEvents(evBL).addToSamplingEvents(evS) |
---|
248 | |
---|
249 | def LFBV4 = new EventGroup(name: "10% fat + vehicle for 4 weeks").addToEvents(evLF4).addToEvents(evBV4).addToSamplingEvents(evS4) |
---|
250 | |
---|
251 | def LFBL4 = new EventGroup(name: "10% fat + leptin for 4 weeks").addToEvents(evLF4).addToEvents(evBL4).addToSamplingEvents(evS4) |
---|
252 | |
---|
253 | def HFBV4 = new EventGroup(name: "45% fat + vehicle for 4 weeks").addToEvents(evHF4).addToEvents(evBV4).addToSamplingEvents(evS4) |
---|
254 | |
---|
255 | def HFBL4 = new EventGroup(name: "45% fat + leptin for 4 weeks").addToEvents(evHF4).addToEvents(evBL4).addToSamplingEvents(evS4) |
---|
256 | |
---|
257 | // Add subjects and samples and compose EventGroups |
---|
258 | def x = 1 |
---|
259 | 80.times { |
---|
260 | def currentSubject = new Subject( |
---|
261 | name: "A" + x++, |
---|
262 | species: mouseTerm, |
---|
263 | template: mouseTemplate, |
---|
264 | ).setFieldValue("Gender", "Male").setFieldValue("Genotype", c57bl6Term).setFieldValue("Age", 17).setFieldValue("Cage", "" + (int) (x / 2)) |
---|
265 | |
---|
266 | // We have to save the subject first, otherwise the parentEvent property of the sample cannot be set |
---|
267 | // (this is possibly a Grails or Hibernate bug) |
---|
268 | mouseStudy.addToSubjects(currentSubject) |
---|
269 | currentSubject.with { if (!validate()) { errors.each { println it} } else save()} |
---|
270 | |
---|
271 | // Add subject to appropriate EventGroup |
---|
272 | if (x > 70) { HFBL4.addToSubjects(currentSubject).save() } |
---|
273 | else if (x > 60) { HFBV4.addToSubjects(currentSubject).save() } |
---|
274 | else if (x > 50) { LFBL4.addToSubjects(currentSubject).save() } |
---|
275 | else if (x > 40) { LFBV4.addToSubjects(currentSubject).save() } |
---|
276 | else if (x > 30) { HFBL1.addToSubjects(currentSubject).save() } |
---|
277 | else if (x > 20) { HFBV1.addToSubjects(currentSubject).save() } |
---|
278 | else if (x > 10) { LFBL1.addToSubjects(currentSubject).save() } |
---|
279 | else { LFBV1.addToSubjects(currentSubject).save() } |
---|
280 | |
---|
281 | // Create sample |
---|
282 | def currentSample = new Sample( |
---|
283 | name: currentSubject.name + '_B', |
---|
284 | material: bloodTerm, |
---|
285 | template: humanBloodSampleTemplate, |
---|
286 | parentSubject: currentSubject, |
---|
287 | parentEvent: evS //x > 40 ? evS4 : evS |
---|
288 | ); |
---|
289 | mouseStudy.addToSamples(currentSample) |
---|
290 | currentSample.with { if (!validate()) { errors.each { println it} } else save()} |
---|
291 | currentSample.setFieldValue("Text on vial", "T" + (Math.random() * 100L)) |
---|
292 | } |
---|
293 | |
---|
294 | // Add EventGroups to study |
---|
295 | 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()} |
---|
296 | |
---|
297 | // Add persons and publications to study |
---|
298 | def studyperson1 = new StudyPerson(person: person1, role: role1) |
---|
299 | def studyperson2 = new StudyPerson(person: person2, role: role2) |
---|
300 | |
---|
301 | mouseStudy.addToPersons(studyperson1).addToPersons(studyperson2).addToPublications(publication1).addToPublications(publication2).with { if (!validate()) { errors.each { println it} } else save()} |
---|
302 | |
---|
303 | def humanStudy = new Study( |
---|
304 | template : studyTemplate, |
---|
305 | title : "NuGO PPS human study", |
---|
306 | code : "PPSH", |
---|
307 | researchQuestion: "How much are fasting plasma and urine metabolite levels affected by prolonged fasting ?", |
---|
308 | description : "Human study performed at RRI; centres involved: RRI, IFR, TUM, Maastricht U.", |
---|
309 | ecCode : "unknown", |
---|
310 | startDate : Date.parse('yyyy-MM-dd', '2008-01-14'), |
---|
311 | owner : owner, |
---|
312 | writers : [otherUser] |
---|
313 | ).with { if (!validate()) { errors.each { println it} } else save()} |
---|
314 | |
---|
315 | def rootGroup = new EventGroup(name: 'Root group'); |
---|
316 | |
---|
317 | def fastingEvent = new Event( |
---|
318 | startTime : 3 * 24 * 3600 + 22 * 3600, |
---|
319 | endTime : 3 * 24 * 3600 + 30 * 3600, |
---|
320 | template : fastingTreatmentTemplate).setFieldValue('Fasting period', '8h'); |
---|
321 | |
---|
322 | def bloodSamplingEventBefore = new SamplingEvent( |
---|
323 | startTime : 0, |
---|
324 | template : bloodSamplingEventTemplate, |
---|
325 | sampleTemplate : humanBloodSampleTemplate).setFieldValue('Sample volume', 4.5F); |
---|
326 | |
---|
327 | def bloodSamplingEventAfter = new SamplingEvent( |
---|
328 | startTime : 3 * 24 * 3600 + 30 * 3600, |
---|
329 | template : bloodSamplingEventTemplate, |
---|
330 | sampleTemplate : humanBloodSampleTemplate).setFieldValue('Sample volume', 4.5F); |
---|
331 | |
---|
332 | rootGroup.addToEvents fastingEvent |
---|
333 | rootGroup.addToSamplingEvents bloodSamplingEventBefore |
---|
334 | rootGroup.addToSamplingEvents bloodSamplingEventAfter |
---|
335 | rootGroup.save() |
---|
336 | |
---|
337 | humanStudy.addToEvents(fastingEvent) |
---|
338 | humanStudy.addToSamplingEvents(bloodSamplingEventBefore) |
---|
339 | humanStudy.addToSamplingEvents(bloodSamplingEventAfter) |
---|
340 | humanStudy.addToEventGroups rootGroup |
---|
341 | |
---|
342 | humanStudy.save() |
---|
343 | |
---|
344 | def y = 1 |
---|
345 | 11.times { |
---|
346 | def currentSubject = new Subject( |
---|
347 | name : "" + y++, |
---|
348 | species : humanTerm, |
---|
349 | template : humanTemplate |
---|
350 | ).setFieldValue("Gender", (Math.random() > 0.5) ? "Male" : "Female") |
---|
351 | //.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) |
---|
352 | |
---|
353 | humanStudy.addToSubjects(currentSubject) |
---|
354 | currentSubject.with { if (!validate()) { errors.each { println it} } else save()} |
---|
355 | |
---|
356 | rootGroup.addToSubjects currentSubject |
---|
357 | rootGroup.save() |
---|
358 | |
---|
359 | def currentSample = new Sample( |
---|
360 | name : currentSubject.name + '_B', |
---|
361 | material : bloodTerm, |
---|
362 | template : humanBloodSampleTemplate, |
---|
363 | parentSubject: currentSubject, |
---|
364 | parentEvent : bloodSamplingEventBefore |
---|
365 | ); |
---|
366 | |
---|
367 | humanStudy.addToSamples(currentSample) |
---|
368 | currentSample.with { if (!validate()) { errors.each { println it} } else save()} |
---|
369 | currentSample.setFieldValue("Text on vial", "T" + (Math.random() * 100L)) |
---|
370 | |
---|
371 | currentSample = new Sample( |
---|
372 | name : currentSubject.name + '_A', |
---|
373 | material : bloodTerm, |
---|
374 | template : humanBloodSampleTemplate, |
---|
375 | parentSubject: currentSubject, |
---|
376 | parentEvent : bloodSamplingEventAfter |
---|
377 | ); |
---|
378 | |
---|
379 | humanStudy.addToSamples(currentSample) |
---|
380 | currentSample.with { if (!validate()) { errors.each { println it} } else save()} |
---|
381 | currentSample.setFieldValue("Text on vial", "T" + (Math.random() * 100L)) |
---|
382 | } |
---|
383 | |
---|
384 | // Add persons to study |
---|
385 | def studyperson3 = new StudyPerson(person: person1, role: role2) |
---|
386 | humanStudy.addToPersons(studyperson3).addToPublications(publication2).with { if (!validate()) { errors.each { println it} } else save()} |
---|
387 | |
---|
388 | // Add SAM assay reference |
---|
389 | def clinicalModule = new AssayModule( |
---|
390 | name: 'SAM module for clinical data', |
---|
391 | platform: 'clinical measurements', |
---|
392 | url: config.modules.sam.url.toString() |
---|
393 | ).with { if (!validate()) { errors.each { println it} } else save()} |
---|
394 | |
---|
395 | // Add metabolomics assay reference |
---|
396 | def metabolomicsModule = new AssayModule( |
---|
397 | name: 'Metabolomics module', |
---|
398 | platform: 'GCMS/LCMS', |
---|
399 | url: config.modules.metabolomics.url.toString() |
---|
400 | ).with { if (!validate()) { errors.each { println it} } else save()} |
---|
401 | |
---|
402 | // Add metabolomics assay reference |
---|
403 | def metagenomicsModule = new AssayModule( |
---|
404 | name: 'Metagenomics module', |
---|
405 | platform: 'High throughput sequencing', |
---|
406 | url: config.modules.metagenomics.url.toString() |
---|
407 | ).with { if (!validate()) { errors.each { println it} } else save()} |
---|
408 | |
---|
409 | def lipidAssayRef = new Assay( |
---|
410 | name: 'Lipid profiling', |
---|
411 | template: ccAssayTemplate, |
---|
412 | module: clinicalModule, |
---|
413 | externalAssayID: 'PPS3_SAM' |
---|
414 | ) |
---|
415 | |
---|
416 | def metAssayRef = new Assay( |
---|
417 | name: 'Lipidomics profile', |
---|
418 | template: metAssayTemplate, |
---|
419 | module: metabolomicsModule, |
---|
420 | externalAssayID: 'PPS3_Lipidomics' |
---|
421 | ).setFieldValue('Spectrometry technique', 'LC/MS') |
---|
422 | |
---|
423 | mouseStudy.samples*.each { |
---|
424 | lipidAssayRef.addToSamples(it) |
---|
425 | metAssayRef.addToSamples(it) |
---|
426 | } |
---|
427 | |
---|
428 | mouseStudy.addToAssays(lipidAssayRef); |
---|
429 | mouseStudy.addToAssays(metAssayRef); |
---|
430 | mouseStudy.save() |
---|
431 | |
---|
432 | def glucoseAssayBRef = new Assay( |
---|
433 | name : 'Glucose assay before', |
---|
434 | template : ccAssayTemplate, |
---|
435 | module : clinicalModule, |
---|
436 | externalAssayID: 'PPSH-Glu-B' |
---|
437 | ) |
---|
438 | |
---|
439 | def glucoseAssayARef = new Assay( |
---|
440 | name : 'Glucose assay after', |
---|
441 | template : ccAssayTemplate, |
---|
442 | module : clinicalModule, |
---|
443 | externalAssayID: 'PPSH-Glu-A' |
---|
444 | ) |
---|
445 | |
---|
446 | def metAssayRefB = new Assay( |
---|
447 | name : 'Lipidomics profile before', |
---|
448 | template : metAssayTemplate, |
---|
449 | module : metabolomicsModule, |
---|
450 | externalAssayID: 'PPSH_Lipidomics_start' |
---|
451 | ).setFieldValue('Spectrometry technique', 'GC/MS') |
---|
452 | |
---|
453 | def metAssayRefA = new Assay( |
---|
454 | name : 'Lipidomics profile after', |
---|
455 | template : metAssayTemplate, |
---|
456 | module : metabolomicsModule, |
---|
457 | externalAssayID: 'PPSH_Lipidomics_end' |
---|
458 | ).setFieldValue('Spectrometry technique', 'GC/MS') |
---|
459 | |
---|
460 | |
---|
461 | // Add sequencing (metagenomics) assays |
---|
462 | def sequencingAssay16SRef = new Assay( |
---|
463 | name : '16S Sequencing assay', |
---|
464 | template : ccAssayTemplate, |
---|
465 | module : metagenomicsModule, |
---|
466 | externalAssayID: 'PPSH-SEQ-16S' |
---|
467 | ) |
---|
468 | |
---|
469 | // Add sequencing (metagenomics) assays |
---|
470 | def sequencingAssay18SRef = new Assay( |
---|
471 | name : '18S Sequencing assay', |
---|
472 | template : ccAssayTemplate, |
---|
473 | module : metagenomicsModule, |
---|
474 | externalAssayID: 'PPSH-SEQ-18S' |
---|
475 | ) |
---|
476 | |
---|
477 | humanStudy.samples*.each { |
---|
478 | if (it.parentEvent.startTime == 0) { |
---|
479 | glucoseAssayBRef.addToSamples(it) |
---|
480 | metAssayRefB.addToSamples(it) |
---|
481 | } |
---|
482 | else { |
---|
483 | glucoseAssayARef.addToSamples(it) |
---|
484 | metAssayRefA.addToSamples(it) |
---|
485 | sequencingAssay16SRef.addToSamples(it) |
---|
486 | sequencingAssay18SRef.addToSamples(it) |
---|
487 | } |
---|
488 | } |
---|
489 | |
---|
490 | humanStudy.addToAssays(sequencingAssay16SRef) |
---|
491 | humanStudy.addToAssays(sequencingAssay18SRef) |
---|
492 | humanStudy.addToAssays(glucoseAssayARef) |
---|
493 | humanStudy.addToAssays(glucoseAssayBRef) |
---|
494 | humanStudy.addToAssays(metAssayRefA) |
---|
495 | humanStudy.addToAssays(metAssayRefB) |
---|
496 | humanStudy.save() |
---|
497 | } |
---|
498 | } |
---|