Expression* Expression :: Compile (const RGString& expressionString) {
	
	int errcnt = 0;
	finalExpression = NULL;
	RemainingCharacters = (int)expressionString.Length ();
	ExpressionCriterion = expressionString;
	name_stack.ClearAndDelete ();
		
	if ( Exprparse ())
		errcnt++;
	
	if (errcnt > 0)
		cout << "Found errors in:  " << expressionString.GetData () << endl;
		
	if (name_stack.Entries () > 0)
		cout << "Left with " << name_stack.Entries () << " names still in stack...compilation incomplete." << endl;
		
	name_stack.ClearAndDelete ();
		
	if (errcnt == 0)
		return finalExpression;
	
	return NULL;

}
Exemple #2
0
bool GenotypesForAMarkerSet :: ContainsOffLadderAllele (const RGString& locusName, const RGString& alleleName) {

	RGDList alleleList;
	bool returnValue;

	if (mOffLadderAlleles == NULL)
		return false;

	if (!mOffLadderAlleles->FindAllAllelesForNamedLocus (locusName, alleleList)) {

		alleleList.Clear ();
		return false;
	}

	IndividualAllele target;
	target.SetName (alleleName);

	if (alleleList.Contains (&target))
		returnValue = true;

	else
		returnValue = false;

	alleleList.Clear ();
	return returnValue;
}
Boolean RGHashTable :: ContainsReference (const RGPersistent* p) const {
	
	// contains pointer

	RGDList* list = SelectList (p);
	return list->ContainsReference (p);
}
Exemple #4
0
bool GenotypesForAMarkerSet :: ContainsSampleTriallele (const RGString& locusName, RGDList& alleles) {

	RGDList locusCollection;

	if (mSampleTriAlleles == NULL)
		return false;

	if (!mSampleTriAlleles->FindAllCopiesOfNamedLocus (locusName, locusCollection))
		return false;

	RGDListIterator itCollection (locusCollection);
	IndividualLocus* nextLocus;

	while (nextLocus = (IndividualLocus*) itCollection ()) {

		if (nextLocus->IsContainedIn (alleles)) {

			locusCollection.Clear ();
			return true;
		}
	}
	
	locusCollection.Clear ();
	return false;
}
RGPersistent* RGHashTable :: RemoveAllReferences (const RGPersistent* p) {

	RGDList* list = SelectList (p);
	int NEntriesStart = list->Entries ();
	int NEntriesEnd;
	RGPersistent* q = list->RemoveAllReferences (p);
	NEntriesEnd = list->Entries ();
	NumberOfEntries -= (NEntriesStart - NEntriesEnd);
	return q;
}
RGPersistent* RGHashTable :: Remove (const RGPersistent* target) {

	RGDList* list = SelectList (target);
	RGPersistent* q = list->Remove (target);

	if (q != NULL)
		NumberOfEntries--;

	return q;
}
RGPersistent* RGHashTable :: RemoveReference (const RGPersistent* p) {

	RGDList* list = SelectList (p);
	RGPersistent* q = list->RemoveReference (p);

	if (q != NULL)
		NumberOfEntries--;

	return q;
}
Boolean RGXmlDataMinLength :: Test (const RGDList& x) const {

	if (x.Entries () >= SizeLimit)
				return TRUE;

	return FALSE;
}
Exemple #9
0
bool LocusCollection :: FindAllCopiesOfNamedLocus (const RGString& name, RGDList& results) {

	RGDListIterator it (mLociByName);
	IndividualLocus* nextLocus;

	while (nextLocus = (IndividualLocus*) it ()) {

		if (name == nextLocus->GetName ())
			results.Append (nextLocus);
	}

	if (results.Entries () > 0)
		return true;

	return false;
}
Exemple #10
0
void IndividualLocus :: AppendAllelesToList (RGDList& alleleList) {

	RGDListIterator it (mAllelesByName);
	IndividualAllele* nextAllele;

	while (nextAllele = (IndividualAllele*) it ())
		alleleList.Append (nextAllele);
}
Exemple #11
0
bool LocusCollection :: FindAllAllelesForNamedLocus (const RGString& name, RGDList& results) {

	RGDList temp;

	if (!FindAllCopiesOfNamedLocus (name, temp))
		return false;

	IndividualLocus* nextLocus;

	while (nextLocus = (IndividualLocus*) temp.GetFirst ())
		nextLocus->AppendAllelesToList (results); 
	
	if (results.Entries () == 0)
		return false;

	return true;
}
Exemple #12
0
bool IndividualLocus :: IsContainedIn (const RGDList& alleleList) const {

	RGDList temp (mAllelesByName);
	IndividualAllele* nextAllele;

	while (nextAllele = (IndividualAllele*) temp.GetFirst ()) {

		if (!alleleList.Contains (nextAllele)) {

			temp.ClearAndDelete ();
			delete nextAllele;
			return false;
		}

		delete nextAllele;
	}

	return true;
}
Exemple #13
0
bool LocusCollection :: IsContainedIn (const LocusCollection& collection) const {

	RGDList tempLocusList (mLociByName);
	IndividualLocus* nextLocus;
	IndividualLocus* foundLocus;

	while (nextLocus = (IndividualLocus*) tempLocusList.GetFirst ()) {

		foundLocus = collection.FindLocus (nextLocus->GetName ());

		if ((foundLocus == NULL) || (!nextLocus->Matches (*foundLocus))) {

			delete nextLocus;
			tempLocusList.ClearAndDelete ();
			return false;
		}

		delete nextLocus;
	}

	return true;
}
Exemple #14
0
bool GenotypeSet :: FindAllGenotypes (const RGString& fileName, RGDList& genotypes) {

	RGDListIterator it (mGenotypes);
	GenotypesForAMarkerSet* nextSet;
	IndividualGenotype* ig;
	int startEntries = genotypes.Entries ();
	int endEntries;

	while (nextSet = (GenotypesForAMarkerSet*) it ()) {

		ig = nextSet->FindGenotypeForFileName (fileName);

		if (ig != NULL)
			genotypes.Append (ig);
	}

	endEntries = genotypes.Entries ();

	if (endEntries > startEntries)
		return true;

	return false;
}
int RGHashTable :: OccurrencesOfReference (const RGPersistent* p) const {

	RGDList* list = SelectList (p);
	return list->OccurrencesOfReference (p);
}
RGPersistent* RGHashTable :: FindReference (const RGPersistent* p) {

	RGDList* list = SelectList (p);
	return list->FindReference (p);
}
int Ladder :: AmendLadderData (LadderInputFile* inFile, RGString& oldLadderString) {

	RGString newLadderString;

	// Parse oldLadder data into pieces for individual edits
	RGString locusString;
	RGString* newLocusString;
	RGDList locusStrings;
	size_t startPos = 0;
	size_t endPos;
	RGXMLTagSearch locusSearch ("Locus", oldLadderString);
	RGXMLTagSearch searchRegionsSearch ("SearchRegions", oldLadderString);

	RGString* ilsName = (RGString*)inFile->GetILSNameList ().First ();
	endPos = 0;
	oldLadderString.FindNextSubstring (0, "\t\t\t<Locus>", endPos);
	RGString insertBase;
	insertBase << "\t\t\t\t\t<ILSName>" << ilsName->GetData () << "</ILSName>\n";
	insertBase << "\t\t\t\t</LSBases>";
	RGString leadString = oldLadderString.ExtractSubstring (0, endPos - 1);
	//cout << "Lead string = \n" << leadString.GetData () << endl;
	endPos = 0;
	leadString.FindAndReplaceNextSubstring ("\t\t\t\t</LSBases>", insertBase, endPos);
	//cout << "Lead string = \n" << leadString.GetData () << endl;
	newLadderString << leadString;

	startPos = 0;

	while (locusSearch.FindNextTag (startPos, endPos, locusString)) {

		newLocusString = new RGString (locusString);
		locusStrings.Append (newLocusString);
		startPos = endPos;
	}

	if (mLocusList.size () != locusStrings.Entries ()) {

		cout << "Number of loci in bins file does not match number of loci in ladder file" << endl;
		return -152;
	}

	Locus* nextLocus;
	RGString locusInsert;
	RGString currentLocusString;
	RGString nameString;
	RGXMLTagSearch locusNameSearch ("Name", currentLocusString);
	RGXMLTagSearch coreRepeatSearch ("CoreRepeatNumber", currentLocusString);
	double minSearch;
	double maxSearch;
	RGString repeatString;
	int repeatNumber;

	while (locusStrings.Entries () > 0) {

		newLocusString = (RGString*) locusStrings.GetFirst ();
		currentLocusString = *newLocusString;
		locusNameSearch.ResetSearch ();
		coreRepeatSearch.ResetSearch ();

		locusNameSearch.FindNextTag (0, endPos, nameString);
		nextLocus = FindLocusByName (nameString);

		if (nextLocus == NULL) {

			cout << "Could not find locus named " << nameString.GetData () << ".  Exiting..." << endl;
			return -155;
		}

		if (!coreRepeatSearch.FindNextTag (0, endPos, repeatString))
			repeatNumber = 4;

		else
			repeatNumber = repeatString.ConvertToInteger ();

		locusInsert = "";
		minSearch = nextLocus->GetMinSearchILSBP () - repeatNumber + 1;
		maxSearch = nextLocus->GetMaxSearchILSBP () + repeatNumber -1;

		locusInsert << "\t\t\t\t\t<Region>\n";
		locusInsert << "\t\t\t\t\t\t<ILSName>" << ilsName->GetData () << "</ILSName>\n";
		locusInsert << "\t\t\t\t\t\t<MinGrid>" << 0.01 * floor (100.0 * minSearch + 0.5) << "</MinGrid>\n";
		locusInsert << "\t\t\t\t\t\t<MaxGrid>" << 0.01 * floor (100.0 * maxSearch + 0.5) << "</MaxGrid>\n";
		locusInsert << "\t\t\t\t\t</Region>\n";
		locusInsert << "\t\t\t\t</SearchRegions>";
		endPos = 0;
		currentLocusString.FindAndReplaceNextSubstring ("\t\t\t\t</SearchRegions>", locusInsert, endPos);

		newLadderString << "\t\t\t<Locus>" << currentLocusString << "</Locus>\n";
		delete newLocusString;
	}

	newLadderString << "\t\t</Set>\n";
	newLadderString << "\t</Kits>\n";
	newLadderString << "</KitData>\n";

	RGString ladderPath = inFile->GetOutputConfigDirectoryPath () + "/" + inFile->GetLadderFileName ();
	RGTextOutput ladderOutput (ladderPath, FALSE);

	if (!ladderOutput.FileIsValid ()) {

		cout << "Could not open ladder output file:  " << ladderPath.GetData () << endl;
		return -161;
	}

	ladderOutput << newLadderString;

	cout << "Ladder update completed successfully..." << endl;
	return 0;
}
RGPersistent* RGHashTable :: Insert (RGPersistent* p) {

	RGDList* list = SelectList (p);
	NumberOfEntries++;
	return list->Insert (p);
}
RGPersistent* RGHashTable :: Find (const RGPersistent* target) const {

	RGDList* list = SelectList (target);
	return list->Find (target);
}
Exemple #20
0
Boolean STRBaseLocus :: ExtractGridSignals (RGDList& channelSignalList, const LaneStandard* ls, RGDList& locusDataSignalList, ChannelData* lsData, Locus* locus) {

    int lsSize = ls->GetNumberOfCharacteristics ();
    int i1;
    int i2;
    double c1;
    double c2;
    Notice* newNotice;

    if (lsSize < 0) {

        Msg << "Number of characteristics not available for Locus named " << LocusName << "\n";
        newNotice = new SetupErrorNumberPeaksUnavailableForLocus;
        locus->AddNoticeToList (newNotice);
        return FALSE;
    }

    if (LowerBoundGridLSBasePair < 0.0) {

        i1 = (int) floor (LowerBoundGridLSIndex);

        if (i1 < 0) {

            Msg << "Internal Lane Standard lower bound index for Grid is out of bounds for Locus named " << LocusName << "\n";
            return FALSE;
        }

        i2 = i1 + 1;
        c2 = LowerBoundGridLSIndex - i1;
        c1 = 1.0 - c2;
        MinimumGridTime = c1 * ls->GetLaneStandardTimeForCharacteristicNumber (i1) +
                          c2 * ls->GetLaneStandardTimeForCharacteristicNumber (i2);
//		cout << "Not using base pairs for minimum of locus " << LocusName << endl;
    }

    else
        MinimumGridTime = lsData->GetTimeForSpecifiedID (LowerBoundGridLSBasePair);

    if (UpperBoundGridLSBasePair < 0.0) {

        i1 = (int) floor (UpperBoundGridLSIndex);

        if (i1 < 0) {

            Msg << "Internal Lane Standard upper bound index for Grid is out of bounds for Locus named " << LocusName << "\n";
            return FALSE;
        }

        i2 = i1 + 1;
        c2 = UpperBoundGridLSIndex - i1;
        c1 = 1.0 - c2;
        MaximumGridTime = c1 * ls->GetLaneStandardTimeForCharacteristicNumber (i1) +
                          c2 * ls->GetLaneStandardTimeForCharacteristicNumber (i2);
//		cout << "Not using base pairs for maximum of locus " << LocusName << endl;
    }

    else
        MaximumGridTime = lsData->GetTimeForSpecifiedID (UpperBoundGridLSBasePair);

    RGDListIterator it (channelSignalList);
    DataSignal* nextSignal;
    double nextMean;
    locusDataSignalList.Clear ();

    // Assume channelSignalList is in increasing order by signal means

    while (nextSignal = (DataSignal*) it ()) {

        nextMean = nextSignal->GetMean ();

        if (nextMean >= MinimumGridTime) {

            if (nextMean <= MaximumGridTime) {

                it.RemoveCurrentItem ();
                locusDataSignalList.Append (nextSignal);
            }

            else
                break;
        }
    }

    if (locusDataSignalList.Entries () < mLocusSize) {

        Msg << "Locus named " << LocusName << " could not find the required number of unanalyzed peaks in range\n";
        newNotice = new LocusHasTooFewPeaks;
        locus->AddNoticeToList (newNotice);
        return FALSE;
    }

    return TRUE;
}
RGPersistent* RGHashTable :: Prepend (RGPersistent* p) {

	RGDList* list = SelectList (p);
	NumberOfEntries++;
	return list->Prepend (p);
}
Boolean RGHashTable :: Contains (const RGPersistent* p) const {

	RGDList* list = SelectList (p);
	return list->Contains (p);
}
Exemple #23
0
STRBaseLaneStandard :: STRBaseLaneStandard (const RGString& xmlString) : BaseLaneStandard (xmlString),
    mCharacteristicArray (NULL), mDifferenceArray (NULL), mUnnormalizedDifferenceArray(0),
    mNormsLeft (NULL), mNormsRight (NULL), mRelativeSizes (NULL),
    mSize (0), mDifferenceSize (0), mOmissionSize (0), mOmissionArray (NULL), mNumberOfLargePeaks (0),
    mLargeCharacteristicArray (NULL), mLargeDifferenceArray (NULL), mNumberOfLargeDifferences (0),
    mFirstIntervalFraction (-1.0), mSmallestIntervalFraction (-1.0), mMaxRelativeHeight (-1),
    mCorrelationAcceptanceThreshold (0.993), mCorrelationAutoAcceptanceThreshold (0.9975)
//
//, mLastHalfSize (0), mLastHalfCharacteristicArray (NULL), mLastHalfUnnormalizedDifferenceArray (NULL),
//mLastHalfRelativeSizes (NULL), mLastHalfDifferenceSize (0), mLastHalfNormsLeft (NULL), mLastHalfNormsRight (NULL)
{

    RGString TextInput (xmlString);
    RGBracketStringSearch CharacteristicsToken ("<Characteristics>", "</Characteristics>", TextInput);
    RGString CharacteristicsString;
    RGString HeightString;
    RGBracketStringSearch HeightToken ("<RelativeHeights>", "</RelativeHeights>", TextInput);
    RGBracketStringSearch OmissionSearch ("<Omissions>", "</Omissions>", TextInput);
    RGBracketStringSearch AcceptanceThresholdSearch ("<CorrelationAcceptanceThreshold>", "</CorrelationAcceptanceThreshold>", TextInput);
    RGBracketStringSearch AutoAcceptanceThresholdSearch ("<CorrelationAutoAcceptanceThreshold>", "</CorrelationAutoAcceptanceThreshold>", TextInput);
    RGString OmissionString;
    size_t endPosition;
    RGString token;
    RGString delim;
    RGString numberString;

    double minChar;
    double maxChar;
    RGDList tokens;
    double value;
    RGPDouble* valuePtr;

    double previous;
    double next;
    double cumulative;
    int i = 0;
    double temp;
    int k;
    int j;

    if (!CharacteristicsToken.FindNextBracketedString (0, endPosition, CharacteristicsString)) {

        Msg << "Internal Lane Standard named " << Name << " could not find Characteristics token from string\n";
        Msg << TextInput << "\n";
        Valid = FALSE;
    }

    else {

        RGStringTokenizer data (CharacteristicsString);
        data.AddDelimiter (' ');
        data.AddDelimiter ("  ");
        data.AddDelimiter ("   ");
        data.AddDelimiter ("    ");
        data.AddDelimiter ("     ");
        data.AddRemoveItem (',');
        data.AddDelimiter ('\t');
        data.AddDelimiter ('\n');

        while (data.NextToken (token, delim)) {

            if (token.Length () > 0) {

                value = token.ConvertToDouble ();
                valuePtr = new RGPDouble (value);

                if (tokens.Entries () == 0) {

                    minChar = maxChar = value;
                    tokens.Append (valuePtr);
                }

                else if (value < minChar) {

                    minChar = value;
                    tokens.Prepend (valuePtr);
                }

                else if (value > maxChar) {

                    maxChar = value;
                    tokens.Append (valuePtr);
                }

                else
                    tokens.Insert (valuePtr);
            }
        }

        mSize = (int)tokens.Entries ();
        NCharacteristics = mSize;
        mCharacteristicArray = new double [mSize];
        mDifferenceSize = mSize - 1;
        mDifferenceArray = new double [mDifferenceSize];
        mUnnormalizedDifferenceArray = new double [mDifferenceSize];
        mNormsLeft = new double [mDifferenceSize];
        mNormsRight = new double [mDifferenceSize];

        //mLastHalfSize = mSize / 2;

        //if (2 * mLastHalfSize < mSize)
        //	mLastHalfSize += 1;

        //mLastHalfDifferenceSize = mLastHalfSize - 1;
        //mLastHalfCharacteristicArray = new double [mLastHalfSize];
        //mLastHalfUnnormalizedDifferenceArray = new double [mLastHalfDifferenceSize];
        //mLastHalfNormsLeft = new double [mLastHalfDifferenceSize];
        //mLastHalfNormsRight = new double [mLastHalfDifferenceSize];

        while (valuePtr = (RGPDouble*)tokens.GetFirst ()) {

            mCharacteristicArray [i] = valuePtr->GetDouble ();
            delete valuePtr;
            i++;
        }

        //int displacement = mSize - mLastHalfSize;	// +0, +1, -1?????

        //for (i=0; i<mLastHalfSize; i++)
        //	mLastHalfCharacteristicArray [i] = mCharacteristicArray [i + displacement];

        previous = mCharacteristicArray [0];

        for (i=0; i<mDifferenceSize; i++) {

            next = mCharacteristicArray [i+1];
            mUnnormalizedDifferenceArray [i] = mDifferenceArray [i] = next - previous;
            previous = next;
        }

        //for (i=0; i<mLastHalfSize; i++)
        //	mLastHalfUnnormalizedDifferenceArray [i] = mUnnormalizedDifferenceArray [i + displacement];

        double norm = 0.0;

        for (i=0; i<mDifferenceSize; i++)
            norm += mDifferenceArray [i] * mDifferenceArray [i];

        norm = sqrt (norm);

        if (norm > 0.0) {

            for (i=0; i<mDifferenceSize; i++)
                mDifferenceArray [i] /= norm;
        }

        cumulative = 0.0;

        for (i=0; i<mDifferenceSize; i++) {

            temp = mUnnormalizedDifferenceArray [i];
            cumulative += temp * temp;
            mNormsLeft [i] = cumulative;
        }

        cumulative = 0.0;

        for (i=mDifferenceSize-1; i>=0; i--) {

            temp = mUnnormalizedDifferenceArray [i];
            cumulative += temp * temp;
            mNormsRight [i] = cumulative;
        }

        //cumulative = 0.0;

        //for (i=0; i<mLastHalfDifferenceSize; i++) {

        //	temp = mLastHalfUnnormalizedDifferenceArray [i];
        //	cumulative += temp * temp;
        //	mLastHalfNormsLeft [i] = cumulative;
        //}

        //cumulative = 0.0;

        //for (i=mLastHalfDifferenceSize-1; i>=0; i--) {

        //	temp = mLastHalfUnnormalizedDifferenceArray [i];
        //	cumulative += temp * temp;
        //	mLastHalfNormsRight [i] = cumulative;
        //}

        MaxCharacteristic = maxChar;
        MinCharacteristic = minChar;
        double width = mCharacteristicArray [mSize - 1] - mCharacteristicArray [0];

        if (width > 0.0)
            mFirstIntervalFraction = mUnnormalizedDifferenceArray [0] / width;

        else
            mFirstIntervalFraction = 1.0;

        double temp = mUnnormalizedDifferenceArray [0];
        double value;

        for (i=0; i<mDifferenceSize; i++) {

            value = mUnnormalizedDifferenceArray [i];

            if (value < temp)
                temp = value;
        }

        if (width > 0.0)
            mSmallestIntervalFraction = temp / width;

        else
            mSmallestIntervalFraction = 1.0;

        if (!HeightToken.FindNextBracketedString (0, endPosition, HeightString)) {

            mRelativeSizes = NULL;
//			mLastHalfRelativeSizes = NULL;
        }

        else {

            RGStringTokenizer data2 (HeightString);
            data2.AddDelimiter (' ');
            data2.AddDelimiter ("  ");
            data2.AddDelimiter ("   ");
            data2.AddDelimiter ("    ");
            data2.AddDelimiter ("     ");
            data2.AddRemoveItem (',');
            data2.AddDelimiter ('\t');
            data2.AddDelimiter ('\n');

            mRelativeSizes = new int [mSize];

            for (k=0; k<mSize; k++)
                mRelativeSizes [k] = -1;

            k = 0;

            while (data2.NextToken (token, delim)) {

                if (token.Length () > 0) {

                    token.ToUpper ();
                    char first = token.GetFirstCharacter ();

                    switch (first) {

                    case 'H':
                        mRelativeSizes [k] = 5;
                        break;

                    case 'L':
                        mRelativeSizes [k] = 1;
                        break;

                    case 'M':
                        if (token.Length () == 1)
                            mRelativeSizes [k] = 3;

                        else if (token.GetLastCharacter () == 'H')
                            mRelativeSizes [k] = 4;

                        else
                            mRelativeSizes [k] = 2;

                        break;

                    default:
                        mRelativeSizes [k] = -1;
                    }
                }

                k++;

                if (k >= mSize)
                    break;
            }

            //mLastHalfRelativeSizes = new int [mLastHalfSize];

            //for (i=0; i<mLastHalfSize; i++)
            //	mLastHalfRelativeSizes [i] = mRelativeSizes [i + displacement];

            int maxRelativeSize = 0;
            int relativeSize;

            for (j=0; j<mSize; j++) {

                relativeSize = mRelativeSizes [j];

                if (relativeSize > maxRelativeSize)
                    maxRelativeSize = relativeSize;
            }

            int numberOfHighsInILS = 0;
            mMaxRelativeHeight = maxRelativeSize;

            for (j=0; j<mSize; j++) {

                if (mRelativeSizes [j] == maxRelativeSize)
                    numberOfHighsInILS++;
            }

            mNumberOfLargePeaks = numberOfHighsInILS;
            mNumberOfLargeDifferences = numberOfHighsInILS - 1;
            mLargeCharacteristicArray = new double [numberOfHighsInILS];

            if (mNumberOfLargeDifferences > 0)
                mLargeDifferenceArray = new double [mNumberOfLargeDifferences];

            k = 0;

            for (j=0; j<mSize; j++) {

                if (mRelativeSizes [j] == maxRelativeSize) {

                    mLargeCharacteristicArray [k] = mCharacteristicArray [j];
                    k++;
                }
            }

            if (mLargeDifferenceArray != NULL) {

                for (j=0; j<mNumberOfLargeDifferences; j++)
                    mLargeDifferenceArray [j] = mLargeCharacteristicArray [j + 1] - mLargeCharacteristicArray [j];
            }
        }

        if (OmissionSearch.FindNextBracketedString (0, endPosition, OmissionString)) {

            RGStringTokenizer omissionData (OmissionString);
            omissionData.AddDelimiter (' ');
            omissionData.AddDelimiter ("  ");
            omissionData.AddDelimiter ("   ");
            omissionData.AddDelimiter ("    ");
            omissionData.AddDelimiter ("     ");
            omissionData.AddRemoveItem (',');
            omissionData.AddDelimiter ('\t');
            omissionData.AddDelimiter ('\n');

            while (omissionData.NextToken (token, delim)) {

                if (token.Length () > 0) {

                    value = token.ConvertToDouble ();
                    valuePtr = new RGPDouble (value);

                    if (tokens.Entries () == 0) {

                        minChar = maxChar = value;
                        tokens.Append (valuePtr);
                    }

                    else if (value < minChar) {

                        minChar = value;
                        tokens.Prepend (valuePtr);
                    }

                    else if (value > maxChar) {

                        maxChar = value;
                        tokens.Append (valuePtr);
                    }

                    else
                        tokens.Insert (valuePtr);
                }
            }

            mOmissionSize = (int)tokens.Entries ();

            if (mOmissionSize == 0)
                return;

            mOmissionArray = new double [mOmissionSize];

            i = 0;

            while (valuePtr = (RGPDouble*)tokens.GetFirst ()) {

                mOmissionArray [i] = valuePtr->GetDouble ();
                delete valuePtr;
                i++;
            }
        }
    }

    cout << "ILS Name = " << Name.GetData () << endl;

    if (!AcceptanceThresholdSearch.FindNextBracketedString (0, endPosition, numberString))
        cout << "\tCould not find ILS acceptance threshold...using " << mCorrelationAcceptanceThreshold << endl;

    else {

        mCorrelationAcceptanceThreshold = numberString.ConvertToDouble ();
        cout << "\tFrom ILS settings...ILS acceptance threshold = " << mCorrelationAcceptanceThreshold << endl;
    }

    if (!AutoAcceptanceThresholdSearch.FindNextBracketedString (0, endPosition, numberString))
        cout << "\tCould not find ILS auto acceptance threshold...using default value = " << mCorrelationAutoAcceptanceThreshold << endl << endl;

    else {

        mCorrelationAutoAcceptanceThreshold = numberString.ConvertToDouble ();
        cout << "\tFrom ILS settings...ILS auto acceptance threshold = " << mCorrelationAutoAcceptanceThreshold << endl << endl;
    }
}
int
yyparse (void)
{
    int yystate;
    /* Number of tokens to shift before error messages enabled.  */
    int yyerrstatus;

    /* The stacks and their tools:
       'yyss': related to states.
       'yyvs': related to semantic values.

       Refer to the stacks through separate pointers, to allow yyoverflow
       to reallocate them elsewhere.  */

    /* The state stack.  */
    yytype_int16 yyssa[YYINITDEPTH];
    yytype_int16 *yyss;
    yytype_int16 *yyssp;

    /* The semantic value stack.  */
    YYSTYPE yyvsa[YYINITDEPTH];
    YYSTYPE *yyvs;
    YYSTYPE *yyvsp;

    YYSIZE_T yystacksize;

  int yyn;
  int yyresult;
  /* Lookahead token as an internal (translated) token number.  */
  int yytoken = 0;
  /* The variables used to return semantic value and location from the
     action routines.  */
  YYSTYPE yyval;

#if YYERROR_VERBOSE
  /* Buffer for error messages, and its allocated size.  */
  char yymsgbuf[128];
  char *yymsg = yymsgbuf;
  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
#endif

#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))

  /* The number of symbols on the RHS of the reduced rule.
     Keep to zero when no symbol should be popped.  */
  int yylen = 0;

  yyssp = yyss = yyssa;
  yyvsp = yyvs = yyvsa;
  yystacksize = YYINITDEPTH;

  YYDPRINTF ((stderr, "Starting parse\n"));

  yystate = 0;
  yyerrstatus = 0;
  yynerrs = 0;
  yychar = YYEMPTY; /* Cause a token to be read.  */
  goto yysetstate;

/*------------------------------------------------------------.
| yynewstate -- Push a new state, which is found in yystate.  |
`------------------------------------------------------------*/
 yynewstate:
  /* In all cases, when you get here, the value and location stacks
     have just been pushed.  So pushing a state here evens the stacks.  */
  yyssp++;

 yysetstate:
  *yyssp = yystate;

  if (yyss + yystacksize - 1 <= yyssp)
    {
      /* Get the current used size of the three stacks, in elements.  */
      YYSIZE_T yysize = yyssp - yyss + 1;

#ifdef yyoverflow
      {
        /* Give user a chance to reallocate the stack.  Use copies of
           these so that the &'s don't force the real ones into
           memory.  */
        YYSTYPE *yyvs1 = yyvs;
        yytype_int16 *yyss1 = yyss;

        /* Each stack pointer address is followed by the size of the
           data in use in that stack, in bytes.  This used to be a
           conditional around just the two extra args, but that might
           be undefined if yyoverflow is a macro.  */
        yyoverflow (YY_("memory exhausted"),
                    &yyss1, yysize * sizeof (*yyssp),
                    &yyvs1, yysize * sizeof (*yyvsp),
                    &yystacksize);

        yyss = yyss1;
        yyvs = yyvs1;
      }
#else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE
      goto yyexhaustedlab;
# else
      /* Extend the stack our own way.  */
      if (YYMAXDEPTH <= yystacksize)
        goto yyexhaustedlab;
      yystacksize *= 2;
      if (YYMAXDEPTH < yystacksize)
        yystacksize = YYMAXDEPTH;

      {
        yytype_int16 *yyss1 = yyss;
        union yyalloc *yyptr =
          (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
        if (! yyptr)
          goto yyexhaustedlab;
        YYSTACK_RELOCATE (yyss_alloc, yyss);
        YYSTACK_RELOCATE (yyvs_alloc, yyvs);
#  undef YYSTACK_RELOCATE
        if (yyss1 != yyssa)
          YYSTACK_FREE (yyss1);
      }
# endif
#endif /* no yyoverflow */

      yyssp = yyss + yysize - 1;
      yyvsp = yyvs + yysize - 1;

      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
                  (unsigned long int) yystacksize));

      if (yyss + yystacksize - 1 <= yyssp)
        YYABORT;
    }

  YYDPRINTF ((stderr, "Entering state %d\n", yystate));

  if (yystate == YYFINAL)
    YYACCEPT;

  goto yybackup;

/*-----------.
| yybackup.  |
`-----------*/
yybackup:

  /* Do appropriate processing given the current state.  Read a
     lookahead token if we need one and don't already have one.  */

  /* First try to decide what to do without reference to lookahead token.  */
  yyn = yypact[yystate];
  if (yypact_value_is_default (yyn))
    goto yydefault;

  /* Not known => get a lookahead token if don't already have one.  */

  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
  if (yychar == YYEMPTY)
    {
      YYDPRINTF ((stderr, "Reading a token: "));
      yychar = yylex ();
    }

  if (yychar <= YYEOF)
    {
      yychar = yytoken = YYEOF;
      YYDPRINTF ((stderr, "Now at end of input.\n"));
    }
  else
    {
      yytoken = YYTRANSLATE (yychar);
      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
    }

  /* If the proper action on seeing token YYTOKEN is to reduce or to
     detect an error, take that action.  */
  yyn += yytoken;
  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
    goto yydefault;
  yyn = yytable[yyn];
  if (yyn <= 0)
    {
      if (yytable_value_is_error (yyn))
        goto yyerrlab;
      yyn = -yyn;
      goto yyreduce;
    }

  /* Count tokens shifted since error; after three, turn off error
     status.  */
  if (yyerrstatus)
    yyerrstatus--;

  /* Shift the lookahead token.  */
  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);

  /* Discard the shifted token.  */
  yychar = YYEMPTY;

  yystate = yyn;
  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  *++yyvsp = yylval;
  YY_IGNORE_MAYBE_UNINITIALIZED_END

  goto yynewstate;


/*-----------------------------------------------------------.
| yydefault -- do the default action for the current state.  |
`-----------------------------------------------------------*/
yydefault:
  yyn = yydefact[yystate];
  if (yyn == 0)
    goto yyerrlab;
  goto yyreduce;


/*-----------------------------.
| yyreduce -- Do a reduction.  |
`-----------------------------*/
yyreduce:
  /* yyn is the number of a rule to reduce with.  */
  yylen = yyr2[yyn];

  /* If YYLEN is nonzero, implement the default value of the action:
     '$$ = $1'.

     Otherwise, the following line sets YYVAL to garbage.
     This behavior is undocumented and Bison
     users should not rely upon it.  Assigning to YYVAL
     unconditionally makes the parser a bit smaller, and it avoids a
     GCC warning that YYVAL may be used uninitialized.  */
  yyval = yyvsp[1-yylen];


  YY_REDUCE_PRINT (yyn);
  switch (yyn)
    {
        case 2:
#line 73 "SmartExpressionExpr.y" /* yacc.c:1646  */
    {

				Expression::SetCompiledExpression ((Expression*)(yyvsp[0].evalue));
	}
#line 1272 "ExpressionYacc.cpp" /* yacc.c:1646  */
    break;

  case 3:
#line 80 "SmartExpressionExpr.y" /* yacc.c:1646  */
    {					
	            
	            //
	            // process name
	            //
	            
				rstr = (RGString*)name_stack.GetFirst ();
				(yyval.evalue) = new SingleMessage (*rstr);
				delete rstr;
	}
#line 1287 "ExpressionYacc.cpp" /* yacc.c:1646  */
    break;

  case 4:
#line 91 "SmartExpressionExpr.y" /* yacc.c:1646  */
    {
	            
	            //rstr = (RGString*)name_stack.GetFirst ();
	            //delete rstr;
	            (yyval.evalue) = new ConstantExpr (true);
	}
#line 1298 "ExpressionYacc.cpp" /* yacc.c:1646  */
    break;

  case 5:
#line 98 "SmartExpressionExpr.y" /* yacc.c:1646  */
    {
	            
	            //rstr = (RGString*)name_stack.GetFirst ();
	            //delete rstr;
	            (yyval.evalue) = new ConstantExpr (false);
	}
#line 1309 "ExpressionYacc.cpp" /* yacc.c:1646  */
    break;

  case 6:
#line 105 "SmartExpressionExpr.y" /* yacc.c:1646  */
    {
	            
	            (yyval.evalue) = (yyvsp[-1].evalue);
	}
#line 1318 "ExpressionYacc.cpp" /* yacc.c:1646  */
    break;

  case 7:
#line 110 "SmartExpressionExpr.y" /* yacc.c:1646  */
    {
	            
	            (yyval.evalue) = new And ((yyvsp[-2].evalue), (yyvsp[0].evalue));
	}
#line 1327 "ExpressionYacc.cpp" /* yacc.c:1646  */
    break;

  case 8:
#line 115 "SmartExpressionExpr.y" /* yacc.c:1646  */
    {
	            
	            (yyval.evalue) = new Or ((yyvsp[-2].evalue), (yyvsp[0].evalue));
	}
#line 1336 "ExpressionYacc.cpp" /* yacc.c:1646  */
    break;

  case 9:
#line 120 "SmartExpressionExpr.y" /* yacc.c:1646  */
    {    //????????????????????????????????
	            
	            (yyval.evalue) = new Not ((yyvsp[0].evalue));
	}
#line 1345 "ExpressionYacc.cpp" /* yacc.c:1646  */
    break;

  case 10:
#line 125 "SmartExpressionExpr.y" /* yacc.c:1646  */
    {
	            
	            (yyval.evalue) = new ExclusiveOr ((yyvsp[-2].evalue), (yyvsp[0].evalue));
	}
#line 1354 "ExpressionYacc.cpp" /* yacc.c:1646  */
    break;


#line 1358 "ExpressionYacc.cpp" /* yacc.c:1646  */
      default: break;
    }
  /* User semantic actions sometimes alter yychar, and that requires
     that yytoken be updated with the new translation.  We take the
     approach of translating immediately before every use of yytoken.
     One alternative is translating here after every semantic action,
     but that translation would be missed if the semantic action invokes
     YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
     if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
     incorrect destructor might then be invoked immediately.  In the
     case of YYERROR or YYBACKUP, subsequent parser actions might lead
     to an incorrect destructor call or verbose syntax error message
     before the lookahead is translated.  */
  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);

  YYPOPSTACK (yylen);
  yylen = 0;
  YY_STACK_PRINT (yyss, yyssp);

  *++yyvsp = yyval;

  /* Now 'shift' the result of the reduction.  Determine what state
     that goes to, based on the state we popped back to and the rule
     number reduced by.  */

  yyn = yyr1[yyn];

  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
    yystate = yytable[yystate];
  else
    yystate = yydefgoto[yyn - YYNTOKENS];

  goto yynewstate;


/*--------------------------------------.
| yyerrlab -- here on detecting error.  |
`--------------------------------------*/
yyerrlab:
  /* Make sure we have latest lookahead translation.  See comments at
     user semantic actions for why this is necessary.  */
  yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);

  /* If not already recovering from an error, report this error.  */
  if (!yyerrstatus)
    {
      ++yynerrs;
#if ! YYERROR_VERBOSE
      yyerror (YY_("syntax error"));
#else
# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
                                        yyssp, yytoken)
      {
        char const *yymsgp = YY_("syntax error");
        int yysyntax_error_status;
        yysyntax_error_status = YYSYNTAX_ERROR;
        if (yysyntax_error_status == 0)
          yymsgp = yymsg;
        else if (yysyntax_error_status == 1)
          {
            if (yymsg != yymsgbuf)
              YYSTACK_FREE (yymsg);
            yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
            if (!yymsg)
              {
                yymsg = yymsgbuf;
                yymsg_alloc = sizeof yymsgbuf;
                yysyntax_error_status = 2;
              }
            else
              {
                yysyntax_error_status = YYSYNTAX_ERROR;
                yymsgp = yymsg;
              }
          }
        yyerror (yymsgp);
        if (yysyntax_error_status == 2)
          goto yyexhaustedlab;
      }
# undef YYSYNTAX_ERROR
#endif
    }



  if (yyerrstatus == 3)
    {
      /* If just tried and failed to reuse lookahead token after an
         error, discard it.  */

      if (yychar <= YYEOF)
        {
          /* Return failure if at end of input.  */
          if (yychar == YYEOF)
            YYABORT;
        }
      else
        {
          yydestruct ("Error: discarding",
                      yytoken, &yylval);
          yychar = YYEMPTY;
        }
    }

  /* Else will try to reuse lookahead token after shifting the error
     token.  */
  goto yyerrlab1;


/*---------------------------------------------------.
| yyerrorlab -- error raised explicitly by YYERROR.  |
`---------------------------------------------------*/
yyerrorlab:

  /* Pacify compilers like GCC when the user code never invokes
     YYERROR and the label yyerrorlab therefore never appears in user
     code.  */
  if (/*CONSTCOND*/ 0)
     goto yyerrorlab;

  /* Do not reclaim the symbols of the rule whose action triggered
     this YYERROR.  */
  YYPOPSTACK (yylen);
  yylen = 0;
  YY_STACK_PRINT (yyss, yyssp);
  yystate = *yyssp;
  goto yyerrlab1;


/*-------------------------------------------------------------.
| yyerrlab1 -- common code for both syntax error and YYERROR.  |
`-------------------------------------------------------------*/
yyerrlab1:
  yyerrstatus = 3;      /* Each real token shifted decrements this.  */

  for (;;)
    {
      yyn = yypact[yystate];
      if (!yypact_value_is_default (yyn))
        {
          yyn += YYTERROR;
          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
            {
              yyn = yytable[yyn];
              if (0 < yyn)
                break;
            }
        }

      /* Pop the current state because it cannot handle the error token.  */
      if (yyssp == yyss)
        YYABORT;


      yydestruct ("Error: popping",
                  yystos[yystate], yyvsp);
      YYPOPSTACK (1);
      yystate = *yyssp;
      YY_STACK_PRINT (yyss, yyssp);
    }

  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  *++yyvsp = yylval;
  YY_IGNORE_MAYBE_UNINITIALIZED_END


  /* Shift the error token.  */
  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);

  yystate = yyn;
  goto yynewstate;


/*-------------------------------------.
| yyacceptlab -- YYACCEPT comes here.  |
`-------------------------------------*/
yyacceptlab:
  yyresult = 0;
  goto yyreturn;

/*-----------------------------------.
| yyabortlab -- YYABORT comes here.  |
`-----------------------------------*/
yyabortlab:
  yyresult = 1;
  goto yyreturn;

#if !defined yyoverflow || YYERROR_VERBOSE
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here.  |
`-------------------------------------------------*/
yyexhaustedlab:
  yyerror (YY_("memory exhausted"));
  yyresult = 2;
  /* Fall through.  */
#endif

yyreturn:
  if (yychar != YYEMPTY)
    {
      /* Make sure we have latest lookahead translation.  See comments at
         user semantic actions for why this is necessary.  */
      yytoken = YYTRANSLATE (yychar);
      yydestruct ("Cleanup: discarding lookahead",
                  yytoken, &yylval);
    }
  /* Do not reclaim the symbols of the rule whose action triggered
     this YYABORT or YYACCEPT.  */
  YYPOPSTACK (yylen);
  YY_STACK_PRINT (yyss, yyssp);
  while (yyssp != yyss)
    {
      yydestruct ("Cleanup: popping",
                  yystos[*yyssp], yyvsp);
      YYPOPSTACK (1);
    }
#ifndef yyoverflow
  if (yyss != yyssa)
    YYSTACK_FREE (yyss);
#endif
#if YYERROR_VERBOSE
  if (yymsg != yymsgbuf)
    YYSTACK_FREE (yymsg);
#endif
  return yyresult;
}