ngs_server 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (284) hide show
  1. data/.gitignore +4 -0
  2. data/Gemfile +4 -0
  3. data/Rakefile +2 -0
  4. data/bin/ngs_server +58 -0
  5. data/data/holder.txt +0 -0
  6. data/ext/bamtools/CMakeLists.txt +49 -0
  7. data/ext/bamtools/LICENSE +22 -0
  8. data/ext/bamtools/README +60 -0
  9. data/ext/bamtools/Tutorial_Toolkit_BamTools-1.0.pdf +0 -0
  10. data/ext/bamtools/docs/Doxyfile +1601 -0
  11. data/ext/bamtools/extconf.rb +9 -0
  12. data/ext/bamtools/src/CMakeFiles/CMakeDirectoryInformation.cmake +22 -0
  13. data/ext/bamtools/src/CMakeFiles/SharedHeaders.dir/DependInfo.cmake +13 -0
  14. data/ext/bamtools/src/CMakeFiles/SharedHeaders.dir/build.make +65 -0
  15. data/ext/bamtools/src/CMakeFiles/SharedHeaders.dir/cmake_clean.cmake +8 -0
  16. data/ext/bamtools/src/CMakeFiles/SharedHeaders.dir/depend.internal +3 -0
  17. data/ext/bamtools/src/CMakeFiles/SharedHeaders.dir/depend.make +3 -0
  18. data/ext/bamtools/src/CMakeFiles/SharedHeaders.dir/progress.make +2 -0
  19. data/ext/bamtools/src/CMakeFiles/progress.marks +1 -0
  20. data/ext/bamtools/src/CMakeLists.txt +18 -0
  21. data/ext/bamtools/src/ExportHeader.cmake +31 -0
  22. data/ext/bamtools/src/Makefile +182 -0
  23. data/ext/bamtools/src/api/BamAlignment.cpp +2432 -0
  24. data/ext/bamtools/src/api/BamAlignment.h +206 -0
  25. data/ext/bamtools/src/api/BamAux.h +456 -0
  26. data/ext/bamtools/src/api/BamConstants.h +127 -0
  27. data/ext/bamtools/src/api/BamIndex.h +79 -0
  28. data/ext/bamtools/src/api/BamMultiReader.cpp +395 -0
  29. data/ext/bamtools/src/api/BamMultiReader.h +126 -0
  30. data/ext/bamtools/src/api/BamReader.cpp +369 -0
  31. data/ext/bamtools/src/api/BamReader.h +117 -0
  32. data/ext/bamtools/src/api/BamWriter.cpp +142 -0
  33. data/ext/bamtools/src/api/BamWriter.h +63 -0
  34. data/ext/bamtools/src/api/CMakeFiles/APIHeaders.dir/DependInfo.cmake +14 -0
  35. data/ext/bamtools/src/api/CMakeFiles/APIHeaders.dir/build.make +80 -0
  36. data/ext/bamtools/src/api/CMakeFiles/APIHeaders.dir/cmake_clean.cmake +8 -0
  37. data/ext/bamtools/src/api/CMakeFiles/APIHeaders.dir/depend.internal +3 -0
  38. data/ext/bamtools/src/api/CMakeFiles/APIHeaders.dir/depend.make +3 -0
  39. data/ext/bamtools/src/api/CMakeFiles/APIHeaders.dir/progress.make +2 -0
  40. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/BamAlignment.cpp.o +0 -0
  41. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/BamMultiReader.cpp.o +0 -0
  42. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/BamReader.cpp.o +0 -0
  43. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/BamWriter.cpp.o +0 -0
  44. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/CXX.includecache +596 -0
  45. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/DependInfo.cmake +41 -0
  46. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/SamHeader.cpp.o +0 -0
  47. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/SamProgram.cpp.o +0 -0
  48. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/SamProgramChain.cpp.o +0 -0
  49. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/SamReadGroup.cpp.o +0 -0
  50. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/SamReadGroupDictionary.cpp.o +0 -0
  51. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/SamSequence.cpp.o +0 -0
  52. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/SamSequenceDictionary.cpp.o +0 -0
  53. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/build.make +675 -0
  54. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/cmake_clean.cmake +32 -0
  55. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/cmake_clean_target.cmake +3 -0
  56. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/depend.internal +295 -0
  57. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/depend.make +295 -0
  58. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/flags.make +8 -0
  59. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/internal/BamHeader_p.cpp.o +0 -0
  60. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/internal/BamIndexFactory_p.cpp.o +0 -0
  61. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/internal/BamMultiReader_p.cpp.o +0 -0
  62. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/internal/BamRandomAccessController_p.cpp.o +0 -0
  63. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/internal/BamReader_p.cpp.o +0 -0
  64. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/internal/BamStandardIndex_p.cpp.o +0 -0
  65. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/internal/BamToolsIndex_p.cpp.o +0 -0
  66. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/internal/BamWriter_p.cpp.o +0 -0
  67. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/internal/BgzfStream_p.cpp.o +0 -0
  68. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/internal/SamFormatParser_p.cpp.o +0 -0
  69. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/internal/SamFormatPrinter_p.cpp.o +0 -0
  70. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/internal/SamHeaderValidator_p.cpp.o +0 -0
  71. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/link.txt +2 -0
  72. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/progress.make +24 -0
  73. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/BamAlignment.cpp.o +0 -0
  74. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/BamMultiReader.cpp.o +0 -0
  75. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/BamReader.cpp.o +0 -0
  76. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/BamWriter.cpp.o +0 -0
  77. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/CXX.includecache +596 -0
  78. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/DependInfo.cmake +47 -0
  79. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/SamHeader.cpp.o +0 -0
  80. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/SamProgram.cpp.o +0 -0
  81. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/SamProgramChain.cpp.o +0 -0
  82. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/SamReadGroup.cpp.o +0 -0
  83. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/SamReadGroupDictionary.cpp.o +0 -0
  84. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/SamSequence.cpp.o +0 -0
  85. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/SamSequenceDictionary.cpp.o +0 -0
  86. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/build.make +677 -0
  87. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/cmake_clean.cmake +33 -0
  88. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/depend.internal +295 -0
  89. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/depend.make +295 -0
  90. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/flags.make +8 -0
  91. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/internal/BamHeader_p.cpp.o +0 -0
  92. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/internal/BamIndexFactory_p.cpp.o +0 -0
  93. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/internal/BamMultiReader_p.cpp.o +0 -0
  94. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/internal/BamRandomAccessController_p.cpp.o +0 -0
  95. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/internal/BamReader_p.cpp.o +0 -0
  96. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/internal/BamStandardIndex_p.cpp.o +0 -0
  97. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/internal/BamToolsIndex_p.cpp.o +0 -0
  98. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/internal/BamWriter_p.cpp.o +0 -0
  99. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/internal/BgzfStream_p.cpp.o +0 -0
  100. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/internal/SamFormatParser_p.cpp.o +0 -0
  101. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/internal/SamFormatPrinter_p.cpp.o +0 -0
  102. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/internal/SamHeaderValidator_p.cpp.o +0 -0
  103. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/link.txt +1 -0
  104. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/progress.make +24 -0
  105. data/ext/bamtools/src/api/CMakeFiles/CMakeDirectoryInformation.cmake +22 -0
  106. data/ext/bamtools/src/api/CMakeFiles/progress.marks +1 -0
  107. data/ext/bamtools/src/api/CMakeLists.txt +78 -0
  108. data/ext/bamtools/src/api/Makefile +902 -0
  109. data/ext/bamtools/src/api/SamConstants.h +95 -0
  110. data/ext/bamtools/src/api/SamHeader.cpp +184 -0
  111. data/ext/bamtools/src/api/SamHeader.h +68 -0
  112. data/ext/bamtools/src/api/SamProgram.cpp +139 -0
  113. data/ext/bamtools/src/api/SamProgram.h +61 -0
  114. data/ext/bamtools/src/api/SamProgramChain.cpp +351 -0
  115. data/ext/bamtools/src/api/SamProgramChain.h +85 -0
  116. data/ext/bamtools/src/api/SamReadGroup.cpp +221 -0
  117. data/ext/bamtools/src/api/SamReadGroup.h +68 -0
  118. data/ext/bamtools/src/api/SamReadGroupDictionary.cpp +289 -0
  119. data/ext/bamtools/src/api/SamReadGroupDictionary.h +86 -0
  120. data/ext/bamtools/src/api/SamSequence.cpp +161 -0
  121. data/ext/bamtools/src/api/SamSequence.h +60 -0
  122. data/ext/bamtools/src/api/SamSequenceDictionary.cpp +292 -0
  123. data/ext/bamtools/src/api/SamSequenceDictionary.h +88 -0
  124. data/ext/bamtools/src/api/api_global.h +21 -0
  125. data/ext/bamtools/src/api/cmake_install.cmake +122 -0
  126. data/ext/bamtools/src/api/internal/BamHeader_p.cpp +132 -0
  127. data/ext/bamtools/src/api/internal/BamHeader_p.h +71 -0
  128. data/ext/bamtools/src/api/internal/BamIndexFactory_p.cpp +112 -0
  129. data/ext/bamtools/src/api/internal/BamIndexFactory_p.h +49 -0
  130. data/ext/bamtools/src/api/internal/BamMultiMerger_p.h +297 -0
  131. data/ext/bamtools/src/api/internal/BamMultiReader_p.cpp +805 -0
  132. data/ext/bamtools/src/api/internal/BamMultiReader_p.h +103 -0
  133. data/ext/bamtools/src/api/internal/BamRandomAccessController_p.cpp +272 -0
  134. data/ext/bamtools/src/api/internal/BamRandomAccessController_p.h +93 -0
  135. data/ext/bamtools/src/api/internal/BamReader_p.cpp +380 -0
  136. data/ext/bamtools/src/api/internal/BamReader_p.h +112 -0
  137. data/ext/bamtools/src/api/internal/BamStandardIndex_p.cpp +986 -0
  138. data/ext/bamtools/src/api/internal/BamStandardIndex_p.h +236 -0
  139. data/ext/bamtools/src/api/internal/BamToolsIndex_p.cpp +641 -0
  140. data/ext/bamtools/src/api/internal/BamToolsIndex_p.h +187 -0
  141. data/ext/bamtools/src/api/internal/BamWriter_p.cpp +424 -0
  142. data/ext/bamtools/src/api/internal/BamWriter_p.h +66 -0
  143. data/ext/bamtools/src/api/internal/BgzfStream_p.cpp +438 -0
  144. data/ext/bamtools/src/api/internal/BgzfStream_p.h +108 -0
  145. data/ext/bamtools/src/api/internal/SamFormatParser_p.cpp +230 -0
  146. data/ext/bamtools/src/api/internal/SamFormatParser_p.h +61 -0
  147. data/ext/bamtools/src/api/internal/SamFormatPrinter_p.cpp +210 -0
  148. data/ext/bamtools/src/api/internal/SamFormatPrinter_p.h +60 -0
  149. data/ext/bamtools/src/api/internal/SamHeaderValidator_p.cpp +510 -0
  150. data/ext/bamtools/src/api/internal/SamHeaderValidator_p.h +101 -0
  151. data/ext/bamtools/src/api/internal/SamHeaderVersion_p.h +134 -0
  152. data/ext/bamtools/src/cmake_install.cmake +42 -0
  153. data/ext/bamtools/src/shared/bamtools_global.h +78 -0
  154. data/ext/bamtools/src/third_party/CMakeFiles/CMakeDirectoryInformation.cmake +22 -0
  155. data/ext/bamtools/src/third_party/CMakeFiles/progress.marks +1 -0
  156. data/ext/bamtools/src/third_party/CMakeLists.txt +10 -0
  157. data/ext/bamtools/src/third_party/Makefile +167 -0
  158. data/ext/bamtools/src/third_party/cmake_install.cmake +35 -0
  159. data/ext/bamtools/src/third_party/jsoncpp/CMakeFiles/CMakeDirectoryInformation.cmake +22 -0
  160. data/ext/bamtools/src/third_party/jsoncpp/CMakeFiles/jsoncpp.dir/CXX.includecache +144 -0
  161. data/ext/bamtools/src/third_party/jsoncpp/CMakeFiles/jsoncpp.dir/DependInfo.cmake +27 -0
  162. data/ext/bamtools/src/third_party/jsoncpp/CMakeFiles/jsoncpp.dir/build.make +157 -0
  163. data/ext/bamtools/src/third_party/jsoncpp/CMakeFiles/jsoncpp.dir/cmake_clean.cmake +13 -0
  164. data/ext/bamtools/src/third_party/jsoncpp/CMakeFiles/jsoncpp.dir/depend.internal +31 -0
  165. data/ext/bamtools/src/third_party/jsoncpp/CMakeFiles/jsoncpp.dir/depend.make +31 -0
  166. data/ext/bamtools/src/third_party/jsoncpp/CMakeFiles/jsoncpp.dir/flags.make +8 -0
  167. data/ext/bamtools/src/third_party/jsoncpp/CMakeFiles/jsoncpp.dir/json_reader.cpp.o +0 -0
  168. data/ext/bamtools/src/third_party/jsoncpp/CMakeFiles/jsoncpp.dir/json_value.cpp.o +0 -0
  169. data/ext/bamtools/src/third_party/jsoncpp/CMakeFiles/jsoncpp.dir/json_writer.cpp.o +0 -0
  170. data/ext/bamtools/src/third_party/jsoncpp/CMakeFiles/jsoncpp.dir/link.txt +1 -0
  171. data/ext/bamtools/src/third_party/jsoncpp/CMakeFiles/jsoncpp.dir/progress.make +4 -0
  172. data/ext/bamtools/src/third_party/jsoncpp/CMakeFiles/progress.marks +1 -0
  173. data/ext/bamtools/src/third_party/jsoncpp/CMakeLists.txt +23 -0
  174. data/ext/bamtools/src/third_party/jsoncpp/LICENSE +55 -0
  175. data/ext/bamtools/src/third_party/jsoncpp/Makefile +263 -0
  176. data/ext/bamtools/src/third_party/jsoncpp/cmake_install.cmake +29 -0
  177. data/ext/bamtools/src/third_party/jsoncpp/json.h +15 -0
  178. data/ext/bamtools/src/third_party/jsoncpp/json_batchallocator.h +130 -0
  179. data/ext/bamtools/src/third_party/jsoncpp/json_config.h +42 -0
  180. data/ext/bamtools/src/third_party/jsoncpp/json_features.h +47 -0
  181. data/ext/bamtools/src/third_party/jsoncpp/json_forwards.h +42 -0
  182. data/ext/bamtools/src/third_party/jsoncpp/json_internalarray.inl +453 -0
  183. data/ext/bamtools/src/third_party/jsoncpp/json_internalmap.inl +612 -0
  184. data/ext/bamtools/src/third_party/jsoncpp/json_reader.cpp +870 -0
  185. data/ext/bamtools/src/third_party/jsoncpp/json_reader.h +201 -0
  186. data/ext/bamtools/src/third_party/jsoncpp/json_tool.h +93 -0
  187. data/ext/bamtools/src/third_party/jsoncpp/json_value.cpp +1701 -0
  188. data/ext/bamtools/src/third_party/jsoncpp/json_value.h +1059 -0
  189. data/ext/bamtools/src/third_party/jsoncpp/json_valueiterator.inl +297 -0
  190. data/ext/bamtools/src/third_party/jsoncpp/json_writer.cpp +819 -0
  191. data/ext/bamtools/src/third_party/jsoncpp/json_writer.h +179 -0
  192. data/ext/bamtools/src/toolkit/CMakeFiles/CMakeDirectoryInformation.cmake +25 -0
  193. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/CXX.includecache +698 -0
  194. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/DependInfo.cmake +34 -0
  195. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/bamtools.cpp.o +0 -0
  196. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/bamtools_convert.cpp.o +0 -0
  197. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/bamtools_count.cpp.o +0 -0
  198. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/bamtools_coverage.cpp.o +0 -0
  199. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/bamtools_filter.cpp.o +0 -0
  200. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/bamtools_header.cpp.o +0 -0
  201. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/bamtools_index.cpp.o +0 -0
  202. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/bamtools_merge.cpp.o +0 -0
  203. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/bamtools_random.cpp.o +0 -0
  204. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/bamtools_resolve.cpp.o +0 -0
  205. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/bamtools_revert.cpp.o +0 -0
  206. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/bamtools_sort.cpp.o +0 -0
  207. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/bamtools_split.cpp.o +0 -0
  208. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/bamtools_stats.cpp.o +0 -0
  209. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/build.make +447 -0
  210. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/cmake_clean.cmake +24 -0
  211. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/depend.internal +319 -0
  212. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/depend.make +319 -0
  213. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/flags.make +8 -0
  214. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/link.txt +1 -0
  215. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/progress.make +15 -0
  216. data/ext/bamtools/src/toolkit/CMakeFiles/progress.marks +1 -0
  217. data/ext/bamtools/src/toolkit/CMakeLists.txt +44 -0
  218. data/ext/bamtools/src/toolkit/Makefile +560 -0
  219. data/ext/bamtools/src/toolkit/bamtools.cpp +163 -0
  220. data/ext/bamtools/src/toolkit/bamtools_convert.cpp +888 -0
  221. data/ext/bamtools/src/toolkit/bamtools_convert.h +37 -0
  222. data/ext/bamtools/src/toolkit/bamtools_count.cpp +187 -0
  223. data/ext/bamtools/src/toolkit/bamtools_count.h +37 -0
  224. data/ext/bamtools/src/toolkit/bamtools_coverage.cpp +196 -0
  225. data/ext/bamtools/src/toolkit/bamtools_coverage.h +37 -0
  226. data/ext/bamtools/src/toolkit/bamtools_filter.cpp +911 -0
  227. data/ext/bamtools/src/toolkit/bamtools_filter.h +37 -0
  228. data/ext/bamtools/src/toolkit/bamtools_header.cpp +122 -0
  229. data/ext/bamtools/src/toolkit/bamtools_header.h +38 -0
  230. data/ext/bamtools/src/toolkit/bamtools_index.cpp +126 -0
  231. data/ext/bamtools/src/toolkit/bamtools_index.h +37 -0
  232. data/ext/bamtools/src/toolkit/bamtools_merge.cpp +221 -0
  233. data/ext/bamtools/src/toolkit/bamtools_merge.h +37 -0
  234. data/ext/bamtools/src/toolkit/bamtools_random.cpp +255 -0
  235. data/ext/bamtools/src/toolkit/bamtools_random.h +37 -0
  236. data/ext/bamtools/src/toolkit/bamtools_resolve.cpp +1396 -0
  237. data/ext/bamtools/src/toolkit/bamtools_resolve.h +42 -0
  238. data/ext/bamtools/src/toolkit/bamtools_revert.cpp +194 -0
  239. data/ext/bamtools/src/toolkit/bamtools_revert.h +37 -0
  240. data/ext/bamtools/src/toolkit/bamtools_sort.cpp +410 -0
  241. data/ext/bamtools/src/toolkit/bamtools_sort.h +37 -0
  242. data/ext/bamtools/src/toolkit/bamtools_split.cpp +551 -0
  243. data/ext/bamtools/src/toolkit/bamtools_split.h +38 -0
  244. data/ext/bamtools/src/toolkit/bamtools_stats.cpp +286 -0
  245. data/ext/bamtools/src/toolkit/bamtools_stats.h +37 -0
  246. data/ext/bamtools/src/toolkit/bamtools_tool.h +35 -0
  247. data/ext/bamtools/src/toolkit/bamtools_version.h +20 -0
  248. data/ext/bamtools/src/toolkit/bamtools_version.h.in +20 -0
  249. data/ext/bamtools/src/toolkit/cmake_install.cmake +52 -0
  250. data/ext/bamtools/src/utils/CMakeFiles/BamTools-utils.dir/CXX.includecache +250 -0
  251. data/ext/bamtools/src/utils/CMakeFiles/BamTools-utils.dir/DependInfo.cmake +29 -0
  252. data/ext/bamtools/src/utils/CMakeFiles/BamTools-utils.dir/bamtools_fasta.cpp.o +0 -0
  253. data/ext/bamtools/src/utils/CMakeFiles/BamTools-utils.dir/bamtools_options.cpp.o +0 -0
  254. data/ext/bamtools/src/utils/CMakeFiles/BamTools-utils.dir/bamtools_pileup_engine.cpp.o +0 -0
  255. data/ext/bamtools/src/utils/CMakeFiles/BamTools-utils.dir/bamtools_utilities.cpp.o +0 -0
  256. data/ext/bamtools/src/utils/CMakeFiles/BamTools-utils.dir/build.make +184 -0
  257. data/ext/bamtools/src/utils/CMakeFiles/BamTools-utils.dir/cmake_clean.cmake +14 -0
  258. data/ext/bamtools/src/utils/CMakeFiles/BamTools-utils.dir/depend.internal +40 -0
  259. data/ext/bamtools/src/utils/CMakeFiles/BamTools-utils.dir/depend.make +40 -0
  260. data/ext/bamtools/src/utils/CMakeFiles/BamTools-utils.dir/flags.make +8 -0
  261. data/ext/bamtools/src/utils/CMakeFiles/BamTools-utils.dir/link.txt +1 -0
  262. data/ext/bamtools/src/utils/CMakeFiles/BamTools-utils.dir/progress.make +5 -0
  263. data/ext/bamtools/src/utils/CMakeFiles/CMakeDirectoryInformation.cmake +23 -0
  264. data/ext/bamtools/src/utils/CMakeFiles/progress.marks +1 -0
  265. data/ext/bamtools/src/utils/CMakeLists.txt +30 -0
  266. data/ext/bamtools/src/utils/Makefile +290 -0
  267. data/ext/bamtools/src/utils/bamtools_fasta.cpp +632 -0
  268. data/ext/bamtools/src/utils/bamtools_fasta.h +47 -0
  269. data/ext/bamtools/src/utils/bamtools_filter_engine.h +552 -0
  270. data/ext/bamtools/src/utils/bamtools_filter_properties.h +195 -0
  271. data/ext/bamtools/src/utils/bamtools_filter_ruleparser.h +319 -0
  272. data/ext/bamtools/src/utils/bamtools_options.cpp +287 -0
  273. data/ext/bamtools/src/utils/bamtools_options.h +213 -0
  274. data/ext/bamtools/src/utils/bamtools_pileup_engine.cpp +327 -0
  275. data/ext/bamtools/src/utils/bamtools_pileup_engine.h +94 -0
  276. data/ext/bamtools/src/utils/bamtools_utilities.cpp +333 -0
  277. data/ext/bamtools/src/utils/bamtools_utilities.h +67 -0
  278. data/ext/bamtools/src/utils/bamtools_variant.h +128 -0
  279. data/ext/bamtools/src/utils/cmake_install.cmake +29 -0
  280. data/ext/bamtools/src/utils/utils_global.h +21 -0
  281. data/lib/ngs_server/version.rb +3 -0
  282. data/lib/ngs_server.rb +3 -0
  283. data/ngs_server.gemspec +23 -0
  284. metadata +339 -0
@@ -0,0 +1,552 @@
1
+ // ***************************************************************************
2
+ // bamtools_filter_engine.h (c) 2010 Derek Barnett, Erik Garrison
3
+ // Marth Lab, Department of Biology, Boston College
4
+ // ---------------------------------------------------------------------------
5
+ // Last modified: 19 November 2010
6
+ // ---------------------------------------------------------------------------
7
+ // Provides a generic filter engine based on filter-sets of properties,
8
+ // with possible "rules" (compound logical expressions) to create more complex
9
+ // queries on a data set.
10
+ //
11
+ // FilterEngine consists, most importantly, of :
12
+ //
13
+ // a list of possible properties (each tagged whether it has been 'enabled' as a filter)
14
+ // a map of filterName => propertySet
15
+ // queue for compound rule expression (i.e. "(filter1 AND filter2) OR !filter3" )
16
+ //
17
+ // Each propertySet is a list of properties enabled for this particular filter object
18
+ //
19
+ // Implemented as a map of propertyNames to propertyFilterValue
20
+ // ( "property1" => pfv1
21
+ // "property2" => pfv2
22
+ // "property4" => pfv4
23
+ // etc. )
24
+ //
25
+ // Any properties that are 'possible', via FilterEngine::addProperty(), but not enabled
26
+ // via FilterEngine::setProperty() (in our example, say "property3"), evaluate to true
27
+ // for any query. Meaning that if a property is not set on this filter, we don't care
28
+ // about it here, so it passes though OK.
29
+ //
30
+ // A propertyFilterValue contains a value and comparison type
31
+ //
32
+ // ( pfv1: Value = 50, Type = GREATER_THAN_EQUAL
33
+ // pfv2: Value = "foo", Type = STARTS_WITH
34
+ // pfv4: Value = "bar", Type = CONTAINS
35
+ // etc. )
36
+ //
37
+ // This allows for more complex queries (than simple isEqual?) against a variety of data types.
38
+ //
39
+ // ***************************************************************************
40
+
41
+ #ifndef BAMTOOLS_FILTER_ENGINE_H
42
+ #define BAMTOOLS_FILTER_ENGINE_H
43
+
44
+ #include <utils/bamtools_filter_properties.h>
45
+ #include <utils/bamtools_filter_ruleparser.h>
46
+ #include <utils/bamtools_utilities.h>
47
+ #include <utils/utils_global.h>
48
+ #include <algorithm>
49
+ #include <iostream>
50
+ #include <map>
51
+ #include <queue>
52
+ #include <sstream>
53
+ #include <stack>
54
+ #include <string>
55
+ #include <utility>
56
+ #include <vector>
57
+
58
+ namespace BamTools {
59
+
60
+ struct UTILS_EXPORT FilterCompareType {
61
+ enum Type { AND = 0
62
+ , NOT
63
+ , OR
64
+ };
65
+ };
66
+
67
+ // -----------------------------------------------------------
68
+ // FilterEngine
69
+
70
+ template <typename FilterChecker>
71
+ class UTILS_EXPORT FilterEngine {
72
+
73
+ // ctor & dtor
74
+ public:
75
+ FilterEngine(void)
76
+ : m_ruleString("")
77
+ , m_isRuleQueueGenerated(false)
78
+ , m_defaultCompareType(FilterCompareType::OR)
79
+ , AND_OPERATOR("&")
80
+ , OR_OPERATOR("|")
81
+ , NOT_OPERATOR("!")
82
+ { }
83
+
84
+ ~FilterEngine(void) { }
85
+
86
+ // 'filter set' methods
87
+ public:
88
+ // creates a new filter set, returns true if created, false if error or already exists
89
+ bool addFilter(const std::string& filterName);
90
+
91
+ // return list of current filter names
92
+ const std::vector<std::string> filterNames(void);
93
+
94
+ // 'property' methods
95
+ public:
96
+
97
+ // add a new known property (& type) to engine
98
+ bool addProperty(const std::string& propertyName);
99
+
100
+ // sets property filter (value, type) for propertyName, on a particular filter set
101
+ // setProperty("filter1", "mapQuality", 50, GREATER_THAN_EQUAL)
102
+ template<typename T>
103
+ bool setProperty(const std::string& filterName,
104
+ const std::string& propertyName,
105
+ const T& value,
106
+ const PropertyFilterValue::ValueCompareType& type = PropertyFilterValue::EXACT);
107
+
108
+ // returns list of all properties known by FilterEngine ( any created using addProperty() )
109
+ const std::vector<std::string> allPropertyNames(void);
110
+
111
+ // returns list of property names that are 'enabled' ( only those touched by setProperty() )
112
+ const std::vector<std::string> enabledPropertyNames(void);
113
+
114
+ // 'rule' methods
115
+ public:
116
+
117
+ // sets comparison operator between filters if no rule string given
118
+ // default is to do an OR on each filter
119
+ void setDefaultCompareType(const FilterCompareType::Type& type = FilterCompareType::OR);
120
+
121
+ // sets rule string for building expression queue
122
+ // if empty, creates
123
+ void setRule(const std::string& ruleString = "");
124
+
125
+ // token parsing (for property filter generation)
126
+ public:
127
+ template<typename T>
128
+ static bool parseToken(const std::string& token, T& value, PropertyFilterValue::ValueCompareType& type);
129
+
130
+ // query evaluation
131
+ public:
132
+ // returns true if query passes all filters in FilterEngine
133
+ template<typename T>
134
+ bool check(const T& query);
135
+
136
+ // internal rule-handling methods
137
+ private:
138
+ void buildDefaultRuleString(void);
139
+ void buildRuleQueue(void);
140
+ template<typename T>
141
+ bool evaluateFilterRules(const T& query);
142
+
143
+ // data members
144
+ private:
145
+ // all 'filter sets'
146
+ FilterMap m_filters;
147
+
148
+ // all known properties
149
+ std::vector<Property> m_properties;
150
+
151
+ // infix expression of filter-set comparison rules
152
+ std::string m_ruleString;
153
+
154
+ // postfix expression of tokens (filterNames) and operators (as strings)
155
+ // if this is empty, uses m_compareType to build default expression queue
156
+ std::queue<std::string> m_ruleQueue;
157
+
158
+ // flag to test if the rule expression queue has been generated
159
+ bool m_isRuleQueueGenerated;
160
+
161
+ // 'default' comparison operator between filters if no rule string given
162
+ // if this is changed, m_ruleString is used to build new m_ruleQueue
163
+ FilterCompareType::Type m_defaultCompareType;
164
+
165
+ // client-specified checking type ( provides method: bool check(PropertyFilter, T object) )
166
+ FilterChecker m_checker;
167
+
168
+ // token-parsing constants
169
+ static const int NOT_CHAR = (int)'!';
170
+ static const int EQUAL_CHAR = (int)'=';
171
+ static const int GREATER_THAN_CHAR = (int)'>';
172
+ static const int LESS_THAN_CHAR = (int)'<';
173
+ static const int WILDCARD_CHAR = (int)'*';
174
+
175
+ // filter evaluation constants
176
+ const std::string AND_OPERATOR;
177
+ const std::string OR_OPERATOR;
178
+ const std::string NOT_OPERATOR;
179
+ };
180
+
181
+ // creates a new filter set, returns true if created, false if error or already exists
182
+ template<typename FilterChecker>
183
+ inline bool FilterEngine<FilterChecker>::addFilter(const std::string& filterName) {
184
+ return (m_filters.insert(std::make_pair(filterName, PropertyFilter()))).second;
185
+ }
186
+
187
+ // add a new known property & type to engine
188
+ template<typename FilterChecker>
189
+ inline bool FilterEngine<FilterChecker>::addProperty(const std::string& propertyName) {
190
+ const std::vector<std::string> propertyNames = allPropertyNames();
191
+ bool found = std::binary_search( propertyNames.begin(), propertyNames.end(), propertyName );
192
+ if ( found ) return false;
193
+ m_properties.push_back( Property(propertyName) );
194
+ std::sort( m_properties.begin(), m_properties.end() );
195
+ return true;
196
+ }
197
+
198
+ // returns list of all properties known by FilterEngine
199
+ // ( any that were created using addProperty() )
200
+ template<typename FilterChecker>
201
+ inline const std::vector<std::string> FilterEngine<FilterChecker>::allPropertyNames(void) {
202
+ // set up stringlist
203
+ std::vector<std::string> names;
204
+ names.reserve(m_properties.size());
205
+ // iterate through all properties, appending to stringlist
206
+ std::vector<Property>::const_iterator propIter = m_properties.begin();
207
+ std::vector<Property>::const_iterator propEnd = m_properties.end();
208
+ for ( ; propIter != propEnd; ++propIter )
209
+ names.push_back( (*propIter).Name );
210
+ // return stringlist
211
+ return names;
212
+ }
213
+
214
+ // builds a default rule string based on m_defaultCompareType
215
+ // used if user supplied an explicit rule string
216
+ template<typename FilterChecker>
217
+ inline void FilterEngine<FilterChecker>::buildDefaultRuleString(void) {
218
+
219
+ // set up temp string stream
220
+ std::stringstream ruleStream("");
221
+
222
+ // get first filterName
223
+ FilterMap::const_iterator mapIter = m_filters.begin();
224
+ ruleStream << (*mapIter).first;
225
+
226
+ // if there are more filters present
227
+ // iterate over remaining filters, appending compare operator and filter name
228
+ if ( m_filters.size() > 1 ) {
229
+ for ( ++mapIter ; mapIter != m_filters.end(); ++mapIter )
230
+ ruleStream << ( (m_defaultCompareType == FilterCompareType::AND) ? " & " : " | " )
231
+ << (*mapIter).first;
232
+ }
233
+
234
+ // set m_ruleString from temp stream
235
+ m_ruleString = ruleStream.str();
236
+ }
237
+
238
+ // build expression queue based on ruleString
239
+ template<typename FilterChecker>
240
+ inline void FilterEngine<FilterChecker>::buildRuleQueue(void) {
241
+
242
+ // skip if no filters present
243
+ if ( m_filters.empty() ) return;
244
+
245
+ // clear out any prior expression queue data
246
+ while ( !m_ruleQueue.empty() )
247
+ m_ruleQueue.pop();
248
+
249
+ // create a rule string, if not provided
250
+ if ( m_ruleString.empty() )
251
+ buildDefaultRuleString();
252
+
253
+ // initialize RuleParser, run, and retrieve results
254
+ RuleParser ruleParser(m_ruleString);
255
+ ruleParser.parse();
256
+ m_ruleQueue = ruleParser.results();
257
+
258
+ // set flag if rule queue contains any values
259
+ m_isRuleQueueGenerated = (!m_ruleQueue.empty());
260
+ }
261
+
262
+ // returns whether query value passes filter engine rules
263
+ template<class FilterChecker> template<typename T>
264
+ bool FilterEngine<FilterChecker>::check(const T& query) {
265
+
266
+ // return result of querying against filter rules
267
+ return evaluateFilterRules(query);
268
+ }
269
+
270
+ // returns list of property names that are 'enabled' ( only those touched by setProperty() )
271
+ template<typename FilterChecker>
272
+ inline const std::vector<std::string> FilterEngine<FilterChecker>::enabledPropertyNames(void) {
273
+ // initialize stringlist
274
+ std::vector<std::string> names;
275
+ names.reserve(m_properties.size());
276
+ // iterate over all properties, appending if enabled
277
+ std::vector<Property>::const_iterator propIter = m_properties.begin();
278
+ std::vector<Property>::const_iterator propEnd = m_properties.end();
279
+ for ( ; propIter != propEnd; ++propIter )
280
+ if ( (*propIter).IsEnabled )
281
+ names.push_back( (*propIter).Name );
282
+ // return stringlist
283
+ return names;
284
+ }
285
+
286
+ // evaluates postfix rule queue - with each filter as an operand, AND|OR|NOT as operators
287
+ template<class FilterChecker> template<typename T>
288
+ bool FilterEngine<FilterChecker>::evaluateFilterRules(const T& query) {
289
+
290
+ // build ruleQueue if not done before
291
+ if ( !m_isRuleQueueGenerated )
292
+ buildRuleQueue();
293
+
294
+ std::stack<bool> resultStack;
295
+ FilterMap::const_iterator filterIter;
296
+ FilterMap::const_iterator filterEnd = m_filters.end();
297
+ std::queue<std::string> ruleQueueCopy = m_ruleQueue;
298
+ while ( !ruleQueueCopy.empty() ) {
299
+ const std::string& token = ruleQueueCopy.front();
300
+
301
+ // token is NOT_OPERATOR
302
+ if ( token == FilterEngine<FilterChecker>::NOT_OPERATOR ) {
303
+ BAMTOOLS_ASSERT_MESSAGE( !resultStack.empty(), "Empty result stack - cannot apply operator: !" );
304
+ resultStack.top() = !resultStack.top();
305
+ }
306
+
307
+ // token is AND_OPERATOR
308
+ else if ( token == FilterEngine<FilterChecker>::AND_OPERATOR ) {
309
+ BAMTOOLS_ASSERT_MESSAGE( resultStack.size() >= 2 , "Not enough operands - cannot apply operator: &" );
310
+ bool topResult = resultStack.top();
311
+ resultStack.pop();
312
+ resultStack.top() &= topResult;
313
+ }
314
+
315
+ // token is OR_OPERATOR
316
+ else if ( token == FilterEngine<FilterChecker>::OR_OPERATOR ) {
317
+ BAMTOOLS_ASSERT_MESSAGE( resultStack.size() >= 2 , "Not enough operands - cannot apply operator: |" );
318
+ bool topResult = resultStack.top();
319
+ resultStack.pop();
320
+ resultStack.top() |= topResult;
321
+ }
322
+
323
+ // token is an operand
324
+ else {
325
+ // look up PropertyFilter that matches this token
326
+ filterIter = m_filters.find(token);
327
+ BAMTOOLS_ASSERT_MESSAGE( (filterIter != filterEnd), "Filter mentioned in rule, not found in FilterEngine" );
328
+ const PropertyFilter& filter = (*filterIter).second;
329
+ bool result = m_checker.check(filter, query);
330
+ resultStack.push( result );
331
+ }
332
+
333
+ // pop token from ruleQueue
334
+ ruleQueueCopy.pop();
335
+ }
336
+
337
+ // return last result
338
+ BAMTOOLS_ASSERT_MESSAGE( resultStack.size() == 1, "Result stack should only have one value remaining - cannot return result" );
339
+ return resultStack.top();
340
+ }
341
+
342
+ // return list of current filter names
343
+ template<typename FilterChecker>
344
+ inline const std::vector<std::string> FilterEngine<FilterChecker>::filterNames(void) {
345
+ // initialize stringlist
346
+ std::vector<std::string> names;
347
+ names.reserve(m_filters.size());
348
+ // iterate over all filters, appending filter name
349
+ FilterMap::const_iterator mapIter = m_filters.begin();
350
+ FilterMap::const_iterator mapEnd = m_filters.end();
351
+ for ( ; mapIter != mapEnd; ++mapIter )
352
+ names.push_back( (*mapIter).first );
353
+ // return stringlist
354
+ return names;
355
+ }
356
+
357
+ // parse a filterValue token string that may contain comparison qualifiers (">50", "*SRR", etc.)
358
+ template<class FilterChecker> template<typename T>
359
+ bool FilterEngine<FilterChecker>::parseToken(const std::string& token, T& value, PropertyFilterValue::ValueCompareType& type) {
360
+
361
+ // skip if token is empty
362
+ if ( token.empty() ) return false;
363
+
364
+ // will store token after special chars are removed
365
+ std::string strippedToken;
366
+
367
+ // if only single character
368
+ if ( token.length() == 1 ) {
369
+ strippedToken = token;
370
+ type = PropertyFilterValue::EXACT;
371
+ }
372
+
373
+ // more than one character, check for special chars
374
+ else {
375
+ const int firstChar = (int)token.at(0);
376
+ switch ( firstChar ) {
377
+
378
+ case ( FilterEngine<FilterChecker>::NOT_CHAR ) :
379
+ strippedToken = token.substr(1);
380
+ type = PropertyFilterValue::NOT;
381
+ break;
382
+
383
+ case ( FilterEngine<FilterChecker>::GREATER_THAN_CHAR ) :
384
+
385
+ // check for '>=' case
386
+ if ( token.at(1) == FilterEngine<FilterChecker>::EQUAL_CHAR ) {
387
+ if ( token.length() == 2 ) return false;
388
+ strippedToken = token.substr(2);
389
+ type = PropertyFilterValue::GREATER_THAN_EQUAL;
390
+ }
391
+
392
+ // otherwise only '>'
393
+ else {
394
+ strippedToken = token.substr(1);
395
+ type = PropertyFilterValue::GREATER_THAN;
396
+ }
397
+
398
+ break;
399
+
400
+ case ( FilterEngine<FilterChecker>::LESS_THAN_CHAR ) :
401
+
402
+ // check for '<=' case
403
+ if ( token.at(1) == FilterEngine<FilterChecker>::EQUAL_CHAR ) {
404
+ if ( token.length() == 2 ) return false;
405
+ strippedToken = token.substr(2);
406
+ type = PropertyFilterValue::LESS_THAN_EQUAL;
407
+ }
408
+
409
+ // otherwise only '<'
410
+ else {
411
+ strippedToken = token.substr(1);
412
+ type = PropertyFilterValue::LESS_THAN;
413
+ }
414
+
415
+ break;
416
+
417
+ case ( FilterEngine<FilterChecker>::WILDCARD_CHAR ) :
418
+
419
+ // check for *str* case (CONTAINS)
420
+ if ( token.at( token.length() - 1 ) == FilterEngine<FilterChecker>::WILDCARD_CHAR ) {
421
+ if ( token.length() == 2 ) return false;
422
+ strippedToken = token.substr(1, token.length() - 2);
423
+ type = PropertyFilterValue::CONTAINS;
424
+ }
425
+
426
+ // otherwise *str case (ENDS_WITH)
427
+ else {
428
+ strippedToken = token.substr(1);
429
+ type = PropertyFilterValue::ENDS_WITH;
430
+ }
431
+
432
+ break;
433
+
434
+ default :
435
+ // check for str* case (STARTS_WITH)
436
+ if ( token.at( token.length() - 1 ) == FilterEngine<FilterChecker>::WILDCARD_CHAR ) {
437
+ if ( token.length() == 2 ) return false;
438
+ strippedToken = token.substr(0, token.length() - 1);
439
+ type = PropertyFilterValue::STARTS_WITH;
440
+ }
441
+
442
+ // otherwise EXACT
443
+ else {
444
+ strippedToken = token;
445
+ type = PropertyFilterValue::EXACT;
446
+ }
447
+
448
+ break;
449
+ }
450
+ }
451
+
452
+ // convert stripped token to value
453
+ std::stringstream stream(strippedToken);
454
+ if ( strippedToken == "true" || strippedToken == "false" )
455
+ stream >> std::boolalpha >> value;
456
+ else
457
+ stream >> value;
458
+
459
+ // check for valid CompareType on type T
460
+ Variant variantCheck = value;
461
+
462
+ // if T is not string AND CompareType is for string values, return false
463
+ if ( !variantCheck.is_type<std::string>() ) {
464
+ if ( type == PropertyFilterValue::CONTAINS ||
465
+ type == PropertyFilterValue::ENDS_WITH ||
466
+ type == PropertyFilterValue::STARTS_WITH )
467
+
468
+ return false;
469
+ }
470
+
471
+ // return success
472
+ return true;
473
+ }
474
+
475
+ // sets comparison operator between filters if no rule string given
476
+ // default is to do an OR on each filter
477
+ template<typename FilterChecker>
478
+ inline void FilterEngine<FilterChecker>::setDefaultCompareType(const FilterCompareType::Type& type) {
479
+ // check for supported compare type
480
+ if ( type == FilterCompareType::AND || type == FilterCompareType::OR ) {
481
+ // if not the current compare type
482
+ if ( m_defaultCompareType != type ) {
483
+ m_defaultCompareType = type;
484
+ buildRuleQueue();
485
+ }
486
+ }
487
+ }
488
+
489
+ // sets property filter (value, type) for propertyName, on a particular filter set
490
+ // setProperty("filter1", "mapQuality", 50, GREATER_THAN_EQUAL)
491
+ template<class FilterChecker> template<typename T>
492
+ bool FilterEngine<FilterChecker>::setProperty(const std::string& filterName,
493
+ const std::string& propertyName,
494
+ const T& value,
495
+ const PropertyFilterValue::ValueCompareType& type)
496
+ {
497
+ // lookup filter by name, return false if not found
498
+ FilterMap::iterator filterIter = m_filters.find(filterName);
499
+ if ( filterIter == m_filters.end() ) return false;
500
+
501
+ // lookup property for filter, add new PropertyFilterValue if not found, modify if already exists
502
+ PropertyFilter& filter = (*filterIter).second;
503
+ PropertyMap::iterator propertyIter = filter.Properties.find(propertyName);
504
+
505
+ bool success;
506
+
507
+ // property not found for this filter, create new entry
508
+ if ( propertyIter == filter.Properties.end() )
509
+ success = (filter.Properties.insert(std::make_pair(propertyName, PropertyFilterValue(value, type)))).second;
510
+
511
+ // property already exists, modify
512
+ else {
513
+ PropertyFilterValue& filterValue = (*propertyIter).second;
514
+ filterValue.Value = value;
515
+ filterValue.Type = type;
516
+ success = true;
517
+ }
518
+
519
+ // if error so far, return false
520
+ if ( !success ) return false;
521
+
522
+ // --------------------------------------------
523
+ // otherwise, set Property.IsEnabled to true
524
+
525
+ // lookup property
526
+ std::vector<Property>::iterator knownPropertyIter = std::find( m_properties.begin(), m_properties.end(), propertyName);
527
+
528
+ // if not found, create a new (enabled) entry (& re-sort list)
529
+ if ( knownPropertyIter == m_properties.end() ) {
530
+ m_properties.push_back( Property(propertyName, true) );
531
+ std::sort( m_properties.begin(), m_properties.end() );
532
+ }
533
+
534
+ // property already known, set as enabled
535
+ else (*knownPropertyIter).IsEnabled = true;
536
+
537
+ // return success
538
+ return true;
539
+ }
540
+
541
+ // sets user-specified rule string & signals update of rule-expression queue
542
+ template<typename FilterChecker>
543
+ inline void FilterEngine<FilterChecker>::setRule(const std::string& ruleString) {
544
+ if ( m_ruleString != ruleString) {
545
+ m_ruleString = ruleString;
546
+ buildRuleQueue();
547
+ }
548
+ }
549
+
550
+ } // namespace BamTools
551
+
552
+ #endif // BAMTOOLS_FILTER_ENGINE_H