module Bio::Alignment::PropertyMethods

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

Constants

GAP_CHAR

gap character

GAP_REGEXP

regular expression for detecting gaps.

MISSING_CHAR

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_char() click to toggle source

Gap character.

    # File lib/bio/alignment.rb
102 def gap_char
103   ((defined? @gap_char) ? @gap_char : nil) or GAP_CHAR
104 end
gap_regexp() click to toggle source

Returns regular expression for checking gap.

   # File lib/bio/alignment.rb
95 def gap_regexp
96   ((defined? @gap_regexp) ? @gap_regexp : nil) or GAP_REGEXP
97 end
get_all_property() click to toggle source

Returns properties defined in the object as an hash.

    # File lib/bio/alignment.rb
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
is_gap?(s) click to toggle source

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

   # File lib/bio/alignment.rb
90 def is_gap?(s)
91   (gap_regexp =~ s) ? true : false
92 end
missing_char() click to toggle source

Character if the site is missing or unknown.

    # File lib/bio/alignment.rb
109 def missing_char
110   ((defined? @missing_char) ? @missing_char : nil) or MISSING_CHAR
111 end
seqclass() click to toggle source

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.

    # File lib/bio/alignment.rb
120 def seqclass
121   ((defined? @seqclass) ? @seqclass : nil) or String
122 end
set_all_property(hash) click to toggle source

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

    # File lib/bio/alignment.rb
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