Skip to content

Commit

Permalink
Allow calling MMseqs2 modules with base: prefix to enable inheriting …
Browse files Browse the repository at this point in the history
…software to find shadowed modules

E.g. Foldseek can find MMseqs2's own createdb with foldseek base:createdb
  • Loading branch information
milot-mirdita committed Sep 7, 2023
1 parent df77d9e commit 90aa913
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/commons/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@ Command *getCommandByName(const char *s) {
if (!strcmp(s, p.cmd))
return &p;
}

// allow base commands also to be called with a prefix, e.g. "mmseqs base:createdb"
// this allows inheriting programs to find shadowed base modules
const char *prefix = "base:";
const char *check = strncmp(s, prefix, strlen(prefix)) == 0 ? s + strlen(prefix) : s;
for (size_t i = 0; i < baseCommands.size(); i++) {
Command &p = baseCommands[i];
if (!strcmp(s, p.cmd))
if (!strcmp(check, p.cmd))
return &p;
}
return NULL;
Expand Down

0 comments on commit 90aa913

Please sign in to comment.