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

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
102:       def gap_char
103:         ((defined? @gap_char) ? @gap_char : nil) or GAP_CHAR
104:       end

Returns regular expression for checking gap.

[Source]

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

Returns properties defined in the object as an hash.

[Source]

     # File lib/bio/alignment.rb, line 129
129:       def get_all_property
130:         ret = {}
131:         if defined? @gap_regexp
132:           ret[:gap_regexp] = @gap_regexp
133:         end
134:         if defined? @gap_char
135:           ret[:gap_char] = @gap_char
136:         end
137:         if defined? @missing_char
138:           ret[:missing_char] = @missing_char
139:         end
140:         if defined? @seqclass
141:           ret[:seqclass] = @seqclass
142:         end
143:         ret
144:       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
90:       def is_gap?(s)
91:         (gap_regexp =~ s) ? true : false
92:       end

Character if the site is missing or unknown.

[Source]

     # File lib/bio/alignment.rb, line 109
109:       def missing_char
110:         ((defined? @missing_char) ? @missing_char : nil) or MISSING_CHAR
111:       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
120:       def seqclass
121:         ((defined? @seqclass) ? @seqclass : nil) or String
122:       end

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

[Source]

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

[Validate]