Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow colors from CSV columns #62

Merged
merged 3 commits into from
Jun 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ Bandage.app
# CLion
.idea

# clangd
.cache

# build dir
build

# Misc
*DS_Store*
Bandage.pro.user*
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ set(LIB_SOURCES
ui/tablewidgetitemname.cpp
ui/tablewidgetitemshown.cpp
ui/verticallabel.cpp
ui/verticalscrollarea.cpp graph/nodecolorer.cpp graph/nodecolorer.h graph/nodecolorers.h)
ui/verticalscrollarea.cpp graph/nodecolorer.cpp graph/nodecolorer.h graph/nodecolorers.h graph/sequenceutils.cpp graph/fileutils.cpp graph/fileutils.h)

set(FORMS
ui/aboutdialog.ui
Expand Down
4 changes: 2 additions & 2 deletions blast/blasthit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "graph/debruijnnode.h"
#include "blastquery.h"
#include "program/globals.h"
#include "graph/sequenceutils.hpp"
#include "graph/sequenceutils.h"
#include <cmath>

BlastHit::BlastHit(BlastQuery * query, DeBruijnNode * node,
Expand Down Expand Up @@ -79,5 +79,5 @@ GraphLocation BlastHit::getHitEnd() const
//This function returns the node sequence for this hit.
QByteArray BlastHit::getNodeSequence() const
{
return sequenceToQByteArray(m_node->getSequence().Subseq(m_nodeStart-1, m_nodeEnd));
return utils::sequenceToQByteArray(m_node->getSequence().Subseq(m_nodeStart-1, m_nodeEnd));
}
17 changes: 10 additions & 7 deletions blast/blastsearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,20 @@


#include "blastsearch.h"
#include "graph/assemblygraph.h"
#include <QDir>
#include <QRegularExpression>
#include "buildblastdatabaseworker.h"
#include "runblastsearchworker.h"

#include "program/settings.h"
#include <QApplication>
#include <utility>

#include "graph/assemblygraph.h"
#include "graph/debruijnnode.h"
#include "graph/annotationsmanager.h"
#include "graph/fileutils.h"

#include <QDir>
#include <QRegularExpression>
#include <QApplication>
#include <cmath>
#include "graph/annotationsmanager.hpp"

BlastSearch::BlastSearch() :
m_blastQueries(), m_tempDirectory("bandage_temp/")
Expand Down Expand Up @@ -297,7 +300,7 @@ int BlastSearch::loadBlastQueriesFromFastaFile(QString fullFileName)

std::vector<QString> queryNames;
std::vector<QByteArray> querySequences;
AssemblyGraph::readFastaOrFastqFile(std::move(fullFileName), &queryNames, &querySequences);
utils::readFastaOrFastqFile(std::move(fullFileName), &queryNames, &querySequences);

for (size_t i = 0; i < queryNames.size(); ++i)
{
Expand Down
10 changes: 8 additions & 2 deletions command_line/commoncommandlinefunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ void getSettingsUsage(QStringList * text)
*text << "";
*text << "Node colours";
*text << dashes;
*text << "--colour <scheme> Node colouring scheme, from one of the following options: random, uniform, depth, blastsolid, blastrainbow, custom (default: random if --query option not used, blastsolid if --query option used)";
*text << "--colour <scheme> Node colouring scheme, from one of the following options: random, uniform, depth, gc, blastsolid, blastrainbow, custom (default: random if --query option not used, blastsolid if --query option used)";
*text << "";
*text << "Random colour scheme";
*text << dashes;
Expand Down Expand Up @@ -271,7 +271,7 @@ QString checkForInvalidOrExcessSettings(QStringList * arguments)
checkOptionWithoutValue("--noaa", arguments);
checkOptionWithoutValue("--singlearr", arguments);
QStringList validColourOptions;
validColourOptions << "random" << "uniform" << "depth" << "blastsolid" << "blastrainbow" << "custom";
validColourOptions << "random" << "uniform" << "depth" << "blastsolid" << "blastrainbow" << "custom" << "gc" << "gfa";
error = checkOptionForString("--colour", arguments, validColourOptions); if (error.length() > 0) return error;
error = checkOptionForInt("--ransatpos", arguments, g_settings->randomColourPositiveSaturation, false); if (error.length() > 0) return error;
error = checkOptionForInt("--ransatneg", arguments, g_settings->randomColourNegativeSaturation, false); if (error.length() > 0) return error;
Expand Down Expand Up @@ -1056,6 +1056,12 @@ NodeColorScheme getColourSchemeOption(const QString& option, QStringList * argum
return DEPTH_COLOUR;
else if (colourString == "custom")
return CUSTOM_COLOURS;
else if (colourString == "gc")
return GC_CONTENT;
else if (colourString == "gfa")
return TAG_VALUE;
else if (colourString == "csv")
return CSV_COLUMN;

//Random colours is the default
return defaultScheme;
Expand Down
5 changes: 3 additions & 2 deletions command_line/querypaths.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "commoncommandlinefunctions.h"
#include "program/settings.h"
#include "graph/assemblygraph.h"
#include "graph/sequenceutils.h"
#include "blast/blastsearch.h"
#include <QDateTime>

Expand Down Expand Up @@ -229,7 +230,7 @@ int bandageQueryPaths(QStringList arguments)
for (int i = 0; i < pathSequenceIDs.size(); ++i)
{
pathsOut << ">" + pathSequenceIDs[i] + "\n";
pathsOut << AssemblyGraph::addNewlinesToSequence(pathSequences[i]);
pathsOut << utils::addNewlinesToSequence(pathSequences[i]);
}
}

Expand All @@ -242,7 +243,7 @@ int bandageQueryPaths(QStringList arguments)
for (int i = 0; i < hitSequenceIDs.size(); ++i)
{
hitsOut << ">" << hitSequenceIDs[i] << "\n";
hitsOut << AssemblyGraph::addNewlinesToSequence(hitSequences[i]);
hitsOut << utils::addNewlinesToSequence(hitSequences[i]);
}
}

Expand Down
2 changes: 1 addition & 1 deletion graph/annotationsmanager.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "annotationsmanager.hpp"
#include "annotationsmanager.h"

AnnotationGroup &AnnotationsManager::createAnnotationGroup(QString name) {
if (name == g_settings->blastAnnotationGroupName) {
Expand Down
File renamed without changes.
Loading