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.4 lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.0.3-java lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.0.3 lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.0.2-java lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.0.2 lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.0.1-java lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.0.1 lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.0.0-java lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.0.0 lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.0.0.alpha.61-java lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.0.0.alpha.61 lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.0.0.alpha.60-java lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.0.0.alpha.60 lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.0.0.alpha.59-java lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.0.0.alpha.59 lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.0.0.alpha.58-java lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.0.0.alpha.58 lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.0.0.alpha.57-java lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.0.0.alpha.57 lib/bel_parser/language/covalent_protein_modification.rb
bel_parser-1.0.0.alpha.56-java lib/bel_parser/language/covalent_protein_modification.rb