Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4409 y24 379 study setup fields to align to the ena database fields improvement #4674

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
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
5 changes: 4 additions & 1 deletion app/models/metadata/builder_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ def sanitized_object_name

def localised_sections(field)
sections = @object.class.localised_sections(field).dup
sections.label_options = { class: 'required' } if @object.required?(field)
required_fields = %i[ebi_library_strategy ebi_library_source ebi_library_selection]
if @object.required?(field) || (@object.new_record? && required_fields.include?(field))
sections.label_options = { class: 'required' }
end
sections
end

Expand Down
14 changes: 7 additions & 7 deletions app/models/study.rb
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,10 @@ class Study < ApplicationRecord # rubocop:todo Metrics/ClassLength
custom_attribute(:commercially_available, required: true, in: YES_OR_NO)
custom_attribute(:study_name_abbreviation)

# add ebi library strategy
custom_attribute(:ebi_library_strategy, required: true, in: EBI_LIBRARY_STRATEGY_OPTIONS)
custom_attribute(:ebi_library_source, required: true, in: EBI_LIBRARY_SOURCE_OPTIONS)
custom_attribute(:ebi_library_selection, required: true, in: EBI_LIBRARY_SELECTION_OPTIONS)
# add ebi library strategy, ebi library source, ebi library selection
custom_attribute(:ebi_library_strategy, in: EBI_LIBRARY_STRATEGY_OPTIONS)
custom_attribute(:ebi_library_source, in: EBI_LIBRARY_SOURCE_OPTIONS)
custom_attribute(:ebi_library_selection, in: EBI_LIBRARY_SELECTION_OPTIONS)

custom_attribute(
:data_release_strategy,
Expand Down Expand Up @@ -318,9 +318,9 @@ class Study < ApplicationRecord # rubocop:todo Metrics/ClassLength
allow_blank: true
}

validates :ebi_library_strategy, inclusion: { in: EBI_LIBRARY_STRATEGY_OPTIONS }
validates :ebi_library_source, inclusion: { in: EBI_LIBRARY_SOURCE_OPTIONS }
validates :ebi_library_selection, inclusion: { in: EBI_LIBRARY_SELECTION_OPTIONS }
validates :ebi_library_strategy, presence: true, on: :create
validates :ebi_library_source, presence: true, on: :create
validates :ebi_library_selection, presence: true, on: :create

before_validation do |record|
record.reference_genome_id = 1 if record.reference_genome_id.blank?
Expand Down
7 changes: 4 additions & 3 deletions app/views/shared/metadata/edit/_study.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
<%= group.text_area(:study_description) %>
<%= group.text_area(:study_abstract) %>
<%= group.radio_select(:study_sra_hold, Study::STUDY_SRA_HOLDS) %>
<%= metadata_fields.select(:ebi_library_strategy, Study::EBI_LIBRARY_STRATEGY_OPTIONS) %>
<%= metadata_fields.select(:ebi_library_source, Study::EBI_LIBRARY_SOURCE_OPTIONS) %>
<%= metadata_fields.select(:ebi_library_selection, Study::EBI_LIBRARY_SELECTION_OPTIONS) %>

<%= metadata_fields.select(:ebi_library_strategy, options_for_select([['Please select...', nil]] + Study::EBI_LIBRARY_STRATEGY_OPTIONS, metadata_fields.object.ebi_library_strategy), (metadata_fields.object.new_record? ? { required: true } : {})) %>
<%= metadata_fields.select(:ebi_library_source, options_for_select([['Please select...', nil]] + Study::EBI_LIBRARY_SOURCE_OPTIONS, metadata_fields.object.ebi_library_source), (metadata_fields.object.new_record? ? { required: true } : {})) %>
<%= metadata_fields.select(:ebi_library_selection, options_for_select([['Please select...', nil]] + Study::EBI_LIBRARY_SELECTION_OPTIONS, metadata_fields.object.ebi_library_selection), (metadata_fields.object.new_record? ? { required: true } : {})) %>
<% end %>

<%= metadata_fields.radio_select(:contains_human_dna, Study::YES_OR_NO) %>
Expand Down
59 changes: 50 additions & 9 deletions config/ena_requirement_fields.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,91 @@
default: &DEFAULT
EBI_Library_strategy:
- "RNA-Seq"
- "ChIP-Seq"
- "WGS"
- "WGA"
- "WXS"
- "AMPLICON"
- "RNA-Seq"
- "ssRNA-seq"
- "snRNA-seq"
- "miRNA-Seq"
- "ncRNA-Seq"
- "FL-cDNA"
- "EST"
- "Hi-C"
- "ATAC-seq"
- "WCS"
- "RAD-Seq"
- "CLONE"
- "POOLCLONE"
- "AMPLICON"
- "CLONEEND"
- "Bisulfite-Seq"
- "FINISHING"
- "ChIP-Seq"
- "MNase-Seq"
- "DNase-Hypersensitivity"
- "Bisulfite-Seq"
- "CTS"
- "MRE-Seq"
- "MeDIP-Seq"
- "MBD-Seq"
- "Tn-Seq"
- "VALIDATION"
- "FAIRE-seq"
- "SELEX"
- "RIP-Seq"
- "ChIA-PET"
- "Synthetic-Long-Read"
- "Targeted-Capture"
- "Tethered Chromatin Conformation Capture"
- "NOMe-seq"
- "ChM-Seq"
- "GBS"
- "Ribo-seq"
- "OTHER"

EBI_Library_source:
- "GENOMIC"
- "GENOMIC SINGLE CELL"
- "TRANSCRIPTOMIC"
- "TRANSCRIPTOMIC SINGLE CELL"
- "METAGENOMIC"
- "METATRANSCRIPTOMIC"
- "SYNTHETIC"
- "VIRAL RNA"
- "OTHER"

EBI_Library_selection:
- "RANDOM"
- "PCR"
- "RANDOM PCR"
- "RT-PCR"
- "HMPR"
- "MF"
- "CF-S"
- "CF-M"
- "CF-T"
- "MDA"
- "repeat fractionation"
- "size fractionation"
- "MSLL"
- "MSLL"
- "cDNA"
- "ChIP"
- "cDNA_randomPriming"
- "cDNA_oligo_dT"
- "PolyA"
- "Oligo-dT"
- "Inverse rRNA"
- "Inverse rRNA selection"
- "CHIP"
- "CHIP-Seq"
- "MNase"
- "DNAse"
- "Hybrid Selection"
- "Reduced Representation"
- "Restriction Digest"
- "5-methylcytidine antibody"
- "MBD2 protein methyl-CpG binding domain"
- "CAGE"
- "RACE"
- "MDA"
- "padlock probes capture method"
- "other"
- "unspecified"

development:
<<: *DEFAULT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
And I create study "Another Big study" with faculty sponsor "Barry Ball"
And I create study "Small study" with faculty sponsor "Conor Cone"
And I am on the faculty sponsor homepage
Then the faculty sponsor index page should include:

Check failure on line 44 in features/administration/11184645_faculty_sponsor_management.feature

View workflow job for this annotation

GitHub Actions / cucumber_tests (2, 1)

List the studies associated with a Faculty Sponsor failed: Tables were not identical:

Check failure on line 44 in features/administration/11184645_faculty_sponsor_management.feature

View workflow job for this annotation

GitHub Actions / cucumber_tests (2, 0)

List the studies associated with a Faculty Sponsor failed: Tables were not identical:
| Name | Number of Studies |
| Adam Apple | 0 |
| Barry Ball | 2 |
Expand All @@ -65,6 +65,11 @@
And I fill in "Study name" with "Study name"
And I select "Not suitable for alignment" from "Reference genome"
And I fill in "Study description" with "some description"
And I select "General" from "Program"
And I select "Clone Sequencing" from "Study Type"
And I select "WGS" from "EBI Library Strategy"
And I select "GENOMIC" from "EBI Library Source"
And I select "PCR" from "EBI Library Selection"
And I fill in "Data access group" with "dag"
And I select "John Doe" from "Faculty Sponsor"
And I choose "Yes" from "Do any of the samples in this study contain human DNA?"
Expand Down
5 changes: 5 additions & 0 deletions features/studies/data_release_timings.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ Feature: Studies have timings for release of their data
Given I am on the study creation page
And I fill in "Study name" with "Testing data release strategies"
And I select "Jack Sponsor" from "Faculty Sponsor"
And I select "General" from "Program"
And I select "Clone Sequencing" from "Study Type"
And I select "WGS" from "EBI Library Strategy"
And I select "GENOMIC" from "EBI Library Source"
And I select "PCR" from "EBI Library Selection"
And I fill in "Study description" with "Checking that the data release strategies behave appropriately"
And I choose "No" from "Do any of the samples in this study contain human DNA?"
And I choose "No" from "Does this study contain samples that are contaminated with human DNA which must be removed prior to analysis?"
Expand Down
5 changes: 5 additions & 0 deletions features/studies/release_agreement.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ Feature: Studies have a release agreement
Given I am on the study creation page
And I fill in "Study name" with "Testing release agreements"
And I select "Jack Sponsor" from "Faculty Sponsor"
And I select "General" from "Program"
And I select "Clone Sequencing" from "Study Type"
And I select "WGS" from "EBI Library Strategy"
And I select "GENOMIC" from "EBI Library Source"
And I select "PCR" from "EBI Library Selection"
And I fill in "Study description" with "Checking that release agreements behave properly"
And I fill in "Data access group" with "mygroup"
And I choose "No" from "Do any of the samples in this study contain human DNA?"
Expand Down
10 changes: 10 additions & 0 deletions spec/features/studies/create_study_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@
expect(page).to have_field('Public', type: :radio)
end

expect(page).to have_field('EBI Library Strategy', type: :select)
expect(page).to have_field('EBI Library Source', type: :select)
expect(page).to have_field('EBI Library Selection', type: :select)

expect(page).to have_field('What sort of study is this?', type: :select)
expect(page).to have_field('How is the data release to be timed?', type: :select)
expect(page).to have_field('Prelim ID', type: :text)
Expand All @@ -56,6 +60,9 @@

expect(page).to have_content "Name can't be blank"
expect(page).to have_content "Study description can't be blank"
expect(page).to have_content "Study metadata ebi library strategy can't be blank"
expect(page).to have_content "Study metadata ebi library source can't be blank"
expect(page).to have_content "Study metadata ebi library selection can't be blank"
end

it 'create managed study', :js do
Expand Down Expand Up @@ -83,6 +90,9 @@
fill_in 'ENA Study Accession Number', with: '12345'
fill_in 'Study name abbreviation', with: 'CCC3'
select('Jack Sponsor', from: 'Faculty Sponsor')
select('RNA-Seq', from: 'EBI Library Strategy')
select('GENOMIC', from: 'EBI Library Source')
select('PCR', from: 'EBI Library Selection')

within_fieldset 'Do any of the samples in this study contain human DNA?' do
choose('Yes', allow_label_click: true)
Expand Down
Loading