Exemplo n.º 1
0
IndividualGenotype :: IndividualGenotype (const RGString& xmlString) : RGPersistent (), mValid (true) {

	RGString XMLString (xmlString);
	RGBracketStringSearch nameSearch ("<Name>", "</Name>", XMLString);
	RGBracketStringSearch fileCriterionSearch ("<FileNameString>", "</FileNameString>", XMLString);
	RGBracketStringSearch locusSearch ("<Loci>", "</Loci>", XMLString);
	size_t startOffset = 0;
	size_t endOffset = startOffset;
	RGString locusString;

	if (!nameSearch.FindNextBracketedString (startOffset, endOffset, mName))
		mValid = false;

	startOffset = endOffset;

	if (fileCriterionSearch.FindNextBracketedString (startOffset, endOffset, mFileNameSearchString))
		startOffset = endOffset;

	else
		mFileNameSearchString = mName;

	if (!locusSearch.FindNextBracketedString (startOffset, endOffset, locusString))
		mValid = false;

	else {

		mLoci = new LocusCollection (locusString);

		if (!mLoci->isValid ())
			mValid = false;
	}
}
Exemplo n.º 2
0
SynonymList :: SynonymList (const RGString& tagName, const RGString& xmlString) : mIt (mList), mValid (true) {

	RGString startTag = "<" + tagName + ">";
	RGString endTag = "</" + tagName + ">";
	RGString str (xmlString);
	RGString txtSearchStr;
	RGBracketStringSearch TagSearch (startTag, endTag, str);
	RGBracketStringSearch TextSearch ("<text>", "</text>", txtSearchStr);
	RGString textString;
	size_t startPos = 0;
	size_t endPos;
	RGString* newString;

	if (!TagSearch.FindNextBracketedString (startPos, endPos, txtSearchStr))
		mValid = false;

	else {

		startPos = 0;
		TextSearch .ResetSearch ();

		while (TextSearch.FindNextBracketedString (startPos, endPos, textString)) {

			startPos = endPos;
			newString = new RGString (textString);
			mList.Append (newString);
		}
	}
}
Exemplo n.º 3
0
IndividualLocus :: IndividualLocus (const RGString& xmlString) : RGPersistent (), mAlleles (5), mValid (true) {

	RGString XMLString (xmlString);
	RGBracketStringSearch nameSearch ("<Name>", "</Name>", XMLString);
	RGBracketStringSearch alleleSearch ("<Allele>", "</Allele>", XMLString);
	size_t startOffset = 0;
	size_t endOffset;
	IndividualAllele* newAllele;
	RGString alleleString;

	if (!nameSearch.FindNextBracketedString (startOffset, endOffset, mName))
		mValid = false;

	startOffset = endOffset;

	while (alleleSearch.FindNextBracketedString (startOffset, endOffset, alleleString)) {

		startOffset = endOffset;
		newAllele = new IndividualAllele (alleleString);

		if (!newAllele->isValid ())
			mValid = false;

		else {

			mAlleles.Insert (newAllele);
			mAllelesByName.Append (newAllele);
		}
	}

	if (mAlleles.Entries () == 0)
		mValid = false;
}
Exemplo n.º 4
0
bool STRBaseLocus :: GetLadderSearchRegion (size_t& startIndex, RGString& input, const RGString& familyName) {

    RGBracketStringSearch searchRegionsSearch ("<SearchRegions>", "</SearchRegions>", input);
    RGString searchRegion;
    RGString searchDetails;
    RGBracketStringSearch individualRegionsSearch ("<Region>", "</Region>", searchRegion);
    RGBracketStringSearch familyNameSearch ("<ILSName>", "</ILSName>", searchDetails);
    RGBracketStringSearch minILSGridSearch ("<MinGrid>", "</MinGrid>", searchDetails);
    RGBracketStringSearch maxILSGridSearch ("<MaxGrid>", "</MaxGrid>", searchDetails);
    size_t start = startIndex;
    size_t end;
    size_t individualEnd;
    bool foundData = false;
    RGString searchName;
    RGString number;

    if (!searchRegionsSearch.FindNextBracketedString (start, end, searchRegion))
        return false;

    startIndex = end;
    individualRegionsSearch.ResetSearch ();
    start = 0;

    while (individualRegionsSearch.FindNextBracketedString (start, end, searchDetails)) {

        familyNameSearch.ResetSearch ();

        if (!familyNameSearch.FindNextBracketedString (0, individualEnd, searchName))
            return false;

        if (searchName == familyName) {

            minILSGridSearch.ResetSearch ();
            maxILSGridSearch.ResetSearch ();

            if (!minILSGridSearch.FindNextBracketedString (0, individualEnd, number))
                return false;

            LowerBoundGridLSBasePair = number.ConvertToDouble ();

            if (!maxILSGridSearch.FindNextBracketedString (0, individualEnd, number))
                return false;

            UpperBoundGridLSBasePair = number.ConvertToDouble ();
            return true;
        }

        start = end;
    }

    return false;
}
Exemplo n.º 5
0
bool LocusCollection :: AddLoci (const RGString& xmlString) {

	RGString XMLString (xmlString);
	RGBracketStringSearch locusSearch ("<Locus>", "</Locus>", XMLString);
	size_t startOffset = 0;
	size_t endOffset = 0;
	IndividualLocus* newLocus;
	RGString locusString;
	bool returnValue = true;

	while (locusSearch.FindNextBracketedString (startOffset, endOffset, locusString)) {

		startOffset = endOffset;
		newLocus = new IndividualLocus (locusString);

		if (!newLocus->isValid ())
			returnValue = false;

		else {

			mLoci.Insert (newLocus);
			mLociByName.Append (newLocus);
		}
	}

	return returnValue;
}
Exemplo n.º 6
0
LocusCollection :: LocusCollection (const RGString& xmlString) : RGPersistent (), mLoci (31), mValid (true) {

	RGString XMLString (xmlString);
	RGBracketStringSearch locusSearch ("<Locus>", "</Locus>", XMLString);
	size_t startOffset = 0;
	size_t endOffset = 0;
	IndividualLocus* newLocus;
	RGString locusString;

	while (locusSearch.FindNextBracketedString (startOffset, endOffset, locusString)) {

		startOffset = endOffset;
		newLocus = new IndividualLocus (locusString);

		if (!newLocus->isValid ())
			mValid = false;

		else {

			mLoci.Insert (newLocus);
			mLociByName.Append (newLocus);
		}
	}

	if (mLoci.Entries () == 0)
		mValid = false;
}
Exemplo n.º 7
0
IndividualAllele :: IndividualAllele (const RGString& xmlString) : RGPersistent (), mValid (true), mAssociatedPeak (NULL) {

	RGString XMLString (xmlString);
	RGBracketStringSearch nameSearch ("<Name>", "</Name>", XMLString);
//	RGBracketStringSearch bioIDSearch ("<BioID>", "</BioID>", XMLString);
	size_t startOffset = 0;
	size_t endOffset = 0;
//	RGString numberString;

	if (!nameSearch.FindNextBracketedString (startOffset, endOffset, mName))
		mName = xmlString;

/*	if (!bioIDSearch.FindNextBracketedString (startOffset, endOffset, numberString))
		mValid = false;

	mBioID = numberString.ConvertToInteger ();*/
}
Exemplo n.º 8
0
STRBaseAllele :: STRBaseAllele (const RGString& xmlInput) : BaseAllele (xmlInput) {

    RGString Input (xmlInput);
    RGBracketStringSearch BPToken ("<BP>", "</BP>", Input);
    RGString bpString;
    size_t EndPosition;

    if (!BPToken.FindNextBracketedString (0, EndPosition, bpString)) {

        BP = -1;
        Valid = FALSE;
        Msg << "Allele invalid...could not find BP string for allele named " << AlleleName << "\n";
//		cout << "Allele invalid...could not find BP string...name:  " << AlleleName << endl;
    }

    else
        BP = bpString.ConvertToInteger ();
}
Exemplo n.º 9
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;
    }
}
Exemplo n.º 10
0
STRBaseLocus :: STRBaseLocus (const RGString& xmlInput) : BaseLocus (xmlInput), LowerBoundGridLSIndex (-1.0),
    UpperBoundGridLSIndex (-1.0), MinimumGridTime (-1.0), MaximumGridTime (-1.0), LowerBoundGridLSBasePair (-1.0),
    UpperBoundGridLSBasePair (-1.0), mNoExtension (false) {

    mSampleLocusSpecificStutterThreshold = Locus::GetSampleStutterThreshold ();
    mSampleLocusSpecificPlusStutterThreshold = Locus::GetSamplePlusStutterThreshold ();
    mSampleLocusSpecificAdenylationThreshold = Locus::GetSampleAdenylationThreshold ();
    mSampleLocusSpecificFractionalFilter = Locus::GetSampleFractionalFilter ();
    mSampleLocusSpecificPullupFractionalFilter = Locus::GetSamplePullupFractionalFilter ();
    mSampleLocusSpecificHeterozygousImbalanceThreshold = Locus::GetHeterozygousImbalanceLimit ();
    mSampleLocusSpecificMinBoundForHomozygote = Locus::GetMinBoundForHomozygote ();

    mLadderLocusSpecificStutterThreshold = Locus::GetGridStutterThreshold ();
    mLadderLocusSpecificAdenylationThreshold = Locus::GetGridAdenylationThreshold ();
    mLadderLocusSpecificFractionalFilter = Locus::GetGridFractionalFilter ();
    mLadderLocusSpecificPullupFractionalFilter = Locus::GetGridPullupFractionalFilter ();

    RGString Input (xmlInput);
    RGBracketStringSearch MinToken ("<MinBP>", "</MinBP>", Input);
    RGBracketStringSearch MaxToken ("<MaxBP>", "</MaxBP>", Input);
    RGBracketStringSearch LowerGridIndex ("<MinGridLSIndex>", "</MinGridLSIndex>", Input);
    RGBracketStringSearch UpperGridIndex ("<MaxGridLSIndex>", "</MaxGridLSIndex>", Input);
    RGBracketStringSearch CoreRepeatSearch ("<CoreRepeatNumber>", "</CoreRepeatNumber>", Input);
    RGBracketStringSearch LowerGridBasePair ("<MinGridLSBasePair>", "</MinGridLSBasePair>", Input);
    RGBracketStringSearch UpperGridBasePair ("<MaxGridLSBasePair>", "</MaxGridLSBasePair>", Input);

    RGBracketStringSearch NoExtensionSearch ("<NoExtension>", "</NoExtension>", Input);

    RGXMLTagSearch yLinkedSearch ("YLinked", Input);
    RGXMLTagSearch maxExpectedAllelesSearch ("MaxExpectedAlleles", Input);
    RGXMLTagSearch minExpectedAllelesSearch ("MinExpectedAlleles", Input);
    size_t EndPosition;
    RGString BPString;
    RGString extString;
    bool lowerBoundFound = false;
    bool upperBoundFound = false;
    RGString trueString ("true");
    RGString familyName = BaseLocus::GetILSFamilyName ();
//	cout << "Current Family Name = " << familyName.GetData () << endl;  // This was a test to make sure the family name is known at this point.  Test succeeded 12/31/2015.
    bool useILSFamilies = PopulationCollection::UseILSFamiliesInLadderFile ();  // if true, use families; otherwise, use the old way.
    bool isValid = true;
    size_t StartPosition = 0;

    if (NoExtensionSearch.FindNextBracketedString (0, EndPosition, extString)) {

        if (extString.FindNextSubstringCaseIndependent (0, trueString, EndPosition))
            mNoExtension = true;

        else
            mNoExtension = false;
    }

    if (!MinToken.FindNextBracketedString (0, EndPosition, BPString)) {

        Valid = FALSE;
        Msg << "Locus named " << LocusName << " could not find Minimum Base Pair token\n";
        MinimumBP = -1;
    }

    else
        MinimumBP = BPString.ConvertToInteger ();

    if (!MaxToken.FindNextBracketedString (0, EndPosition, BPString)) {

        Valid = FALSE;
        Msg << "Locus named " << LocusName << " could not find Maximum Base Pair token\n";
        MaximumBP = -1;
    }

    else
        MaximumBP = BPString.ConvertToInteger ();

    if (LowerGridIndex.FindNextBracketedString (0, EndPosition, BPString)) {

        LowerBoundGridLSIndex = BPString.ConvertToDouble ();
        lowerBoundFound = true;
    }

    if (UpperGridIndex.FindNextBracketedString (0, EndPosition, BPString)) {

        UpperBoundGridLSIndex = BPString.ConvertToDouble ();
        upperBoundFound = true;
    }

    // test for ladder with ILS Family names here and, if found, use family name instead of the following four if's *******

    if (useILSFamilies) {

        isValid = GetLadderSearchRegion (StartPosition, Input, familyName);

        if (!isValid) {

            Valid = FALSE;
            Msg << "Locus named " << LocusName << " could not find family-based search region\n";
        }
    }

    else {

        if (LowerGridBasePair.FindNextBracketedString (0, EndPosition, BPString)) {

            LowerBoundGridLSBasePair = BPString.ConvertToDouble ();
            lowerBoundFound = true;
        }

        if (UpperGridBasePair.FindNextBracketedString (0, EndPosition, BPString)) {

            UpperBoundGridLSBasePair = BPString.ConvertToDouble ();
            upperBoundFound = true;
        }

        if (!lowerBoundFound) {

            Valid = FALSE;
            Msg << "Locus named " << LocusName << " could not find Minimum Grid Internal Lane Standard token, either index or base pair\n";
        }

        if (!upperBoundFound) {

            Valid = FALSE;
            Msg << "Locus named " << LocusName << " could not find Maximum Grid Internal Lane Standard token, either index or base pair\n";
        }
    }

    if (!CoreRepeatSearch.FindNextBracketedString (0, EndPosition, BPString))
        CoreRepeatNumber = 4;

    else
        CoreRepeatNumber = BPString.ConvertToInteger ();

    if (!yLinkedSearch.FindNextTag (0, EndPosition, BPString))
        mIsYLinked = false;

    else {

        if (BPString == "false")
            mIsYLinked = false;

        else
            mIsYLinked = true;
    }

    if (!maxExpectedAllelesSearch.FindNextTag (0, EndPosition, BPString))
        mMaxExpectedAlleles = 2;

    else
        mMaxExpectedAlleles = BPString.ConvertToInteger ();

    if (!minExpectedAllelesSearch.FindNextTag (0, EndPosition, BPString))
        mMinExpectedAlleles = 1;

    else
        mMinExpectedAlleles = BPString.ConvertToInteger ();

    if (!Valid) {

        Msg << "XML Input:\n" << Input << "\n";
    }
}
Exemplo n.º 11
0
STRBaseLocus :: STRBaseLocus (const RGString& xmlInput) : BaseLocus (xmlInput), LowerBoundGridLSIndex (-1.0),
UpperBoundGridLSIndex (-1.0), MinimumGridTime (-1.0), MaximumGridTime (-1.0), LowerBoundGridLSBasePair (-1.0), 
UpperBoundGridLSBasePair (-1.0) {

	mSampleLocusSpecificStutterThreshold = Locus::GetSampleStutterThreshold ();
	mSampleLocusSpecificPlusStutterThreshold = Locus::GetSamplePlusStutterThreshold ();
	mSampleLocusSpecificAdenylationThreshold = Locus::GetSampleAdenylationThreshold ();
	mSampleLocusSpecificFractionalFilter = Locus::GetSampleFractionalFilter ();
	mSampleLocusSpecificPullupFractionalFilter = Locus::GetSamplePullupFractionalFilter ();
	mSampleLocusSpecificHeterozygousImbalanceThreshold = Locus::GetHeterozygousImbalanceLimit ();
	mSampleLocusSpecificMinBoundForHomozygote = Locus::GetMinBoundForHomozygote ();

	mLadderLocusSpecificStutterThreshold = Locus::GetGridStutterThreshold ();
	mLadderLocusSpecificAdenylationThreshold = Locus::GetGridAdenylationThreshold ();
	mLadderLocusSpecificFractionalFilter = Locus::GetGridFractionalFilter ();
	mLadderLocusSpecificPullupFractionalFilter = Locus::GetGridPullupFractionalFilter ();

	RGString Input (xmlInput);
	RGBracketStringSearch MinToken ("<MinBP>", "</MinBP>", Input);
	RGBracketStringSearch MaxToken ("<MaxBP>", "</MaxBP>", Input);
	RGBracketStringSearch LowerGridIndex ("<MinGridLSIndex>", "</MinGridLSIndex>", Input);
	RGBracketStringSearch UpperGridIndex ("<MaxGridLSIndex>", "</MaxGridLSIndex>", Input);
	RGBracketStringSearch CoreRepeatSearch ("<CoreRepeatNumber>", "</CoreRepeatNumber>", Input);
	RGBracketStringSearch LowerGridBasePair ("<MinGridLSBasePair>", "</MinGridLSBasePair>", Input);
	RGBracketStringSearch UpperGridBasePair ("<MaxGridLSBasePair>", "</MaxGridLSBasePair>", Input);

	RGXMLTagSearch yLinkedSearch ("YLinked", Input);
	RGXMLTagSearch maxExpectedAllelesSearch ("MaxExpectedAlleles", Input);
	RGXMLTagSearch minExpectedAllelesSearch ("MinExpectedAlleles", Input);
	size_t EndPosition;
	RGString BPString;
	bool lowerBoundFound = false;
	bool upperBoundFound = false;

	if (!MinToken.FindNextBracketedString (0, EndPosition, BPString)) {

		Valid = FALSE;
		Msg << "Locus named " << LocusName << " could not find Minimum Base Pair token\n";
		MinimumBP = -1;
	}

	else
		MinimumBP = BPString.ConvertToInteger ();

	if (!MaxToken.FindNextBracketedString (0, EndPosition, BPString)) {

		Valid = FALSE;
		Msg << "Locus named " << LocusName << " could not find Maximum Base Pair token\n";
		MaximumBP = -1;
	}

	else
		MaximumBP = BPString.ConvertToInteger ();

	if (LowerGridIndex.FindNextBracketedString (0, EndPosition, BPString)) {

		LowerBoundGridLSIndex = BPString.ConvertToDouble ();
		lowerBoundFound = true;
	}

	if (UpperGridIndex.FindNextBracketedString (0, EndPosition, BPString)) {

		UpperBoundGridLSIndex = BPString.ConvertToDouble ();
		upperBoundFound = true;
	}

	if (LowerGridBasePair.FindNextBracketedString (0, EndPosition, BPString)) {

		LowerBoundGridLSBasePair = BPString.ConvertToDouble ();
		lowerBoundFound = true;
	}

	if (UpperGridBasePair.FindNextBracketedString (0, EndPosition, BPString)) {

		UpperBoundGridLSBasePair = BPString.ConvertToDouble ();
		upperBoundFound = true;
	}

	if (!lowerBoundFound) {

		Valid = FALSE;
		Msg << "Locus named " << LocusName << " could not find Minimum Grid Internal Lane Standard token, either index or base pair\n";
	}

	if (!upperBoundFound) {

		Valid = FALSE;
		Msg << "Locus named " << LocusName << " could not find Maximum Grid Internal Lane Standard token, either index or base pair\n";
	}

	if (!CoreRepeatSearch.FindNextBracketedString (0, EndPosition, BPString))
		CoreRepeatNumber = 4;

	else
		CoreRepeatNumber = BPString.ConvertToInteger ();

	if (!yLinkedSearch.FindNextTag (0, EndPosition, BPString))
		mIsYLinked = false;

	else {

		if (BPString == "false")
			mIsYLinked = false;

		else
			mIsYLinked = true;
	}

	if (!maxExpectedAllelesSearch.FindNextTag (0, EndPosition, BPString))
		mMaxExpectedAlleles = 2;

	else
		mMaxExpectedAlleles = BPString.ConvertToInteger ();

	if (!minExpectedAllelesSearch.FindNextTag (0, EndPosition, BPString))
		mMinExpectedAlleles = 1;

	else
		mMinExpectedAlleles = BPString.ConvertToInteger ();

	if (!Valid) {

		Msg << "XML Input:\n" << Input << "\n";
	}
}