XT-neighbor
xtn.h
Go to the documentation of this file.
1 #include <vector>
8 const int MAX_COMPRESSED_LENGTH = 18;
10 int verboseGlobal = 0;
12 const char LEVENSHTEIN = 0;
14 const char HAMMING = 1;
15 
19 struct Int3 {
20  unsigned int entry[3] = {0, 0, 0};
21  __device__ __host__
22  bool operator==(const Int3& t) const {
23  return (entry[0] == t.entry[0]) && (entry[1] == t.entry[1]) && (entry[2] == t.entry[2]);
24  }
25 };
26 
30 struct Int2 {
31  int x = 0, y = 0;
32  __device__ __host__
33  bool operator==(const Int2& t) const {
34  return (x == t.x) && (y == t.y);
35  }
36 };
37 
41 struct SeqInfo {
42  int frequency, repertoire, originalIndex;
43  __device__
44  bool operator==(const SeqInfo& t) const;
45 };
46 
50 struct XTNArgs {
51  int distance = 1;
52  int verbose = 0;
53  char* seqPath = NULL;
54  int seqLen = 0;
55  char* outputPath = NULL;
56  char measure = LEVENSHTEIN;
57  char* infoPath = NULL;
58  int infoLen = 0;
59  int airr = 0;
60 };
61 
65 struct MemoryContext {
66  size_t gpuSize = 0;
67  size_t ramSize = 0;
68  int bandwidth1 = 0;
69  int bandwidth2 = 0;
70  int chunkSize = 0;
71 #ifdef TEST_ENV
72  int histogramSize = 16;
73  int maxThroughputExponent = 7;
74 #else
75  int histogramSize = 65536;
76  int maxThroughputExponent = 0;
77 #endif
78 };
79 
83 struct XTNOutput {
84  Int2* indexPairs = NULL;
85  char* pairwiseDistances = NULL;
86  size_t* pairwiseFrequencies = NULL;
87  int len = 0;
88 };
89 
94 
95 class SeqArray {
96 private:
97  unsigned int *offsets, *offsets_d = NULL;
98  std::vector<char> seqs;
99  char* seqs_d = NULL;
100  int size = 0;
101  int maxSize = 0;
102 
103 public:
104  SeqArray(int seqLen);
105  int append(char* inputStr);
106  __device__
107  int getItem(int index, char* &result);
108  int getItemCPU(int index, char* &result);
109  void toDevice();
110  void destroy();
111  int getSize();
112  char* getSeqs_d();
113  unsigned int* getOffsets_d();
114 };
115 
124 void xtn_perform(XTNArgs args, SeqArray seqArr, SeqInfo* seqInfo, void callback (XTNOutput));
Definition: xtn.h:93
const int MAX_COMPRESSED_LENGTH
CDR3 length limit for compression.
Definition: xtn.h:8
__device__ __host__ bool operator==(const Int2 &t) const
Definition: xtn.h:33
int verboseGlobal
control printing of each method
Definition: xtn.h:10
int x
Definition: xtn.h:31
__device__ __host__ bool operator==(const Int3 &t) const
Definition: xtn.h:22
Definition: xtn.h:95
12-byte integer representation for CDR3 string.
Definition: xtn.h:19
int repertoire
Definition: xtn.h:42
8-byte integer representation for pair of sequence index.
Definition: xtn.h:30
void xtn_perform(XTNArgs args, SeqArray seqArr, SeqInfo *seqInfo, void callback(XTNOutput))
the algorithm&#39;s API.
const char HAMMING
enum for distant type
Definition: xtn.h:14
bundled representation for algorithm&#39;s output.
Definition: xtn.h:83
ReturnCode
control-flow representation.
Definition: xtn.h:93
Information related to a sequence.
Definition: xtn.h:41
unsigned int entry[3]
Definition: xtn.h:20
const char LEVENSHTEIN
enum for distant type
Definition: xtn.h:12
bundled representation for memory constraints and info.
Definition: xtn.h:65
Definition: xtn.h:93
int y
Definition: xtn.h:31
Definition: xtn.h:93
bundled representation for command line arguments.
Definition: xtn.h:50