Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions db/seeds/example_data/example_data_files_and_models_seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
data_file2 = DataFile.new(title: 'Model simulation and Exp data for reconstituted system',
description: 'Experimental data for the reconstituted system are plotted together with the model prediction.')
data_file2.contributor = $guest_person
data_file2.license = 'CC-BY-SA-4.0'
data_file2.projects = [$project]
data_file2.policy = Policy.create(name: 'default policy', access_type: 1)
data_file2.content_blob = ContentBlob.new(original_filename: 'combinedPlot.jpg',
Expand All @@ -32,7 +33,11 @@
$model_assay.associate(data_file2, relationship: relationship)
end

AssetsCreator.create(asset_id: data_file2.id, creator_id: $guest_user.id, asset_type: data_file2.class.name)
AssetsCreator.create(asset_id: data_file2.id, creator_id: $admin_person.id, asset_type: data_file2.class.name)
data_file2.other_creators = 'Person A, Person B'
disable_authorization_checks { data_file2.save }
User.with_current_user($guest_user) { data_file2.annotate_with(['metabolism', 'modelling', 'gluconeogenesis'], 'tag', $guest_person) }
disable_authorization_checks { data_file2.save }
# copy file
FileUtils.cp File.dirname(__FILE__) + '/' + data_file2.content_blob.original_filename, data_file2.content_blob.filepath
disable_authorization_checks { data_file2.content_blob.save }
Expand Down Expand Up @@ -77,15 +82,16 @@
description: 'Standard operating procedure for reconstituting the gluconeogenic enzyme system from Sulfolobus solfataricus to study metabolic pathway efficiency at high temperatures.')
sop.contributor = $guest_person
sop.projects = [$project]
sop.license = 'CC-BY-SA-4.0'
sop.assays = [$exp_assay, $model_assay]
sop.policy = Policy.create(name: 'default policy', access_type: 1)
sop.content_blob = ContentBlob.new(original_filename: 'test_sop.txt',
content_type: 'text')
AssetsCreator.create(asset_id: sop.id, creator_id: $guest_person.id, asset_type: sop.class.name)
FileUtils.cp File.dirname(__FILE__) + '/' + sop.content_blob.original_filename, sop.content_blob.filepath

disable_authorization_checks {sop.save!}
sop.annotate_with(['protocol', 'enzymology', 'thermophile'], 'tag', $guest_person)
User.with_current_user($guest_user) { sop.annotate_with(['protocol', 'enzymology', 'thermophile'], 'tag', $guest_person) }
disable_authorization_checks { sop.save! }
puts 'Seeded 1 SOP.'

# Store references for other seed files
Expand Down
1 change: 1 addition & 0 deletions db/seeds/example_data/example_document.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is an example document for the SEEK sandbox. It describes the experimental setup for the reconstituted gluconeogenic enzyme system from Sulfolobus solfataricus.
9 changes: 6 additions & 3 deletions db/seeds/example_data/example_isa_structure_seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@
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.')
investigation.projects = [$project]
investigation.contributor = $guest_person
investigation.creators = [$admin_person]
investigation.other_creators = ['Person A', 'Person B']
investigation.policy = Policy.create(name: 'default policy', access_type: 1)
investigation.annotate_with(['metabolism', 'thermophile'], 'tag', $guest_person)
User.with_current_user($guest_user) { investigation.annotate_with(['metabolism', 'thermophile'], 'tag', $guest_person) }
investigation.save
puts 'Seeded 1 investigation.'

study = Study.new(title: 'Carbon loss at high T')
study.description = 'The carbon loss at high T description will be here but I am currently not imaginative enough.'
study.contributor = $guest_person
study.policy = Policy.create(name: 'default policy', access_type: 1)
study.investigation = investigation
study.annotate_with(['thermophile', 'high temperature'], 'tag', $guest_person)
User.with_current_user($guest_user) { study.annotate_with(['thermophile', 'high temperature'], 'tag', $guest_person) }
study.save
puts 'Seeded 1 study.'

Expand All @@ -22,7 +25,7 @@
observation_unit.other_creators = [$admin_person.name, 'Jane Doe']
observation_unit.contributor = $guest_person
observation_unit.policy = Policy.create(name: 'default policy', access_type: 1)
observation_unit.annotate_with(['bioreactor'], 'tag', $guest_person)
User.with_current_user($guest_user) { observation_unit.annotate_with(['bioreactor'], 'tag', $guest_person) }
observation_unit.study = study
disable_authorization_checks { observation_unit.save }
puts 'Seeded 1 observation unit'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Project, Institution, Workgroup, Program, Strains, Organisms
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.')
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
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.')
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
institution = Institution.where(title: 'Default Institution').first_or_create(country: 'United Kingdom')
workgroup = WorkGroup.where(project_id: project.id, institution_id: institution.id).first_or_create

Expand All @@ -18,6 +19,7 @@

# Create an organism
organism = Organism.where(title: 'Sulfolobus solfataricus').first_or_create
organism.concept_uri = '2287'
organism.projects = [project]
organism.strains = [strain]
organism.save!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# publication
publication = Publication.new(
publication_type_id: PublicationType.where(title:"Journal").first.id,
publication_type_id: PublicationType.where(title: 'Journal').first_or_create!(title: 'Journal').id,
pubmed_id: '23865479',
title: 'Intermediate instability at high temperature leads to low pathway efficiency for an in vitro reconstituted system of gluconeogenesis in Sulfolobus solfataricus',
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.
Expand All @@ -17,7 +17,7 @@
# Set contributor and projects
publication.contributor = $guest_person
publication.projects << $project

publication.registered_mode = 2
# Build policy through the association
publication.build_policy(name: 'default policy', access_type: 1)
# Publication date
Expand All @@ -33,10 +33,11 @@
]
# Citation
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."

authors.each do |author_attrs|
publication.publication_authors.build(author_attrs)
end
# Tags
User.with_current_user($guest_user) { publication.annotate_with(['metabolism', 'thermophile'], 'tag', $guest_person) }

# Save publication with all associations
disable_authorization_checks do
Expand All @@ -60,26 +61,69 @@
presentation.contributor = $guest_person
presentation.policy = Policy.create(name: 'default policy', access_type: 1)
presentation.content_blob = ContentBlob.new(original_filename: 'presentation.pptx', content_type: 'application/vnd.openxmlformats-officedocument.presentationml.presentation')
disable_authorization_checks { presentation.save! }
AssetsCreator.create(asset_id: presentation.id, creator_id: $guest_person.id, asset_type: presentation.class.name)
FileUtils.cp File.dirname(__FILE__) + '/' + presentation.content_blob.original_filename, presentation.content_blob.filepath # TODO results in "This version is not available"
presentation.version = 1
presentation.save!
FileUtils.cp File.dirname(__FILE__) + '/presentation.pptx', presentation.content_blob.filepath
disable_authorization_checks { presentation.content_blob.save }
puts 'Seeded 1 presentation.'

# Create an event
event = Event.new(title: 'Event for publication', description: 'Event for publication', start_date: Date.today, end_date: Date.today + 1.day)
event.projects = [$project]
event.contributor = $guest_person
event.policy = Policy.create(name: 'default policy', access_type: 1)
# event.website = 'http://www.seek4science.org'
event.url = 'http://www.seek4science.org'
event.city = 'London'
event.country = 'United Kingdom'
event.address = 'Dunmore Terrace 123'

event.save!
puts 'Seeded 1 event.'

# Document
document = Document.new(
title: 'Experimental setup for the reconstituted gluconeogenic enzyme system',
description: 'This document describes the experimental setup and procedures used for reconstituting the gluconeogenic enzyme system from Sulfolobus solfataricus.'
)
document.projects = [$project]
document.contributor = $guest_person
document.license = 'CC-BY-4.0'
document.policy = Policy.create(name: 'default policy', access_type: 1)
document.content_blob = ContentBlob.new(original_filename: 'example_document.txt', content_type: 'text/plain')
User.with_current_user($guest_user) { document.annotate_with(['gluconeogenesis', 'protocol', 'thermophile'], 'tag', $guest_person) }
disable_authorization_checks { document.save! }
AssetsCreator.create(asset_id: document.id, creator_id: $admin_person.id, asset_type: document.class.name)
FileUtils.cp File.dirname(__FILE__) + '/example_document.txt', document.content_blob.filepath
disable_authorization_checks { document.content_blob.save }
puts 'Seeded 1 document.'

# Collection
collection = Collection.new(
title: 'Gluconeogenesis in Sulfolobus solfataricus',
description: 'A collection of data files, models, SOPs and publications related to the reconstituted gluconeogenic enzyme system from Sulfolobus solfataricus.'
)
collection.projects = [$project]
collection.contributor = $guest_person
collection.license = 'CC-BY-4.0'
collection.policy = Policy.create(name: 'default policy', access_type: 1)
User.with_current_user($guest_user) { collection.annotate_with(['gluconeogenesis', 'thermophile', 'metabolism'], 'tag', $guest_person) }
disable_authorization_checks { collection.save! }
[
{ asset: $data_file1, comment: 'Metabolite concentration data', order: 1 },
{ asset: $data_file2, comment: 'Model simulation vs experimental data plot', order: 2 },
{ asset: $model, comment: 'Mathematical model of the four-enzyme system', order: 3 },
{ asset: $sop, comment: 'Protocol for reconstituting the enzyme system', order: 4 },
{ asset: document, comment: 'Experimental setup description', order: 5 },
{ asset: publication, comment: 'Key publication for this work', order: 6 },
{ asset: presentation, comment: 'Conference presentation', order: 7 },
].each do |item|
CollectionItem.create!(collection: collection, asset: item[:asset], comment: item[:comment], order: item[:order])
end
puts 'Seeded 1 collection.'

# Store references for other seed files
$publication = publication
$presentation = presentation
$event = event
$event = event
$document = document
$collection = collection
4 changes: 2 additions & 2 deletions db/seeds/example_data/example_samples_seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@
description: 'Whether the culture has reached stationary phase'
)

User.with_current_user($guest_user) { culture_sample_type.annotate_with(['bacterial culture', 'thermophile', 'microbiology'], 'tag', $guest_person) }
disable_authorization_checks { culture_sample_type.save! }
culture_sample_type.annotate_with(['bacterial culture', 'thermophile', 'microbiology'], 'tag', $guest_person)
puts 'Seeded bacterial culture sample type.'

# Create a sample type for enzyme preparations
Expand Down Expand Up @@ -120,8 +120,8 @@
description: 'Number of purification steps performed'
)

User.with_current_user($guest_user) { enzyme_sample_type.annotate_with(['enzyme', 'protein', 'purification'], 'tag', $guest_person) }
disable_authorization_checks { enzyme_sample_type.save! }
enzyme_sample_type.annotate_with(['enzyme', 'protein', 'purification'], 'tag', $guest_person)
puts 'Seeded enzyme preparation sample type.'

# Now create actual samples
Expand Down
19 changes: 15 additions & 4 deletions db/seeds/example_data/example_users_seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,17 @@
# TODO, check if admin really has access to the admin environment
admin_user.build_person(first_name: 'Admin', last_name: 'User', email: 'admin@test1000.com') unless admin_user.person
admin_user.save!
admin_user.person.work_groups << $workgroup
admin_person = admin_user.person
admin_person.save
admin_person.first_name = 'Admin'
admin_person.last_name = 'User'
admin_person.orcid = 'https://orcid.org/0000-0002-1825-0097'
admin_person.web_page = 'https://example.org'
admin_person.phone = '00-0000-0000-0000'
admin_person.work_groups << $workgroup unless admin_person.work_groups.include?($workgroup)
disable_authorization_checks { admin_person.save! }
# TODO, bug, annotations are not shown in the web interface
admin_person.add_annotations(['administration', 'data management'], 'expertise', admin_person)
admin_person.add_annotations(['SEEK', 'Ruby on Rails'], 'tool', admin_person)
puts 'Seeded 1 admin.'

## Guest
Expand All @@ -25,15 +33,18 @@
guest_user.activate
guest_user.build_person(first_name: 'Guest', last_name: 'User', email: 'guest@example.com') unless guest_user.person
guest_user.save!
guest_user.person.work_groups << $workgroup
guest_person = guest_user.person
guest_person.save
guest_person.first_name = 'Guest'
guest_person.last_name = 'User'
guest_person.work_groups << $workgroup unless guest_person.work_groups.include?($workgroup)
disable_authorization_checks { guest_person.save! }
puts 'Seeded 1 guest.'

# Update project
disable_authorization_checks do
$project.description = 'This is a test project for the SEEK sandbox.'
$project.web_page = 'http://www.seek4science.org'
$project.wiki_page = 'http://www.wiki.org/' # TODO, rename wiki_page to internal_page?
$project.pals = [guest_person]
$project.save!
puts 'Seeded 1 project.'
Expand Down
Loading