In this final submission, you will build on checkpoint B to load the database and DNA sequence from files. There will be two databases and several sequences that will be available for download below. Example of the database is the file small.txt: name,AGATC,AATG,TATC Alice,2,8,3 Bob,4,1,5 Charlie,3,2,5 Example of the sequence is the file 1.txt: AAGGTAAGTTTAGAATATAAAAGGTGAGTTAAATAGAATAGGTTAAAATTAAAGGAGATCAGATCAGATCAGATCTATCTATCTATCTATCTATCAGAAAAGAGTAAATAGTTAAAGAGTAAGATATTGAATTAATGGAAAATATTGTTGGGGAAAGGAGGGATAGAAGG Implement/modify the following functions: Modify the function readData, which will now take an additional parameter: a string representing the filename containing the database of individuals and their STR counts. It will also return a bool indicating if opening the file was successful or not: bool readData(string filename, vector& nameSTRs, vector& nameIndividuals, vector>& STRcounts) Update the function documentation accordingly. Implement a new function getSequenceFromFile that takes two parameters: a string representing the sequence filename (such as 1.txt), and a string that will store the DNA sequence contained in the file. It will return a bool indicating if opening the file was successful or not. The function's prototype is not provided on purpose (you should be able to decipher it from the description). You must also write the complete function documentation. Update the main() function to prompt the user for the filename of the sequence. If the file doesn't open, print an error message and return. Next, prompt the user for the filename of the database. If the file doesn't open, print an error message and return. See the sample output below for the format of the error messages. Next, prompt the user for an integer. If it is equal to 0, do not print the data (i.e. do not call the function printData), otherwise print it. The rest of the main() continues as before (displaying the counts for each STR read from the data in the provided DNA sequence and displaying the match, if there is one). Example input 1: sequence1.txt small.txt 1 Expected output: Error in reading DNA sequence from the file: sequence1.txt Example input 2: 1.txt db.txt 1 Expected output: Error in reading DB file: db.txt Example input 3: 1.txt small.txt 1 Expected output: name Alice Bob Charlie ---------------------------------------- AGATC 2 4 3 AATG 8 1 2 TATC 3 5 5 Counts of the STRs in the DNA sequence is: 4 1 5 Found Match: Bob Example input 4: 13.txt large.txt 0 Expected output: Counts of the STRs in the DNA sequence is: 21 45 36 7 10 33 31 35 No Match Found!

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter7: File Handling And Applications
Section: Chapter Questions
Problem 6PE
icon
Related questions
Question

In this final submission, you will build on checkpoint B to load the database and DNA sequence from files. There will be two databases and several sequences that will be available for download below. Example of the database is the file small.txt:

name,AGATC,AATG,TATC

Alice,2,8,3

Bob,4,1,5

Charlie,3,2,5

Example of the sequence is the file 1.txt:

AAGGTAAGTTTAGAATATAAAAGGTGAGTTAAATAGAATAGGTTAAAATTAAAGGAGATCAGATCAGATCAGATCTATCTATCTATCTATCTATCAGAAAAGAGTAAATAGTTAAAGAGTAAGATATTGAATTAATGGAAAATATTGTTGGGGAAAGGAGGGATAGAAGG

Implement/modify the following functions:

  1. Modify the function readData, which will now take an additional parameter: a string representing the filename containing the database of individuals and their STR counts. It will also return a bool indicating if opening the file was successful or not:

bool readData(string filename, vector<string>& nameSTRs, vector<string>& nameIndividuals, vector<vector<int>>& STRcounts)

Update the function documentation accordingly.

  1. Implement a new function getSequenceFromFile that takes two parameters: a string representing the sequence filename (such as 1.txt), and a string that will store the DNA sequence contained in the file. It will return a bool indicating if opening the file was successful or not. The function's prototype is not provided on purpose (you should be able to decipher it from the description). You must also write the complete function documentation.

  2. Update the main() function to prompt the user for the filename of the sequence. If the file doesn't open, print an error message and return. Next, prompt the user for the filename of the database. If the file doesn't open, print an error message and return. See the sample output below for the format of the error messages. Next, prompt the user for an integer. If it is equal to 0, do not print the data (i.e. do not call the function printData), otherwise print it. The rest of the main() continues as before (displaying the counts for each STR read from the data in the provided DNA sequence and displaying the match, if there is one).

Example input 1:

sequence1.txt small.txt 1

Expected output:

Error in reading DNA sequence from the file: sequence1.txt

Example input 2:

1.txt db.txt 1

Expected output:

Error in reading DB file: db.txt

Example input 3:

1.txt small.txt 1

Expected output:

name Alice Bob Charlie

----------------------------------------

AGATC 2 4 3

AATG 8 1 2

TATC 3 5 5

Counts of the STRs in the DNA sequence is: 4 1 5

Found Match: Bob

Example input 4:

13.txt large.txt 0

Expected output:

Counts of the STRs in the DNA sequence is: 21 45 36 7 10 33 31 35

No Match Found!

Expert Solution
steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Knowledge Booster
Linux
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,