From 79fb32cfc9decd7f8cd8f1cfd284d8f20b05070f Mon Sep 17 00:00:00 2001 From: Ryan Wick Date: Fri, 16 Oct 2015 09:24:28 +1100 Subject: [PATCH 1/3] Reset contiguity status after a graph edit --- ui/mainwindow.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ui/mainwindow.cpp b/ui/mainwindow.cpp index 4d4c449c..65dd7f7d 100644 --- a/ui/mainwindow.cpp +++ b/ui/mainwindow.cpp @@ -2228,7 +2228,11 @@ void MainWindow::removeSelection() g_assemblyGraph->determineGraphInfo(); displayGraphDetails(); + + //Now that the graph has changed, we have to reset BLAST and contiguity + //stuff, as they may no longer apply. cleanUpAllBlast(); + g_assemblyGraph->resetNodeContiguityStatus(); } @@ -2259,7 +2263,11 @@ void MainWindow::duplicateSelectedNodes() g_assemblyGraph->determineGraphInfo(); displayGraphDetails(); + + //Now that the graph has changed, we have to reset BLAST and contiguity + //stuff, as they may no longer apply. cleanUpAllBlast(); + g_assemblyGraph->resetNodeContiguityStatus(); } void MainWindow::mergeSelectedNodes() @@ -2300,7 +2308,11 @@ void MainWindow::mergeSelectedNodes() g_assemblyGraph->determineGraphInfo(); displayGraphDetails(); + + //Now that the graph has changed, we have to reset BLAST and contiguity + //stuff, as they may no longer apply. cleanUpAllBlast(); + g_assemblyGraph->resetNodeContiguityStatus(); } void MainWindow::mergeAllPossible() @@ -2328,7 +2340,11 @@ void MainWindow::mergeAllPossible() { g_assemblyGraph->determineGraphInfo(); displayGraphDetails(); + + //Now that the graph has changed, we have to reset BLAST and contiguity + //stuff, as they may no longer apply. cleanUpAllBlast(); + g_assemblyGraph->resetNodeContiguityStatus(); } else QMessageBox::information(this, "No possible merges", "The graph contains no nodes that can be merged."); From 5b22daeca8cad31efa5fde503c7e9b611b56704b Mon Sep 17 00:00:00 2001 From: Ryan Wick Date: Fri, 16 Oct 2015 09:35:17 +1100 Subject: [PATCH 2/3] Copy additional data when duplicating a node --- graph/assemblygraph.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/graph/assemblygraph.cpp b/graph/assemblygraph.cpp index 2a5f7f86..e8430df3 100644 --- a/graph/assemblygraph.cpp +++ b/graph/assemblygraph.cpp @@ -1945,12 +1945,20 @@ void AssemblyGraph::duplicateNodePair(DeBruijnNode * node, MyGraphicsScene * sce double newReadDepth = node->getReadDepth() / 2.0; + //Create the new nodes. DeBruijnNode * newPosNode = new DeBruijnNode(newPosNodeName, newReadDepth, originalPosNode->getSequence()); DeBruijnNode * newNegNode = new DeBruijnNode(newNegNodeName, newReadDepth, originalNegNode->getSequence()); - newPosNode->setReverseComplement(newNegNode); newNegNode->setReverseComplement(newPosNode); + //Copy over additional stuff from the original nodes. + newPosNode->setCustomColour(originalPosNode->getCustomColour()); + newNegNode->setCustomColour(originalNegNode->getCustomColour()); + newPosNode->setCustomLabel(originalPosNode->getCustomLabel()); + newNegNode->setCustomLabel(originalNegNode->getCustomLabel()); + newPosNode->setCsvData(originalPosNode->getAllCsvData()); + newNegNode->setCsvData(originalNegNode->getAllCsvData()); + m_deBruijnGraphNodes.insert(newPosNodeName, newPosNode); m_deBruijnGraphNodes.insert(newNegNodeName, newNegNode); From 501955f07697b1db2f24dc1c86169f4a1c7b823c Mon Sep 17 00:00:00 2001 From: Ryan Wick Date: Fri, 16 Oct 2015 09:37:37 +1100 Subject: [PATCH 3/3] Reset node colours after resetting contiguity --- graph/assemblygraph.cpp | 2 ++ ui/mainwindow.cpp | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/graph/assemblygraph.cpp b/graph/assemblygraph.cpp index e8430df3..2b8a245e 100644 --- a/graph/assemblygraph.cpp +++ b/graph/assemblygraph.cpp @@ -299,6 +299,8 @@ void AssemblyGraph::resetNodeContiguityStatus() i.value()->resetContiguityStatus(); } m_contiguitySearchDone = false; + + resetAllNodeColours(); } void AssemblyGraph::resetAllNodeColours() diff --git a/ui/mainwindow.cpp b/ui/mainwindow.cpp index 65dd7f7d..24c5b439 100644 --- a/ui/mainwindow.cpp +++ b/ui/mainwindow.cpp @@ -1030,7 +1030,6 @@ void MainWindow::switchColourScheme() void MainWindow::determineContiguityFromSelectedNode() { g_assemblyGraph->resetNodeContiguityStatus(); - g_assemblyGraph->resetAllNodeColours(); std::vector selectedNodes = m_scene->getSelectedNodes(); if (selectedNodes.size() > 0)