From 04c0e46f6dc1de414f3fea6f54527599db32bc28 Mon Sep 17 00:00:00 2001 From: Shostina Date: Mon, 15 Jan 2024 08:31:56 +0300 Subject: [PATCH] Move graph's titles with nodes --- command_line/image.cpp | 2 +- graph/assemblygraphlist.cpp | 7 ++- graph/assemblygraphlist.h | 36 +++++++------- graph/graphicsitemnode.cpp | 11 ++++- graph/nodecolorer.cpp | 16 ++----- graphsearch/blast/blastsearch.cpp | 6 +-- graphsearch/hmmer/hmmersearch.cpp | 4 +- graphsearch/minimap2/minimap2search.cpp | 4 +- layout/graphlayoutworker.cpp | 12 +++-- painting/textgraphicsitemnode.cpp | 14 ++---- program/settings.h | 1 + ui/mainwindow.cpp | 64 ++++++++++++++----------- ui/mainwindow.h | 1 + ui/mainwindow.ui | 23 +++++++-- 14 files changed, 113 insertions(+), 88 deletions(-) diff --git a/command_line/image.cpp b/command_line/image.cpp index be9056f2..04b70021 100644 --- a/command_line/image.cpp +++ b/command_line/image.cpp @@ -73,7 +73,7 @@ int handleImageCmd(QApplication *app, } g_assemblyGraph->clear(); - g_assemblyGraph->append(new AssemblyGraph()); + g_assemblyGraph->m_graphMap[1] = new AssemblyGraph(); bool loadSuccess = g_assemblyGraph->first()->loadGraphFromFile(cmd.m_graph.c_str()); if (!loadSuccess) { outputText(("Bandage-NG error: could not load " + cmd.m_graph.native()).c_str(), &err); // FIXME diff --git a/graph/assemblygraphlist.cpp b/graph/assemblygraphlist.cpp index 9112e1d8..f5568411 100644 --- a/graph/assemblygraphlist.cpp +++ b/graph/assemblygraphlist.cpp @@ -72,7 +72,7 @@ QString AssemblyGraphList::generateNodesNotFoundErrorMessage(std::vectorrecalculateAllNodeWidths(averageNodeWidth,depthPower, depthEffectOnWidth); } @@ -88,12 +88,11 @@ void AssemblyGraphList::changeNodeDepth(const std::vector &nodes } for (auto node : nodes) { - auto graphIndex = node->getGraphId() - 1; //If this graph does not already have a depthTag, give it a depthTag of KC //so the depth info will be saved. - if (m_graphList[graphIndex]->m_depthTag == "") - m_graphList[graphIndex]->m_depthTag = "KC"; + if (m_graphMap[node->getGraphId()]->m_depthTag == "") + m_graphMap[node->getGraphId()]->m_depthTag = "KC"; } } diff --git a/graph/assemblygraphlist.h b/graph/assemblygraphlist.h index 7bb7310a..b362971e 100644 --- a/graph/assemblygraphlist.h +++ b/graph/assemblygraphlist.h @@ -11,56 +11,56 @@ class AssemblyGraphList AssemblyGraphList(); AssemblyGraph* first() { - if (m_graphList.isEmpty()) { + if (m_graphMap.isEmpty()) { auto assemblyGraph = new AssemblyGraph(); - m_graphList.append(assemblyGraph); + m_graphMap[1] = assemblyGraph; } - return m_graphList.first(); + return m_graphMap[1]; } - AssemblyGraph* last() { return m_graphList.last(); } - bool isEmpty() { return m_graphList.isEmpty(); } - auto begin() { return m_graphList.begin(); } - auto begin() const { return m_graphList.begin(); } - auto end() { return m_graphList.end(); } - auto end() const { return m_graphList.end(); } - void append(AssemblyGraph* graph) { m_graphList.append(graph); } - void clear() { m_graphList.clear(); } - size_t size() const { return m_graphList.size(); } + //AssemblyGraph* last() { return m_graphList.last(); } + bool isEmpty() { return m_graphMap.isEmpty(); } + //auto begin() { return m_graphList.begin(); } + //auto begin() const { return m_graphList.begin(); } + //auto end() { return m_graphList.end(); } + //auto end() const { return m_graphList.end(); } + //void append(AssemblyGraph* graph) { m_graphList.append(graph); } + void clear() { m_graphMap.clear(); } + size_t size() const { return m_graphMap.size(); } QColor getCustomColourForDisplay(const DeBruijnNode *node) const; QStringList getCustomLabelForDisplay(const DeBruijnNode *node) const; int getNodeCount(){ int count = 0; - for (auto graph : m_graphList) { + for (auto graph : m_graphMap.values()) { count += graph->m_nodeCount; } return count; } int getEdgeCount() { int count = 0; - for (auto graph : m_graphList) { + for (auto graph : m_graphMap.values()) { count += graph->m_edgeCount; } return count; } int getPathCount() { int count = 0; - for (auto graph : m_graphList) { + for (auto graph : m_graphMap.values()) { count += graph->m_pathCount; } return count; } int getTotalLength() { int count = 0; - for (auto graph : m_graphList) { + for (auto graph : m_graphMap.values()) { count += graph->m_totalLength; } return count; } void determineGraphInfo() { - for (auto graph : m_graphList) { + for (auto graph : m_graphMap.values()) { graph -> determineGraphInfo(); } } @@ -73,7 +73,7 @@ class AssemblyGraphList void changeNodeDepth(const std::vector &nodes, double newDepth); void recalculateAllNodeWidths(double averageNodeWidth, double depthPower, double depthEffectOnWidth); - QList m_graphList; + QMap m_graphMap; private: diff --git a/graph/graphicsitemnode.cpp b/graph/graphicsitemnode.cpp index d03e5d1e..c03f3200 100644 --- a/graph/graphicsitemnode.cpp +++ b/graph/graphicsitemnode.cpp @@ -23,6 +23,8 @@ #include "assemblygraph.h" #include "annotationsmanager.h" +#include "painting/textgraphicsitemnode.h" + #include "program/globals.h" #include "program/memory.h" #include "program/settings.h" @@ -394,6 +396,13 @@ void GraphicsItemNode::mouseMoveEvent(QGraphicsSceneMouseEvent * event) fixEdgePaths(&nodesToMove); fixHiCEdgePaths(&nodesToMove); + if (g_settings->multyGraphMode && g_settings->moveGraphTitle) { + AssemblyGraph& currrentGraph = *g_assemblyGraph->m_graphMap[m_deBruijnNode->getGraphId()]; + if (currrentGraph.hasTextGraphicsItem()) { + TextGraphicsItemNode * graphTitle = currrentGraph.getTextGraphicsItemNode(); + graphTitle->mouseMoveEvent(event); + } + } } } @@ -479,7 +488,7 @@ QStringList GraphicsItemNode::getNodeText() const if (g_settings->displayNodeDepth) nodeText << formatDepthForDisplay(m_deBruijnNode->getDepth()); if (g_settings->displayNodeCsvData) { - for (auto graph : g_assemblyGraph->m_graphList) { + for (auto graph : g_assemblyGraph->m_graphMap.values()) { auto data = graph->getCsvLine(m_deBruijnNode, g_settings->displayNodeCsvDataCol); if (data) nodeText << *data; diff --git a/graph/nodecolorer.cpp b/graph/nodecolorer.cpp index bac5ce62..84ba4da6 100644 --- a/graph/nodecolorer.cpp +++ b/graph/nodecolorer.cpp @@ -335,7 +335,7 @@ QColor GCNodeColorer::get(const GraphicsItemNode *node) { QColor TagValueNodeColorer::get(const GraphicsItemNode *node) { const DeBruijnNode *deBruijnNode = node->m_deBruijnNode; - for (auto graph : m_graphs.data()->m_graphList) { + for (auto graph : m_graphs.data()->m_graphMap.values()) { auto tags = graph->m_nodeTags.find(deBruijnNode); if (tags != graph->m_nodeTags.end()) { if (auto tag = gfa::getTag(m_tagName.c_str(), tags->second)) { @@ -354,7 +354,7 @@ void TagValueNodeColorer::reset() { m_tagNames.clear(); // Collect all tags and their corresponding values - for (auto graph : m_graphs.data()->m_graphList) { + for (auto graph : m_graphs.data()->m_graphMap.values()) { for (const auto &entry : graph->m_nodeTags) { for (const auto &tag: entry.second) { std::stringstream stream; @@ -386,13 +386,7 @@ void TagValueNodeColorer::reset() { QColor CSVNodeColorer::get(const GraphicsItemNode *node) { const DeBruijnNode *deBruijnNode = node->m_deBruijnNode; - AssemblyGraph* graph; - for(auto currentGraph : m_graphs.data()->m_graphList) { - if (currentGraph->getGraphId() == deBruijnNode->getGraphId()) { - graph = currentGraph; - break; - } - } + AssemblyGraph* graph = m_graphs.data()->m_graphMap[deBruijnNode->getGraphId()]; auto val = graph->getCsvLine(deBruijnNode, m_colIdx); if (!val || m_colIdx >= m_colors.size()) return m_graphs->getCustomColourForDisplay(deBruijnNode); @@ -409,11 +403,11 @@ void CSVNodeColorer::reset() { m_colors.clear(); size_t columns = 0; - for (auto graph : m_graphs.data()->m_graphList) + for (auto graph : m_graphs.data()->m_graphMap.values()) columns = std::max(columns, size_t(graph->m_csvHeaders.size())); m_colors.resize(columns); // Store all unique values into a map - for(auto graph : m_graphs.data()->m_graphList) { + for(auto graph : m_graphs.data()->m_graphMap.values()) { for (const auto &entry : graph->m_nodeCSVData) { const auto &row = entry.second; for (size_t i = 0; i < row.size() && i < columns; ++i) { diff --git a/graphsearch/blast/blastsearch.cpp b/graphsearch/blast/blastsearch.cpp index 88523d31..bc6bd049 100644 --- a/graphsearch/blast/blastsearch.cpp +++ b/graphsearch/blast/blastsearch.cpp @@ -70,7 +70,7 @@ QString BlastSearch::buildDatabase(QSharedPointer graphList, { QTextStream out(&file); - for (AssemblyGraph* graph: graphList->m_graphList) { + for (AssemblyGraph* graph: graphList->m_graphMap.values()) { for (const auto *node : graph->m_deBruijnGraphNodes) { if (m_cancelBuildDatabase) return (m_lastError = "Build cancelled."); @@ -91,7 +91,7 @@ QString BlastSearch::buildDatabase(QSharedPointer graphList, // Make sure the graph has sequences bool atLeastOneSequence = false; - for (AssemblyGraph* graph: graphList->m_graphList) { + for (AssemblyGraph* graph: graphList->m_graphMap.values()) { for (const auto *node : graph->m_deBruijnGraphNodes) { if (!node->sequenceIsMissing()) { atLeastOneSequence = true; @@ -341,7 +341,7 @@ buildHitsFromBlastOutput(QString blastOutput, QStringList blastHitList = blastOutput.split("\n", Qt::SkipEmptyParts); - for(auto graph : g_assemblyGraph->m_graphList) { + for(auto graph : g_assemblyGraph->m_graphMap.values()) { for (const auto &hitString : blastHitList) { QStringList alignmentParts = hitString.split('\t'); diff --git a/graphsearch/hmmer/hmmersearch.cpp b/graphsearch/hmmer/hmmersearch.cpp index 04ae1c3f..278e81d9 100644 --- a/graphsearch/hmmer/hmmersearch.cpp +++ b/graphsearch/hmmer/hmmersearch.cpp @@ -73,7 +73,7 @@ QString HmmerSearch::buildDatabase(QSharedPointer graphList, // in order to mitigate this, emit the largest (=more diverse) node first const DeBruijnNode *longest = nullptr; size_t length = 0; - for (AssemblyGraph* graph: graphList->m_graphList) { + for (AssemblyGraph* graph: graphList->m_graphMap.values()) { for (const auto *node : graph->m_deBruijnGraphNodes) { if (!node->sequenceIsMissing() && node->getLength() > length) { length = node->getLength(); @@ -115,7 +115,7 @@ QString HmmerSearch::buildDatabase(QSharedPointer graphList, QTextStream out(&file); - for (AssemblyGraph* graph: graphList->m_graphList) { + for (AssemblyGraph* graph: graphList->m_graphMap.values()) { for (const auto *node : graph->m_deBruijnGraphNodes) { if (m_cancelBuildDatabase) return (m_lastError = "Build cancelled."); diff --git a/graphsearch/minimap2/minimap2search.cpp b/graphsearch/minimap2/minimap2search.cpp index f2874d58..32f30f2b 100644 --- a/graphsearch/minimap2/minimap2search.cpp +++ b/graphsearch/minimap2/minimap2search.cpp @@ -60,7 +60,7 @@ QString Minimap2Search::buildDatabase(QSharedPointer graphLis { QTextStream out(&file); - for (AssemblyGraph* graph: graphList->m_graphList) { + for (AssemblyGraph* graph: graphList->m_graphMap.values()) { for (const auto *node : graph->m_deBruijnGraphNodes) { if (m_cancelBuildDatabase) return (m_lastError = "Build cancelled."); @@ -81,7 +81,7 @@ QString Minimap2Search::buildDatabase(QSharedPointer graphLis // Make sure the graph has sequences bool atLeastOneSequence = false; - for (AssemblyGraph* graph: graphList->m_graphList) { + for (AssemblyGraph* graph: graphList->m_graphMap.values()) { for (const auto *node : graph->m_deBruijnGraphNodes) { if (!node->sequenceIsMissing()) { atLeastOneSequence = true; diff --git a/layout/graphlayoutworker.cpp b/layout/graphlayoutworker.cpp index c1d4af41..dacb65fb 100644 --- a/layout/graphlayoutworker.cpp +++ b/layout/graphlayoutworker.cpp @@ -595,7 +595,7 @@ QList GraphLayoutWorker::layoutGraph(QSharedPointerm_graphList) { + for(AssemblyGraph* graph : graphList->m_graphMap.values()) { const AssemblyGraph& refGraph = std::cref(*graph); ogdf::Graph G; ogdf::EdgeArray edgeLengths(G); @@ -699,11 +699,15 @@ QList GraphLayoutWorker::layoutGraph(QSharedPointerm_graphList.begin(), graphList->m_graphList.end(), [](AssemblyGraph* a, AssemblyGraph* b)->bool{ - return (layout::getMaxX(*a->m_layout) + layout::getMaxY(*a->m_layout)) > (layout::getMaxX(*b->m_layout) + layout::getMaxY(*b->m_layout)); + QList idGraphs = graphList->m_graphMap.keys(); + + std::sort(idGraphs.begin(), idGraphs.end(), [&](int a, int b)->bool{ + return (layout::getMaxX(*(graphList->m_graphMap[a])->m_layout) + layout::getMaxY(*(graphList->m_graphMap[a])->m_layout)) > + (layout::getMaxX(*(graphList->m_graphMap[b])->m_layout) + layout::getMaxY(*(graphList->m_graphMap[b])->m_layout)); }); - for(AssemblyGraph* graph : graphList->m_graphList) { + for(int id : idGraphs) { + AssemblyGraph* graph = graphList->m_graphMap[id]; if (maxX < boundX) { maxX = std::max(maxX, prevX + textWidth) + boardWidth; prevX = maxX; diff --git a/painting/textgraphicsitemnode.cpp b/painting/textgraphicsitemnode.cpp index 45566b52..5c7cbb08 100644 --- a/painting/textgraphicsitemnode.cpp +++ b/painting/textgraphicsitemnode.cpp @@ -62,10 +62,6 @@ void TextGraphicsItemNode::paint(QPainter * painter, const QStyleOptionGraphicsI painter->scale(zoomAdjustment, zoomAdjustment); painter->translate(offset); -// painter->setBrush(Qt::NoBrush); -// painter->setPen(QPen(Qt::black, 1.0)); -// painter->drawRect(boundingRect()); - drawTextPathAtLocation(painter, textPath); painter->translate(-offset); painter->scale(inverseZoomAdjustment, inverseZoomAdjustment); @@ -97,10 +93,10 @@ void TextGraphicsItemNode::mousePressEvent(QGraphicsSceneMouseEvent * event) //graphics items will need to be adjusted accordingly. void TextGraphicsItemNode::mouseMoveEvent(QGraphicsSceneMouseEvent * event) { - QPointF difference = event->pos() - event->lastPos(); - auto *graphicsScene = dynamic_cast(scene()); - + prepareGeometryChange(); + QPointF difference = event->pos() - event->lastPos(); + auto *graphicsScene = dynamic_cast(scene()); - m_centre += difference; - graphicsScene->possiblyExpandSceneRectangle(this); + m_centre = m_centre + difference; + graphicsScene->possiblyExpandSceneRectangle(this); } diff --git a/program/settings.h b/program/settings.h index e64e28c1..60fdd741 100644 --- a/program/settings.h +++ b/program/settings.h @@ -247,6 +247,7 @@ class Settings FloatSetting hicEdgeLength; bool roundMode = false; bool multyGraphMode = false; + bool moveGraphTitle = true; }; #endif // SETTINGS_H diff --git a/ui/mainwindow.cpp b/ui/mainwindow.cpp index e3cd9f5a..fd476d79 100644 --- a/ui/mainwindow.cpp +++ b/ui/mainwindow.cpp @@ -255,6 +255,7 @@ MainWindow::MainWindow(QString fileToLoadOnStartup, QString featuresForestFileTo connect(this, SIGNAL(windowLoaded()), this, SLOT(afterMainWindowShow()), Qt::ConnectionType(Qt::QueuedConnection | Qt::UniqueConnection)); connect(ui->actionLoad_HiC_data, SIGNAL(triggered()), this, SLOT(loadHiC())); connect(ui->hicInclusionFilterComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(hicInclusionFilterChanged())); + connect(ui->moveTitlesCheckBox, SIGNAL(toggled(bool)), this, SLOT(setMoveGraphTitleSetting())); } @@ -325,9 +326,9 @@ void MainWindow::cleanUp() { m_blastSearchDialog = nullptr; } - for (auto assemblyGraph : g_assemblyGraph->m_graphList) + for (auto assemblyGraph : g_assemblyGraph->m_graphMap.values()) assemblyGraph->cleanUp(); - g_assemblyGraph->m_graphList.clear(); + g_assemblyGraph->m_graphMap.clear(); setWindowTitle("Bandage-NG"); @@ -367,7 +368,7 @@ void MainWindow::loadCSV(QString fullFileName, AssemblyGraph* assemblyGraph) { isCSVLoaded = true; } else { - for (auto graph : g_assemblyGraph->m_graphList) { + for (auto graph : g_assemblyGraph->m_graphMap.values()) { if (graph->loadCSV(fullFileName, &columns, &errormsg, &coloursLoaded)) isCSVLoaded = true; } @@ -390,6 +391,7 @@ void MainWindow::loadCSV(QString fullFileName, AssemblyGraph* assemblyGraph) { } void MainWindow::loadGraphs(QString fullDirName, QString basePath) { + ui->moveTitlesCheckBox->setEnabled(true); if (fullDirName.isEmpty()) { fullDirName = QFileDialog::getExistingDirectory(this, "Load graphs from dir", g_memory->rememberedPath, QFileDialog::ShowDirsOnly); @@ -450,6 +452,7 @@ AssemblyGraph* MainWindow::loadGraph(QString fullFileName, QString graphName, bo if (isSingleGraphMode) { cleanUp(); g_settings->multyGraphMode = false; + ui->moveTitlesCheckBox->setEnabled(false); } ui->selectionSearchNodesLineEdit->clear(); @@ -458,10 +461,11 @@ AssemblyGraph* MainWindow::loadGraph(QString fullFileName, QString graphName, bo progress->show(); auto assemblyGrpah = new AssemblyGraph(); - g_assemblyGraph->m_graphList.append(assemblyGrpah); - g_assemblyGraph->last()->setGraphName(std::move(graphName)); - int graphId = g_assemblyGraph->m_graphList.size(); - g_assemblyGraph->last()->setGraphId(graphId); + assemblyGrpah->setGraphName(std::move(graphName)); + int graphId = g_assemblyGraph->m_graphMap.size() + 1; + assemblyGrpah->setGraphId(graphId); + g_assemblyGraph->m_graphMap[graphId] = assemblyGrpah; + auto *watcher = new QFutureWatcher; connect(watcher, &QFutureWatcher::finished, @@ -529,14 +533,14 @@ AssemblyGraph* MainWindow::loadGraph(QString fullFileName, QString graphName, bo connect(watcher, SIGNAL(finished()), progress, SLOT(deleteLater())); connect(watcher, SIGNAL(finished()), watcher, SLOT(deleteLater())); - auto res = QtConcurrent::run(&io::AssemblyGraphBuilder::build, builder, std::ref(*(g_assemblyGraph->last()))); + auto res = QtConcurrent::run(&io::AssemblyGraphBuilder::build, builder, std::ref(*assemblyGrpah)); watcher->setFuture(res); return assemblyGrpah; } void MainWindow::loadGraphLayout(QString fullFileName) { g_assemblyGraph->clear(); - g_assemblyGraph->append(new AssemblyGraph()); + g_assemblyGraph->m_graphMap[1] = new AssemblyGraph(); if (fullFileName.isEmpty()) fullFileName = QFileDialog::getOpenFileName(this, "Load Bandage layout", "", "Bandage layout (*.layout)"); @@ -716,9 +720,9 @@ void MainWindow::getSelectedNodeInfo(int & selectedNodeCount, QString & selected // FIXME: Hack! selectedNodeDepthText += " GC: " + formatDoubleForDisplay(100 * selectedNodes[0]->getGC(), 1) + "%"; - auto graphIndex = selectedNodes.front()->getGraphId() - 1; - auto tags = g_assemblyGraph->m_graphList[graphIndex]->m_nodeTags.find(selectedNodes.front()); - if (tags != g_assemblyGraph->m_graphList[graphIndex]->m_nodeTags.end()) { + auto graphIndex = selectedNodes.front()->getGraphId(); + auto tags = g_assemblyGraph->m_graphMap[graphIndex]->m_nodeTags.find(selectedNodes.front()); + if (tags != g_assemblyGraph->m_graphMap[graphIndex]->m_nodeTags.end()) { std::stringstream txt; for (const auto &tag : tags->second) txt << tag << ' '; @@ -979,7 +983,7 @@ void MainWindow::drawGraph() { if (m_uiState == GRAPH_LOADED || m_uiState == GRAPH_DRAWN) { resetScene(); - for(auto& assemblyGraph : g_assemblyGraph->m_graphList) { + for(auto& assemblyGraph : g_assemblyGraph->m_graphMap.values()) { auto scope = graph::scope(g_settings->graphScope, ui->startingNodesLineEdit->text(), @@ -1007,24 +1011,24 @@ void MainWindow::drawGraph() { void MainWindow::graphLayoutFinished(QList layouts) { - int i = 0; + //int i = 1; m_scene->clear(); int drawnNodeCount = 0; - for(auto layout : layouts) { - m_scene->addGraphicsItemsToScene(*g_assemblyGraph->m_graphList[i], *layout); + for(AssemblyGraph* graph : g_assemblyGraph->m_graphMap.values()) { + GraphLayout* layout = graph->m_layout; + m_scene->addGraphicsItemsToScene(*graph, *layout); double averageNodeWidth = g_settings->averageNodeWidth / pow(g_absoluteZoom, 0.75); ui->nodeWidthSpinBox->setValue(averageNodeWidth); - g_assemblyGraph->m_graphList[i]->recalculateAllNodeWidths(averageNodeWidth, - g_settings->depthPower, - g_settings->depthEffectOnWidth); + graph->recalculateAllNodeWidths(averageNodeWidth, + g_settings->depthPower, + g_settings->depthEffectOnWidth); g_graphicsView->viewport()->update(); selectionChanged(); setUiState(GRAPH_DRAWN); - drawnNodeCount += (g_assemblyGraph->m_graphList[i]->getDrawnNodeCount()); - i += 1; + drawnNodeCount += (graph->getDrawnNodeCount()); } if (drawnNodeCount > 0) { m_scene->setSceneRectangle(); @@ -1052,7 +1056,7 @@ void MainWindow::resetScene() { std::vector MainWindow::getNodesFromLineEdit(QLineEdit * lineEdit, bool exactMatch, std::vector * nodesNotInGraph) { std::vector res; - for (AssemblyGraph* graph : g_assemblyGraph->m_graphList) { + for (AssemblyGraph* graph : g_assemblyGraph->m_graphMap.values()) { for (DeBruijnNode * node : graph->getNodesFromString(lineEdit->text(), exactMatch, nodesNotInGraph)) { res.push_back(node); } @@ -1306,7 +1310,7 @@ void MainWindow::saveSelectedPathToFile() } void MainWindow::resetAllNodeColours() { - for (auto assemblyGraph : g_assemblyGraph->m_graphList) { + for (auto assemblyGraph : g_assemblyGraph->m_graphMap.values()) { for (auto &entry : assemblyGraph->m_deBruijnGraphNodes) { auto *graphicsItemNode = entry->getGraphicsItemNode(); if (!graphicsItemNode) @@ -1390,7 +1394,7 @@ void MainWindow::fixSettingsColourScheme(int idx) { } else if (scheme == CSV_COLUMN) { ui->tagsComboBox->clear(); auto *colorer = dynamic_cast(&*g_settings->nodeColorer); - for (auto graph : g_assemblyGraph->m_graphList) { + for (auto graph : g_assemblyGraph->m_graphMap.values()) { if (!graph->m_csvHeaders.empty()) { ui->tagsComboBox->addItems(graph->m_csvHeaders); colorer->setColumnIdx(0); @@ -2420,7 +2424,7 @@ void MainWindow::saveEntireGraphToFasta() { return; //User did hit cancel int count = 0; - for (auto assemblyGraph : g_assemblyGraph->m_graphList) { + for (auto assemblyGraph : g_assemblyGraph->m_graphMap.values()) { count += 1; QFileInfo fileInfo = QFileInfo(fullFileName); g_memory->rememberedPath = QFileInfo(fullFileName).absolutePath(); @@ -2439,7 +2443,7 @@ void MainWindow::saveEntireGraphToFastaOnlyPositiveNodes() { int count = 0; - for (auto assemblyGraph : g_assemblyGraph->m_graphList) { + for (auto assemblyGraph : g_assemblyGraph->m_graphMap.values()) { count += 1; QFileInfo fileInfo = QFileInfo(fullFileName); g_memory->rememberedPath = QFileInfo(fullFileName).absolutePath(); @@ -2459,7 +2463,7 @@ void MainWindow::saveEntireGraphToGfa() { int count = 0; - for (auto assemblyGraph : g_assemblyGraph->m_graphList) { + for (auto assemblyGraph : g_assemblyGraph->m_graphMap.values()) { count += 1; QFileInfo fileInfo = QFileInfo(fullFileName); g_memory->rememberedPath = QFileInfo(fullFileName).absolutePath(); @@ -2478,7 +2482,7 @@ void MainWindow::saveVisibleGraphToGfa() { int count = 0; - for (auto assemblyGraph : g_assemblyGraph->m_graphList) { + for (auto assemblyGraph : g_assemblyGraph->m_graphMap.values()) { count += 1; QFileInfo fileInfo = QFileInfo(fullFileName); g_memory->rememberedPath = QFileInfo(fullFileName).absolutePath(); @@ -3024,6 +3028,10 @@ void MainWindow::setFeatureTextDisplaySettings() g_graphicsViewFeaturesForest->viewport()->update(); } +void MainWindow::setMoveGraphTitleSetting() +{ + g_settings->moveGraphTitle = ui->moveTitlesCheckBox->isChecked(); +} void MainWindow::setFeatureNodeCustomColour() { std::vector selectedNodes = m_featuresForestWidget->m_scene->getSelectedFeatureNodes(); diff --git a/ui/mainwindow.h b/ui/mainwindow.h index 61b8c0f6..c5fa9223 100644 --- a/ui/mainwindow.h +++ b/ui/mainwindow.h @@ -225,6 +225,7 @@ private slots: void loadHiC(QString fullFileName = ""); void setHiCWidgetVisibility(bool visible); void hicInclusionFilterChanged(); + void setMoveGraphTitleSetting(); protected: void showEvent(QShowEvent *ev) override; diff --git a/ui/mainwindow.ui b/ui/mainwindow.ui index 43d8c830..0207fc8e 100644 --- a/ui/mainwindow.ui +++ b/ui/mainwindow.ui @@ -61,8 +61,8 @@ 0 - -503 - 336 + 0 + 332 1876 @@ -2010,10 +2010,10 @@ then colour which other nodes in the graph are likely to be contiguous - 0 - 0 + -14 + -185 237 - 1024 + 1051 @@ -2631,6 +2631,19 @@ then colour which other nodes in the graph are likely to be contiguous + + + + true + + + Move nodes with graph's title + + + true + + +