The reverse-complement of a dna string is a new string in


A DNA strand is represented by a string of the characters A, C, G, and T, each of which represents a nucleotide. Each nucleotide has its complement as indicated by this Ruby hash: NUCLEOTIDE_COMPLEMENT = { 'A' => 'T', 'T' => 'A', 'C' => 'G', 'G' => 'C' }

The reverse-complement of a DNA string is a new string in which each nucleotide is replaced by its complement and the string is reversed.

Reverse-complements are important in bioinformatics since a strand of DNA can be read in forward direction or, equivalently, its complementary strand can be read in its forward direction, which is reverse of the original string's direction.

Add the reverse_complement method to your DNA class.

In response to reverse_complement, it returns a new DNA instance representing its reverse-complement. Note also that a == b if and only if DNA instances a and b represent the same DNA strand.

>> dna1 = DNA.new('ATTGCC')

 => ATTGCC

>> dna2 = dna1.reverse_complement

=> GGCAAT

>> dna2

=> GGCAAT

>> dna1

=> ATTGCC

>> dna2.reverse_complement

 => ATTGCC

>> dna1.reverse_complement.reverse_complement == dna1

=> true

Solution Preview :

Prepared by a verified Expert
Database Management System: The reverse-complement of a dna string is a new string in
Reference No:- TGS01632066

Now Priced at $25 (50% Discount)

Recommended (94%)

Rated (4.6/5)