Skip to content

Commit 9b52eb4

Browse files
committed
Added program, not yet able to link it with the project
Added observation unit and enabled it in the config Fixed issue with Assay (Last is not correct as it now has stream assay?) user / person replacement from main?
1 parent 94cacff commit 9b52eb4

File tree

1 file changed

+80
-48
lines changed

1 file changed

+80
-48
lines changed

db/seeds/example_data/example_data.seeds.rb

Lines changed: 80 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Project, Institution, Workgroup
2-
project = Project.where(title: 'Default Project').first_or_create
2+
program = Programme.where(title: 'Default Programme').first_or_create(web_page: 'http://www.seek4science.org', funding_details: 'Funding H2020X01Y001', description: 'This is a test programme for the SEEK sandbox.')
3+
project = Project.where(title: 'Default Project').first_or_create(:programme_id => program.id) # TODO this link is not working
34
institution = Institution.where(title: 'Default Institution').first_or_create(country: 'United Kingdom')
45
workgroup = WorkGroup.where(project_id: project.id, institution_id: institution.id).first_or_create
56

@@ -35,41 +36,64 @@
3536
investigation = Investigation.new(title: 'Central Carbon Metabolism of Sulfolobus solfataricus',
3637
description: 'An investigation in the CCM of S. solfataricus with a focus on the unique temperature adaptations and regulation; using a combined modelling and experimental approach.')
3738
investigation.projects = [project]
38-
investigation.contributor = guest_user
39+
investigation.contributor = guest_person
3940
investigation.policy = Policy.create(name: 'default policy', access_type: 1)
4041
investigation.save
4142
puts 'Seeded 1 investigation.'
4243

4344
study = Study.new(title: 'Carbon loss at high T')
44-
study.contributor = guest_user
45+
study.contributor = guest_person
4546
study.policy = Policy.create(name: 'default policy', access_type: 1)
4647
study.investigation = investigation
4748
study.save
4849
puts 'Seeded 1 study.'
4950

51+
## Observation unit
52+
observation_unit = ObservationUnit.new(title: 'Large scale bioreactor')
53+
observation_unit.contributor = guest_person
54+
observation_unit.policy = Policy.create(name: 'default policy', access_type: 1)
55+
observation_unit.study = study
56+
disable_authorization_checks { observation_unit.save }
57+
puts 'Seeded 1 observation unit'
58+
59+
## Assays ##
60+
61+
## Experimental assay?
5062
exp_assay = Assay.new(title: 'Reconstituted system reference state',
5163
description: 'The four purified enzymes were incubated in assay buffer and consumption of 3PG and production of F6P were measured in time, together with GAP and DHAP concentrations.')
5264
exp_assay.contributor = guest_person
5365
exp_assay.policy = Policy.create(name: 'default policy', access_type: 1)
5466
exp_assay.study = study
55-
exp_assay.assay_class = AssayClass.first
67+
exp_assay.assay_class = AssayClass.experimental
5668
exp_assay.save
57-
puts 'Seeded 1 experimental assay.'
69+
puts "exp_assay: Seeded 1 #{exp_assay.assay_class.long_key.downcase}."
5870

71+
# Modeling assay?
5972
model_assay = Assay.new(title: 'Model reconstituted system',
6073
description: 'Mathematical model for the reconstituted system with PGK, GAPDH, TPI and FBPAase.')
6174
model_assay.contributor = guest_person
6275
model_assay.policy = Policy.create(name: 'default policy', access_type: 1)
6376
model_assay.study = study
64-
model_assay.assay_class = AssayClass.last
77+
model_assay.assay_class = AssayClass.modelling
6578
model_assay.save
66-
puts 'Seeded 1 modelling analysis.'
79+
puts "Seeded 1 #{model_assay.assay_class.long_key.downcase}."
6780

81+
# Assay stream
82+
assay_stream = Assay.new(title: 'Assay stream',
83+
description: 'A stream of assays? This is a test assay stream for the example data.',)
84+
assay_stream.contributor = guest_person
85+
assay_stream.policy = Policy.create(name: 'default policy', access_type: 1)
86+
assay_stream.study = study
87+
assay_stream.assay_class = AssayClass.assay_stream
88+
assay_stream.save
89+
puts "Seeded 1 assay stream #{model_assay.assay_class.long_key.downcase}."
90+
#
91+
#######
6892
# Assets
6993
# TODO check filesize
7094
data_file1 = DataFile.new(title: 'Metabolite concentrations during reconstituted enzyme incubation',
7195
description: 'The purified enzymes, PGK, GAPDH, TPI and FBPAase were incubated at 70 C en conversion of 3PG to F6P was followed.')
72-
data_file1.contributor = guest_user
96+
data_file1.contributor = guest_person
7397
data_file1.projects = [project]
7498
relationship = RelationshipType.where(title: 'Validation data').first
7599
data_file1.policy = Policy.create(name: 'default policy', access_type: 1)
@@ -88,7 +112,7 @@
88112

89113
data_file2 = DataFile.new(title: 'Model simulation and Exp data for reconstituted system',
90114
description: 'Experimental data for the reconstituted system are plotted together with the model prediction.')
91-
data_file2.contributor = guest_user
115+
data_file2.contributor = guest_person
92116
data_file2.projects = [project]
93117
data_file2.policy = Policy.create(name: 'default policy', access_type: 1)
94118
data_file2.content_blob = ContentBlob.new(original_filename: 'combinedPlot.jpg',
@@ -109,7 +133,7 @@
109133
model = Model.new(title: 'Mathematical model for the combined four enzyme system',
110134
description: 'The PGK, GAPDH, TPI and FBPAase were modelled together using the individual rate equations. Closed system.')
111135
model.model_format = ModelFormat.find_by_title('SBML')
112-
model.contributor = guest_user
136+
model.contributor = guest_person
113137
model.projects = [project]
114138
model.assays = [model_assay]
115139
model.policy = Policy.create(name: 'default policy', access_type: 1)
@@ -131,7 +155,7 @@
131155
content_type: 'text/xml')
132156
model.content_blobs = [cb1, cb2, cb3, cb4, cb5, cb6]
133157
disable_authorization_checks { model.save }
134-
AssetsCreator.create(asset_id: model.id, creator_id: guest_user.id, asset_type: model.class.name)
158+
AssetsCreator.create(asset_id: model.id, creator_id: guest_person.id, asset_type: model.class.name)
135159
# copy file
136160
model.content_blobs.each do |blob|
137161
FileUtils.cp File.dirname(__FILE__) + '/' + blob.original_filename, blob.filepath
@@ -144,62 +168,68 @@
144168
sop = Sop.new(title: "Default title",
145169
description: "Default description"
146170
)
147-
sop.contributor = guest_user
171+
sop.contributor = guest_person
148172
sop.projects = [project]
149173
sop.assays = [exp_assay]
150174
sop.policy = Policy.create(name: 'default policy', access_type: 1)
151175
sop.content_blob = ContentBlob.new(original_filename: 'test_sop.txt',
152176
content_type: 'text'
153177
)
154178
disable_authorization_checks {sop.save}
155-
AssetsCreator.create(asset_id: sop.id, creator_id: guest_user.id, asset_type: sop.class.name)
179+
AssetsCreator.create(asset_id: sop.id, creator_id: guest_person.id, asset_type: sop.class.name)
156180
#copy file
157181
FileUtils.cp File.dirname(__FILE__) + '/' + sop.content_blob.original_filename, sop.content_blob.filepath
158182
puts "Seeded 1 sop."
159183
=end
160184

161185
# publication
162-
publication = Publication.new(pubmed_id: '23865479',
163-
title: 'Intermediate instability at high temperature leads to low pathway efficiency for an in vitro reconstituted system of gluconeogenesis in Sulfolobus solfataricus',
164-
abstract: "Four enzymes of the gluconeogenic pathway in Sulfolobus solfataricus were purified and kinetically characterized. The enzymes were reconstituted in vitro to quantify the contribution of temperature instability of the pathway intermediates to carbon loss from the system.
165-
The reconstituted system, consisting of phosphoglycerate kinase, glyceraldehyde 3-phosphate dehydrogenase, triose phosphate isomerase and the fructose 1,6-bisphosphate aldolase/phosphatase, maintained a constant consumption rate of 3-phosphoglycerate and production of
166-
fructose 6-phosphate over a 1-h period. Cofactors ATP and NADPH were regenerated via pyruvate kinase and glucose dehydrogenase. A mathematical model was constructed on the basis of the kinetics of the purified enzymes and the measured half-life times of the pathway intermediates.
167-
The model quantitatively predicted the system fluxes and metabolite concentrations. Relative enzyme concentrations were chosen such that half the carbon in the system was lost due to degradation of the thermolabile intermediates dihydroxyacetone phosphate, glyceraldehyde 3-phosphate
168-
and 1,3-bisphosphoglycerate, indicating that intermediate instability at high temperature can significantly affect pathway efficiency.",
169-
published_date: '2015',
170-
journal: 'FEBS J')
171-
172-
publication.contributor = guest_user
173-
publication.projects = [project]
174-
publication.policy = Policy.create(name: 'default policy', access_type: 1)
175-
publication_author1 = PublicationAuthor.new(first_name: 'T.',
176-
last_name: 'Kouril',
177-
author_index: 1)
178-
publication_author2 = PublicationAuthor.new(first_name: 'D.',
179-
last_name: 'Esser',
180-
author_index: 1)
181-
publication_author3 = PublicationAuthor.new(first_name: 'J.',
182-
last_name: 'Kort',
183-
author_index: 1)
184-
publication_author4 = PublicationAuthor.new(first_name: 'H. V.',
185-
last_name: 'Westerhoff',
186-
author_index: 1)
187-
publication_author5 = PublicationAuthor.new(first_name: 'B.',
188-
last_name: 'Siebers',
189-
author_index: 1)
190-
publication_author6 = PublicationAuthor.new(first_name: 'J.',
191-
last_name: 'Snoep',
192-
author_index: 1)
193-
194-
publication.publication_authors = [publication_author1, publication_author2, publication_author3, publication_author4, publication_author5, publication_author6]
186+
publication = Publication.new(
187+
publication_type_id: PublicationType.where(title:"Journal").first.id,
188+
pubmed_id: '23865479',
189+
title: 'Intermediate instability at high temperature leads to low pathway efficiency for an in vitro reconstituted system of gluconeogenesis in Sulfolobus solfataricus',
190+
abstract: "Four enzymes of the gluconeogenic pathway in Sulfolobus solfataricus were purified and kinetically characterized. The enzymes were reconstituted in vitro to quantify the contribution of temperature instability of the pathway intermediates to carbon loss from the system.
191+
The reconstituted system, consisting of phosphoglycerate kinase, glyceraldehyde 3-phosphate dehydrogenase, triose phosphate isomerase and the fructose 1,6-bisphosphate aldolase/phosphatase, maintained a constant consumption rate of 3-phosphoglycerate and production of
192+
fructose 6-phosphate over a 1-h period. Cofactors ATP and NADPH were regenerated via pyruvate kinase and glucose dehydrogenase. A mathematical model was constructed on the basis of the kinetics of the purified enzymes and the measured half-life times of the pathway intermediates.
193+
The model quantitatively predicted the system fluxes and metabolite concentrations. Relative enzyme concentrations were chosen such that half the carbon in the system was lost due to degradation of the thermolabile intermediates dihydroxyacetone phosphate, glyceraldehyde 3-phosphate
194+
and 1,3-bisphosphoglycerate, indicating that intermediate instability at high temperature can significantly affect pathway efficiency.",
195+
published_date: '2015',
196+
journal: 'FEBS J'
197+
)
198+
199+
# Set contributor and projects
200+
publication.contributor = guest_person
201+
publication.projects << project
202+
203+
# Build policy through the association
204+
publication.build_policy(name: 'default policy', access_type: 1)
205+
206+
# Build publication authors
207+
authors = [
208+
{ first_name: 'T.', last_name: 'Kouril', author_index: 1 },
209+
{ first_name: 'D.', last_name: 'Esser', author_index: 2 },
210+
{ first_name: 'J.', last_name: 'Kort', author_index: 3 },
211+
{ first_name: 'H. V.', last_name: 'Westerhoff', author_index: 4 },
212+
{ first_name: 'B.', last_name: 'Siebers', author_index: 5 },
213+
{ first_name: 'J.', last_name: 'Snoep', author_index: 6 }
214+
]
215+
216+
authors.each do |author_attrs|
217+
publication.publication_authors.build(author_attrs)
218+
end
219+
220+
# Save publication with all associations
195221
disable_authorization_checks do
196-
publication.save
222+
publication.save! # raises an error if something is invalid
197223
publication.associate(exp_assay)
198224
publication.associate(model_assay)
199225
end
200-
AssetsCreator.create(asset_id: publication.id, creator_id: guest_user.id, asset_type: publication.class.name)
226+
227+
# Create asset
228+
AssetsCreator.create(asset_id: publication.id, creator_id: guest_person.id, asset_type: publication.class.name)
229+
201230
puts 'Seeded 1 publication.'
202231

232+
# Log activity
203233
[project, investigation, study, exp_assay, model_assay, data_file1, data_file2, model, publication].each do |item|
204234
ActivityLog.create(action: 'create',
205235
culprit: guest_user,
@@ -213,6 +243,8 @@
213243
<p style="text-align:center">For more information about SEEK and to see a video, please visit our <a href="http://www.seek4science.org">Website</a>.</p>'
214244

215245
Seek::Config.solr_enabled = true
246+
Seek::Config.isa_enabled = true
247+
Seek::Config.observation_units_enabled = true
216248
Seek::Config.programmes_enabled = true
217249
Seek::Config.programme_user_creation_enabled = true
218250
Seek::Config.noreply_sender = '[email protected]'

0 commit comments

Comments
 (0)