labLinkedLists: Sequence Database I

  < Previous  Next >

Due Date

See the calendar for due date.

Objectives:

Description:

Now that you've parsed the input file for the genetic samples from around the Great Smoky Mountains and stored that information in allocated DNA objects (see labParser), it's time to put them in a list. You will need to set up the following C++ class: DNAList. The description of this class follows:

class DNAList:
This class is a linked list of nodes that have pointers to (not copies of) DNA objects and at a minimum should contain:
  1. Appropriate constructor(s) and destructor
  2. Data members to store:
    1. Head pointer to list
  3. A DNANode struct or class that holds a pointer to a DNA object and a "next" pointer to a DNANode object (and a "prev" pointer if you're using a doubly-linked list).
  4. A push_back(DNA* newDNA) method that adds a node to the end of the list
  5. A find(int id) method that returns a DNA* if a DNA object with id exists in the list; otherwise it returns nullptr
  6. An obliterate(int id) method that deletes the DNA entry with an accession number id, removes the corresponding node and returns true, if found. Otherwise, it returns false.
  7. An int size() method that returns the number of elements in the list

Additionally, you'll need to modify your SequenceDatabase class to have a data members to store a DNAList object. Furthermore, the commands to be processed should be handled in the following ways:
D <label> <ID> <sequence> <length> <cDNA start index> (allocates memory for a new DNA object and add it to the list)
P <ID> (finds the specified DNA entry in the list and prints information about it)
O <ID> (obliterates the specified DNA entry from the list)
S (displays the number of DNA entries)

Requirements:

  1. Name the project for this assignment labLinkedLists-yourlastname.
  2. Use the following labLinkedLists-main.cpp file, which has the main() function in it. Do not modify it.
  3. You must have a separate header and implementation file for each class (i.e, sequenceDatabase.h, sequenceDatabase.cpp, DNA.h, DNA.cpp, DNAList.h, and DNAList.cpp).
  4. If attempting to delete or print a DNA entry that doesn't exist, print out an error statement and continue processing commands.
  5. Your program must compile and run in both Visual Studio 2012 or newer and on ranger. On ranger, it must compile with the following command:
    g++ -std=c++0x *.cpp -o labLinkedLists
  6. Do not include spaces in directory names or file names.
  7. You can assume that the information in labLinkedLists-inputA.tab and labLinkedLists-inputB.tab is syntactically correct and that each file has a newline at the end of the file.
    Please produce your own input file(s) for testing.
  8. Output needs to be stored in the file specified in main() and match the format given in labLinkedLists-answerKeyA.txt:
    Importing labLinkedLists-inputA.tab ...
    Printing 9999 ...
    Can not find item (9999)!
    
    Obliterating 9999 ...
    Can not delete DNA (9999), NOT found!
    
    Entries: 0
    
    Adding 1234567890 ...
    
    Entries: 1
    
    Printing 1234567890 ...
    DNA:	Label: taxon1	ID: 1234567890	Sequence: agtcgatcagaagatctcct	Length: 20	cDNAStartIndex: -1
    
    Obliterating 1234567890 ...
    
    Entries: 0
    
    Printing 1234 ...
    Can not find item (1234)!
    
    Obliterating 1234 ...
    Can not delete DNA (1234), NOT found!
    
    
    Note: The two error messages, those that start with "Can not ...", need to also be sent to the output file.
  9. Make a file named rubric-yourlastname.txt in your project directory with a completed rubric. Specify estimated points for each entry including the number of hours spent.

Submission

Before submitting your project, remove the debug and ipch directories (if present) and any .sdf files. Zip the whole project folder (e.g., by right-clicking on the folder and choosing send to::Compressed (zipped folder) in Windows Explorer). Name your zip file as labLinkedLists.zip. Make sure that all of the source code files (especially labLinkedLists-main.cpp) are in your zipped file. You can verify this by coping your zip file to a temporary location and uncompressing it. Submit your zip file at https://3110.cs.mtsu.edu/. For further instructions, please see the Miscellaneous page.

Rubric:

Points       Item
----------   --------------------------------------------------------------
_____ / 10   Documentation (applies to new and modified files):
             All source code files (.h & .cpp) include file name, author, description etc.
             Functions and variables
             + All non-trival variables are commented
             + All functions preceded by brief comments
             + Comments included before major portions of code
             + Functions should be no longer than 1 page
_____ / 10   Appropriate methods (including destructor(s))
_____ / 28   Correct output (matches the format of the example & demonstrates correct execution)
_____ /  0   Compiles and runs in Visual Studio AND on ranger
_____ /  2   Completed rubric (estimates for each line including hours spent)
             
_____ / 50   Total


_____  Approximate number of hours spent
      

Notes

  1. Start small. Plan out what the role of each object and then the outline of each function. Add some code, compile it and test it. Consider adding a DNAList object as a member to your SequenceDatabase class and getting that to compile (meaning, just enough code in sequenceDatabase.h, dnaList.cpp and dnaList.h to compile, but no more). Then, add in the code to add a DNA pointer into the list. Make sure it compiles and works appropriately (verify that it at least matches the appropriate parts of the required output). Then, add in some more functionality.
  2. Always download files (especially the input files) instead of copying and pasting them. This will preserve the newline(s) at the end of the files.
  3. Lost on how all the classes fit together? Can you draw the relationship between the three classes and the struct?
  4. Visual Studio is available on shemp. You can use your CS account (with CSD\ before it) to login into shemp.cs.mtsu.edu. (Note, shemp has been a version behind everything else which can cause problems, especially going from a newer to an older version.)
  5. Part of the grading process is automated by using diff. You should verify that your output matches the above output exactly with the following commands on ranger:
    g++  -std=c++0x  *.cpp  -o labLinkedLists-yourlastname
    cp  /nfshome/hcarroll/public_html/3110/private/labs/labLinkedLists-inputA.tab  labLinkedLists-inputA.tab
    (echo ""; echo "") | ./labLinkedLists-yourlastname
    diff  /nfshome/hcarroll/public_html/3110/private/labs/labLinkedLists-answerKeyA.txt  labLinkedLists-outputA.txt
    
    If the two files match exactly (which is what you want) then there should be NO output from diff. If diff shows one or more differences, fix them and run it again. To get side-by-side output (with the answer key on the left and your output on the right), replace the last line with:
    diff  --side-by-side  /nfshome/hcarroll/public_html/3110/private/labs/labLinkedLists-answerKeyA.txt  labLinkedLists-outputA.txt
    For details about interpreting the output of diff, see the Using diff section on the Misc. webpage.

Last Modified: