Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/bio/BIOExtensions.rb

Instance Method Summary collapse

Instance Method Details

#count_ambiguitiesObject

Monkey patching to count how many ambiguity codes are present in the string, for Nucleic Acids



139
140
141
142
143
144
145
146
147
# File 'lib/bio/BIOExtensions.rb', line 139

def count_ambiguities
  snps=0

  for i in (0..self.size-1)

    snps += 1 if !Bio::NucleicAcid.is_unambiguous(self[i])
  end
  snps
end

#upper_case_countObject

Counts how many bases are uppercase



150
151
152
# File 'lib/bio/BIOExtensions.rb', line 150

def upper_case_count
  match(/[^A-Z]*/).to_s.size
end