Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

DIY (50%) A research lab requires an application to go through thousands of DNA samples and find all the matches to their sample. A DNA

DIY (50%)

A research lab requires an application to go through thousands of DNA samples and find all the matches to their sample.

A DNA strand representation is done through combinations of the characters 'a', 'c', 'g' and 't' with no spaces in between. These combinations are kept as a cString of characters in a comma-separated file with a 6 digit integer id attached to each sample as follows:

243245,acccgttcgattcagtcgatcgatcgggatattgcaaa 

Each DNA strand is between 100 to 1000 characters.

The number of DNA strands in the data file could be millions. This amount is different in each data file.

Your responsibility is to write a library of functions in a module called "DNA" that can support the main program provided to have the following execution outcome:

The ids in the file are not sorted. Your search results must be sorted based on the Ids of the DNA strands in ascending order:

Enter DNA data file name: lowBaseDnaSmall.csv DNA search program Enter a DNA squence (max 100 chars) > gtcc 4 matches found: 1) 444136: atattttccactgaacggtccagatcgacgatcggggtgtaacagttcatctttggtataccctctccggcgttagatatggtcgaaacgggaacggctag ====================================================================== 2) 448885: ctgatgcagatggattgcgataacggagcgcaatgtgcaatacgggccttcgggaaacggctcgtccgtttcccgaacgcggaacgcaaagaacatgaca ====================================================================== 3) 469926: cggaccacggcccccgtcccccgcatgttcgacgagtggatagagttgagatccatccctttcctagcgtcattgttgcgatacgattgtagtgagcagct ====================================================================== 4) 489349: ccccttttaccaaatcgaagcttttgtgcgaatgtggtcttattgtacgtccgtctcacaggtgactcacactgtccgctctactgagaagcctcctatgc ====================================================================== Enter a DNA squence (max 100 chars) > gtacct No match found! Enter a DNA squence (max 100 chars) > ! DNA Search Program Closed. 

Tester Program

/* ------------------------------------------------------ Workshop 2 part 2 Module: N/A Filename: main.cpp Version 1 Author Fardad Soleimanloo Revision History ----------------------------------------------------------- Date Reason -----------------------------------------------------------*/ #include  #include "cStrTools.h" #include "DNA.h" using namespace std; using namespace sdds; int main() { bool done = false; char dna[101]; char filename[256]; cout << "Enter DNA data file name: "; cin >> filename; if (beginSearch(filename)) { while (!done) { cout << "Enter a DNA squence (max 100 chars)" << endl << "> "; read(dna, 100); if (strCmp(dna, "!") == 0) { done = true; } else { if (read(dna)) { sort(); displayMatches(); deallocate(); } else { cout << "No match found!" << endl; } } } endSearch(); } return 0; }

Mandatory Functions

bool beginSearch(const char *filename);

It will try to open the file and initialize any requirements needed for the application. Returns true if the file is opened successfully and returns false it fails to open the file.

bool read(const char* subDNA);

Dynamically creates an array of DNA records to the number of matches found in the file and stores the matches in them. Returns true if at least one match is found and false if no match is found in the records.

void sort()

Sorts the dynamic array of DNA matches found in the file based on the ids in ascending order.

void displayMatches()

Displays the dynamic DNA records in the following format.

row) ID: DNA strand ====================================================================== 

void deallocate()

Deallocates all the dynamic memory within the DNA array elements and the DNA array itself.

void endSearch()

Finalizes the program by releasing the resources allocated by the program (like closing the data file and etc...).

And then Prints:

DNA Search Program Closed. 

Execution Sample

Sample execution on dna.csv file

Part 2 Submission (DIY)

Files to submit:

cStrTools.cpp cStrTooos.h DNA.cpp DNA.h main.cpp

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 10g SQL

Authors: Joan Casteel, Lannes Morris Murphy

1st Edition

141883629X, 9781418836290

More Books

Students also viewed these Databases questions

Question

Having an obese friend increases the likelihood of obesity.

Answered: 1 week ago