comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/mash/CommandContain.h @ 69:33d812a61356

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