-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add taxonomic filtering during prefilter with --taxon-list
This happens before the ungapped alignment stage, thus is not affected by --max-seqs
- Loading branch information
1 parent
3b9cf88
commit 1d63172
Showing
8 changed files
with
99 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#ifndef QUERY_MATCHER_TAXONOMY_HOOK_H | ||
#define QUERY_MATCHER_TAXONOMY_HOOK_H | ||
|
||
#include "QueryMatcher.h" | ||
#include "NcbiTaxonomy.h" | ||
#include "MappingReader.h" | ||
#include "DBReader.h" | ||
#include "PrefilteringIndexReader.h" | ||
#include "TaxonomyExpression.h" | ||
|
||
class QueryMatcherTaxonomyHook : public QueryMatcherHook { | ||
public: | ||
QueryMatcherTaxonomyHook(std::string targetPath, DBReader<unsigned int>* targetReader, const std::string& expressionString) | ||
: targetReader(targetReader), dbFrom(0) { | ||
std::string targetName = PrefilteringIndexReader::dbPathWithoutIndex(targetPath); | ||
taxonomy = NcbiTaxonomy::openTaxonomy(targetName); | ||
taxonomyMapping = new MappingReader(targetName); | ||
expression = new TaxonomyExpression(expressionString, *taxonomy); | ||
} | ||
|
||
~QueryMatcherTaxonomyHook() { | ||
delete taxonomy; | ||
delete taxonomyMapping; | ||
delete expression; | ||
} | ||
|
||
void setDbFrom(unsigned int from) { | ||
dbFrom = from; | ||
} | ||
|
||
size_t afterDiagonalMatchingHook(QueryMatcher& matcher, size_t resultSize) { | ||
size_t writePos = 0; | ||
for (size_t i = 0; i < resultSize; i++) { | ||
unsigned int currId = matcher.foundDiagonals[i].id; | ||
unsigned int key = targetReader->getDbKey(dbFrom + currId); | ||
TaxID currTax = taxonomyMapping->lookup(key); | ||
if (expression->isAncestor(currTax)) { | ||
if (i != writePos) { | ||
matcher.foundDiagonals[writePos] = matcher.foundDiagonals[i]; | ||
} | ||
writePos++; | ||
} | ||
} | ||
return writePos; | ||
} | ||
|
||
NcbiTaxonomy* taxonomy; | ||
MappingReader* taxonomyMapping; | ||
DBReader<unsigned int>* targetReader; | ||
TaxonomyExpression* expression; | ||
|
||
unsigned int dbFrom; | ||
}; | ||
|
||
#endif |
Submodule regression
updated
2 files
+24 −0 | regression/run_searchtaxfilter.sh | |
+1 −0 | run_regression.sh |