Skip to content

Commit 820df8b

Browse files
committed
expanded the example_data further
- added strain information - added organism - updated project description, web page, pals - updated institution using ROR - added annotate_with (tags) - observation unit description, creators and tags - added organism to exp_assay - sop corrections with a fake file - publication citation added and date
1 parent 6fda913 commit 820df8b

File tree

2 files changed

+65
-15
lines changed

2 files changed

+65
-15
lines changed

db/seeds/example_data/example_data.seeds.rb

Lines changed: 65 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,29 @@
11
# Project, Institution, Workgroup
22
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
3+
project = Project.where(title: 'Default Project').first_or_create(:programme_id => program.id, description: 'A description for the default project') # TODO this link is not working
44
institution = Institution.where(title: 'Default Institution').first_or_create(country: 'United Kingdom')
55
workgroup = WorkGroup.where(project_id: project.id, institution_id: institution.id).first_or_create
66

7+
8+
# Create a strain
9+
strain = Strain.where(title: 'Sulfolobus solfataricus strain 98/2').first_or_create()
10+
strain.projects = [project]
11+
strain.policy = Policy.create(name: 'default policy', access_type: 1)
12+
strain.organism = Organism.where(title: 'Sulfolobus solfataricus').first_or_create()
13+
strain.provider_name = 'BacDive'
14+
strain.provider_id = '123456789'
15+
strain.synonym = '98/2'
16+
strain.comment = 'This is a test strain.'
17+
strain.save!
18+
puts 'Seeded 1 strain.'
19+
20+
# Create an organism
21+
organism = Organism.where(title: 'Sulfolobus solfataricus').first_or_create()
22+
organism.projects = [project]
23+
organism.strains = [strain]
24+
organism.save!
25+
puts 'Seeded 1 organism.'
26+
727
## Create an admin and a guest user
828

929
# Admin
@@ -35,26 +55,53 @@
3555
guest_person.save
3656
puts 'Seeded 1 guest.'
3757

58+
# Update project
59+
disable_authorization_checks do
60+
project.description = 'This is a test project for the SEEK sandbox.'
61+
project.web_page = 'http://www.seek4science.org'
62+
project.pals = [guest_person]
63+
project.save!
64+
puts 'Seeded 1 project.'
65+
end
66+
67+
# Update institution
68+
disable_authorization_checks do
69+
institution.country = 'United Kingdom'
70+
institution.city = 'Manchester' # Overridden by ROR
71+
institution.web_page = 'http://www.seek4science.org' # Overridden by ROR
72+
institution.ror_id = '027m9bs27'
73+
institution.address = '10 Downing Street' # Stays the same
74+
institution.department = 'Department of SEEK for Science'
75+
# Logo?
76+
institution.save!
77+
puts 'Seeded 1 institution.'
78+
end
79+
3880
# ISA
3981
investigation = Investigation.new(title: 'Central Carbon Metabolism of Sulfolobus solfataricus',
4082
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.')
4183
investigation.projects = [project]
4284
investigation.contributor = guest_person
4385
investigation.policy = Policy.create(name: 'default policy', access_type: 1)
86+
investigation.annotate_with(['metabolism', 'thermophile'], 'tag', guest_person)
4487
investigation.save
4588
puts 'Seeded 1 investigation.'
4689

4790
study = Study.new(title: 'Carbon loss at high T')
4891
study.contributor = guest_person
4992
study.policy = Policy.create(name: 'default policy', access_type: 1)
5093
study.investigation = investigation
94+
study.annotate_with(['thermophile', 'high temperature'], 'tag', guest_person)
5195
study.save
5296
puts 'Seeded 1 study.'
5397

5498
## Observation unit
5599
observation_unit = ObservationUnit.new(title: 'Large scale bioreactor')
100+
observation_unit.description = 'A large scale bioreactor with a 1000 mL reservoir.'
101+
observation_unit.other_creators = [admin_person.name, 'Jane Doe']
56102
observation_unit.contributor = guest_person
57103
observation_unit.policy = Policy.create(name: 'default policy', access_type: 1)
104+
observation_unit.annotate_with(['bioreactor'], 'tag', guest_person)
58105
observation_unit.study = study
59106
disable_authorization_checks { observation_unit.save }
60107
puts 'Seeded 1 observation unit'
@@ -67,7 +114,9 @@
67114
exp_assay.contributor = guest_person
68115
exp_assay.policy = Policy.create(name: 'default policy', access_type: 1)
69116
exp_assay.study = study
117+
# exp_assay.observation_units = [observation_unit] # TODO ActiveRecord::HasManyThroughNestedAssociationsAreReadonly: Cannot modify association 'Assay#observation_units' because it goes through more than one other association. (ActiveRecord::HasManyThroughNestedAssociationsAreReadonly)
70118
exp_assay.assay_class = AssayClass.experimental
119+
exp_assay.organisms = [organism]
71120
exp_assay.save
72121
puts "exp_assay: Seeded 1 #{exp_assay.assay_class.long_key.downcase}."
73122

@@ -90,7 +139,7 @@
90139
assay_stream.assay_class = AssayClass.assay_stream
91140
assay_stream.save
92141
puts "Seeded 1 assay stream #{model_assay.assay_class.long_key.downcase}."
93-
#
142+
94143
#######
95144
# Assets
96145
# TODO check filesize
@@ -166,24 +215,22 @@
166215
end
167216
puts 'Seeded 1 model.'
168217

169-
# sop
170-
=begin
171-
sop = Sop.new(title: "Default title",
172-
description: "Default description"
173-
)
218+
# Sop creation
219+
sop = Sop.new(title: 'Reconstituted Enzyme System Protocol',
220+
description: 'Standard operating procedure for reconstituting the gluconeogenic enzyme system from Sulfolobus solfataricus to study metabolic pathway efficiency at high temperatures.')
174221
sop.contributor = guest_person
175222
sop.projects = [project]
176-
sop.assays = [exp_assay]
223+
sop.assays = [exp_assay, model_assay]
177224
sop.policy = Policy.create(name: 'default policy', access_type: 1)
178225
sop.content_blob = ContentBlob.new(original_filename: 'test_sop.txt',
179-
content_type: 'text'
180-
)
181-
disable_authorization_checks {sop.save}
226+
content_type: 'text')
182227
AssetsCreator.create(asset_id: sop.id, creator_id: guest_person.id, asset_type: sop.class.name)
183-
#copy file
184228
FileUtils.cp File.dirname(__FILE__) + '/' + sop.content_blob.original_filename, sop.content_blob.filepath
185-
puts "Seeded 1 sop."
186-
=end
229+
230+
disable_authorization_checks {sop.save!}
231+
sop.annotate_with(['protocol', 'enzymology', 'thermophile'], 'tag', guest_person)
232+
puts 'Seeded 1 SOP.'
233+
187234

188235
# publication
189236
publication = Publication.new(
@@ -205,7 +252,8 @@
205252

206253
# Build policy through the association
207254
publication.build_policy(name: 'default policy', access_type: 1)
208-
255+
# Publication date
256+
publication.published_date = Date.today.to_s
209257
# Build publication authors
210258
authors = [
211259
{ first_name: 'T.', last_name: 'Kouril', author_index: 1 },
@@ -215,6 +263,8 @@
215263
{ first_name: 'B.', last_name: 'Siebers', author_index: 5 },
216264
{ first_name: 'J.', last_name: 'Snoep', author_index: 6 }
217265
]
266+
# Citation
267+
publication.citation = "Kouril, T. et al. Intermediate instability at high temperature leads to low pathway efficiency for an in vitro reconstituted system of gluconeogenesis in Sulfolobus solfataricus. FEBS J. 2015;687:100-108."
218268

219269
authors.each do |author_attrs|
220270
publication.publication_authors.build(author_attrs)

db/seeds/example_data/test_sop.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)