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

Compilation and installation instructions added for Fedora #100

Open
wants to merge 31 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
53a7917
Add posibility to colors node in cli image generation
natir Feb 3, 2017
d9c665a
Fix crash when adding new BLAST queries but not immediately running s…
rrwick Mar 10, 2017
2db0b0c
Refuse to load GFA/FASTG with duplicate node names
rrwick Mar 17, 2017
109c3cb
Remove unnecessary lines in project file
rrwick Mar 17, 2017
bf1d2ae
Merge pull request #35 from natir/master
rrwick Mar 18, 2017
d1b59ff
Add select nodes with dead ends
rrwick Apr 7, 2017
1c5050d
Merge branch 'development' of https://github.com/rrwick/Bandage into …
rrwick Apr 7, 2017
9acfcf3
Allow FASTQ files for BLAST search
rrwick May 8, 2017
c774cc5
Small fix for CSV parsing
rrwick May 26, 2017
3cbd21b
Fix Bandage info tab-delimited output
rrwick Jul 13, 2017
4f14171
Added dotplot.cpp and dotplot.h to calculate k-mer seed hits. Also, u…
isovic Oct 17, 2017
a18aaca
Added the placeholder for the dotplot, and removed the vertical space…
isovic Oct 17, 2017
a8622dd
Added a shared pointer to hold the dotplot scene, and the method whic…
isovic Oct 17, 2017
821dd3f
Added the signal handling and plotting of the dotplot between two sel…
isovic Oct 17, 2017
8439ab1
Added declarations to dotplot.h.
isovic Oct 18, 2017
9bccb54
Allowed self-dotplots.
isovic Oct 18, 2017
8870cb9
Added unit tests for the new methods.
isovic Oct 19, 2017
7899b41
Fixed the dotplot.cpp and dotplot.h according to the results discover…
isovic Oct 19, 2017
6246fd3
Changed the upper limit to k-mer size as checked by the Main window.
isovic Oct 19, 2017
7ed3e9f
Minor aesthetic changes.
isovic Oct 19, 2017
aafde88
Merge pull request #52 from isovic/dotplot
rrwick Oct 20, 2017
ccad4b8
Adjust UI layout of dotplot
rrwick Oct 20, 2017
cd243f9
Tweaks to dotplot
rrwick Oct 20, 2017
e0aec11
Use a spinbox for k-mer size input
rrwick Oct 20, 2017
76d98ba
Fix issues with tab order
rrwick Oct 24, 2017
542d69e
Added a failing test case for the dotplot.
isovic Oct 31, 2017
5348448
Fixed the bug in findHits (dotplot). Previously, only the first hit w…
isovic Oct 31, 2017
a94af64
Merge pull request #54 from isovic/dotplot
rrwick Nov 1, 2017
9768bff
Merge branch 'master' into development
rrwick Jul 19, 2019
366e935
Add support for SKESA fasta files
rrwick Feb 21, 2020
ccfa041
Compilation and installation instructions added for Fedora
nmendozam Nov 11, 2020
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: 2 additions & 4 deletions Bandage.pro
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ INCLUDEPATH += ui

SOURCES += \
program/main.cpp\
program/dotplot.cpp \
program/settings.cpp \
program/globals.cpp \
program/graphlayoutworker.cpp \
Expand Down Expand Up @@ -121,6 +122,7 @@ SOURCES += \

HEADERS += \
program/settings.h \
program/dotplot.h \
program/globals.h \
program/graphlayoutworker.h \
graph/debruijnnode.h \
Expand Down Expand Up @@ -259,10 +261,6 @@ FORMS += \
RESOURCES += \
images/images.qrc


unix:INCLUDEPATH += /usr/include/
unix:LIBS += -L/usr/lib

# The following settings are compatible with OGDF being built in 64 bit release mode using Visual Studio 2013
win32:LIBS += -lpsapi
win32:RC_FILE = images/myapp.rc
Expand Down
2 changes: 2 additions & 0 deletions BandageTests.pro
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ SOURCES += \
program/settings.cpp \
program/globals.cpp \
program/graphlayoutworker.cpp \
program/dotplot.cpp \
graph/debruijnnode.cpp \
graph/debruijnedge.cpp \
graph/graphicsitemnode.cpp \
Expand Down Expand Up @@ -123,6 +124,7 @@ HEADERS += \
program/settings.h \
program/globals.h \
program/graphlayoutworker.h \
program/dotplot.h \
graph/debruijnnode.h \
graph/debruijnedge.h \
graph/graphicsitemnode.h \
Expand Down
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,26 @@ The Linux binaries comes in two varieties: dynamically-linked and statically-lin

If the compiled binaries do not work for you, the instructions below should help you build Bandage on most common OSs. If you are having difficulties building Bandage for your OS, feel free to contact me (Ryan) at [email protected] and I'll do my best to help you out!

### <img src="http://rrwick.github.io/Bandage/images/OS/ubuntu.png" alt="" width="34" height="40" align="middle"> Ubuntu
### <img src="http://rrwick.github.io/Bandage/images/OS/ubuntu.png" alt="" width="34" height="40" align="middle"> Ubuntu & Fedora

The following instructions successfully build Bandage on a fresh installation of Ubuntu 14.04:
The following instructions successfully build Bandage on a fresh installation of Ubuntu 14.04 or fedora 33:

1. Ensure the package lists are up-to-date: `sudo apt-get update`
2. Install prerequisite packages: `sudo apt-get install build-essential git qtbase5-dev libqt5svg5-dev`
2. Install prerequisite packages:

For Ubuntu:
```
sudo apt-get install build-essential git qtbase5-dev libqt5svg5-dev
```
For Fedora:
```
sudo dnf groupinstall "Development Tools" "Development Libraries"
sudo dnf install qt5-qtsvg-devel git qt5-qtbase-devel
```
3. Download the Bandage code from GitHub: `git clone https://github.com/rrwick/Bandage.git`
4. Open a terminal in the Bandage directory.
5. Set the environment variable to specify that you will be using Qt 5, not Qt 4: `export QT_SELECT=5`
6. Run qmake to generate a Makefile: `qmake`
6. Run qmake to generate a Makefile: `qmake` or in Fedora `qmake-qt5`
7. Build the program: `make`
8. `Bandage` should now be an executable file.
9. Optionally, copy the program into /usr/local/bin: `sudo make install`. The Bandage build directory can then be deleted.
Expand Down
2 changes: 1 addition & 1 deletion blast/blastsearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ int BlastSearch::loadBlastQueriesFromFastaFile(QString fullFileName)

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

for (size_t i = 0; i < queryNames.size(); ++i)
{
Expand Down
36 changes: 36 additions & 0 deletions command_line/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,26 @@ int bandageImage(QStringList arguments)
g_settings->startingNodes,
"all");

QString errormsg;
QStringList columns;
bool coloursLoaded = false;
QString csvPath = parseColorsOption(arguments);
if (csvPath != "")
{
if(!g_assemblyGraph->loadCSV(csvPath, &columns, &errormsg, &coloursLoaded))
{
err << errormsg << endl;
return 1;
}

if(coloursLoaded == false)
{
err << csvPath << " didn't contains color" << endl;
return 1;
}
g_settings->nodeColourScheme = CUSTOM_COLOURS;
}

if (errorMessage != "")
{
err << errorMessage << endl;
Expand Down Expand Up @@ -212,6 +232,7 @@ void printImageUsage(QTextStream * out, bool all)
text << "";
text << "Options: --height <int> Image height (default: 1000)";
text << "--width <int> Image width (default: not set)";
text << "--color <file> csv file with 2 column first the node name second the node color";
text << "";
text << "If only height or width is set, the other will be determined automatically. If both are set, the image will be exactly that size.";
text << "";
Expand All @@ -232,6 +253,9 @@ QString checkForInvalidImageOptions(QStringList arguments)
error = checkOptionForInt("--width", &arguments, IntSetting(0, 1, 32767), false);
if (error.length() > 0) return error;

error = checkOptionForString("--colors", &arguments, QStringList(), "a path of csv file");
if (error.length() > 0) return error;

return checkForInvalidOrExcessSettings(&arguments);
}

Expand All @@ -251,3 +275,15 @@ void parseImageOptions(QStringList arguments, int * width, int * height)
parseSettings(arguments);
}

//This function parses the command line options. It assumes that the options
//have already been checked for correctness.
QString parseColorsOption(QStringList arguments)
{
QString path = "";
if (isOptionPresent("--colors", &arguments))
path = getStringOption("--colors", &arguments);

parseSettings(arguments);

return path;
}
1 change: 1 addition & 0 deletions command_line/image.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ int bandageImage(QStringList arguments);
void printImageUsage(QTextStream * out, bool all);
QString checkForInvalidImageOptions(QStringList arguments);
void parseImageOptions(QStringList arguments, int * width, int * height);
QString parseColorsOption(QStringList arguments);

#endif // IMAGE_H
2 changes: 1 addition & 1 deletion command_line/info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ int bandageInfo(QStringList arguments)
out << median << "\t";
out << thirdQuartile << "\t";
out << longestNode << "\t";
out << medianDepthByBase << "\n";
out << medianDepthByBase << "\t";
out << estimatedSequenceLength << "\n";
}
else
Expand Down
76 changes: 74 additions & 2 deletions graph/assemblygraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,9 @@ void AssemblyGraph::buildDeBruijnGraphFromGfa(QString fullFileName, bool *unsupp

QString nodeName = lineParts.at(1);
if (nodeName.isEmpty())
nodeName = "node";
nodeName = getUniqueNodeName("node");
if (m_deBruijnGraphNodes.contains(nodeName + "+"))
throw "load error";

QByteArray sequence = lineParts.at(2).toLocal8Bit();

Expand Down Expand Up @@ -972,6 +974,8 @@ void AssemblyGraph::buildDeBruijnGraphFromFastg(QString fullFileName)
nodeName += "-";
else
nodeName += "+";
if (m_deBruijnGraphNodes.contains(nodeName))
throw "load error";

QString nodeDepthString = thisNodeDetails.at(5);
if (negativeNode)
Expand Down Expand Up @@ -1414,6 +1418,16 @@ void AssemblyGraph::buildDeBruijnGraphFromPlainFasta(QString fullFileName)
m_depthTag = "KC";
}

// Check to see if the name matches SKESA format, in which case we can get the depth and node number.
else if (thisNodeDetails.size() >= 3 && thisNodeDetails[0] == "Contig" && thisNodeDetails[1].toInt() > 0) {
name = thisNodeDetails[1];
bool ok;
double convertedDepth = thisNodeDetails[2].toDouble(&ok);
if (ok)
depth = convertedDepth;
m_depthTag = "KC";
}

// If it doesn't match, then we will use the sequence name up to the first space.
else {
QStringList nameParts = name.split(" ");
Expand All @@ -1439,6 +1453,10 @@ void AssemblyGraph::buildDeBruijnGraphFromPlainFasta(QString fullFileName)
if (lowerName.contains("circular=true"))
circularNodeNames.push_back(name);

// SKESA circularity
if (thisNodeDetails.size() == 4 and thisNodeDetails[3] == "Circ")
circularNodeNames.push_back(name);

if (name.length() < 1)
throw "load error";

Expand Down Expand Up @@ -1692,6 +1710,12 @@ bool AssemblyGraph::loadCSV(QString filename, QStringList * columns, QString * e
//If the node name it finds does not end in a '+' or '-', it will add '+'.
QString AssemblyGraph::getNodeNameFromString(QString string)
{
// First check for the most obvious case, where the string is already a node name.
if (m_deBruijnGraphNodes.contains(string))
return string;
if (m_deBruijnGraphNodes.contains(string + "+"))
return string + "+";

QStringList parts = string.split("_");
if (parts.size() == 0)
return "";
Expand Down Expand Up @@ -2375,7 +2399,25 @@ QString AssemblyGraph::getOppositeNodeName(QString nodeName)
}


void AssemblyGraph::readFastaFile(QString filename, std::vector<QString> * names, std::vector<QByteArray> *sequences)
void AssemblyGraph::readFastaOrFastqFile(QString filename, std::vector<QString> * names,
std::vector<QByteArray> * sequences) {
QChar firstChar = 0;
QFile inputFile(filename);
if (inputFile.open(QIODevice::ReadOnly)) {
QTextStream in(&inputFile);
QString firstLine = in.readLine();
firstChar = firstLine.at(0);
inputFile.close();
}
if (firstChar == '>')
readFastaFile(filename, names, sequences);
else if (firstChar == '@')
readFastqFile(filename, names, sequences);
}



void AssemblyGraph::readFastaFile(QString filename, std::vector<QString> * names, std::vector<QByteArray> * sequences)
{
QFile inputFile(filename);
if (inputFile.open(QIODevice::ReadOnly))
Expand Down Expand Up @@ -2423,6 +2465,36 @@ void AssemblyGraph::readFastaFile(QString filename, std::vector<QString> * names
}


void AssemblyGraph::readFastqFile(QString filename, std::vector<QString> * names, std::vector<QByteArray> * sequences)
{
QFile inputFile(filename);
if (inputFile.open(QIODevice::ReadOnly))
{
QTextStream in(&inputFile);
while (!in.atEnd())
{
QApplication::processEvents();

QString name = in.readLine().simplified();
QByteArray sequence = in.readLine().simplified().toLocal8Bit();
in.readLine(); // separator
in.readLine(); // qualities

if (name.length() == 0)
continue;
if (sequence.length() == 0)
continue;
if (name.at(0) != '@')
continue;
name.remove(0, 1); //Remove '@' from start
names->push_back(name);
sequences->push_back(sequence);
}
inputFile.close();
}
}


void AssemblyGraph::recalculateAllDepthsRelativeToDrawnMean()
{
double meanDrawnDepth = getMeanDepth(true);
Expand Down
4 changes: 4 additions & 0 deletions graph/assemblygraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,12 @@ class AssemblyGraph : public QObject
void setAllEdgesExactOverlap(int overlap);
void autoDetermineAllEdgesExactOverlap();

static void readFastaOrFastqFile(QString filename, std::vector<QString> * names,
std::vector<QByteArray> * sequences);
static void readFastaFile(QString filename, std::vector<QString> * names,
std::vector<QByteArray> * sequences);
static void readFastqFile(QString filename, std::vector<QString> * names,
std::vector<QByteArray> * sequences);

int getDrawnNodeCount() const;
void deleteNodes(std::vector<DeBruijnNode *> * nodes);
Expand Down
Loading