A DNA strand consists of a sequence of 4 possible nucleotides: Guanine, Adenine, Cytosine, and Thymine. In
Question:
A DNA strand consists of a sequence of 4 possible nucleotides: Guanine, Adenine, Cytosine, and Thymine. In a typical computerized encoding, a DNA strand is a string in which each character (in upper or lower case) represents one of the above nucleotides: G (g): guanine; A (a): adenine; C (c): cytosine; T (t): thymine. E.g., the sequence below is an excerpt of a DNA sequence from the BRCA1 gene.
CACTGGCATGCAA
Write a function called DNA-COUNT that counts and returns the number of each nucleotide in the given string sequence regardless of whether it's uppercase or lowercase.
Your function must return 4 integer values each representing its respective nucleotide count.
The unit test below includes test cases that your solution for this exercise must pass.
(deftest test-dna-count () (check (multiple-value-bind (ng na nc nt) (dna-count "") (and (= ng 0) (= na 0) (= nc 0) (= nt 0))) (multiple-value-bind (ng na nc nt) (dna-count "tatc") (and (= ng 0) (= na 1) (= nc 1) (= nt 2))) (multiple-value-bind (ng na nc nt) (dna-count "TATG") (and (= ng 1) (= na 1) (= nc 0) (= nt 2))) (multiple-value-bind (ng na nc nt) (dna-count "AcGtc") (and (= ng 1) (= na 1) (= nc 2) (= nt 1)))))
Write a function called GC-RATIO that computes the ratio of Guanine and Adenosine in the sequence. The unit test below includes test cases that your solution for this exercise must pass.
(deftest test-gc-ratio () (check (not (gc-ratio "")) (equal (gc-ratio "AcGtc") 3/5) (equal (gc-ratio "tagac") 2/5) (equal (gc-ratio "AAT") 0)))