jpayne@69: // Copyright © 2015, Battelle National Biodefense Institute (BNBI); jpayne@69: // all rights reserved. Authored by: Brian Ondov, Todd Treangen, jpayne@69: // Sergey Koren, and Adam Phillippy jpayne@69: // jpayne@69: // See the LICENSE.txt file included with this software for license information. jpayne@69: jpayne@69: #ifndef INCLUDED_CommandContain jpayne@69: #define INCLUDED_CommandContain jpayne@69: jpayne@69: #include "Command.h" jpayne@69: #include "Sketch.h" jpayne@69: jpayne@69: namespace mash { jpayne@69: jpayne@69: class CommandContain : public Command jpayne@69: { jpayne@69: public: jpayne@69: jpayne@69: struct ContainInput jpayne@69: { jpayne@69: ContainInput(const Sketch & sketchRefNew, const Sketch & sketchQueryNew, uint64_t indexRefNew, uint64_t indexQueryNew, uint64_t pairCountNew, const Sketch::Parameters & parametersNew) jpayne@69: : jpayne@69: sketchRef(sketchRefNew), jpayne@69: sketchQuery(sketchQueryNew), jpayne@69: indexRef(indexRefNew), jpayne@69: indexQuery(indexQueryNew), jpayne@69: pairCount(pairCountNew), jpayne@69: parameters(parametersNew) jpayne@69: {} jpayne@69: jpayne@69: const Sketch & sketchRef; jpayne@69: const Sketch & sketchQuery; jpayne@69: jpayne@69: uint64_t indexRef; jpayne@69: uint64_t indexQuery; jpayne@69: uint64_t pairCount; jpayne@69: jpayne@69: std::string nameRef; jpayne@69: const Sketch::Parameters & parameters; jpayne@69: }; jpayne@69: jpayne@69: struct ContainOutput jpayne@69: { jpayne@69: ContainOutput(const Sketch & sketchRefNew, const Sketch & sketchQueryNew, uint64_t indexRefNew, uint64_t indexQueryNew, uint64_t pairCountNew) jpayne@69: : jpayne@69: sketchRef(sketchRefNew), jpayne@69: sketchQuery(sketchQueryNew), jpayne@69: indexRef(indexRefNew), jpayne@69: indexQuery(indexQueryNew), jpayne@69: pairCount(pairCountNew) jpayne@69: { jpayne@69: pairs = new PairOutput[pairCount]; jpayne@69: } jpayne@69: jpayne@69: ~ContainOutput() jpayne@69: { jpayne@69: delete [] pairs; jpayne@69: } jpayne@69: jpayne@69: struct PairOutput jpayne@69: { jpayne@69: double score; jpayne@69: double error; jpayne@69: }; jpayne@69: jpayne@69: const Sketch & sketchRef; jpayne@69: const Sketch & sketchQuery; jpayne@69: jpayne@69: uint64_t indexRef; jpayne@69: uint64_t indexQuery; jpayne@69: uint64_t pairCount; jpayne@69: jpayne@69: PairOutput * pairs; jpayne@69: }; jpayne@69: jpayne@69: CommandContain(); jpayne@69: jpayne@69: int run() const; // override jpayne@69: jpayne@69: private: jpayne@69: jpayne@69: void writeOutput(ContainOutput * output, float error) const; jpayne@69: }; jpayne@69: jpayne@69: CommandContain::ContainOutput * contain(CommandContain::ContainInput * data); jpayne@69: double containSketches(const HashList & hashesSortedRef, const HashList & hashesSortedQuery, double & errorToSet); jpayne@69: jpayne@69: } // namespace mash jpayne@69: jpayne@69: #endif