From 9653b3fbb4f959cba2aa93916b96a576afc98848 Mon Sep 17 00:00:00 2001 From: Ryan Wick Date: Wed, 15 Jul 2015 13:15:25 +1000 Subject: [PATCH] Add error if query option used in wrong place --- command_line/commoncommandlinefunctions.cpp | 3 +++ program/globals.h | 2 ++ program/main.cpp | 2 ++ program/settings.cpp | 2 ++ program/settings.h | 2 ++ 5 files changed, 11 insertions(+) diff --git a/command_line/commoncommandlinefunctions.cpp b/command_line/commoncommandlinefunctions.cpp index fae93afb..8f5f99a6 100644 --- a/command_line/commoncommandlinefunctions.cpp +++ b/command_line/commoncommandlinefunctions.cpp @@ -166,6 +166,9 @@ QString checkForInvalidOrExcessSettings(QStringList * arguments) error = checkOptionForInt("--distance", arguments, 0, 100); if (error.length() > 0) return error; + if (isOptionPresent("--query", arguments) && g_settings->commandLineCommand == NO_COMMAND) + return "The --query option can only be used with Bandage load and Bandage image"; + error = checkOptionForFile("--query", arguments); if (error.length() > 0) return error; error = checkOptionForString("--blastp", arguments, QStringList(), "blastn/tblastn parameters"); diff --git a/program/globals.h b/program/globals.h index 42341884..21b1ba3a 100644 --- a/program/globals.h +++ b/program/globals.h @@ -40,6 +40,8 @@ enum GraphFileType {LAST_GRAPH, FASTG, GFA, TRINITY, ANY_FILE_TYPE, UNKNOWN_FILE enum SequenceType {NUCLEOTIDE, PROTEIN, EITHER_NUCLEOTIDE_OR_PROTEIN}; enum BlastUiState {BLAST_DB_NOT_YET_BUILT, BLAST_DB_BUILD_IN_PROGRESS, BLAST_DB_BUILT_BUT_NO_QUERIES, READY_FOR_BLAST_SEARCH, BLAST_SEARCH_IN_PROGRESS, BLAST_SEARCH_COMPLETE}; +enum CommandLineCommand {NO_COMMAND, BANDAGE_LOAD, BANDAGE_IMAGE}; + extern QSharedPointer g_settings; extern MyGraphicsView * g_graphicsView; diff --git a/program/main.cpp b/program/main.cpp index d846bdde..f100fba6 100644 --- a/program/main.cpp +++ b/program/main.cpp @@ -81,11 +81,13 @@ int main(int argc, char *argv[]) if (first == "load") { arguments.pop_front(); + g_settings->commandLineCommand = BANDAGE_LOAD; return bandageLoad(&a, arguments); } else if (first == "image") { arguments.pop_front(); + g_settings->commandLineCommand = BANDAGE_IMAGE; return bandageImage(arguments); } // else if (first == "contiguous") diff --git a/program/settings.cpp b/program/settings.cpp index 4c8ee04d..cd3e5bbe 100644 --- a/program/settings.cpp +++ b/program/settings.cpp @@ -103,6 +103,8 @@ Settings::Settings() blastSearchParameters = ""; rememberedPath = QDir::homePath(); + + commandLineCommand = NO_COMMAND; } diff --git a/program/settings.h b/program/settings.h index d518db7d..e80e7386 100644 --- a/program/settings.h +++ b/program/settings.h @@ -113,6 +113,8 @@ class Settings QString rememberedPath; + CommandLineCommand commandLineCommand; + bool anyNodeDisplayText() {return displayNodeCustomLabels || displayNodeNames || displayNodeLengths || displayNodeCoverages;} int getBasePairsPerSegment(); };