Sha256: f89446039c708f35a05033e86312964cba90833bafb6d6065ac3227941b2eaaa

Contents?: true

Size: 1.78 KB

Versions: 112

Compression:

Stored size: 1.78 KB

Contents

module BELParser
  module Language
    # CovalentProteinModification defines a controlled vocabulary of
    # post-translational protein modifications.
    #
    # see https://en.wikipedia.org/wiki/Post-translational_modification
    module CovalentProteinModification
      Acetylation     = [:Acetylation, :A].freeze
      Farnesylation   = [:Farnesylation, :F].freeze
      Glycosylation   = [:Glycosylation, :G].freeze
      Hydroxylation   = [:Hydroxylation, :H].freeze
      Methylation     = [:Methylation, :M].freeze
      Phosphorylation = [:Phosphorylation, :P].freeze
      Ribosylation    = [:Ribosylation, :R].freeze
      Sumoylation     = [:Sumoylation, :S].freeze
      Ubiquitination  = [:Ubiquitination, :U].freeze

      # Determines if +sym+ represents a covalent protein modification.
      #
      # @param [#to_sym] sym covalent protein modification code
      # @return [Boolean] +true+ if +sym+ code is included in supported
      # covalent protein modifications; +false+ if not supported
      def self.includes?(sym)
        @hash.key?(sym.to_sym)
      end

      # Gets all supported covalent protein modification.
      def self.names
        @names
      end

      # Gets all supported covalent protein modification (i.e. name, 1-Letter).
      def self.values
        @values
      end

      unless defined? @hash
        @hash = {}
        constants.map(&method(:const_get)).each do |values|
          @hash.update(
            Hash[values.map { |v| [v, values.first] }]
          )
        end
        @hash.freeze
      end

      unless defined? @names
        @names = constants.map(&method(:const_get)).map(&:first).sort.freeze
      end

      unless defined? @values
        @values = constants.map(&method(:const_get)).map(&:to_a).flatten.freeze
      end
    end
  end
end

Version data entries

112 entries across 112 versions & 1 rubygems

Version Path
bel_parser-1.0.0.alpha.23 lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.0.0.alpha.22 lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.0.0.alpha.21 lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.0.0.alpha.20 lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.0.0.alpha.19 lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.0.0.alpha.18 lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.0.0.alpha.17 lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.0.0.alpha.16 lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.0.0.alpha.15 lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.0.0.alpha.14 lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.0.0.alpha.13 lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.0.0.alpha.12 lib/bel_parser/language/covalent_protein_modification.rb