labStl_Inheritance_Polymorphism: Sequence Database II

  < Previous  Next >

Due Date

See the calendar for due date.

Objectives:

Description:

The research team was so pleased with your previous lab, that you have been asked to produce software which maintains a database of DNA, RNA and amino acid (AA) entries! You will need to set up the following C++ classes: Sequence, DNA (very similar to the one in the previous lab), RNA, AA and SequenceDatabase (very similar to the one in the previous lab). A description of these classes follows:

class Sequence:
This class should provide an abstract base class for the DNA, RNA, and AA classes. This class should contain:
  1. Appropriate constructor(s)
  2. Data members to store:
    1. Label
    2. Accession ID (which is unique)
    3. Sequence
    4. Length of the sequence
  3. Appropriate "get" and "set" methods
  4. A print() method
class DNA:
This class is a derived class of the Sequence class and should contain:
  1. Appropriate constructor(s)
  2. Data member to store:
    1. Index of the coding region (or -1 if not applicable)
  3. Appropriate "get" and "set" methods (you could save some precious keystrokes by using the power of inheritance)
class RNA:
This class is a derived class of the Sequence class and should contain:
  1. Appropriate constructors
  2. Data member to store:
    1. Type of RNA: mRNA, rRNA, or tRNA (stored as a enum)
  3. Appropriate "get" and "set" methods (you could save some precious keystrokes by using the power of inheritance)
class AA:
This class is a derived class of the Sequence class and should contain:
  1. Appropriate constructors
  2. Data member to store:
    1. Open Reading Frame for the corresponding DNA sequence: {-3,-2,-1,0,1,2}
  3. Appropriate "get" and "set" methods (you could save some precious keystrokes ... you get the idea)
class SequenceDatabase:
This class should contain:
  1. Appropriate constructor(s)
  2. Data member:
    1. (a single) STL container to store Sequence pointers
  3. Method to process commands from a specified file. Commands are as follows (fields are separated by tabs):
    D <label> <ID> <sequence> <length> <cDNA start index> (allocates memory for a new DNA object and adds it to the container)
    R <label> <ID> <sequence> <length> <RNA Type> (allocates memory for a new RNA object and adds it to the container)
    A <label> <ID> <sequence> <length> <Open reading frame> (allocates memory for a new AA object and adds it to the container)
    P <ID> (prints the specified entry, if possible)
    O <ID> (obliterates the specified entry, if possible)
    S (displays the total number of entries)

Requirements:

  1. Use the following labStl_Inheritance_Polymorphism-main.cpp file, which has the main() function in it. Do not modify it.
  2. You must have a separate header and implementation file for the above classes.
  3. Name the project for this assignment labStl_Inheritance_Polymorphism-yourlastname.
  4. Use STL iterators to find and obliterate sequences
  5. If attempting to delete or print a sequence that doesn't exist, print out an error statement to the specified output file and continue processing commands.
  6. 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 labStl_Inheritance_Polymorphism
  7. You can assume that information in the input files is syntactically correct and that they each have a newline at the end of the file.
  8. You can use labStl_Inheritance_Polymorphism-inputA.tab and labStl_Inheritance_Polymorphism-inputB.tab to assist your development.
    Please produce your own input file(s) for testing.
  9. Output needs to be stored in the file specified in main() and match the format given in labStl_Inheritance_Polymorphism-answerKeyA.txt:
    Importing labStl_Inheritance_Polymorphism-inputA.tab ...
    Printing 9999 ...
    Can not find item (9999)!
    
    Obliterating 9999 ...
    Can not delete item (9999), NOT found!
    
    Entries: 0 total
    
    Adding 17 ...
    
    Adding 117 ...
    
    Adding 217 ...
    
    Printing 17 ...
    DNA:	Label: CISY_EMENI	ID: 17	Sequence: cttggacagcatggagttctcgagccaaatttgtcggtacactaccttaaacagccctagcgaatctcggcaacatgtgacggttggtatcgtgcgcgcttgtctgggccgggccgatgcgctatag	Length: 127	cDNAStartIndex: 10
    
    Printing 117 ...
    RNA:	Label: CISY_EMENI	ID: 117	Sequence: auggaguucucgagccaaauuugucgguacacuaccuuaaacagcccuagcgaaucucggcaacaugugacgguugguaucgugcgcgcuugucugggccgggccgaugcgcua	Length: 114	Type: mRNA
    
    Printing 217 ...
    AA:	Label: CISY_EMENI	ID: 217	Sequence: MEFSSQICRYTTLNSPSESRQHVTVGIVRACLGRADAL	Length: 38	ORF: 1
    
    Obliterating 17 ...
    
    Entries: 2 total
    
    Obliterating 117 ...
    
    Obliterating 217 ...
    
    Printing 1234567890 ...
    Can not find item (1234567890)!
    
    Obliterating 1234567890 ...
    Can not delete item (1234567890), NOT found!
    
    Entries: 0 total
    
    
    Note: The error messages need to also be sent to the output file.
  10. Label the pure virtual method(s) in your code with:
    // *** pure virtual method ***
  11. Label the polymorphic method call(s) in your code with:
    // *** polymorphic method call ***
  12. 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.
  13. Do not include spaces in directory names or file names.

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 labStl_Inheritance_Polymorphism.zip. Make sure that all of the source code files (especially labStl_Inheritance_Polymorphism-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
_____ /  42  Requirements met:
             + Sequence class (an abstract base class)
             + RNA class (including enum)
             + AA class
             + STL container to store Sequence pointers
             + STL iterators to implement finding and obliterating sequences
             + Comments indicate pure virtual and polymorphic method call(s)
             + etc.
_____ /      Compiles and runs in Visual Studio and on ranger
_____ /  46  Correct output (matches the format of the example & demonstrates correct execution)
_____ /   2  Completed rubric (estimates for each line including hours spent)
	    
_____ / 100   Total

_____   Approximate number of hours spent

Notes

  1. Start small! For example, initially ignore the RNA and AA classes and just have the DNA class inherit from the Sequence class. Then, incorporate the RNA class. Then the AA class.
  2. Part of the grading process is automated by using diff. You should verify that your output matches the above output directly with the following commands on ranger:
    g++  -std=c++0x  *.cpp  -o labStl_Inheritance_Polymorphism-yourlastname
    cp  /nfshome/hcarroll/public_html/3110/private/labs/labStl_Inheritance_Polymorphism-inputA.tab  .
    (echo ""; echo "") | ./labStl_Inheritance_Polymorphism-yourlastname
    diff  /nfshome/hcarroll/public_html/3110/private/labs/labStl_Inheritance_Polymorphism-answerKeyA.txt  labStl_Inheritance_Polymorphism-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/labStl_Inheritance_Polymorphism-answerKeyA.txt  labStl_Inheritance_Polymorphism-outputA.txt
    For details about interpreting the output of diff, see the Using diff section on the Misc. webpage.
  3. 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.
  4. Don't forget to remove DNAList.cpp and DNAList.h from your project (so that your lab will compile on ranger using *.cpp).

Last Modified: