Skip to content

Commit

Permalink
Add error if query option used in wrong place
Browse files Browse the repository at this point in the history
  • Loading branch information
rrwick committed Jul 15, 2015
1 parent 8354b51 commit 9653b3f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions command_line/commoncommandlinefunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 2 additions & 0 deletions program/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<Settings> g_settings;
extern MyGraphicsView * g_graphicsView;
Expand Down
2 changes: 2 additions & 0 deletions program/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 2 additions & 0 deletions program/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ Settings::Settings()
blastSearchParameters = "";

rememberedPath = QDir::homePath();

commandLineCommand = NO_COMMAND;
}


Expand Down
2 changes: 2 additions & 0 deletions program/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ class Settings

QString rememberedPath;

CommandLineCommand commandLineCommand;

bool anyNodeDisplayText() {return displayNodeCustomLabels || displayNodeNames || displayNodeLengths || displayNodeCoverages;}
int getBasePairsPerSegment();
};
Expand Down

0 comments on commit 9653b3f

Please sign in to comment.