Sha256: 8bc32024b61889bd97aac15f8d7ac498c7e5147292b8d8b7c71c2c91f9c5e5fd
Contents?: true
Size: 652 Bytes
Versions: 68
Compression:
Stored size: 652 Bytes
Contents
class NucleotideCount { static nucleotideCounts(strand: string) { const nucleotideOccurrences = { A: 0, C: 0, G: 0, T: 0 } strand.split('').forEach((nucleotide) => { if (nucleotide in nucleotideOccurrences) { if (nucleotide === 'A') {nucleotideOccurrences.A++} if (nucleotide === 'C') {nucleotideOccurrences.C++} if (nucleotide === 'G') {nucleotideOccurrences.G++} if (nucleotide === 'T') {nucleotideOccurrences.T++} } else { throw new Error('Invalid nucleotide in strand') } }) return nucleotideOccurrences } } export default NucleotideCount
Version data entries
68 entries across 68 versions & 1 rubygems