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,206 @@
1
+ // ***************************************************************************
2
+ // BamAlignment.h (c) 2009 Derek Barnett
3
+ // Marth Lab, Department of Biology, Boston College
4
+ // ---------------------------------------------------------------------------
5
+ // Last modified: 22 April 2011 (DB)
6
+ // ---------------------------------------------------------------------------
7
+ // Provides the BamAlignment data structure
8
+ // ***************************************************************************
9
+
10
+ #ifndef BAMALIGNMENT_H
11
+ #define BAMALIGNMENT_H
12
+
13
+ #include <api/api_global.h>
14
+ #include <api/BamAux.h>
15
+ #include <string>
16
+ #include <vector>
17
+
18
+ namespace BamTools {
19
+
20
+ // forward declaration of BamAlignment's friend classes
21
+ namespace Internal {
22
+ class BamReaderPrivate;
23
+ class BamWriterPrivate;
24
+ } // namespace Internal
25
+
26
+ // BamAlignment data structure
27
+ struct API_EXPORT BamAlignment {
28
+
29
+ // constructors & destructor
30
+ public:
31
+ BamAlignment(void);
32
+ BamAlignment(const BamAlignment& other);
33
+ ~BamAlignment(void);
34
+
35
+ // queries against alignment flags
36
+ public:
37
+ bool IsDuplicate(void) const; // returns true if this read is a PCR duplicate
38
+ bool IsFailedQC(void) const; // returns true if this read failed quality control
39
+ bool IsFirstMate(void) const; // returns true if alignment is first mate on read
40
+ bool IsMapped(void) const; // returns true if alignment is mapped
41
+ bool IsMateMapped(void) const; // returns true if alignment's mate is mapped
42
+ bool IsMateReverseStrand(void) const; // returns true if alignment's mate mapped to reverse strand
43
+ bool IsPaired(void) const; // returns true if alignment part of paired-end read
44
+ bool IsPrimaryAlignment(void) const; // returns true if reported position is primary alignment
45
+ bool IsProperPair(void) const; // returns true if alignment is part of read that satisfied paired-end resolution
46
+ bool IsReverseStrand(void) const; // returns true if alignment mapped to reverse strand
47
+ bool IsSecondMate(void) const; // returns true if alignment is second mate on read
48
+
49
+ // manipulate alignment flags
50
+ public:
51
+ void SetIsDuplicate(bool ok); // sets value of "PCR duplicate" flag
52
+ void SetIsFailedQC(bool ok); // sets value of "failed quality control" flag
53
+ void SetIsFirstMate(bool ok); // sets value of "alignment is first mate" flag
54
+ void SetIsMapped(bool ok); // sets value of "alignment is mapped" flag
55
+ void SetIsMateMapped(bool ok); // sets value of "alignment's mate is mapped" flag
56
+ void SetIsMateReverseStrand(bool ok); // sets value of "alignment's mate mapped to reverse strand" flag
57
+ void SetIsPaired(bool ok); // sets value of "alignment part of paired-end read" flag
58
+ void SetIsPrimaryAlignment(bool ok); // sets value of "position is primary alignment" flag
59
+ void SetIsProperPair(bool ok); // sets value of "alignment is part of read that satisfied paired-end resolution" flag
60
+ void SetIsReverseStrand(bool ok); // sets value of "alignment mapped to reverse strand" flag
61
+ void SetIsSecondMate(bool ok); // sets value of "alignment is second mate on read" flag
62
+
63
+ // legacy methods (consider deprecated, but still available)
64
+ void SetIsMateUnmapped(bool ok); // complement of using SetIsMateMapped()
65
+ void SetIsSecondaryAlignment(bool ok); // complement of using SetIsPrimaryAlignment()
66
+ void SetIsUnmapped(bool ok); // complement of using SetIsMapped()
67
+
68
+ // tag data access methods
69
+ public:
70
+
71
+ // -------------------------------------------------------------------------------------
72
+ // N.B. - The following tag access methods may not be used on BamAlignments fetched
73
+ // using BamReader::GetNextAlignmentCore(). Attempting to use them will not result in
74
+ // error message (to keep output clean) but will ALWAYS return false. Only user-created
75
+ // BamAlignments or those retrieved using BamReader::GetNextAlignment() are valid here.
76
+ //
77
+ // You can call BuildCharData() on such an alignment retrieved by GetNextAlignmentCore().
78
+ // This populates all the character data, and will enable subsequent queries on tag data.
79
+ // -------------------------------------------------------------------------------------
80
+
81
+ // adds a tag
82
+ bool AddTag(const std::string& tag, const std::string& type, const std::string& value);
83
+ bool AddTag(const std::string& tag, const std::string& type, const uint32_t& value);
84
+ bool AddTag(const std::string& tag, const std::string& type, const int32_t& value);
85
+ bool AddTag(const std::string& tag, const std::string& type, const float& value);
86
+
87
+ // adds a "binary array" tag
88
+ bool AddTag(const std::string& tag, const std::vector<uint8_t>& values);
89
+ bool AddTag(const std::string& tag, const std::vector<int8_t>& values);
90
+ bool AddTag(const std::string& tag, const std::vector<uint16_t>& values);
91
+ bool AddTag(const std::string& tag, const std::vector<int16_t>& values);
92
+ bool AddTag(const std::string& tag, const std::vector<uint32_t>& values);
93
+ bool AddTag(const std::string& tag, const std::vector<int32_t>& values);
94
+ bool AddTag(const std::string& tag, const std::vector<float>& values);
95
+
96
+ // edits a tag
97
+ bool EditTag(const std::string& tag, const std::string& type, const std::string& value);
98
+ bool EditTag(const std::string& tag, const std::string& type, const uint32_t& value);
99
+ bool EditTag(const std::string& tag, const std::string& type, const int32_t& value);
100
+ bool EditTag(const std::string& tag, const std::string& type, const float& value);
101
+
102
+ // edits a "binary array" tag
103
+ bool EditTag(const std::string& tag, const std::vector<uint8_t>& values);
104
+ bool EditTag(const std::string& tag, const std::vector<int8_t>& values);
105
+ bool EditTag(const std::string& tag, const std::vector<uint16_t>& values);
106
+ bool EditTag(const std::string& tag, const std::vector<int16_t>& values);
107
+ bool EditTag(const std::string& tag, const std::vector<uint32_t>& values);
108
+ bool EditTag(const std::string& tag, const std::vector<int32_t>& values);
109
+ bool EditTag(const std::string& tag, const std::vector<float>& values);
110
+
111
+ // retrieves data for a tag
112
+ bool GetTag(const std::string& tag, std::string& destination) const;
113
+ bool GetTag(const std::string& tag, uint32_t& destination) const;
114
+ bool GetTag(const std::string& tag, int32_t& destination) const;
115
+ bool GetTag(const std::string& tag, float& destination) const;
116
+
117
+ // retrieves data for a "binary array" tag
118
+ bool GetTag(const std::string& tag, std::vector<uint32_t>& destination) const;
119
+ bool GetTag(const std::string& tag, std::vector<int32_t>& destination) const;
120
+ bool GetTag(const std::string& tag, std::vector<float>& destination) const;
121
+
122
+ // retrieves the BAM tag-type character for a tag
123
+ bool GetTagType(const std::string& tag, char& type) const;
124
+
125
+ // legacy methods (consider deprecated, but still available)
126
+ bool GetEditDistance(uint32_t& editDistance) const; // retrieves value of "NM" tag
127
+ bool GetReadGroup(std::string& readGroup) const; // retrieves value of "RG" tag
128
+
129
+ // returns true if alignment has a record for this tag name
130
+ bool HasTag(const std::string& tag) const;
131
+
132
+ // removes a tag
133
+ bool RemoveTag(const std::string& tag);
134
+
135
+ // additional methods
136
+ public:
137
+ // populates alignment string fields
138
+ bool BuildCharData(void);
139
+ // calculates alignment end position
140
+ int GetEndPosition(bool usePadded = false, bool zeroBased = true) const;
141
+
142
+ // public data fields
143
+ public:
144
+ std::string Name; // read name
145
+ int32_t Length; // length of query sequence
146
+ std::string QueryBases; // 'original' sequence (as reported from sequencing machine)
147
+ std::string AlignedBases; // 'aligned' sequence (includes any indels, padding, clipping)
148
+ std::string Qualities; // FASTQ qualities (ASCII characters, not numeric values)
149
+ std::string TagData; // tag data (use provided methods to query/modify)
150
+ int32_t RefID; // ID number for reference sequence
151
+ int32_t Position; // position (0-based) where alignment starts
152
+ uint16_t Bin; // BAM (standard) index bin number for this alignment
153
+ uint16_t MapQuality; // mapping quality score
154
+ uint32_t AlignmentFlag; // alignment bit-flag (use provided methods to query/modify)
155
+ std::vector<CigarOp> CigarData; // CIGAR operations for this alignment
156
+ int32_t MateRefID; // ID number for reference sequence where alignment's mate was aligned
157
+ int32_t MatePosition; // position (0-based) where alignment's mate starts
158
+ int32_t InsertSize; // mate-pair insert size
159
+ std::string Filename; // name of BAM file which this alignment comes from
160
+
161
+ //! \cond
162
+ // internal utility methods
163
+ private:
164
+ bool FindTag(const std::string& tag,
165
+ char*& pTagData,
166
+ const unsigned int& tagDataLength,
167
+ unsigned int& numBytesParsed) const;
168
+ bool IsValidSize(const std::string& tag,
169
+ const std::string& type) const;
170
+ bool SkipToNextTag(const char storageType,
171
+ char*& pTagData,
172
+ unsigned int& numBytesParsed) const;
173
+
174
+ // internal data
175
+ private:
176
+
177
+ struct BamAlignmentSupportData {
178
+
179
+ // data members
180
+ std::string AllCharData;
181
+ uint32_t BlockLength;
182
+ uint32_t NumCigarOperations;
183
+ uint32_t QueryNameLength;
184
+ uint32_t QuerySequenceLength;
185
+ bool HasCoreOnly;
186
+
187
+ // constructor
188
+ BamAlignmentSupportData(void)
189
+ : BlockLength(0)
190
+ , NumCigarOperations(0)
191
+ , QueryNameLength(0)
192
+ , QuerySequenceLength(0)
193
+ , HasCoreOnly(false)
194
+ { }
195
+ };
196
+ BamAlignmentSupportData SupportData;
197
+ friend class Internal::BamReaderPrivate;
198
+ friend class Internal::BamWriterPrivate;
199
+ //! \endcond
200
+ };
201
+
202
+ typedef std::vector<BamAlignment> BamAlignmentVector;
203
+
204
+ } // namespace BamTools
205
+
206
+ #endif // BAMALIGNMENT_H
@@ -0,0 +1,456 @@
1
+ // ***************************************************************************
2
+ // BamAux.h (c) 2009 Derek Barnett, Michael Str�mberg
3
+ // Marth Lab, Department of Biology, Boston College
4
+ // ---------------------------------------------------------------------------
5
+ // Last modified: 4 March 2011 (DB)
6
+ // ---------------------------------------------------------------------------
7
+ // Provides data structures & utility methods that are used throughout the API.
8
+ // ***************************************************************************
9
+
10
+ #ifndef BAMAUX_H
11
+ #define BAMAUX_H
12
+
13
+ #include <api/api_global.h>
14
+ #include <fstream>
15
+ #include <iostream>
16
+ #include <string>
17
+ #include <vector>
18
+
19
+ /*! \file BamAux.h
20
+
21
+ Provides data structures & utility methods that are used throughout the API.
22
+ */
23
+ /*! \namespace BamTools
24
+ \brief Contains all BamTools classes & methods.
25
+
26
+ The BamTools API contained in this namespace contains classes and methods
27
+ for reading, writing, and manipulating BAM alignment files.
28
+ */
29
+ namespace BamTools {
30
+
31
+ // ----------------------------------------------------------------
32
+ // CigarOp
33
+
34
+ /*! \struct BamTools::CigarOp
35
+ \brief Represents a CIGAR alignment operation.
36
+
37
+ \sa http://samtools.sourceforge.net/SAM-1.3.pdf for more details on using CIGAR operations.
38
+ */
39
+ struct API_EXPORT CigarOp {
40
+
41
+ char Type; //!< CIGAR operation type (MIDNSHP)
42
+ uint32_t Length; //!< CIGAR operation length (number of bases)
43
+
44
+ //! constructor
45
+ CigarOp(const char type = '\0',
46
+ const uint32_t& length = 0)
47
+ : Type(type)
48
+ , Length(length)
49
+ { }
50
+ };
51
+
52
+ // ----------------------------------------------------------------
53
+ // RefData
54
+
55
+ /*! \struct BamTools::RefData
56
+ \brief Represents a reference sequence entry
57
+ */
58
+ struct API_EXPORT RefData {
59
+
60
+ std::string RefName; //!< name of reference sequence
61
+ int32_t RefLength; //!< length of reference sequence
62
+
63
+ //! constructor
64
+ RefData(const std::string& name = "",
65
+ const int32_t& length = 0)
66
+ : RefName(name)
67
+ , RefLength(length)
68
+ { }
69
+ };
70
+
71
+ //! convenience typedef for vector of RefData entries
72
+ typedef std::vector<RefData> RefVector;
73
+
74
+ // ----------------------------------------------------------------
75
+ // BamRegion
76
+
77
+ /*! \struct BamTools::BamRegion
78
+ \brief Represents a sequential genomic region
79
+
80
+ Allowed to span multiple (sequential) references.
81
+ */
82
+ struct API_EXPORT BamRegion {
83
+
84
+ int LeftRefID; //!< reference ID for region's left boundary
85
+ int LeftPosition; //!< position for region's left boundary
86
+ int RightRefID; //!< reference ID for region's right boundary
87
+ int RightPosition; //!< position for region's right boundary
88
+
89
+ //! constructor
90
+ BamRegion(const int& leftID = -1,
91
+ const int& leftPos = -1,
92
+ const int& rightID = -1,
93
+ const int& rightPos = -1)
94
+ : LeftRefID(leftID)
95
+ , LeftPosition(leftPos)
96
+ , RightRefID(rightID)
97
+ , RightPosition(rightPos)
98
+ { }
99
+
100
+ //! copy constructor
101
+ BamRegion(const BamRegion& other)
102
+ : LeftRefID(other.LeftRefID)
103
+ , LeftPosition(other.LeftPosition)
104
+ , RightRefID(other.RightRefID)
105
+ , RightPosition(other.RightPosition)
106
+ { }
107
+
108
+ //! Clears region boundaries
109
+ void clear(void) {
110
+ LeftRefID = -1; LeftPosition = -1;
111
+ RightRefID = -1; RightPosition = -1;
112
+ }
113
+
114
+ //! Returns true if region has a left boundary
115
+ bool isLeftBoundSpecified(void) const {
116
+ return ( LeftRefID >= 0 && LeftPosition >= 0 );
117
+ }
118
+
119
+ //! Returns true if region boundaries are not defined
120
+ bool isNull(void) const {
121
+ return ( !isLeftBoundSpecified() && !isRightBoundSpecified() );
122
+ }
123
+
124
+ //! Returns true if region has a right boundary
125
+ bool isRightBoundSpecified(void) const {
126
+ return ( RightRefID >= 0 && RightPosition >= 0 );
127
+ }
128
+ };
129
+
130
+ // ----------------------------------------------------------------
131
+ // General utility methods
132
+
133
+ /*! \fn bool FileExists(const std::string& filename)
134
+ \brief checks if file exists
135
+
136
+ Attempts to open file in a read-only mode.
137
+
138
+ \return \c true if file can be opened successfully
139
+ */
140
+ API_EXPORT inline bool FileExists(const std::string& filename) {
141
+ std::ifstream f(filename.c_str(), std::ifstream::in);
142
+ return !f.fail();
143
+ }
144
+
145
+ /*! \fn void SwapEndian_16(int16_t& x)
146
+ \brief swaps endianness of signed 16-bit integer, in place
147
+
148
+ Swaps endian representation of value in \a x.
149
+ */
150
+ API_EXPORT inline void SwapEndian_16(int16_t& x) {
151
+ x = ((x >> 8) | (x << 8));
152
+ }
153
+
154
+ /*! \fn void SwapEndian_16(uint16_t& x)
155
+ \brief swaps endianness of unsigned 16-bit integer, in place
156
+
157
+ Swaps endian representation of value in \a x.
158
+ */
159
+ API_EXPORT inline void SwapEndian_16(uint16_t& x) {
160
+ x = ((x >> 8) | (x << 8));
161
+ }
162
+
163
+ /*! \fn void SwapEndian_32(int32_t& x)
164
+ \brief swaps endianness of signed 32-bit integer, in place
165
+
166
+ Swaps endian representation of value in \a x.
167
+ */
168
+ API_EXPORT inline void SwapEndian_32(int32_t& x) {
169
+ x = ( (x >> 24) |
170
+ ((x << 8) & 0x00FF0000) |
171
+ ((x >> 8) & 0x0000FF00) |
172
+ (x << 24)
173
+ );
174
+ }
175
+
176
+ /*! \fn void SwapEndian_32(uint32_t& x)
177
+ \brief swaps endianness of unsigned 32-bit integer, in place
178
+
179
+ Swaps endian representation of value in \a x.
180
+ */
181
+ API_EXPORT inline void SwapEndian_32(uint32_t& x) {
182
+ x = ( (x >> 24) |
183
+ ((x << 8) & 0x00FF0000) |
184
+ ((x >> 8) & 0x0000FF00) |
185
+ (x << 24)
186
+ );
187
+ }
188
+
189
+ /*! \fn void SwapEndian_64(int64_t& x)
190
+ \brief swaps endianness of signed 64-bit integer, in place
191
+
192
+ Swaps endian representation of value in \a x.
193
+ */
194
+ API_EXPORT inline void SwapEndian_64(int64_t& x) {
195
+ x = ( (x >> 56) |
196
+ ((x << 40) & 0x00FF000000000000ll) |
197
+ ((x << 24) & 0x0000FF0000000000ll) |
198
+ ((x << 8) & 0x000000FF00000000ll) |
199
+ ((x >> 8) & 0x00000000FF000000ll) |
200
+ ((x >> 24) & 0x0000000000FF0000ll) |
201
+ ((x >> 40) & 0x000000000000FF00ll) |
202
+ (x << 56)
203
+ );
204
+ }
205
+
206
+ /*! \fn void SwapEndian_64(uint64_t& x)
207
+ \brief swaps endianness of unsigned 64-bit integer, in place
208
+
209
+ Swaps endian representation of value in \a x.
210
+ */
211
+ API_EXPORT inline void SwapEndian_64(uint64_t& x) {
212
+ x = ( (x >> 56) |
213
+ ((x << 40) & 0x00FF000000000000ll) |
214
+ ((x << 24) & 0x0000FF0000000000ll) |
215
+ ((x << 8) & 0x000000FF00000000ll) |
216
+ ((x >> 8) & 0x00000000FF000000ll) |
217
+ ((x >> 24) & 0x0000000000FF0000ll) |
218
+ ((x >> 40) & 0x000000000000FF00ll) |
219
+ (x << 56)
220
+ );
221
+ }
222
+
223
+ /*! \fn void SwapEndian_16p(char* data)
224
+ \brief swaps endianness of the next 2 bytes in a buffer, in place
225
+
226
+ Swaps endian representation the next 2 bytes in \a data.
227
+ */
228
+ API_EXPORT inline void SwapEndian_16p(char* data) {
229
+ uint16_t& value = (uint16_t&)*data;
230
+ SwapEndian_16(value);
231
+ }
232
+
233
+ /*! \fn void SwapEndian_32p(char* data)
234
+ \brief swaps endianness of the next 4 bytes in a buffer, in place
235
+
236
+ Swaps endian representation the next 4 bytes in \a data.
237
+ */
238
+ API_EXPORT inline void SwapEndian_32p(char* data) {
239
+ uint32_t& value = (uint32_t&)*data;
240
+ SwapEndian_32(value);
241
+ }
242
+
243
+ /*! \fn void SwapEndian_64p(char* data)
244
+ \brief swaps endianness of the next 8 bytes in a buffer, in place
245
+
246
+ Swaps endian representation the next 8 bytes in \a data.
247
+ */
248
+ API_EXPORT inline void SwapEndian_64p(char* data) {
249
+ uint64_t& value = (uint64_t&)*data;
250
+ SwapEndian_64(value);
251
+ }
252
+
253
+ /*! \fn bool SystemIsBigEndian(void)
254
+ \brief checks host architecture's byte order
255
+ \return \c true if system uses big-endian ordering
256
+ */
257
+ API_EXPORT inline bool SystemIsBigEndian(void) {
258
+ const uint16_t one = 0x0001;
259
+ return ((*(char*) &one) == 0 );
260
+ }
261
+
262
+ /*! \fn void PackUnsignedInt(char* buffer, unsigned int value)
263
+ \brief stores unsigned integer value in a byte buffer
264
+
265
+ \param buffer destination buffer
266
+ \param value unsigned integer to 'pack' in buffer
267
+ */
268
+ API_EXPORT inline void PackUnsignedInt(char* buffer, unsigned int value) {
269
+ buffer[0] = (char)value;
270
+ buffer[1] = (char)(value >> 8);
271
+ buffer[2] = (char)(value >> 16);
272
+ buffer[3] = (char)(value >> 24);
273
+ }
274
+
275
+ /*! \fn void PackUnsignedShort(char* buffer, unsigned short value)
276
+ \brief stores unsigned short integer value in a byte buffer
277
+
278
+ \param buffer destination buffer
279
+ \param value unsigned short integer to 'pack' in buffer
280
+ */
281
+ API_EXPORT inline void PackUnsignedShort(char* buffer, unsigned short value) {
282
+ buffer[0] = (char)value;
283
+ buffer[1] = (char)(value >> 8);
284
+ }
285
+
286
+ /*! \fn double UnpackDouble(const char* buffer)
287
+ \brief reads a double value from byte buffer
288
+
289
+ \param buffer source byte buffer
290
+ \return the (double) value read from the buffer
291
+ */
292
+ API_EXPORT inline double UnpackDouble(const char* buffer) {
293
+ union { double value; unsigned char valueBuffer[sizeof(double)]; } un;
294
+ un.value = 0;
295
+ un.valueBuffer[0] = buffer[0];
296
+ un.valueBuffer[1] = buffer[1];
297
+ un.valueBuffer[2] = buffer[2];
298
+ un.valueBuffer[3] = buffer[3];
299
+ un.valueBuffer[4] = buffer[4];
300
+ un.valueBuffer[5] = buffer[5];
301
+ un.valueBuffer[6] = buffer[6];
302
+ un.valueBuffer[7] = buffer[7];
303
+ return un.value;
304
+ }
305
+
306
+ /*! \fn double UnpackDouble(char* buffer)
307
+ \brief reads a double value from byte buffer
308
+
309
+ This is an overloaded function.
310
+
311
+ \param buffer source byte buffer
312
+ \return the (double) value read from the buffer
313
+ */
314
+ API_EXPORT inline double UnpackDouble(char* buffer) {
315
+ return UnpackDouble( (const char*)buffer );
316
+ }
317
+
318
+ /*! \fn double UnpackFloat(const char* buffer)
319
+ \brief reads a float value from byte buffer
320
+
321
+ \param buffer source byte buffer
322
+ \return the (float) value read from the buffer
323
+ */
324
+ API_EXPORT inline float UnpackFloat(const char* buffer) {
325
+ union { float value; unsigned char valueBuffer[sizeof(float)]; } un;
326
+ un.value = 0;
327
+ un.valueBuffer[0] = buffer[0];
328
+ un.valueBuffer[1] = buffer[1];
329
+ un.valueBuffer[2] = buffer[2];
330
+ un.valueBuffer[3] = buffer[3];
331
+ return un.value;
332
+ }
333
+
334
+ /*! \fn double UnpackFloat(char* buffer)
335
+ \brief reads a float value from byte buffer
336
+
337
+ This is an overloaded function.
338
+
339
+ \param buffer source byte buffer
340
+ \return the (float) value read from the buffer
341
+ */
342
+ API_EXPORT inline float UnpackFloat(char* buffer) {
343
+ return UnpackFloat( (const char*)buffer );
344
+ }
345
+
346
+ /*! \fn signed int UnpackSignedInt(const char* buffer)
347
+ \brief reads a signed integer value from byte buffer
348
+
349
+ \param buffer source byte buffer
350
+ \return the (signed int) value read from the buffer
351
+ */
352
+ API_EXPORT inline signed int UnpackSignedInt(const char* buffer) {
353
+ union { signed int value; unsigned char valueBuffer[sizeof(signed int)]; } un;
354
+ un.value = 0;
355
+ un.valueBuffer[0] = buffer[0];
356
+ un.valueBuffer[1] = buffer[1];
357
+ un.valueBuffer[2] = buffer[2];
358
+ un.valueBuffer[3] = buffer[3];
359
+ return un.value;
360
+ }
361
+
362
+ /*! \fn signed int UnpackSignedInt(char* buffer)
363
+ \brief reads a signed integer value from byte buffer
364
+
365
+ This is an overloaded function.
366
+
367
+ \param buffer source byte buffer
368
+ \return the (signed int) value read from the buffer
369
+ */
370
+ API_EXPORT inline signed int UnpackSignedInt(char* buffer) {
371
+ return UnpackSignedInt( (const char*) buffer );
372
+ }
373
+
374
+ /*! \fn signed short UnpackSignedShort(const char* buffer)
375
+ \brief reads a signed short integer value from byte buffer
376
+
377
+ \param buffer source byte buffer
378
+ \return the (signed short) value read from the buffer
379
+ */
380
+ API_EXPORT inline signed short UnpackSignedShort(const char* buffer) {
381
+ union { signed short value; unsigned char valueBuffer[sizeof(signed short)]; } un;
382
+ un.value = 0;
383
+ un.valueBuffer[0] = buffer[0];
384
+ un.valueBuffer[1] = buffer[1];
385
+ return un.value;
386
+ }
387
+
388
+ /*! \fn signed short UnpackSignedShort(char* buffer)
389
+ \brief reads a signed short integer value from byte buffer
390
+
391
+ This is an overloaded function.
392
+
393
+ \param buffer source byte buffer
394
+ \return the (signed short) value read from the buffer
395
+ */
396
+ API_EXPORT inline signed short UnpackSignedShort(char* buffer) {
397
+ return UnpackSignedShort( (const char*)buffer );
398
+ }
399
+
400
+ /*! \fn unsigned int UnpackUnsignedInt(const char* buffer)
401
+ \brief reads an unsigned integer value from byte buffer
402
+
403
+ \param buffer source byte buffer
404
+ \return the (unsigned int) value read from the buffer
405
+ */
406
+ API_EXPORT inline unsigned int UnpackUnsignedInt(const char* buffer) {
407
+ union { unsigned int value; unsigned char valueBuffer[sizeof(unsigned int)]; } un;
408
+ un.value = 0;
409
+ un.valueBuffer[0] = buffer[0];
410
+ un.valueBuffer[1] = buffer[1];
411
+ un.valueBuffer[2] = buffer[2];
412
+ un.valueBuffer[3] = buffer[3];
413
+ return un.value;
414
+ }
415
+
416
+ /*! \fn unsigned int UnpackUnsignedInt(char* buffer)
417
+ \brief reads an unsigned integer value from byte buffer
418
+
419
+ This is an overloaded function.
420
+
421
+ \param buffer source byte buffer
422
+ \return the (unsigned int) value read from the buffer
423
+ */
424
+ API_EXPORT inline unsigned int UnpackUnsignedInt(char* buffer) {
425
+ return UnpackUnsignedInt( (const char*)buffer );
426
+ }
427
+
428
+ /*! \fn unsigned short UnpackUnsignedShort(const char* buffer)
429
+ \brief reads an unsigned short integer value from byte buffer
430
+
431
+ \param buffer source byte buffer
432
+ \return the (unsigned short) value read from the buffer
433
+ */
434
+ API_EXPORT inline unsigned short UnpackUnsignedShort(const char* buffer) {
435
+ union { unsigned short value; unsigned char valueBuffer[sizeof(unsigned short)]; } un;
436
+ un.value = 0;
437
+ un.valueBuffer[0] = buffer[0];
438
+ un.valueBuffer[1] = buffer[1];
439
+ return un.value;
440
+ }
441
+
442
+ /*! \fn unsigned short UnpackUnsignedShort(char* buffer)
443
+ \brief reads an unsigned short integer value from byte buffer
444
+
445
+ This is an overloaded function.
446
+
447
+ \param buffer source byte buffer
448
+ \return the (unsigned short) value read from the buffer
449
+ */
450
+ API_EXPORT inline unsigned short UnpackUnsignedShort(char* buffer) {
451
+ return UnpackUnsignedShort( (const char*)buffer );
452
+ }
453
+
454
+ } // namespace BamTools
455
+
456
+ #endif // BAMAUX_H