Skip to content

Commit 5a773bb

Browse files
committed
i was having trouble with the inference due to the "large" file size so i broke it up into smaller parts.
- added samples to the list as well - added a presentation with a single example slide
1 parent 820df8b commit 5a773bb

10 files changed

+701
-324
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Activity Logging and Configuration
2+
3+
# Log activity
4+
[$project, $investigation, $study, $exp_assay, $model_assay, $data_file1, $data_file2, $model, $publication].each do |item|
5+
ActivityLog.create(action: 'create',
6+
culprit: $guest_user,
7+
controller_name: item.class.name.underscore.pluralize,
8+
activity_loggable: item,
9+
data: item.title)
10+
end
11+
12+
# Updating programme
13+
disable_authorization_checks do
14+
$program.programme_administrators = [$guest_person, $admin_person]
15+
$program.projects = [$project]
16+
# $program.funding_codes_as_text = ['123456789'] # TODO cannot set funding codes
17+
# Discussion links...
18+
$program.save!
19+
end
20+
21+
# Configuration
22+
Seek::Config.home_description = '<p style="text-align:center;font-size:larger;font-weight:bolder">Welcome to the SEEK Sandbox</p>
23+
<p style="text-align:center;font-size:larger;font-weight:bolder">You can log in with the username: <em>guest</em> and password: <em>guest</em></p>
24+
<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>'
25+
26+
Seek::Config.solr_enabled = true
27+
Seek::Config.isa_enabled = true
28+
Seek::Config.observation_units_enabled = true
29+
Seek::Config.programmes_enabled = true
30+
Seek::Config.programme_user_creation_enabled = true
31+
Seek::Config.noreply_sender = '[email protected]'
32+
Seek::Config.instance_name = 'SEEK SANDBOX'
33+
Seek::Config.application_name = 'FAIRDOM-SEEK'
34+
Seek::Config.exception_notification_enabled = true
35+
Seek::Config.exception_notification_recipients = ['[email protected]']
36+
Seek::Config.datacite_url = 'https://mds.test.datacite.org/'
37+
Seek::Config.doi_prefix = '10.5072'
38+
Seek::Config.doi_suffix = 'seek.5'
39+
Seek::Config.tag_threshold = 0 # TODO set to 0 or 1 so the tags created in this example_data seeds will be visiblw on the front page.
40+
puts 'Finish configuration'
41+
puts 'Please visit admin site for further configuration, e.g. site_base_host, pubmed_api_email, crossref_api_email, bioportal_api_key, email, doi, admin email'
42+
puts 'Admin account: username admin, password adminadmin. You might want to change admin password.'
43+
puts 'Then make sure solr, workers are running'

db/seeds/example_data/example_data.seeds.rb

Lines changed: 8 additions & 324 deletions
Large diffs are not rendered by default.
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# Assets - Data files, Models, SOPs
2+
# TODO check filesize
3+
data_file1 = DataFile.new(title: 'Metabolite concentrations during reconstituted enzyme incubation',
4+
description: 'The purified enzymes, PGK, GAPDH, TPI and FBPAase were incubated at 70 C en conversion of 3PG to F6P was followed.')
5+
data_file1.contributor = $guest_person
6+
data_file1.projects = [$project]
7+
relationship = RelationshipType.where(title: 'Validation data').first
8+
data_file1.policy = Policy.create(name: 'default policy', access_type: 1)
9+
data_file1.content_blob = ContentBlob.new(original_filename: 'ValidationReference.xlsx',
10+
content_type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
11+
disable_authorization_checks do
12+
data_file1.save
13+
$exp_assay.associate(data_file1)
14+
$model_assay.associate(data_file1, relationship: relationship)
15+
end
16+
AssetsCreator.create(asset_id: data_file1.id, creator_id: $guest_user.id, asset_type: data_file1.class.name)
17+
# copy file
18+
FileUtils.cp File.dirname(__FILE__) + '/' + data_file1.content_blob.original_filename, data_file1.content_blob.filepath
19+
disable_authorization_checks { data_file1.content_blob.save }
20+
puts 'Seeded data file 1.'
21+
22+
data_file2 = DataFile.new(title: 'Model simulation and Exp data for reconstituted system',
23+
description: 'Experimental data for the reconstituted system are plotted together with the model prediction.')
24+
data_file2.contributor = $guest_person
25+
data_file2.projects = [$project]
26+
data_file2.policy = Policy.create(name: 'default policy', access_type: 1)
27+
data_file2.content_blob = ContentBlob.new(original_filename: 'combinedPlot.jpg',
28+
content_type: 'image/jpeg')
29+
disable_authorization_checks do
30+
data_file2.save
31+
$exp_assay.associate(data_file2)
32+
$model_assay.associate(data_file2, relationship: relationship)
33+
end
34+
35+
AssetsCreator.create(asset_id: data_file2.id, creator_id: $guest_user.id, asset_type: data_file2.class.name)
36+
# copy file
37+
FileUtils.cp File.dirname(__FILE__) + '/' + data_file2.content_blob.original_filename, data_file2.content_blob.filepath
38+
disable_authorization_checks { data_file2.content_blob.save }
39+
puts 'Seeded data file 2.'
40+
41+
# model
42+
model = Model.new(title: 'Mathematical model for the combined four enzyme system',
43+
description: 'The PGK, GAPDH, TPI and FBPAase were modelled together using the individual rate equations. Closed system.')
44+
model.model_format = ModelFormat.find_by_title('SBML')
45+
model.contributor = $guest_person
46+
model.projects = [$project]
47+
model.assays = [$model_assay]
48+
model.policy = Policy.create(name: 'default policy', access_type: 1)
49+
model.model_type = ModelType.where(title: 'Ordinary differential equations (ODE)').first
50+
model.model_format = ModelFormat.where(title: 'SBML').first
51+
model.recommended_environment = RecommendedModelEnvironment.where(title: 'JWS Online').first
52+
model.organism = Organism.where(title: 'Sulfolobus solfataricus').first
53+
cb1 = ContentBlob.new(original_filename: 'ssolfGluconeogenesisOpenAnn.dat',
54+
content_type: 'text/x-uuencode')
55+
cb2 = ContentBlob.new(original_filename: 'ssolfGluconeogenesisOpenAnn.xml',
56+
content_type: 'text/xml')
57+
cb3 = ContentBlob.new(original_filename: 'ssolfGluconeogenesisOpenAnn.xml',
58+
content_type: 'text/xml')
59+
cb4 = ContentBlob.new(original_filename: 'ssolfGluconeogenesisAnn.xml',
60+
content_type: 'text/xml')
61+
cb5 = ContentBlob.new(original_filename: 'ssolfGluconeogenesisClosed.xml',
62+
content_type: 'text/xml')
63+
cb6 = ContentBlob.new(original_filename: 'ssolfGluconeogenesis.xml',
64+
content_type: 'text/xml')
65+
model.content_blobs = [cb1, cb2, cb3, cb4, cb5, cb6]
66+
disable_authorization_checks { model.save }
67+
AssetsCreator.create(asset_id: model.id, creator_id: $guest_person.id, asset_type: model.class.name)
68+
# copy file
69+
model.content_blobs.each do |blob|
70+
FileUtils.cp File.dirname(__FILE__) + '/' + blob.original_filename, blob.filepath
71+
blob.save
72+
end
73+
puts 'Seeded 1 model.'
74+
75+
# Sop creation
76+
sop = Sop.new(title: 'Reconstituted Enzyme System Protocol',
77+
description: 'Standard operating procedure for reconstituting the gluconeogenic enzyme system from Sulfolobus solfataricus to study metabolic pathway efficiency at high temperatures.')
78+
sop.contributor = $guest_person
79+
sop.projects = [$project]
80+
sop.assays = [$exp_assay, $model_assay]
81+
sop.policy = Policy.create(name: 'default policy', access_type: 1)
82+
sop.content_blob = ContentBlob.new(original_filename: 'test_sop.txt',
83+
content_type: 'text')
84+
AssetsCreator.create(asset_id: sop.id, creator_id: $guest_person.id, asset_type: sop.class.name)
85+
FileUtils.cp File.dirname(__FILE__) + '/' + sop.content_blob.original_filename, sop.content_blob.filepath
86+
87+
disable_authorization_checks {sop.save!}
88+
sop.annotate_with(['protocol', 'enzymology', 'thermophile'], 'tag', $guest_person)
89+
puts 'Seeded 1 SOP.'
90+
91+
# Store references for other seed files
92+
$data_file1 = data_file1
93+
$data_file2 = data_file2
94+
$model = model
95+
$sop = sop
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# ISA - Investigation, Study, Assays, Observation Units
2+
investigation = Investigation.new(title: 'Central Carbon Metabolism of Sulfolobus solfataricus',
3+
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.')
4+
investigation.projects = [$project]
5+
investigation.contributor = $guest_person
6+
investigation.policy = Policy.create(name: 'default policy', access_type: 1)
7+
investigation.annotate_with(['metabolism', 'thermophile'], 'tag', $guest_person)
8+
investigation.save
9+
puts 'Seeded 1 investigation.'
10+
11+
study = Study.new(title: 'Carbon loss at high T')
12+
study.contributor = $guest_person
13+
study.policy = Policy.create(name: 'default policy', access_type: 1)
14+
study.investigation = investigation
15+
study.annotate_with(['thermophile', 'high temperature'], 'tag', $guest_person)
16+
study.save
17+
puts 'Seeded 1 study.'
18+
19+
## Observation unit
20+
observation_unit = ObservationUnit.new(title: 'Large scale bioreactor')
21+
observation_unit.description = 'A large scale bioreactor with a 1000 mL reservoir.'
22+
observation_unit.other_creators = [$admin_person.name, 'Jane Doe']
23+
observation_unit.contributor = $guest_person
24+
observation_unit.policy = Policy.create(name: 'default policy', access_type: 1)
25+
observation_unit.annotate_with(['bioreactor'], 'tag', $guest_person)
26+
observation_unit.study = study
27+
disable_authorization_checks { observation_unit.save }
28+
puts 'Seeded 1 observation unit'
29+
30+
## Assays ##
31+
32+
## Experimental assay?
33+
exp_assay = Assay.new(title: 'Reconstituted system reference state',
34+
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.')
35+
exp_assay.contributor = $guest_person
36+
exp_assay.policy = Policy.create(name: 'default policy', access_type: 1)
37+
exp_assay.study = study
38+
# 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)
39+
exp_assay.assay_class = AssayClass.experimental
40+
exp_assay.organisms = [$organism]
41+
exp_assay.save
42+
puts "exp_assay: Seeded 1 #{exp_assay.assay_class.long_key.downcase}."
43+
44+
# Modeling assay?
45+
model_assay = Assay.new(title: 'Model reconstituted system',
46+
description: 'Mathematical model for the reconstituted system with PGK, GAPDH, TPI and FBPAase.')
47+
model_assay.contributor = $guest_person
48+
model_assay.policy = Policy.create(name: 'default policy', access_type: 1)
49+
model_assay.study = study
50+
model_assay.assay_class = AssayClass.modelling
51+
model_assay.save
52+
puts "Seeded 1 #{model_assay.assay_class.long_key.downcase}."
53+
54+
# Assay stream
55+
assay_stream = Assay.new(title: 'Assay stream',
56+
description: 'A stream of assays? This is a test assay stream for the example data.',)
57+
assay_stream.contributor = $guest_person
58+
assay_stream.policy = Policy.create(name: 'default policy', access_type: 1)
59+
assay_stream.study = study
60+
assay_stream.assay_class = AssayClass.assay_stream
61+
assay_stream.save
62+
puts "Seeded 1 assay stream #{model_assay.assay_class.long_key.downcase}."
63+
64+
# Store references for other seed files
65+
$investigation = investigation
66+
$study = study
67+
$observation_unit = observation_unit
68+
$exp_assay = exp_assay
69+
$model_assay = model_assay
70+
$assay_stream = assay_stream
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Project, Institution, Workgroup, Program, Strains, Organisms
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, description: 'A description for the default project') # TODO this link is not working
4+
institution = Institution.where(title: 'Default Institution').first_or_create(country: 'United Kingdom')
5+
workgroup = WorkGroup.where(project_id: project.id, institution_id: institution.id).first_or_create
6+
7+
# Create a strain
8+
strain = Strain.where(title: 'Sulfolobus solfataricus strain 98/2').first_or_create
9+
strain.projects = [project]
10+
strain.policy = Policy.create(name: 'default policy', access_type: 1)
11+
strain.organism = Organism.where(title: 'Sulfolobus solfataricus').first_or_create
12+
strain.provider_name = 'BacDive'
13+
strain.provider_id = '123456789'
14+
strain.synonym = '98/2'
15+
strain.comment = 'This is a test strain.'
16+
strain.save!
17+
puts 'Seeded 1 strain.'
18+
19+
# Create an organism
20+
organism = Organism.where(title: 'Sulfolobus solfataricus').first_or_create
21+
organism.projects = [project]
22+
organism.strains = [strain]
23+
organism.save!
24+
puts 'Seeded 1 organism.'
25+
26+
# Store references for other seed files
27+
$program = program
28+
$project = project
29+
$institution = institution
30+
$workgroup = workgroup
31+
$strain = strain
32+
$organism = organism
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Publications, Presentations and Events
2+
3+
# publication
4+
publication = Publication.new(
5+
publication_type_id: PublicationType.where(title:"Journal").first.id,
6+
pubmed_id: '23865479',
7+
title: 'Intermediate instability at high temperature leads to low pathway efficiency for an in vitro reconstituted system of gluconeogenesis in Sulfolobus solfataricus',
8+
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.
9+
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
10+
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.
11+
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
12+
and 1,3-bisphosphoglycerate, indicating that intermediate instability at high temperature can significantly affect pathway efficiency.",
13+
published_date: '2015',
14+
journal: 'FEBS J'
15+
)
16+
17+
# Set contributor and projects
18+
publication.contributor = $guest_person
19+
publication.projects << $project
20+
21+
# Build policy through the association
22+
publication.build_policy(name: 'default policy', access_type: 1)
23+
# Publication date
24+
publication.published_date = Date.today.to_s
25+
# Build publication authors
26+
authors = [
27+
{ first_name: 'T.', last_name: 'Kouril', author_index: 1 },
28+
{ first_name: 'D.', last_name: 'Esser', author_index: 2 },
29+
{ first_name: 'J.', last_name: 'Kort', author_index: 3 },
30+
{ first_name: 'H. V.', last_name: 'Westerhoff', author_index: 4 },
31+
{ first_name: 'B.', last_name: 'Siebers', author_index: 5 },
32+
{ first_name: 'J.', last_name: 'Snoep', author_index: 6 }
33+
]
34+
# Citation
35+
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."
36+
37+
authors.each do |author_attrs|
38+
publication.publication_authors.build(author_attrs)
39+
end
40+
41+
# Save publication with all associations
42+
disable_authorization_checks do
43+
publication.save! # raises an error if something is invalid
44+
publication.associate($exp_assay)
45+
publication.associate($model_assay)
46+
end
47+
48+
# Create asset
49+
AssetsCreator.create(asset_id: publication.id, creator_id: $guest_person.id, asset_type: publication.class.name)
50+
puts 'Seeded 1 publication.'
51+
52+
# Presentation
53+
presentation = Presentation.new(
54+
title: 'Intermediate instability at high temperature leads to low pathway efficiency for an in vitro reconstituted system of gluconeogenesis in Sulfolobus solfataricus',
55+
description: "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.
56+
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
57+
",
58+
)
59+
presentation.projects = [$project]
60+
presentation.contributor = $guest_person
61+
presentation.policy = Policy.create(name: 'default policy', access_type: 1)
62+
presentation.content_blob = ContentBlob.new(original_filename: 'presentation.pptx', content_type: 'application/vnd.openxmlformats-officedocument.presentationml.presentation')
63+
AssetsCreator.create(asset_id: presentation.id, creator_id: $guest_person.id, asset_type: presentation.class.name)
64+
FileUtils.cp File.dirname(__FILE__) + '/' + presentation.content_blob.original_filename, presentation.content_blob.filepath # TODO results in "This version is not available"
65+
presentation.version = 1
66+
presentation.save!
67+
puts 'Seeded 1 presentation.'
68+
69+
# Create an event
70+
event = Event.new(title: 'Event for publication', description: 'Event for publication', start_date: Date.today, end_date: Date.today + 1.day)
71+
event.projects = [$project]
72+
event.contributor = $guest_person
73+
event.policy = Policy.create(name: 'default policy', access_type: 1)
74+
# event.website = 'http://www.seek4science.org'
75+
event.city = 'London'
76+
event.country = 'United Kingdom'
77+
event.address = 'Dunmore Terrace 123'
78+
79+
event.save!
80+
puts 'Seeded 1 event.'
81+
82+
# Store references for other seed files
83+
$publication = publication
84+
$presentation = presentation
85+
$event = event

0 commit comments

Comments
 (0)