bool DataSignal :: ReportSmartNoticeObjects (RGTextOutput& text, const RGString& indent, const RGString& delim) { if (NumberOfSmartNoticeObjects () > 0) { int msgLevel = GetHighestMessageLevelWithRestrictionSM (); RGDListIterator it (*mSmartMessageReporters); SmartMessageReporter* nextNotice; text.SetOutputLevel (msgLevel); if (!text.TestCurrentLevel ()) { text.ResetOutputLevel (); return false; } Endl endLine; text << endLine; text << indent << "Notices for curve with (Mean, Sigma, Peak, 2Content, Fit) = " << delim << delim << delim << delim << delim << delim; text << GetMean () << delim << GetStandardDeviation () << delim << Peak () << delim << GetScale (2) << delim << Fit << endLine; while (nextNotice = (SmartMessageReporter*) it ()) text << indent << nextNotice->GetMessage () << nextNotice->GetMessageData () << endLine; text.ResetOutputLevel (); text.Write (1, "\n"); } else return false; return true; }
Boolean CoreBioComponent :: ReportAllSmartNoticeObjects (RGTextOutput& text, const RGString& indent, const RGString& delim, Boolean reportLink) { int severity; Boolean reportedNotices = ReportSmartNoticeObjects (text, indent, delim, reportLink); if (!reportedNotices) { severity = GetLocusAndChannelHighestMessageLevel (); if ((severity > 0) && (severity <= Notice::GetMessageTrigger())) { text.SetOutputLevel (severity); Endl endLine; text << indent << GetSampleName () << " Notices: " << endLine; text.ResetOutputLevel (); } } RGString indent2 = indent + "\t"; bool report = false; if (reportLink) report = true; mLSData->ReportSmartNoticeObjects (text, indent2, delim, report); for (int i=1; i<=mNumberOfChannels; i++) { if (i != mLaneStandardChannel) mDataChannels[i]->ReportAllSmartNoticeObjects (text, indent2, delim, reportLink); } return TRUE; }
int CopyVolumeFile (const RGString& inputFileName, const RGString& outputFileName) { RGFile inputFile (inputFileName, "rt"); if (!inputFile.isValid ()) { cout << "Could not read " << inputFileName.GetData () << " for default volume...exiting" << endl; return -1; } RGString inputFileString; inputFileString.ReadTextFile (inputFile); RGTextOutput outputFile (outputFileName, FALSE); if (!outputFile.FileIsValid ()) { cout << "Could not create " << outputFileName.GetData () << "...exiting" << endl; return -1; } outputFile << inputFileString; return 0; }
Boolean CoreBioComponent :: ReportSmartNoticeObjects (RGTextOutput& text, const RGString& indent, const RGString& delim, Boolean reportLink) { if (NumberOfSmartNoticeObjects () > 0) { int msgLevel = GetHighestMessageLevelWithRestrictionSM (); RGDListIterator it (*mSmartMessageReporters); SmartMessageReporter* nextNotice; text.SetOutputLevel (msgLevel); if (!text.TestCurrentLevel ()) { text.ResetOutputLevel (); return FALSE; } Endl endLine; text << endLine; if (reportLink) text << mTableLink; text << indent << GetSampleName () << " Notices: " << endLine; while (nextNotice = (SmartMessageReporter*) it ()) { text << indent << nextNotice->GetMessage () << nextNotice->GetMessageData () << endLine; } text.ResetOutputLevel (); if (reportLink) { text.SetOutputLevel (msgLevel); text << mTableLink; text.ResetOutputLevel (); } text.Write (1, "\n"); } else return FALSE; return TRUE; }
void DataSignal :: WriteSmartTableArtifactInfoToXML (RGTextOutput& text, RGTextOutput& tempText, const RGString& indent, const RGString& bracketTag, const RGString& locationTag) { int peak; Endl endLine; RGString suffix; RGString label; SmartMessageReporter* notice; int i; RGString virtualAllele; SmartMessageReporter* nextNotice; text.SetOutputLevel (1); int msgNum; smAcceptedOLLeft acceptedOLLeft; smAcceptedOLRight acceptedOLRight; int reportedMessageLevel = GetHighestMessageLevelWithRestrictionSM (); //bool hasThreeLoci; //bool needLocus0; if ((!DontLook ()) && (NumberOfSmartNoticeObjects () != 0)) { bool firstNotice = true; peak = (int) floor (Peak () + 0.5); virtualAllele = GetVirtualAlleleName (); text << indent << "<" << bracketTag << ">" << endLine; // Should be <Artifact> text << indent << "\t<Id>" << GetSignalID () << "</Id>" << endLine; text << indent << "\t<Level>" << reportedMessageLevel << "</Level>" << endLine; text << indent << "\t<RFU>" << peak << "</RFU>" << endLine; text << indent << "\t<" << locationTag << ">" << GetApproximateBioID () << "</" << locationTag << ">" << endLine; text << indent << "\t<PeakArea>" << TheoreticalArea () << "</PeakArea>" << endLine; text << indent << "\t<Time>" << GetMean () << "</Time>" << endLine; text << indent << "\t<Fit>" << GetCurveFit () << "</Fit>" << endLine; if (!mAllowPeakEdit) text << indent << "\t<AllowPeakEdit>false</AllowPeakEdit>" << endLine; RGDListIterator it (*mSmartMessageReporters); i = 0; while (notice = (SmartMessageReporter*) it ()) { if (!notice->GetDisplayOsirisInfo ()) continue; if (firstNotice) { label = indent + "\t<Label>"; firstNotice = false; } if (i > 0) label << " "; label += notice->GetMessage (); label += notice->GetMessageData (); i++; } if (i > 0) { label << "</Label>"; text << label << endLine; } // Now add list of notices... it.Reset (); while (nextNotice = (SmartMessageReporter*) it ()) { msgNum = Notice::GetNextMessageNumber (); nextNotice->SetMessageCount (msgNum); text << indent << "\t<MessageNumber>" << msgNum << "</MessageNumber>" << endLine; tempText << "\t\t<Message>\n"; tempText << "\t\t\t<MessageNumber>" << msgNum << "</MessageNumber>\n"; tempText << "\t\t\t<Text>" << nextNotice->GetMessage () << nextNotice->GetMessageData () << "</Text>\n"; if (nextNotice->HasViableExportInfo ()) { if (nextNotice->IsEnabled ()) tempText << "\t\t\t<Hidden>false</Hidden>\n"; else tempText << "\t\t\t<Hidden>true</Hidden>\n"; if (!nextNotice->IsCritical ()) tempText << "\t\t\t<Critical>false</Critical>\n"; if (nextNotice->IsEnabled ()) tempText << "\t\t\t<Enabled>true</Enabled>\n"; else tempText << "\t\t\t<Enabled>false</Enabled>\n"; if (!nextNotice->IsEditable ()) tempText << "\t\t\t<Editable>false</Editable>\n"; if (nextNotice->GetDisplayExportInfo ()) tempText << "\t\t\t<DisplayExportInfo>true</DisplayExportInfo>\n"; else tempText << "\t\t\t<DisplayExportInfo>false</DisplayExportInfo>\n"; if (!nextNotice->GetDisplayOsirisInfo ()) tempText << "\t\t\t<DisplayOsirisInfo>false</DisplayOsirisInfo>\n"; tempText << "\t\t\t<MsgName>" << nextNotice->GetMessageName () << "</MsgName>\n"; //tempText << "\t\t\t<ExportProtocolList>"; //tempText << "\t\t\t" << nextNotice->GetExportProtocolInformation (); //tempText << "\t\t\t</ExportProtocolList>\n"; } tempText << "\t\t</Message>\n"; } // Now add list of alleles //hasThreeLoci = (mLocus != NULL) && (mLeftLocus != NULL) && (mRightLocus != NULL); //if (mLocus != NULL) { // if ((mLeftLocus == NULL) && (mRightLocus == NULL)) // needLocus0 = true; // else // needLocus0 = false; //} //else // needLocus0 = false; //needLocus0 = (!hasThreeLoci) && ((mLocus != mLeftLocus) || (mLocus != mRightLocus)); if (mLocus != NULL) { //testing RGString locusName = mLocus->GetLocusName (); suffix = GetAlleleName (0); if ((suffix.Length () > 0) || (virtualAllele.Length () > 0)) { text << indent << "\t<Allele>" << endLine; if (suffix.Length () > 0) text << indent << "\t\t<Name>" << suffix << "</Name>" << endLine; else text << indent << "\t\t<Name>" << virtualAllele << "</Name>" << endLine; if (mOffGrid) suffix = "true"; else if (mAcceptedOffGrid) suffix = "accepted"; else suffix = "false"; text << indent << "\t\t<OffLadder>" << suffix << "</OffLadder>" << endLine; text << indent << "\t\t<BPS>" << GetBioID (0) << "</BPS>" << endLine; text << indent << "\t\t<Locus>" << mLocus->GetLocusName () << "</Locus>" << endLine; text << indent << "\t\t<Location>0</Location>" << endLine; text << indent << "\t</Allele>" << endLine; } } if ((mLeftLocus != NULL) && (mLeftLocus != mLocus)) { if (mAlleleNameLeft.Length () > 0) { text << indent << "\t<Allele>" << endLine; text << indent << "\t\t<Name>" << mAlleleNameLeft << "</Name>" << endLine; if (mIsOffGridLeft) suffix = "true"; else if (GetMessageValue (acceptedOLLeft)) suffix = "accepted"; else suffix = "false"; text << indent << "\t\t<OffLadder>" << suffix << "</OffLadder>" << endLine; text << indent << "\t\t<BPS>" << GetBioID (-1) << "</BPS>" << endLine; text << indent << "\t\t<Locus>" << mLeftLocus->GetLocusName () << "</Locus>" << endLine; text << indent << "\t\t<Location>-1</Location>" << endLine; text << indent << "\t</Allele>" << endLine; } } if ((mRightLocus != NULL) && (mRightLocus != mLocus)) { if (mAlleleNameRight.Length () > 0) { text << indent << "\t<Allele>" << endLine; text << indent << "\t\t<Name>" << mAlleleNameRight << "</Name>" << endLine; if (mIsOffGridRight) suffix = "true"; else if (GetMessageValue (acceptedOLRight)) suffix = "accepted"; else suffix = "false"; text << indent << "\t\t<OffLadder>" << suffix << "</OffLadder>" << endLine; text << indent << "\t\t<BPS>" << GetBioID (1) << "</BPS>" << endLine; text << indent << "\t\t<Locus>" << mRightLocus->GetLocusName () << "</Locus>" << endLine; text << indent << "\t\t<Location>1</Location>" << endLine; text << indent << "\t</Allele>" << endLine; } } text << indent << "</" + bracketTag << ">" << endLine; } text.ResetOutputLevel (); }
bool CoreBioComponent :: ReportXMLSmartNoticeObjects (RGTextOutput& text, RGTextOutput& tempText, const RGString& delim) { if (NumberOfSmartNoticeObjects () > 0) { int msgLevel = GetHighestMessageLevelWithRestrictionSM (); RGDListIterator it (*mSmartMessageReporters); SmartMessageReporter* nextNotice; text.SetOutputLevel (msgLevel); tempText.SetOutputLevel (1); int msgNum; int triggerLevel = Notice::GetMessageTrigger (); bool includesExportInfo = false; bool viable; while (nextNotice = (SmartMessageReporter*) it ()) { if (nextNotice->HasViableExportInfo ()) { includesExportInfo = true; break; } } if (!text.TestCurrentLevel () && !includesExportInfo) { text.ResetOutputLevel (); tempText.ResetOutputLevel (); return FALSE; } text.ResetOutputLevel (); text << CLevel (1) << "\t\t\t<SampleAlerts>\n" << PLevel (); it.Reset (); text.SetOutputLevel (1); while (nextNotice = (SmartMessageReporter*) it ()) { viable = nextNotice->HasViableExportInfo (); msgLevel = nextNotice->GetMessagePriority (); if (((msgLevel > 0) && (msgLevel <= triggerLevel)) || viable) { msgNum = Notice::GetNextMessageNumber (); nextNotice->SetMessageCount (msgNum); text << "\t\t\t\t<MessageNumber>" << msgNum << "</MessageNumber>\n"; tempText << "\t\t<Message>\n"; tempText << "\t\t\t<MessageNumber>" << msgNum << "</MessageNumber>\n"; tempText << "\t\t\t<Text>" << nextNotice->GetMessage () << nextNotice->GetMessageData () << "</Text>\n"; if (viable) { if (nextNotice->IsEnabled ()) tempText << "\t\t\t<Hidden>false</Hidden>\n"; else tempText << "\t\t\t<Hidden>true</Hidden>\n"; if (!nextNotice->IsCritical ()) tempText << "\t\t\t<Critical>false</Critical>\n"; if (nextNotice->IsEnabled ()) tempText << "\t\t\t<Enabled>true</Enabled>\n"; else tempText << "\t\t\t<Enabled>false</Enabled>\n"; if (!nextNotice->IsEditable ()) tempText << "\t\t\t<Editable>false</Editable>\n"; if (nextNotice->GetDisplayExportInfo ()) tempText << "\t\t\t<DisplayExportInfo>true</DisplayExportInfo>\n"; else tempText << "\t\t\t<DisplayExportInfo>false</DisplayExportInfo>\n"; if (!nextNotice->GetDisplayOsirisInfo ()) tempText << "\t\t\t<DisplayOsirisInfo>false</DisplayOsirisInfo>\n"; tempText << "\t\t\t<MsgName>" << nextNotice->GetMessageName () << "</MsgName>\n"; //tempText << "\t\t\t<ExportProtocolList>"; //tempText << "\t\t\t" << nextNotice->GetExportProtocolInformation (); //tempText << "\t\t\t</ExportProtocolList>\n"; } tempText << "\t\t</Message>\n"; } } text.ResetOutputLevel (); text << CLevel (1) << "\t\t\t</SampleAlerts>\n" << PLevel (); tempText.ResetOutputLevel (); } else return false; return true; }
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; }