X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=code_ruby%2Flib%2Fmaasha%2Fseq.rb;h=73bf0552938cef82fa937aa43ff7be23b190c94b;hb=0ab290c76c4e253ea809f9a7c2321a28de72b286;hp=e4b6bfd7c27d5933d0bd9c6b65210bd9a7b32ea0;hpb=847dcea71d11154d6636abc7257d2ff1af83bcde;p=biopieces.git diff --git a/code_ruby/lib/maasha/seq.rb b/code_ruby/lib/maasha/seq.rb index e4b6bfd..73bf055 100644 --- a/code_ruby/lib/maasha/seq.rb +++ b/code_ruby/lib/maasha/seq.rb @@ -31,6 +31,7 @@ autoload :BackTrack, 'maasha/seq/backtrack' autoload :Dynamic, 'maasha/seq/dynamic' autoload :Homopolymer, 'maasha/seq/homopolymer' autoload :Levenshtein, 'maasha/seq/levenshtein' +autoload :Ambiguity, 'maasha/seq/ambiguity' # Residue alphabets DNA = %w[a t c g] @@ -384,8 +385,12 @@ class Seq # Method to determine the Hamming Distance between # two Sequence objects (case insensitive). - def hamming_distance(entry) - self.seq.upcase.hamming_distance(entry.seq.upcase) + def hamming_distance(entry, options = nil) + if options and options[:ambiguity] + Ambiguity.hamming_distance(self.seq, entry.seq) + else + self.seq.upcase.hamming_distance(entry.seq.upcase) + end end # Method to determine the Edit Distance between