Skip to content

Commit

Permalink
Implement ENA custom metadata for ISA Study
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin De Pelseneer committed Oct 12, 2023
1 parent 88e9455 commit 3bcb9b6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
2 changes: 0 additions & 2 deletions app/views/isa_studies/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
<%= study_fields.number_field :position, :rows => 5, :class=>"form-control" -%>
</div>

<%= render partial: 'extended_metadata/extended_metadata_attribute_input', locals:{f:f,resource:@isa_study.study} %>

<%= render partial: 'assets/manage_specific_attributes', locals: { f: study_fields } if show_form_manage_specific_attributes? %>

<%= study_fields.fancy_multiselect :publications, { other_projects_checkbox: true, name: "isa_study[study][publication_ids]" } %>
Expand Down
32 changes: 20 additions & 12 deletions db/seeds/016_ena_upload.seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,37 +19,45 @@ def create_sample_controlled_vocab_terms_attributes(array)
'Pooled Clone Sequencing', 'Transcriptome Sequencing', 'Other']

disable_authorization_checks do
# Study
unless ExtendedMetadataType.where(title: 'ENA Sample Metadata', supported_type: 'Study').any?
study_emt = ExtendedMetadataType.new(title: 'ENA Sample Metadata', supported_type: 'Study')
study_emt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'ena_sample_alias_prefix', required: true,
sample_attribute_type: SampleAttributeType.find_by(title: 'String'),
label: 'ENA sample alias prefix')
study_emt.save!
end

study_type_cv = SampleControlledVocab.where(title: 'ENA Study Types').first_or_create!(sample_controlled_vocab_terms_attributes: create_sample_controlled_vocab_terms_attributes(existing_study_types))

# Assay
unless ExtendedMetadataType.where(title: 'ENA Study metadata', supported_type: 'Assay').any?
cmt = ExtendedMetadataType.new(title: 'ENA Study metadata', supported_type: 'Assay')
cmt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'ena_study_title', required: true,
assay_cmt = ExtendedMetadataType.new(title: 'ENA Study metadata', supported_type: 'Assay')
assay_cmt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'ena_study_title', required: true,
sample_attribute_type: SampleAttributeType.find_by(title: 'String'), label: 'ENA study title',
description: 'Title of the study as would be used in a publication.')
cmt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'study_type', required: true,
assay_cmt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'study_type', required: true,
sample_attribute_type: SampleAttributeType.find_by(title: 'Controlled Vocabulary'),
sample_controlled_vocab: study_type_cv,
description: 'The STUDY_TYPE presents a controlled vocabulary for expressing the overall purpose of the study.',
label: 'ENA Study Type')
cmt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'new_study_type', required: false,
assay_cmt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'new_study_type', required: false,
sample_attribute_type: SampleAttributeType.find_by(title: 'String'), label: 'New Study Type',
description: 'Specify a new Study Type here if "Other" was chosen as "ENA Study Type".')
cmt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'ena_study_abstract', required: true,
assay_cmt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'ena_study_abstract', required: true,
sample_attribute_type: SampleAttributeType.find_by(title: 'Text'), label: 'ENA study abstract',
description: 'Briefly describes the goals, purpose, and scope of the Study. This need not be listed if it can be inherited from a referenced publication.')
cmt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'assay_stream', required: true,
assay_cmt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'assay_stream', required: true,
sample_attribute_type: SampleAttributeType.find_by(title: 'String'),
description: 'This is the name that will be transferred to the ISA JSON. Example: "My assay" will be defined as "a_my_assay.txt" in the ISA JSON',
label: 'Name Assay Stream')
cmt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'ena_study_alias_prefix', required: true,
assay_cmt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'ena_study_alias_prefix', required: true,
sample_attribute_type: SampleAttributeType.find_by(title: 'String'), label: 'ENA study alias prefix')
cmt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'ena_experiment_alias_prefix', required: true,
assay_cmt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'ena_experiment_alias_prefix', required: true,
sample_attribute_type: SampleAttributeType.find_by(title: 'String'), label: 'ENA experiment alias prefix')
cmt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'ena_sample_alias_prefix', required: true,
sample_attribute_type: SampleAttributeType.find_by(title: 'String'), label: 'ENA sample alias prefix')

cmt.save!
assay_cmt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'ena_run_alias_prefix', required: true,
sample_attribute_type: SampleAttributeType.find_by(title: 'String'), label: 'ENA run alias prefix')
assay_cmt.save!
end
end
puts 'Seeded ENA extended metadata'

0 comments on commit 3bcb9b6

Please sign in to comment.