Sha256: cf67906d780e16a4dd1196a9a64cc3805dd62c6a22ffde9ed906bf96f63bac23
Contents?: true
Size: 404 Bytes
Versions: 71
Compression:
Stored size: 404 Bytes
Contents
const count = (str, nuc) => [...str].filter(nucleotide => nucleotide === nuc).length; class NucleotideCounts { static parse(strand) { if (strand.replace(/A|C|G|T/g, '').length) { throw new Error('Invalid nucleotide in strand'); } else { return `${count(strand, 'A')} ${count(strand, 'C')} ${count(strand, 'G')} ${count(strand, 'T')}`; } } } export default NucleotideCounts;
Version data entries
71 entries across 71 versions & 1 rubygems