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