export function nucleotideCounts(lett:string) {
const res: Record<string, number> = { A: 0, C: 0, G: 0, T: 0,}; // ricordarsi la virgola alla fine!
for(let i=0; i<lett.length; i++){
let char = lett[i]; // salvare il valore specifico che viene poi riaggiornato.
if(lett[i] == 'A' || lett[i] == 'C' || lett[i] == 'G' || lett[i] == 'T') res[char]++;
else throw new Error('Invalid nucleotide in strand');
}
return res;
}
Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
If you enjoyed what you read here, create your account today and start earning FREE STEEM!