Answer to Question #220604 in C++ for Layla

Question #220604

Task D: Insertion, Deletion, and Frameshift

The worst type of mutation is the frameshift mutation, as it causes the DNA sequence to be parsed incorrectly. This is often created by a deletion or insertion that causes the sequence to be read in a different multiple of three. This abnormal reading often results in an earlier or later “Stop” codon, which causes the protein to be abnormally short or long, thus rendering it not functional.So far, the codons in DNA sequences have been multiples of 3. The file <code class="language-plaintext highlighter-rouge" style="font-family: monospace, monospace; font-size: 1em; padding-left: 0.5em; padding-right: 0.5em; border-style: solid; border-width: 1px; border-radius: 0.5em; border-color: rgb(248, 248, 248); background: rgb(248, 248, 248);">frameshift_mutations.txt</code> contains the same DNA sequences of Task B on the even lines, with frameshift mutations on the odd lines (0-indexed).


1
Expert's answer
2021-07-26T17:18:04-0400
#include <iostream>
#include <fstream>
using namespace std;


void dic_read(ifstream &d) {
    string k, val;
    d.clear();
    d.seekg(0); 
    while (d >> k >> val) {
        cout << "key: " << k << endl;
        cout << "value: " << val << endl;
    }
}
int main()
{
    ifstream fin ("dna.txt");
    if (fin.fail()) {
        cerr << "File does not exist.\n";
        exit(1);
    }
    string strand;
    while(getline(fin, strand)) {
        cout << strand << endl;
    }
    fin.close();


    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS