//genomicPair.cpp //Coded by Jeff Weiss (jmweiss@uci.edu) //ICS 175A, Winter 2004 //Project: Motif detection in yeast //Purpose: provides a data structure to store genetic squences along with the statistical //information we for each sequence #include "genomicPair.h" /* *FUNCTION: genomicPair *PURPOSE: constructor *REMARKS: note that count starts at 0 and scores start at -1 */ GenomicPair::GenomicPair() { count=0; sequence=DString(); score1=-1; score2=-1; score3=-1; } /*GenomicPair::GenomicPair(DString newSequence,int newCount) { count = newCount; sequence = newSequence; }*/ /* *FUNCTION: constructor *PURPOSE: constructor that takes in the sequence and the count *REMARKS: */ GenomicPair::GenomicPair(const DString newSequence, const int newCount) { count = newCount; sequence = newSequence; score1=-1; score2=-1; score3=-1; } /* *FUNCTION: Constructor *PURPOSE: takes in a sqeuence name *REMARKS: note that count is initialized to 1, not 0 */ GenomicPair::GenomicPair(DString newSequence) { sequence=newSequence; count=1; score1=-1; score2=-1; score3=-1; } /* *FUNCTION: constructor *PURPOSE: takes in call values needed for a new genomic pair *REMARKS: used when loading from a file */ GenomicPair::GenomicPair(DString newSequence,int newCount,int newScore1,int newScore2,int newScore3) { sequence=newSequence; count=newCount; score1=newScore1; score2=newScore2; score3=newScore3; } /* *FUNCTION: constructor *PURPOSE: this is a copy constructor *REMARKS: */ GenomicPair::GenomicPair(const GenomicPair& newGenomicPair) { count=newGenomicPair.count; sequence=newGenomicPair.sequence; score1=newGenomicPair.score1; score2=newGenomicPair.score2; score3=newGenomicPair.score3; } /* *FUNCTION: operator = *PURPOSE: this is an assignment operator overload *REMARKS: */ void GenomicPair::operator=(GenomicPair rhs) { sequence=rhs.sequence; count=rhs.count; score1=rhs.score1; score2=rhs.score2; score3=rhs.score3; //return GenomicPair(rhs.sequence,rhs.count,rhs.score1,rhs.score2,rhs.score3); } /* *FUNCTION: < overload comparison operator *PURPOSE: compares score1 for sorting purposes *REMARKS: this is fixed comparison on one of 3 calues */ bool GenomicPair::operator<(GenomicPair rhs) { return score1 < rhs.score1; } /* *FUNCTION: getCount *PURPOSE: get the count associated with the sequence *REMARKS: */ int GenomicPair::getCount() { return count; } /* *FUNCTION: setCount *PURPOSE: set the count for the sequence *REMARKS: */ void GenomicPair::setCount(int newCount) { count=newCount; } /* *FUNCTION: ~GenomicPair *PURPOSE: destructor *REMARKS: note there is no explicit declaraiton of dynamic memory structors in GenomicPair */ GenomicPair::~GenomicPair() { } /* *FUNCTION: getSequence *PURPOSE: returns the sequence DString *REMARKS: */ DString GenomicPair::getSequence() { return sequence; } /* *FUNCTION: set sequence *PURPOSE: sets the sequence *REMARKS: note there is no checking of the passed in value */ void GenomicPair::setSequence(DString newString) { sequence=newString; } /* *FUNCTION: incrementCount *PURPOSE: increments the count by 1 *REMARKS: no error reporting (i.e. if maxint is exceded) */ void GenomicPair::incrementCount() { count++; } /* *FUNCTION: print *PURPOSE: print pair data to stdout *REMARKS: for testing/development purposes only, do not use in production code */ void GenomicPair::print() { cout<<" Count:"<