Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ Problem: You shall write four Rosalind-related template functions in a header file named cs19_rosalind.h. Each of the functions will approximate a Rosalind problem by
C++ Problem:
You shall write four Rosalind-related template functions in a header file named cs19_rosalind.h. Each of the functions will approximate a Rosalind problem by accepting input of a suitable type, and returning output of an appropriate type.
#ifndef CS19_ROSALIND_H_ #define CS19_ROSALIND_H_ #includenamespace cs19 { /** * Counts the occurrences of each nucleotide in a DNA string, similar to Rosalind problem DNA. * See: http://rosalind.info/problems/dna/ * * @tparam DnaSequence an iterable type that supports iteration with a range-based loop, and * contains A/C/G/T char values, e.g. std::string and std::vector . * * @param dna a DNA sequence (assumed to contain A/C/G/T characters) * @return a tuple containing the number of occurrences of 'A', 'C', 'G', 'T' in dna, respectively */ template std::tuple nucleotide_counts(const DnaSequence &dna) { // TODO } /** * Returns a RNA sequence transcribed from a DNA sequence, similar to Rosalind problem RNA. * See: http://rosalind.info/problems/rna/ * * @tparam NucleotideSequence a random-access container type offering operations similar to * std::string and std::vector , e.g. member function size(), indexing with indexes from 0 to * size() - 1, and copying via assignment. * * @param dna a DNA sequence (assumed to contain A/C/G/T characters) * @return an object of the same type representing the transcribed RNA version of the input DNA */ template NucleotideSequence transcribe(const NucleotideSequence &dna) { // TODO } /** * Returns the reverse complement of a DNA sequence, similar to Rosalind problem RNA. * See: http://rosalind.info/problems/revc/ * * @tparam DnaSequence a random-access container type offering operations similar to std::string and * std::vector , e.g. member function size(), indexing with indexes from 0 to size() - 1, and * copying via assignment. * * @param dna a DNA sequence (assumed to contain A/C/G/T characters) * @return an object of the same type, representing reverse complement of the input DNA */ template DnaSequence reverse_complement(const DnaSequence &dna) { // TODO } /** * Returns the Haming distance between two sequence, similar to Rosalind problem HAMM. * See: http://rosalind.info/problems/hamm/ * * @tparam NucleotideSequence a random-access container type offering operations similar to * std::string and std::vector , e.g. member function size(), and indexing with indexes from 0 * to size() - 1. * * @param seq1 the first sequence * @param seq2 the second sequence * @return the Hamming distance between the two sequences, or -1 if they are of unequal length */ template unsigned hamming_distance(const NucleotideSequence &seq1, const NucleotideSequence &seq2) { // TODO } } // namespace cs19 #endif // CS19_ROSALIND_H
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started