Module Bio::Alignment::PropertyMethods
In: lib/bio/alignment.rb  (CVS)

Bio::Alignment::PropertyMethods is a set of methods to treat the gap character and so on.

Methods

Constants

GAP_REGEXP = /[^a-zA-Z]/   regular expression for detecting gaps.
GAP_CHAR = '-'.freeze   gap character
MISSING_CHAR = '?'.freeze   missing character

Attributes

gap_char  [W]  gap character
gap_regexp  [W]  regular expression for checking gap
missing_char  [W]  Character if the site is missing or unknown.
seqclass  [W]  The class of the sequence. The value must be String or its derivatives.

Public Instance methods

Gap character.

[Source]

# File lib/bio/alignment.rb, line 102
      def gap_char
        ((defined? @gap_char) ? @gap_char : nil) or GAP_CHAR
      end

Returns regular expression for checking gap.

[Source]

# File lib/bio/alignment.rb, line 95
      def gap_regexp
        ((defined? @gap_regexp) ? @gap_regexp : nil) or GAP_REGEXP
      end

Returns properties defined in the object as an hash.

[Source]

# File lib/bio/alignment.rb, line 129
      def get_all_property
        ret = {}
        if defined? @gap_regexp
          ret[:gap_regexp] = @gap_regexp
        end
        if defined? @gap_char
          ret[:gap_char] = @gap_char
        end
        if defined? @missing_char
          ret[:missing_char] = @missing_char
        end
        if defined? @seqclass
          ret[:seqclass] = @seqclass
        end
        ret
      end

If given character is a gap, returns true. Otherwise, return false. Note that s must be a String which contain a single character.

[Source]

# File lib/bio/alignment.rb, line 90
      def is_gap?(s)
        (gap_regexp =~ s) ? true : false
      end

Character if the site is missing or unknown.

[Source]

# File lib/bio/alignment.rb, line 109
      def missing_char
        ((defined? @missing_char) ? @missing_char : nil) or MISSING_CHAR
      end

Returns class of the sequence. If instance variable @seqclass (which can be set by ‘seqclass=’ method) is set, simply returns the value. Otherwise, returns the first sequence‘s class. If no sequences are found, returns nil.

[Source]

# File lib/bio/alignment.rb, line 120
      def seqclass
        ((defined? @seqclass) ? @seqclass : nil) or String
      end

Sets properties from given hash. hash would be a return value of get_character method.

[Source]

# File lib/bio/alignment.rb, line 148
      def set_all_property(hash)
        @gap_regexp   = hash[:gap_regexp]   if hash.has_key?(:gap_regexp)
        @gap_char     = hash[:gap_char]     if hash.has_key?(:gap_char)
        @missing_char = hash[:missing_char] if hash.has_key?(:missing_char)
        @seqclass     = hash[:seqclass]     if hash.has_key?(:seqclass)
        self
      end

[Validate]