jpayne@69
|
1 // Copyright © 2015, Battelle National Biodefense Institute (BNBI);
|
jpayne@69
|
2 // all rights reserved. Authored by: Brian Ondov, Todd Treangen,
|
jpayne@69
|
3 // Sergey Koren, and Adam Phillippy
|
jpayne@69
|
4 //
|
jpayne@69
|
5 // See the LICENSE.txt file included with this software for license information.
|
jpayne@69
|
6
|
jpayne@69
|
7 #ifndef INCLUDED_CommandContain
|
jpayne@69
|
8 #define INCLUDED_CommandContain
|
jpayne@69
|
9
|
jpayne@69
|
10 #include "Command.h"
|
jpayne@69
|
11 #include "Sketch.h"
|
jpayne@69
|
12
|
jpayne@69
|
13 namespace mash {
|
jpayne@69
|
14
|
jpayne@69
|
15 class CommandContain : public Command
|
jpayne@69
|
16 {
|
jpayne@69
|
17 public:
|
jpayne@69
|
18
|
jpayne@69
|
19 struct ContainInput
|
jpayne@69
|
20 {
|
jpayne@69
|
21 ContainInput(const Sketch & sketchRefNew, const Sketch & sketchQueryNew, uint64_t indexRefNew, uint64_t indexQueryNew, uint64_t pairCountNew, const Sketch::Parameters & parametersNew)
|
jpayne@69
|
22 :
|
jpayne@69
|
23 sketchRef(sketchRefNew),
|
jpayne@69
|
24 sketchQuery(sketchQueryNew),
|
jpayne@69
|
25 indexRef(indexRefNew),
|
jpayne@69
|
26 indexQuery(indexQueryNew),
|
jpayne@69
|
27 pairCount(pairCountNew),
|
jpayne@69
|
28 parameters(parametersNew)
|
jpayne@69
|
29 {}
|
jpayne@69
|
30
|
jpayne@69
|
31 const Sketch & sketchRef;
|
jpayne@69
|
32 const Sketch & sketchQuery;
|
jpayne@69
|
33
|
jpayne@69
|
34 uint64_t indexRef;
|
jpayne@69
|
35 uint64_t indexQuery;
|
jpayne@69
|
36 uint64_t pairCount;
|
jpayne@69
|
37
|
jpayne@69
|
38 std::string nameRef;
|
jpayne@69
|
39 const Sketch::Parameters & parameters;
|
jpayne@69
|
40 };
|
jpayne@69
|
41
|
jpayne@69
|
42 struct ContainOutput
|
jpayne@69
|
43 {
|
jpayne@69
|
44 ContainOutput(const Sketch & sketchRefNew, const Sketch & sketchQueryNew, uint64_t indexRefNew, uint64_t indexQueryNew, uint64_t pairCountNew)
|
jpayne@69
|
45 :
|
jpayne@69
|
46 sketchRef(sketchRefNew),
|
jpayne@69
|
47 sketchQuery(sketchQueryNew),
|
jpayne@69
|
48 indexRef(indexRefNew),
|
jpayne@69
|
49 indexQuery(indexQueryNew),
|
jpayne@69
|
50 pairCount(pairCountNew)
|
jpayne@69
|
51 {
|
jpayne@69
|
52 pairs = new PairOutput[pairCount];
|
jpayne@69
|
53 }
|
jpayne@69
|
54
|
jpayne@69
|
55 ~ContainOutput()
|
jpayne@69
|
56 {
|
jpayne@69
|
57 delete [] pairs;
|
jpayne@69
|
58 }
|
jpayne@69
|
59
|
jpayne@69
|
60 struct PairOutput
|
jpayne@69
|
61 {
|
jpayne@69
|
62 double score;
|
jpayne@69
|
63 double error;
|
jpayne@69
|
64 };
|
jpayne@69
|
65
|
jpayne@69
|
66 const Sketch & sketchRef;
|
jpayne@69
|
67 const Sketch & sketchQuery;
|
jpayne@69
|
68
|
jpayne@69
|
69 uint64_t indexRef;
|
jpayne@69
|
70 uint64_t indexQuery;
|
jpayne@69
|
71 uint64_t pairCount;
|
jpayne@69
|
72
|
jpayne@69
|
73 PairOutput * pairs;
|
jpayne@69
|
74 };
|
jpayne@69
|
75
|
jpayne@69
|
76 CommandContain();
|
jpayne@69
|
77
|
jpayne@69
|
78 int run() const; // override
|
jpayne@69
|
79
|
jpayne@69
|
80 private:
|
jpayne@69
|
81
|
jpayne@69
|
82 void writeOutput(ContainOutput * output, float error) const;
|
jpayne@69
|
83 };
|
jpayne@69
|
84
|
jpayne@69
|
85 CommandContain::ContainOutput * contain(CommandContain::ContainInput * data);
|
jpayne@69
|
86 double containSketches(const HashList & hashesSortedRef, const HashList & hashesSortedQuery, double & errorToSet);
|
jpayne@69
|
87
|
jpayne@69
|
88 } // namespace mash
|
jpayne@69
|
89
|
jpayne@69
|
90 #endif
|