Skip to content

Commit

Permalink
Ensure proper colorer range for depth range
Browse files Browse the repository at this point in the history
resolves #161
  • Loading branch information
milenovic committed Jan 23, 2025
1 parent 051621a commit f9da80a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
6 changes: 6 additions & 0 deletions graph/assemblygraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@

AssemblyGraph::AssemblyGraph()
: m_sequencesLoadedFromFasta(NOT_READY)
, m_currentScope(graph::Scope::wholeGraph())
{
clearGraphInfo();
}
Expand Down Expand Up @@ -534,6 +535,7 @@ bool AssemblyGraph::loadGraphFromFile(const QString& filename) {
//is not WHOLE_GRAPH.
void AssemblyGraph::markNodesToDraw(const graph::Scope &scope,
const std::vector<DeBruijnNode *>& startingNodes) {
m_currentScope = scope; // store the scope
if (scope.graphScope() == WHOLE_GRAPH) {
for (auto &entry : m_deBruijnGraphNodes) {
//If double mode is off, only positive nodes are drawn. If it's
Expand All @@ -558,6 +560,10 @@ void AssemblyGraph::markNodesToDraw(const graph::Scope &scope,
edge->determineIfDrawn();
}

const graph::Scope &AssemblyGraph::currentScope() const {
return m_currentScope;
}

static QStringList removeNullStringsFromList(const QStringList& in) {
QStringList out;

Expand Down
2 changes: 2 additions & 0 deletions graph/assemblygraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,14 @@ class AssemblyGraph : public QObject
QString getNodeNameFromString(QString string) const;

std::vector<DeBruijnNode *> getNodesInDepthRange(double min, double max) const;
const graph::Scope &currentScope() const;
private:
std::vector<DeBruijnNode *> getNodesFromListExact(const QStringList& nodesList, std::vector<QString> * nodesNotInGraph) const;
std::vector<DeBruijnNode *> getNodesFromListPartial(const QStringList& nodesList, std::vector<QString> * nodesNotInGraph) const;
std::vector<int> makeOverlapCountVector();
void clearAllCsvData();
QString getNewNodeName(QString oldNodeName) const;
graph::Scope m_currentScope;

signals:
void setMergeTotalCount(int totalCount);
Expand Down
9 changes: 7 additions & 2 deletions graph/nodecolorer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,13 @@ QColor DepthNodeColorer::get(const GraphicsItemNode *node) {

double lowValue = g_settings->lowDepthValue, highValue = g_settings->highDepthValue;
if (g_settings->autoDepthValue) {
lowValue = m_graph->m_firstQuartileDepth;
highValue = m_graph->m_thirdQuartileDepth;
if (m_graph->currentScope().graphScope() == DEPTH_RANGE) {
lowValue = m_graph->currentScope().minDepth();
highValue = m_graph->currentScope().maxDepth();
} else {
lowValue = m_graph->m_firstQuartileDepth;
highValue = m_graph->m_thirdQuartileDepth;
}
}

float fraction = (depth - lowValue) / (highValue - lowValue);
Expand Down

0 comments on commit f9da80a

Please sign in to comment.