int CoreBioComponent :: AnalyzeGridSM (SampleData& fileData, GridDataStruct* gridData) { // // This is ladder stage 1 // Endl endLine; RGString Notice; smTestForColorCorrectionMatrixPreset testForColorCorrectionMatrixPreset; int status = InitializeSM (fileData, gridData->mCollection, gridData->mMarkerSetName, TRUE); if (status < 0) { Notice << "BioComponent could not initialize:"; cout << Notice << endl; gridData->mExcelText << CLevel (1) << Notice << "\n" << ErrorString << "Skipping...\n" << PLevel (); gridData->mText << Notice << "\n" << ErrorString << "Skipping\n"; return -1; } if (CoreBioComponent::UseRawData) { if (GetMessageValue (testForColorCorrectionMatrixPreset)) status = SetAllRawDataWithMatrixSM (fileData, gridData->mTestControlPeak, gridData->mTestControlPeak); else status = SetAllRawDataSM (fileData, gridData->mTestControlPeak, gridData->mTestControlPeak); } else status = SetAllDataSM (fileData, gridData->mTestControlPeak, gridData->mTestControlPeak); if (status < 0) { Notice << "BioComponent could not set data:"; cout << Notice << endl; gridData->mExcelText << CLevel (1) << Notice << "\n" << ErrorString << "Skipping...\n" << PLevel (); gridData->mText << Notice << "\n" << ErrorString << "Skipping...\n"; return -2; } if (CoreBioComponent::UseRawData) FindAndRemoveFixedOffsets (); status = AnalyzeGridSM (gridData->mText, gridData->mExcelText, gridData->mMsg); if (status < 0) { Notice << "BioComponent could not analyze grid. Skipping..."; cout << Notice << endl; Notice << "\n"; gridData->mExcelText.Write (1, Notice); gridData->mText << Notice; return -3; } return 0; }
void CPlayerLevels::AddLevel( const FData& level, const std::string& levelId, std::list<CLevel>& levelList ) { FData value; value = level.get("PlayerId",value); if(!value.isString()) { return; } std::string playerId(value.asString()); value = level.get("PlayerName",value); std::string playerName(value.asString()); value = level.get("PlayerSource",value); std::string playerSource(value.asString()); value = level.get("Name",value); std::string name(value.asString()); value = level.get("Data",value); std::string ldata(value.asString()); value = level.get("thumb",value); std::string lthumb(value.asString()); value = level.get("RDate",value); std::string relativeDate(value.asString()); value = level.get("SDate",value); std::string date(value.asString()); value = level.get("Plays",value); int plays = value.asInt(); value = level.get("Votes",value); int votes = value.asInt(); value = level.get("Score",value); int score = value.asInt(); value = level.get("Rating",value); float rating = value.asFloat(); value = level.get("CustomData",value); CustomData customData; Json::ValueIterator it = value.begin(); for(; it != value.end(); it++) { customData.insert(std::make_pair(it.key().asString(), (*it).asString())); } levelList.push_back( CLevel(name, playerName, playerId, playerSource, ldata, lthumb, votes, plays, rating, score, date, relativeDate, customData, levelId)); }
void CoreBioComponent :: ReportXMLSmartSampleTableRowWithLinks (RGTextOutput& text, RGTextOutput& tempText) { RGString type; if (mIsNegativeControl) type = "-Control"; else if (mIsPositiveControl) type = "+Control"; else type = "Sample"; RGString pResult; RGString SimpleFileName (mName); size_t startPos = 0; size_t endPos; size_t length = SimpleFileName.Length (); if (SimpleFileName.FindLastSubstringCaseIndependent (DirectoryManager::GetDataFileType (), startPos, endPos)) { if (endPos == length - 1) SimpleFileName.ExtractAndRemoveLastCharacters (4); } SimpleFileName.FindAndReplaceAllSubstrings ("\\", "/"); startPos = endPos = 0; if (SimpleFileName.FindLastSubstring ("/", startPos, endPos)) { SimpleFileName.ExtractAndRemoveSubstring (0, startPos); } text << CLevel (1) << "\t\t<Sample>\n"; text << "\t\t\t<Name>" << xmlwriter::EscAscii (SimpleFileName, &pResult) << "</Name>\n"; text << "\t\t\t<SampleName>" << xmlwriter::EscAscii (mSampleName, &pResult) << "</SampleName>\n"; text << "\t\t\t<RunStart>" << mRunStart.GetData () << "</RunStart>\n"; text << "\t\t\t<Type>" << type.GetData () << "</Type>\n" << PLevel (); int trigger = Notice::GetMessageTrigger (); // int channelHighestLevel; // bool channelAlerts = false; int cbcHighestMsgLevel = GetHighestMessageLevelWithRestrictionSM (); RGDListIterator it (*mSmartMessageReporters); SmartMessageReporter* nextNotice; bool includesExportInfo = false; while (nextNotice = (SmartMessageReporter*) it ()) { if (nextNotice->HasViableExportInfo ()) { includesExportInfo = true; break; } } if (((cbcHighestMsgLevel > 0) && (cbcHighestMsgLevel <= trigger)) || includesExportInfo) { // text << CLevel (1) << "\t\t\t<SampleAlerts>\n" << PLevel (); // get message numbers and report ReportXMLSmartNoticeObjects (text, tempText, " "); // text << CLevel (1) << "\t\t\t</SampleAlerts>\n" << PLevel (); } mDataChannels [mLaneStandardChannel]->ReportXMLILSSmartNoticeObjects (text, tempText, " "); int i; //for (i=1; i<=mNumberOfChannels; i++) { // //if (i == mLaneStandardChannel) // // continue; // channelHighestLevel = mDataChannels [i]->GetHighestMessageLevelWithRestrictionSM (); // if ((channelHighestLevel > 0) && (channelHighestLevel <= trigger)) { // channelAlerts = true; // break; // } //} // if (channelAlerts) { text << CLevel (1) << "\t\t\t<ChannelAlerts>\n" << PLevel (); for (i=1; i<=mNumberOfChannels; i++) { if (i == mLaneStandardChannel) continue; mDataChannels [i]->ReportXMLSmartNoticeObjects (text, tempText, " "); } text << CLevel (1) << "\t\t\t</ChannelAlerts>\n" << PLevel (); // } mMarkerSet->ResetLocusList (); Locus* nextLocus; while (nextLocus = mMarkerSet->GetNextLocus ()) { nextLocus->ReportXMLSmartSampleTableRowWithLinks (text, tempText, " "); } if (mIsPositiveControl) text << CLevel (1) << "\t\t\t<PositiveControl>" << mPositiveControlName << "</PositiveControl>\n"; text << CLevel (1) << "\t\t</Sample>\n" << PLevel (); }
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 CoreBioComponent :: PrepareSampleForAnalysisSM (SampleData& fileData, SampleDataStruct* sampleData) { // // This is sample stage 1 // Endl endLine; smTestForColorCorrectionMatrixPreset testForColorCorrectionMatrixPreset; RGString notice; notice << "Analyzing sample named " << GetSampleName () << "\n"; sampleData->mExcelText.Write (1, notice); sampleData->mText << notice; notice = ""; // Notice* newNotice; // BlobFound newNotice; smILSFailed ilsRequiresReview; smNormalizeRawDataRelativeToBaselinePreset normalizeRawData; smEnableRawDataFilterForNormalizationPreset enableFilteringForNormalization; Progress = 0; int j; int status = InitializeSM (fileData, sampleData->mCollection, sampleData->mMarkerSetName, FALSE); if (status < 0) { notice << "BIOCOMPONENT COULD NOT INITIALIZE:"; cout << notice << endl; sampleData->mExcelText.Write (1, notice); sampleData->mExcelText << CLevel (1) << notice << "\n" << ErrorString << "Skipping...\n" << PLevel (); sampleData->mText << notice << "\n" << ErrorString << "Skipping...\n"; return -1; } Progress = 1; if (CoreBioComponent::UseRawData) { if (GetMessageValue (testForColorCorrectionMatrixPreset)) status = SetAllRawDataWithMatrixSM (fileData, sampleData->mTestControlPeak, sampleData->mTestSamplePeak); else status = SetAllRawDataSM (fileData, sampleData->mTestControlPeak, sampleData->mTestSamplePeak); } else status = SetAllDataSM (fileData, sampleData->mTestControlPeak, sampleData->mTestSamplePeak); if (status < 0) { notice << "BIOCOMPONENT COULD NOT SET DATA:"; cout << notice << endl; sampleData->mExcelText << CLevel (1) << notice << "\n" << ErrorString << "Skipping...\n" << PLevel (); sampleData->mText << notice << "\n" << ErrorString << "Skipping...\n"; return -2; } CoreBioComponent::InitializeOffScaleData (fileData); Progress = 2; if (CoreBioComponent::UseRawData) { status = FindAndRemoveFixedOffsets (); if (status < 0) { notice << "BIOCOMPONENT COULD NOT COMPUTE OFFSETS ACCURATELY. Skipping..."; cout << notice << endl; sampleData->mExcelText.Write (1, notice); sampleData->mText << notice << "\n" << ErrorString << " Skipping...\n"; return -5; } } if (GetMessageValue (enableFilteringForNormalization)) ChannelData::SetUseNormalizationFilter (true); else ChannelData::SetUseNormalizationFilter (false); if (GetMessageValue (normalizeRawData) && GetMessageValue (enableFilteringForNormalization)) CreateAndSubstituteFilteredDataSignalForRawDataNonILS (); // status = FitAllCharacteristicsSM (sampleData->mText, sampleData->mExcelText, sampleData->mMsg, FALSE); // ->FALSE status = FitAllSampleCharacteristicsSM (sampleData->mText, sampleData->mExcelText, sampleData->mMsg, FALSE); // ->FALSE if (status < 0) { notice << "BIOCOMPONENT COULD NOT FIT ALL CHARACTERISTICS. Skipping..."; cout << notice << endl; sampleData->mExcelText.Write (1, notice); sampleData->mText << notice << "\n" << ErrorString << "Skipping...\n"; return -3; } Progress = 3; // mLSData->ClearAllPeaksBelowAnalysisThreshold (); if (!GetMessageValue (normalizeRawData)) { //AnalyzeCrossChannelSM (); // Moved below - 07/31/2013 //status = AnalyzeLaneStandardChannelSM (sampleData->mText, sampleData->mExcelText, sampleData->mMsg, sampleData->mPrint); //if (status < 0) { // notice << "BIOCOMPONENT COULD NOT ANALYZE INTERNAL LANE STANDARD. Skipping..."; // cout << notice << endl; // sampleData->mExcelText << CLevel (1) << notice << "\n" << ErrorString << "Skipping...\n" << PLevel (); // sampleData->mText << notice << "\n" << ErrorString << "Skipping...\n"; // SetMessageValue (ilsRequiresReview, true); // return -4; //} status = 0; for (j=1; j<=mNumberOfChannels; j++) { if (mDataChannels [j]->SetAllApproximateIDs (mLSData) < 0) status = -1; } if (status < 0) { notice << "BIOCOMPONENT COULD NOT UTILIZE INTERNAL LANE STANDARD. Skipping..."; cout << notice << endl; SetMessageValue (ilsRequiresReview, true); notice = "Could not create ILS time to base pairs transform"; SetDataForSmartMessage (ilsRequiresReview, notice); return -5; } //AnalyzeCrossChannelSM (); // Moved here 07/31/2013...happy birthday, Mom. You'd be 99 today. AnalyzeCrossChannelWithNegativePeaksSM (); // TestSignalsForLaserOffScaleSM (); // Moved inside AnalyzeCrossChannelWithNegativePeaksSM 09/09/2014 cout << "Analyzed cross channel links with negative peaks" << endl; Progress = 4; return 0; } // // In this branch, we normalize the raw data with respect to the dynamic baseline. First, analyze the lane standard, then find // the baseline and subtract it from the raw data. Finally, refit all non-lane standard channels and continue as before. // /*status = AnalyzeLaneStandardChannelSM (sampleData->mText, sampleData->mExcelText, sampleData->mMsg, sampleData->mPrint); if (status < 0) { notice << "BIOCOMPONENT COULD NOT ANALYZE INTERNAL LANE STANDARD. Skipping..."; cout << notice << endl; sampleData->mExcelText << CLevel (1) << notice << "\n" << ErrorString << "Skipping...\n" << PLevel (); sampleData->mText << notice << "\n" << ErrorString << "Skipping...\n"; SetMessageValue (ilsRequiresReview, true); return -4; }*/ status = 0; for (j=1; j<=mNumberOfChannels; j++) { if (mDataChannels [j]->SetAllApproximateIDs (mLSData) < 0) status = -1; } if (NormalizeBaselineForNonILSChannelsSM () < 0) { notice << "BIOCOMPONENT COULD NOT ANALYZE BASELINE. OMITTING BASELINE ANALYSIS..."; cout << notice << endl; status = -1; } //RestoreRawDataAndDeleteFilteredSignalNonILS (); // 02/02/2014: This is now done at the channel level within normalization function. status = FitNonLaneStandardCharacteristicsSM (sampleData->mText, sampleData->mExcelText, sampleData->mMsg, FALSE); // ->FALSE FitNonLaneStandardNegativeCharacteristicsSM (sampleData->mText, sampleData->mExcelText, sampleData->mMsg, FALSE); if (status < 0) { notice << "BIOCOMPONENT COULD NOT FIT ALL NON ILS CHARACTERISTICS. Skipping..."; cout << notice << endl; sampleData->mExcelText.Write (1, notice); sampleData->mText << notice << "\n" << ErrorString << "Skipping...\n"; return -3; } for (j=1; j<=mNumberOfChannels; j++) { if (mDataChannels [j]->SetAllApproximateIDs (mLSData) < 0) status = -1; } if (status < 0) { notice << "BIOCOMPONENT COULD NOT UTILIZE INTERNAL LANE STANDARD. Skipping..."; cout << notice << endl; SetMessageValue (ilsRequiresReview, true); notice = "Could not create ILS time to base pairs transform"; SetDataForSmartMessage (ilsRequiresReview, notice); return -5; } //AnalyzeCrossChannelSM (); AnalyzeCrossChannelWithNegativePeaksSM (); // TestSignalsForLaserOffScaleSM (); // Moved inside AnalyzeCrossChannelWithNegativePeaksSM 09/09/2014 Progress = 4; return 0; }
bool COptions::LoadLevels(std::string dynamicDataFolder, std::string pgmFolder) { long FindHandle; _finddata_t FindData; #ifndef WIN32 // initialise OUR data structure FindData.name = NULL; FindData.suffix = NULL; #endif //------------------------------------------- // Set the path where the level files are stored // (in the program files folder) //------------------------------------------- std::string levelFilePath_pgmFolder; levelFilePath_pgmFolder = pgmFolder; if (pgmFolder.length() >= 1) { char delim = pgmFolder.c_str()[pgmFolder.length()-1]; if (delim != '\\' && delim != '/') #ifdef WIN32 levelFilePath_pgmFolder.append("\\"); #else levelFilePath_pgmFolder.append("/"); #endif } #ifdef WIN32 levelFilePath_pgmFolder.append( "Levels\\" ); #else levelFilePath_pgmFolder.append( "levels/" ); #endif std::string levelFilePath_pgmFolderMask; levelFilePath_pgmFolderMask = levelFilePath_pgmFolder; levelFilePath_pgmFolderMask.append( "*.TXT" ); //------------------------------------------- // Determine number of level files available // (in the program files folder) //------------------------------------------- theLog.WriteLine( "Options => Loading level files '%s'.", levelFilePath_pgmFolderMask.c_str() ); std::vector<SFileInfo> files; FindHandle = _findfirst( levelFilePath_pgmFolderMask.c_str(), &FindData ); if (FindHandle != -1) { do { SFileInfo file; file.fileNameWithoutPath = FindData.name; file.fileNameWithPath = levelFilePath_pgmFolder; file.fileNameWithPath.append(FindData.name); files.push_back(file); } while (_findnext(FindHandle, &FindData) != -1); } _findclose(FindHandle); // If a dynamic folder is set, load level files from there, too if ( dynamicDataFolder != "" ) { //------------------------------------------- // Set the path where the level files are stored // (in the user's application data folder) //------------------------------------------- std::string levelFilePath_dynamicDataFolder; levelFilePath_dynamicDataFolder = dynamicDataFolder; #ifdef WIN32 levelFilePath_dynamicDataFolder.append( "levels\\" ); #else levelFilePath_dynamicDataFolder.append( "levels/" ); #endif std::string levelFilePath_dynamicDataFolderMask; levelFilePath_dynamicDataFolderMask = levelFilePath_dynamicDataFolder; levelFilePath_dynamicDataFolderMask.append( "*.TXT" ); //------------------------------------------- // Determine number of level files available // (in the dynamic data folder) //------------------------------------------- theLog.WriteLine( "Options => Loading level files '%s'.", levelFilePath_dynamicDataFolderMask.c_str() ); FindHandle = _findfirst( levelFilePath_dynamicDataFolderMask.c_str(), &FindData ); if (FindHandle != -1) { do { SFileInfo file; file.fileNameWithoutPath = FindData.name; file.fileNameWithPath = levelFilePath_dynamicDataFolder; file.fileNameWithPath.append(FindData.name); files.push_back(file); } while (_findnext(FindHandle, &FindData) != -1); } _findclose(FindHandle); } //--------------------- // Sort //--------------------- #ifdef WIN32 sort(files.begin(), files.end(), [&](const SFileInfo& a, const SFileInfo& b) {return (a.fileNameWithoutPath < b.fileNameWithoutPath);} ); #endif for (std::vector<SFileInfo>::iterator it = files.begin(); it != files.end(); ++it) { // Create a new CLevel element and add it to the level container m_Levels.push_back(CLevel(it->fileNameWithPath, it->fileNameWithoutPath)); } //--------------------- // Check for a problem //--------------------- // If there is no level if (m_Levels.size() == 0) { // Log failure theLog.WriteLine ("Options => !!! There should be at least 1 level."); return false; } // If the level number we read in the cfg file is invalid compared to the number of existing levels if (m_Level >= (int)m_Levels.size()) // #3078839 { // Select the first level m_Level = 0; } //------------------------------------------------------ // Load all the level files detected earlier //------------------------------------------------------ bool ErrorOccurred = false; for( unsigned int CurrentLevel = 0; CurrentLevel < m_Levels.size(); CurrentLevel++ ) { //theLog.WriteLine ("Options => Loading level file %s...", levelFileNames_full.at(CurrentLevel).c_str() ); if ( !m_Levels.at( CurrentLevel ).LoadFromFile() ) { ErrorOccurred = true; break; } } // If we had to stop then there is a problem. if (ErrorOccurred) return false; // Everything went right return true; }