Skip to content

Commit

Permalink
Add reference strain check for isolates
Browse files Browse the repository at this point in the history
  • Loading branch information
lmrodriguezr committed Jan 4, 2024
1 parent 1b56ae8 commit a432458
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/models/genome.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ def self.fields_with_auto
@@FIELDS_WITH_AUTO
end

Genome.kinds.keys.each do |k, v|
define_method("#{k}?") do
kind? && kind == k.to_s
end
end

def names
@names ||=
Name.where(type_material: database, type_accession: accession)
Expand Down
8 changes: 8 additions & 0 deletions app/models/name/quality_checks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,11 @@ class QcWarning
# [TODO: issue #12] no checks are to be implemented
# - Rule 19 is implied by the SeqCode Registry structure
# - Recommendation 19:
missing_reference_strain: {
message: 'A reference strain should be established when the type ' \
'genome is reported as derived from an isolate',
recommendations: %w[19]
}.merge(@@link_to_edit_type),
unavailable_reference_strain: {
message: 'If isolated, reference strains should be submitted to two ' \
'culture collections',
Expand Down Expand Up @@ -777,6 +782,9 @@ def qc_warnings

if type_is_genome?
@qc_warnings.add(:ambiguous_type_genome) # check
if genome.isolate? && !genome_strain?
@qc_warnings.add(:missing_reference_strain)
end
if genome_strain? && genome_strain_collections < 2
@qc_warnings.add(:unavailable_reference_strain)
end
Expand Down

0 comments on commit a432458

Please sign in to comment.