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


75
76
77
78
79
80
81
82
83
# File 'lib/bio/BIOExtensions.rb', line 75

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


86
87
88
# File 'lib/bio/BIOExtensions.rb', line 86

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