void StructureManager::UpdateTruthValues() { if (m_referenceIndex == -1) { ClearTruthValues(); return; } RNAStructure* refStructure = m_structures[m_referenceIndex]; int length = refStructure->GetLength(); for (int j = 0; j < length; ++j) { refStructure->GetBaseAt(j)->m_truth = RNAStructure::TruePositive; } for (int i = 0; i < m_structureCount; ++i) { RNAStructure* otherStructure = m_structures[i]; if (!otherStructure || otherStructure == refStructure) continue; for (int j = 0; j < length; ++j) { RNAStructure::BaseData* refBase = refStructure->GetBaseAt(j); RNAStructure::BaseData* otherBase = refStructure->GetBaseAt(j); if (refBase->m_pair == RNAStructure::UNPAIRED) { if (otherBase->m_pair == RNAStructure::UNPAIRED) { otherBase->m_truth = RNAStructure::TrueNegative; } else { otherBase->m_truth = RNAStructure::FalsePositive; } } else { if (otherBase->m_pair == RNAStructure::UNPAIRED) { otherBase->m_truth = RNAStructure::FalseNegative; } else if (otherBase->m_pair == refBase->m_pair) { otherBase->m_truth = RNAStructure::TruePositive; } else { otherBase->m_truth = RNAStructure::FalsePositive; } } } } }
/*May not be quite right, modified from orignial code*/ void StatsWindow::UpdateTruthValues() { if (referenceIndex == -1) { ClearTruthValues(); return; } StructureManager* structureManager = RNAStructViz::GetInstance()->GetStructureManager(); Folder* folder = structureManager->GetFolderAt(folderIndex); RNAStructure* refStructure = structureManager->GetStructure(referenceIndex); int length = refStructure->GetLength(); for (int j = 0; j < length; ++j) { refStructure->GetBaseAt(j)->m_truth = RNAStructure::TruePositive; } int shift = 0; for (int i = 0; i < folder->structCount; ++i) { if(folder->folderStructs[(i + shift)] == -1) shift++; if(folder->folderStructs[(i + shift)] != -1) { RNAStructure* otherStructure = structureManager->GetStructure((i+shift)); if (!otherStructure || otherStructure == refStructure) continue; for (int j = 0; j < length; ++j) { RNAStructure::BaseData* refBase = refStructure->GetBaseAt(j); RNAStructure::BaseData* otherBase = otherStructure->GetBaseAt(j); if (refBase->m_pair == RNAStructure::UNPAIRED) { if (otherBase->m_pair == RNAStructure::UNPAIRED) { otherBase->m_truth = RNAStructure::TrueNegative; } else { otherBase->m_truth = RNAStructure::FalsePositive; } } else { if (otherBase->m_pair == RNAStructure::UNPAIRED) { otherBase->m_truth = RNAStructure::FalseNegative; } else if (otherBase->m_pair == refBase->m_pair) { otherBase->m_truth = RNAStructure::TruePositive; } else { otherBase->m_truth = RNAStructure::FalsePositive; } } } } } }