Class: GeneAttribute
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- GeneAttribute
- Includes:
- Housekeeping, Shared::Identifiers, Shared::IsData, Shared::Notes, Shared::Tags
- Defined in:
- app/models/gene_attribute.rb
Overview
A GeneAttribute defines an attribute that must be matched for a Sequence to be classified as a Descriptor::Gene. There are two key attributes, sequence, and sequence relationship. A GeneAttribute will return all sequences who are the object of a taxon name relationship whose subject is Sequence and whose Type is #sequence_relationship_type
! Deprecated?
Instance Attribute Summary collapse
-
#controlled_vocabulary_term_id ⇒ Integer
Not yet implemented, intent/idea is to define a subclass of CVT that represents GO terms.
-
#descriptor_id ⇒ Integer
The descriptor id (Gene) that this attribute defines.
-
#project_id ⇒ Integer
the project ID.
-
#sequence_id ⇒ Integer
The sequence id (Gene), defines the nucleotides in the attribute.
-
#sequence_relationship_type ⇒ String
A SequenceRelationship#type, defines how the sequence was used in this attribute.
Instance Method Summary collapse
Methods included from Shared::IsData
#errors_excepting, #full_error_messages_excepting, #identical, #is_community?, #is_destroyable?, #is_editable?, #is_in_use?, #is_in_users_projects?, #metamorphosize, #similar
Methods included from Shared::Tags
#reject_tags, #tag_with, #tagged?, #tagged_with?
Methods included from Shared::Notes
#concatenated_notes_string, #reject_notes
Methods included from Shared::Identifiers
#dwc_occurrence_id, #identified?, #next_by_identifier, #previous_by_identifier, #reject_identifiers, #uri, #uuid
Methods included from Housekeeping
#has_polymorphic_relationship?
Methods inherited from ApplicationRecord
Instance Attribute Details
#controlled_vocabulary_term_id ⇒ Integer
Returns not yet implemented, intent/idea is to define a subclass of CVT that represents GO terms.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'app/models/gene_attribute.rb', line 26 class GeneAttribute < ApplicationRecord include Housekeeping include Shared::Identifiers include Shared::Notes include Shared::Tags include Shared::IsData acts_as_list scope: [:descriptor_id, :project_id] belongs_to :descriptor, class_name: 'Descriptor::Gene', inverse_of: :gene_attributes belongs_to :sequence, inverse_of: :gene_attributes # Not yet implemented. # Deprecated: Use Tag/Keyword # belongs_to :controlled_vocabulary_term validates :descriptor, presence: true validates :sequence, presence: true validates_uniqueness_of :sequence, scope: [:descriptor, :sequence_relationship_type] after_save :add_to_descriptor_logic_if_absent def to_logic_literal "#{sequence_relationship_type}.#{sequence_id}" end protected def add_to_descriptor_logic_if_absent descriptor.extend_gene_attribute_logic(self, :and) unless descriptor.contains_logic_for?(self) end end |
#descriptor_id ⇒ Integer
Returns the descriptor id (Gene) that this attribute defines.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'app/models/gene_attribute.rb', line 26 class GeneAttribute < ApplicationRecord include Housekeeping include Shared::Identifiers include Shared::Notes include Shared::Tags include Shared::IsData acts_as_list scope: [:descriptor_id, :project_id] belongs_to :descriptor, class_name: 'Descriptor::Gene', inverse_of: :gene_attributes belongs_to :sequence, inverse_of: :gene_attributes # Not yet implemented. # Deprecated: Use Tag/Keyword # belongs_to :controlled_vocabulary_term validates :descriptor, presence: true validates :sequence, presence: true validates_uniqueness_of :sequence, scope: [:descriptor, :sequence_relationship_type] after_save :add_to_descriptor_logic_if_absent def to_logic_literal "#{sequence_relationship_type}.#{sequence_id}" end protected def add_to_descriptor_logic_if_absent descriptor.extend_gene_attribute_logic(self, :and) unless descriptor.contains_logic_for?(self) end end |
#project_id ⇒ Integer
the project ID
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'app/models/gene_attribute.rb', line 26 class GeneAttribute < ApplicationRecord include Housekeeping include Shared::Identifiers include Shared::Notes include Shared::Tags include Shared::IsData acts_as_list scope: [:descriptor_id, :project_id] belongs_to :descriptor, class_name: 'Descriptor::Gene', inverse_of: :gene_attributes belongs_to :sequence, inverse_of: :gene_attributes # Not yet implemented. # Deprecated: Use Tag/Keyword # belongs_to :controlled_vocabulary_term validates :descriptor, presence: true validates :sequence, presence: true validates_uniqueness_of :sequence, scope: [:descriptor, :sequence_relationship_type] after_save :add_to_descriptor_logic_if_absent def to_logic_literal "#{sequence_relationship_type}.#{sequence_id}" end protected def add_to_descriptor_logic_if_absent descriptor.extend_gene_attribute_logic(self, :and) unless descriptor.contains_logic_for?(self) end end |
#sequence_id ⇒ Integer
Returns the sequence id (Gene), defines the nucleotides in the attribute.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'app/models/gene_attribute.rb', line 26 class GeneAttribute < ApplicationRecord include Housekeeping include Shared::Identifiers include Shared::Notes include Shared::Tags include Shared::IsData acts_as_list scope: [:descriptor_id, :project_id] belongs_to :descriptor, class_name: 'Descriptor::Gene', inverse_of: :gene_attributes belongs_to :sequence, inverse_of: :gene_attributes # Not yet implemented. # Deprecated: Use Tag/Keyword # belongs_to :controlled_vocabulary_term validates :descriptor, presence: true validates :sequence, presence: true validates_uniqueness_of :sequence, scope: [:descriptor, :sequence_relationship_type] after_save :add_to_descriptor_logic_if_absent def to_logic_literal "#{sequence_relationship_type}.#{sequence_id}" end protected def add_to_descriptor_logic_if_absent descriptor.extend_gene_attribute_logic(self, :and) unless descriptor.contains_logic_for?(self) end end |
#sequence_relationship_type ⇒ String
Returns a SequenceRelationship#type, defines how the sequence was used in this attribute.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'app/models/gene_attribute.rb', line 26 class GeneAttribute < ApplicationRecord include Housekeeping include Shared::Identifiers include Shared::Notes include Shared::Tags include Shared::IsData acts_as_list scope: [:descriptor_id, :project_id] belongs_to :descriptor, class_name: 'Descriptor::Gene', inverse_of: :gene_attributes belongs_to :sequence, inverse_of: :gene_attributes # Not yet implemented. # Deprecated: Use Tag/Keyword # belongs_to :controlled_vocabulary_term validates :descriptor, presence: true validates :sequence, presence: true validates_uniqueness_of :sequence, scope: [:descriptor, :sequence_relationship_type] after_save :add_to_descriptor_logic_if_absent def to_logic_literal "#{sequence_relationship_type}.#{sequence_id}" end protected def add_to_descriptor_logic_if_absent descriptor.extend_gene_attribute_logic(self, :and) unless descriptor.contains_logic_for?(self) end end |
Instance Method Details
#add_to_descriptor_logic_if_absent ⇒ Object (protected)
55 56 57 |
# File 'app/models/gene_attribute.rb', line 55 def add_to_descriptor_logic_if_absent descriptor.extend_gene_attribute_logic(self, :and) unless descriptor.contains_logic_for?(self) end |
#to_logic_literal ⇒ Object
49 50 51 |
# File 'app/models/gene_attribute.rb', line 49 def to_logic_literal "#{sequence_relationship_type}.#{sequence_id}" end |