Class: Sequence
- Inherits:
-
String
- Object
- String
- Sequence
- Defined in:
- lib/parse_fasta/sequence.rb
Overview
Provide some methods for dealing with common tasks regarding nucleotide sequences.
Instance Method Summary collapse
-
#gc ⇒ 0, Float
Calculates GC content.
Instance Method Details
#gc ⇒ 0, Float
Calculates GC content
Calculates GC content by dividing count of G + C divided by count of G + C + T + A + U. If there are both T's and U's in the Sequence, things will get weird, but then again, that wouldn't happen, now would it!
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/parse_fasta/sequence.rb', line 40 def gc s = self.downcase c = s.count('c') g = s.count('g') t = s.count('t') a = s.count('a') u = s.count('u') return 0 if c + g + t + a + u == 0 return (c + g).quo(c + g + t + a + u).to_f end |