Skip to content

Commit 9653b3f

Browse files
committed
Add error if query option used in wrong place
1 parent 8354b51 commit 9653b3f

File tree

5 files changed

+11
-0
lines changed

5 files changed

+11
-0
lines changed

command_line/commoncommandlinefunctions.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,9 @@ QString checkForInvalidOrExcessSettings(QStringList * arguments)
166166
error = checkOptionForInt("--distance", arguments, 0, 100);
167167
if (error.length() > 0) return error;
168168

169+
if (isOptionPresent("--query", arguments) && g_settings->commandLineCommand == NO_COMMAND)
170+
return "The --query option can only be used with Bandage load and Bandage image";
171+
169172
error = checkOptionForFile("--query", arguments);
170173
if (error.length() > 0) return error;
171174
error = checkOptionForString("--blastp", arguments, QStringList(), "blastn/tblastn parameters");

program/globals.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ enum GraphFileType {LAST_GRAPH, FASTG, GFA, TRINITY, ANY_FILE_TYPE, UNKNOWN_FILE
4040
enum SequenceType {NUCLEOTIDE, PROTEIN, EITHER_NUCLEOTIDE_OR_PROTEIN};
4141
enum BlastUiState {BLAST_DB_NOT_YET_BUILT, BLAST_DB_BUILD_IN_PROGRESS, BLAST_DB_BUILT_BUT_NO_QUERIES,
4242
READY_FOR_BLAST_SEARCH, BLAST_SEARCH_IN_PROGRESS, BLAST_SEARCH_COMPLETE};
43+
enum CommandLineCommand {NO_COMMAND, BANDAGE_LOAD, BANDAGE_IMAGE};
44+
4345

4446
extern QSharedPointer<Settings> g_settings;
4547
extern MyGraphicsView * g_graphicsView;

program/main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,13 @@ int main(int argc, char *argv[])
8181
if (first == "load")
8282
{
8383
arguments.pop_front();
84+
g_settings->commandLineCommand = BANDAGE_LOAD;
8485
return bandageLoad(&a, arguments);
8586
}
8687
else if (first == "image")
8788
{
8889
arguments.pop_front();
90+
g_settings->commandLineCommand = BANDAGE_IMAGE;
8991
return bandageImage(arguments);
9092
}
9193
// else if (first == "contiguous")

program/settings.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ Settings::Settings()
103103
blastSearchParameters = "";
104104

105105
rememberedPath = QDir::homePath();
106+
107+
commandLineCommand = NO_COMMAND;
106108
}
107109

108110

program/settings.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ class Settings
113113

114114
QString rememberedPath;
115115

116+
CommandLineCommand commandLineCommand;
117+
116118
bool anyNodeDisplayText() {return displayNodeCustomLabels || displayNodeNames || displayNodeLengths || displayNodeCoverages;}
117119
int getBasePairsPerSegment();
118120
};

0 commit comments

Comments
 (0)