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.1.6-java lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.1.6 lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.1.5 lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.1.4-java lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.1.4 lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.1.3-java lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.1.3 lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.1.2-java lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.1.2 lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.1.1-java lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.1.1 lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.0.8-java lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.0.8 lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.0.7-java lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.0.7 lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.0.6-java lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.0.6 lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.0.5-java lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.0.5 lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.0.4-java lib/bel_parser/language/covalent_protein_modification.rb