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,380 @@
1
+ // ***************************************************************************
2
+ // BamReader_p.cpp (c) 2009 Derek Barnett
3
+ // Marth Lab, Department of Biology, Boston College
4
+ // ---------------------------------------------------------------------------
5
+ // Last modified: 10 May 2011 (DB)
6
+ // ---------------------------------------------------------------------------
7
+ // Provides the basic functionality for reading BAM files
8
+ // ***************************************************************************
9
+
10
+ #include <api/BamConstants.h>
11
+ #include <api/BamReader.h>
12
+ #include <api/internal/BamHeader_p.h>
13
+ #include <api/internal/BamRandomAccessController_p.h>
14
+ #include <api/internal/BamReader_p.h>
15
+ #include <api/internal/BamStandardIndex_p.h>
16
+ #include <api/internal/BamToolsIndex_p.h>
17
+ #include <api/internal/BgzfStream_p.h>
18
+ using namespace BamTools;
19
+ using namespace BamTools::Internal;
20
+
21
+ #include <algorithm>
22
+ #include <iostream>
23
+ #include <iterator>
24
+ #include <vector>
25
+ using namespace std;
26
+
27
+ // constructor
28
+ BamReaderPrivate::BamReaderPrivate(BamReader* parent)
29
+ : m_alignmentsBeginOffset(0)
30
+ , m_parent(parent)
31
+ {
32
+ m_isBigEndian = BamTools::SystemIsBigEndian();
33
+ }
34
+
35
+ // destructor
36
+ BamReaderPrivate::~BamReaderPrivate(void) {
37
+ Close();
38
+ }
39
+
40
+ // closes the BAM file
41
+ void BamReaderPrivate::Close(void) {
42
+
43
+ // clear header & reference data
44
+ m_references.clear();
45
+ m_header.Clear();
46
+
47
+ // close internal
48
+ m_randomAccessController.Close();
49
+ m_stream.Close();
50
+
51
+ // clear filename
52
+ m_filename.clear();
53
+ }
54
+
55
+ // creates an index file of requested type on current BAM file
56
+ bool BamReaderPrivate::CreateIndex(const BamIndex::IndexType& type) {
57
+ if ( !IsOpen() ) return false;
58
+ return m_randomAccessController.CreateIndex(this, type);
59
+ }
60
+
61
+ // return path & filename of current BAM file
62
+ const string BamReaderPrivate::Filename(void) const {
63
+ return m_filename;
64
+ }
65
+
66
+ // return header data as std::string
67
+ string BamReaderPrivate::GetHeaderText(void) const {
68
+ return m_header.ToString();
69
+ }
70
+
71
+ // return header data as SamHeader object
72
+ SamHeader BamReaderPrivate::GetSamHeader(void) const {
73
+ return m_header.ToSamHeader();
74
+ }
75
+
76
+ // get next alignment (with character data fully parsed)
77
+ bool BamReaderPrivate::GetNextAlignment(BamAlignment& alignment) {
78
+
79
+ // if valid alignment found
80
+ if ( GetNextAlignmentCore(alignment) ) {
81
+
82
+ // store alignment's "source" filename
83
+ alignment.Filename = m_filename;
84
+
85
+ // return success/failure of parsing char data
86
+ return alignment.BuildCharData();
87
+ }
88
+
89
+ // no valid alignment found
90
+ return false;
91
+ }
92
+
93
+ // retrieves next available alignment core data (returns success/fail)
94
+ // ** DOES NOT populate any character data fields (read name, bases, qualities, tag data, filename)
95
+ // these can be accessed, if necessary, from the supportData
96
+ // useful for operations requiring ONLY positional or other alignment-related information
97
+ bool BamReaderPrivate::GetNextAlignmentCore(BamAlignment& alignment) {
98
+
99
+ // skip if region is set but has no alignments
100
+ if ( m_randomAccessController.HasRegion() &&
101
+ !m_randomAccessController.RegionHasAlignments() )
102
+ {
103
+ return false;
104
+ }
105
+
106
+ // if can't read next alignment
107
+ if ( !LoadNextAlignment(alignment) )
108
+ return false;
109
+
110
+ // check alignment's region-overlap state
111
+ BamRandomAccessController::RegionState state = m_randomAccessController.AlignmentState(alignment);
112
+
113
+ // if alignment starts after region, no need to keep reading
114
+ if ( state == BamRandomAccessController::AfterRegion )
115
+ return false;
116
+
117
+ // read until overlap is found
118
+ while ( state != BamRandomAccessController::OverlapsRegion ) {
119
+
120
+ // if can't read next alignment
121
+ if ( !LoadNextAlignment(alignment) )
122
+ return false;
123
+
124
+ // check alignment's region-overlap state
125
+ state = m_randomAccessController.AlignmentState(alignment);
126
+
127
+ // if alignment starts after region, no need to keep reading
128
+ if ( state == BamRandomAccessController::AfterRegion )
129
+ return false;
130
+ }
131
+
132
+ // if we get here, we found the next 'valid' alignment
133
+ // (e.g. overlaps current region if one was set, simply the next alignment if not)
134
+ alignment.SupportData.HasCoreOnly = true;
135
+ return true;
136
+ }
137
+
138
+ int BamReaderPrivate::GetReferenceCount(void) const {
139
+ return m_references.size();
140
+ }
141
+
142
+ const RefVector& BamReaderPrivate::GetReferenceData(void) const {
143
+ return m_references;
144
+ }
145
+
146
+ // returns RefID for given RefName (returns References.size() if not found)
147
+ int BamReaderPrivate::GetReferenceID(const string& refName) const {
148
+
149
+ // retrieve names from reference data
150
+ vector<string> refNames;
151
+ RefVector::const_iterator refIter = m_references.begin();
152
+ RefVector::const_iterator refEnd = m_references.end();
153
+ for ( ; refIter != refEnd; ++refIter)
154
+ refNames.push_back( (*refIter).RefName );
155
+
156
+ // return 'index-of' refName (or -1 if not found)
157
+ int index = distance(refNames.begin(), find(refNames.begin(), refNames.end(), refName));
158
+ if ( index == (int)m_references.size() ) return -1;
159
+ else return index;
160
+ }
161
+
162
+ bool BamReaderPrivate::HasIndex(void) const {
163
+ return m_randomAccessController.HasIndex();
164
+ }
165
+
166
+ bool BamReaderPrivate::IsOpen(void) const {
167
+ return m_stream.IsOpen;
168
+ }
169
+
170
+ // load BAM header data
171
+ bool BamReaderPrivate::LoadHeaderData(void) {
172
+ return m_header.Load(&m_stream);
173
+ }
174
+
175
+ // populates BamAlignment with alignment data under file pointer, returns success/fail
176
+ bool BamReaderPrivate::LoadNextAlignment(BamAlignment& alignment) {
177
+
178
+ // read in the 'block length' value, make sure it's not zero
179
+ char buffer[sizeof(uint32_t)];
180
+ m_stream.Read(buffer, sizeof(uint32_t));
181
+ alignment.SupportData.BlockLength = BamTools::UnpackUnsignedInt(buffer);
182
+ if ( m_isBigEndian ) BamTools::SwapEndian_32(alignment.SupportData.BlockLength);
183
+ if ( alignment.SupportData.BlockLength == 0 ) return false;
184
+
185
+ // read in core alignment data, make sure the right size of data was read
186
+ char x[Constants::BAM_CORE_SIZE];
187
+ if ( m_stream.Read(x, Constants::BAM_CORE_SIZE) != Constants::BAM_CORE_SIZE )
188
+ return false;
189
+
190
+ // swap core endian-ness if necessary
191
+ if ( m_isBigEndian ) {
192
+ for ( int i = 0; i < Constants::BAM_CORE_SIZE; i+=sizeof(uint32_t) )
193
+ BamTools::SwapEndian_32p(&x[i]);
194
+ }
195
+
196
+ // set BamAlignment 'core' and 'support' data
197
+ alignment.RefID = BamTools::UnpackSignedInt(&x[0]);
198
+ alignment.Position = BamTools::UnpackSignedInt(&x[4]);
199
+
200
+ unsigned int tempValue = BamTools::UnpackUnsignedInt(&x[8]);
201
+ alignment.Bin = tempValue >> 16;
202
+ alignment.MapQuality = tempValue >> 8 & 0xff;
203
+ alignment.SupportData.QueryNameLength = tempValue & 0xff;
204
+
205
+ tempValue = BamTools::UnpackUnsignedInt(&x[12]);
206
+ alignment.AlignmentFlag = tempValue >> 16;
207
+ alignment.SupportData.NumCigarOperations = tempValue & 0xffff;
208
+
209
+ alignment.SupportData.QuerySequenceLength = BamTools::UnpackUnsignedInt(&x[16]);
210
+ alignment.MateRefID = BamTools::UnpackSignedInt(&x[20]);
211
+ alignment.MatePosition = BamTools::UnpackSignedInt(&x[24]);
212
+ alignment.InsertSize = BamTools::UnpackSignedInt(&x[28]);
213
+
214
+ // set BamAlignment length
215
+ alignment.Length = alignment.SupportData.QuerySequenceLength;
216
+
217
+ // read in character data - make sure proper data size was read
218
+ bool readCharDataOK = false;
219
+ const unsigned int dataLength = alignment.SupportData.BlockLength - Constants::BAM_CORE_SIZE;
220
+ char* allCharData = (char*)calloc(sizeof(char), dataLength);
221
+
222
+ if ( m_stream.Read(allCharData, dataLength) == (signed int)dataLength ) {
223
+
224
+ // store 'allCharData' in supportData structure
225
+ alignment.SupportData.AllCharData.assign((const char*)allCharData, dataLength);
226
+
227
+ // set success flag
228
+ readCharDataOK = true;
229
+
230
+ // save CIGAR ops
231
+ // need to calculate this here so that BamAlignment::GetEndPosition() performs correctly,
232
+ // even when GetNextAlignmentCore() is called
233
+ const unsigned int cigarDataOffset = alignment.SupportData.QueryNameLength;
234
+ uint32_t* cigarData = (uint32_t*)(allCharData + cigarDataOffset);
235
+ CigarOp op;
236
+ alignment.CigarData.clear();
237
+ alignment.CigarData.reserve(alignment.SupportData.NumCigarOperations);
238
+ for ( unsigned int i = 0; i < alignment.SupportData.NumCigarOperations; ++i ) {
239
+
240
+ // swap endian-ness if necessary
241
+ if ( m_isBigEndian ) BamTools::SwapEndian_32(cigarData[i]);
242
+
243
+ // build CigarOp structure
244
+ op.Length = (cigarData[i] >> Constants::BAM_CIGAR_SHIFT);
245
+ op.Type = Constants::BAM_CIGAR_LOOKUP[ (cigarData[i] & Constants::BAM_CIGAR_MASK) ];
246
+
247
+ // save CigarOp
248
+ alignment.CigarData.push_back(op);
249
+ }
250
+ }
251
+
252
+ // clean up & return parsing success/failure
253
+ free(allCharData);
254
+ return readCharDataOK;
255
+ }
256
+
257
+ // loads reference data from BAM file
258
+ bool BamReaderPrivate::LoadReferenceData(void) {
259
+
260
+ // get number of reference sequences
261
+ char buffer[sizeof(uint32_t)];
262
+ m_stream.Read(buffer, sizeof(uint32_t));
263
+ uint32_t numberRefSeqs = BamTools::UnpackUnsignedInt(buffer);
264
+ if ( m_isBigEndian ) BamTools::SwapEndian_32(numberRefSeqs);
265
+ m_references.reserve((int)numberRefSeqs);
266
+
267
+ // iterate over all references in header
268
+ for ( unsigned int i = 0; i != numberRefSeqs; ++i ) {
269
+
270
+ // get length of reference name
271
+ m_stream.Read(buffer, sizeof(uint32_t));
272
+ uint32_t refNameLength = BamTools::UnpackUnsignedInt(buffer);
273
+ if ( m_isBigEndian ) BamTools::SwapEndian_32(refNameLength);
274
+ char* refName = (char*)calloc(refNameLength, 1);
275
+
276
+ // get reference name and reference sequence length
277
+ m_stream.Read(refName, refNameLength);
278
+ m_stream.Read(buffer, sizeof(int32_t));
279
+ int32_t refLength = BamTools::UnpackSignedInt(buffer);
280
+ if ( m_isBigEndian ) BamTools::SwapEndian_32(refLength);
281
+
282
+ // store data for reference
283
+ RefData aReference;
284
+ aReference.RefName = (string)((const char*)refName);
285
+ aReference.RefLength = refLength;
286
+ m_references.push_back(aReference);
287
+
288
+ // clean up calloc-ed temp variable
289
+ free(refName);
290
+ }
291
+
292
+ // return success
293
+ return true;
294
+ }
295
+
296
+ bool BamReaderPrivate::LocateIndex(const BamIndex::IndexType& preferredType) {
297
+ return m_randomAccessController.LocateIndex(this, preferredType);
298
+ }
299
+
300
+ // opens BAM file (and index)
301
+ bool BamReaderPrivate::Open(const string& filename) {
302
+
303
+ // close current BAM file if open
304
+ if ( m_stream.IsOpen )
305
+ Close();
306
+
307
+ // attempt to open BgzfStream for reading
308
+ if ( !m_stream.Open(filename, "rb") ) {
309
+ cerr << "BamReader ERROR: Could not open BGZF stream for " << filename << endl;
310
+ return false;
311
+ }
312
+
313
+ // attempt to load header data
314
+ if ( !LoadHeaderData() ) {
315
+ cerr << "BamReader ERROR: Could not load header data for " << filename << endl;
316
+ Close();
317
+ return false;
318
+ }
319
+
320
+ // attempt to load reference data
321
+ if ( !LoadReferenceData() ) {
322
+ cerr << "BamReader ERROR: Could not load reference data for " << filename << endl;
323
+ Close();
324
+ return false;
325
+ }
326
+
327
+ // if all OK, store filename & offset of first alignment
328
+ m_filename = filename;
329
+ m_alignmentsBeginOffset = m_stream.Tell();
330
+
331
+ // return success
332
+ return true;
333
+ }
334
+
335
+ bool BamReaderPrivate::OpenIndex(const std::string& indexFilename) {
336
+ return m_randomAccessController.OpenIndex(indexFilename, this);
337
+ }
338
+
339
+ // returns BAM file pointer to beginning of alignment data
340
+ bool BamReaderPrivate::Rewind(void) {
341
+
342
+ // attempt rewind to first alignment
343
+ if ( !m_stream.Seek(m_alignmentsBeginOffset) )
344
+ return false;
345
+
346
+ // verify that we can read first alignment
347
+ BamAlignment al;
348
+ if ( !LoadNextAlignment(al) )
349
+ return false;
350
+
351
+ // reset region
352
+ m_randomAccessController.ClearRegion();
353
+
354
+ // rewind back to beginning of first alignment
355
+ // return success/fail of seek
356
+ return m_stream.Seek(m_alignmentsBeginOffset);
357
+ }
358
+
359
+ bool BamReaderPrivate::Seek(const int64_t& position) {
360
+ return m_stream.Seek(position);
361
+ }
362
+
363
+ void BamReaderPrivate::SetIndex(BamIndex* index) {
364
+ m_randomAccessController.SetIndex(index);
365
+ }
366
+
367
+ // change the index caching behavior
368
+ void BamReaderPrivate::SetIndexCacheMode(const BamIndex::IndexCacheMode& mode) {
369
+ m_randomAccessController.SetIndexCacheMode(mode);
370
+ }
371
+
372
+ // sets current region & attempts to jump to it
373
+ // returns success/failure
374
+ bool BamReaderPrivate::SetRegion(const BamRegion& region) {
375
+ return m_randomAccessController.SetRegion(this, region, m_references.size());
376
+ }
377
+
378
+ int64_t BamReaderPrivate::Tell(void) const {
379
+ return m_stream.Tell();
380
+ }
@@ -0,0 +1,112 @@
1
+ // ***************************************************************************
2
+ // BamReader_p.h (c) 2010 Derek Barnett
3
+ // Marth Lab, Department of Biology, Boston College
4
+ // ---------------------------------------------------------------------------
5
+ // Last modified: 5 April 2011 (DB)
6
+ // ---------------------------------------------------------------------------
7
+ // Provides the basic functionality for reading BAM files
8
+ // ***************************************************************************
9
+
10
+ #ifndef BAMREADER_P_H
11
+ #define BAMREADER_P_H
12
+
13
+ // -------------
14
+ // W A R N I N G
15
+ // -------------
16
+ //
17
+ // This file is not part of the BamTools API. It exists purely as an
18
+ // implementation detail. This header file may change from version to version
19
+ // without notice, or even be removed.
20
+ //
21
+ // We mean it.
22
+
23
+ #include <api/BamAlignment.h>
24
+ #include <api/BamIndex.h>
25
+ #include <api/BamReader.h>
26
+ #include <api/SamHeader.h>
27
+ #include <api/internal/BamHeader_p.h>
28
+ #include <api/internal/BamRandomAccessController_p.h>
29
+ #include <api/internal/BgzfStream_p.h>
30
+ #include <string>
31
+
32
+ namespace BamTools {
33
+ namespace Internal {
34
+
35
+ class BamReaderPrivate {
36
+
37
+ // ctor & dtor
38
+ public:
39
+ BamReaderPrivate(BamReader* parent);
40
+ ~BamReaderPrivate(void);
41
+
42
+ // BamReader interface
43
+ public:
44
+
45
+ // file operations
46
+ void Close(void);
47
+ const std::string Filename(void) const;
48
+ bool IsOpen(void) const;
49
+ bool Open(const std::string& filename);
50
+ bool Rewind(void);
51
+ bool SetRegion(const BamRegion& region);
52
+
53
+ // access alignment data
54
+ bool GetNextAlignment(BamAlignment& alignment);
55
+ bool GetNextAlignmentCore(BamAlignment& alignment);
56
+
57
+ // access auxiliary data
58
+ std::string GetHeaderText(void) const;
59
+ SamHeader GetSamHeader(void) const;
60
+ int GetReferenceCount(void) const;
61
+ const RefVector& GetReferenceData(void) const;
62
+ int GetReferenceID(const std::string& refName) const;
63
+
64
+ // index operations
65
+ bool CreateIndex(const BamIndex::IndexType& type);
66
+ bool HasIndex(void) const;
67
+ bool LocateIndex(const BamIndex::IndexType& preferredType);
68
+ bool OpenIndex(const std::string& indexFilename);
69
+ void SetIndex(BamIndex* index);
70
+ void SetIndexCacheMode(const BamIndex::IndexCacheMode& mode);
71
+
72
+ // internal methods, but available as a BamReaderPrivate 'interface'
73
+ //
74
+ // these methods should only be used by BamTools::Internal classes
75
+ // (currently only used by the BamIndex subclasses)
76
+ public:
77
+ // retrieves header text from BAM file
78
+ bool LoadHeaderData(void);
79
+ // retrieves BAM alignment under file pointer
80
+ // (does no overlap checking or character data parsing)
81
+ bool LoadNextAlignment(BamAlignment& alignment);
82
+ // builds reference data structure from BAM file
83
+ bool LoadReferenceData(void);
84
+ // seek reader to file position
85
+ bool Seek(const int64_t& position);
86
+ // return reader's file position
87
+ int64_t Tell(void) const;
88
+
89
+ // data members
90
+ public:
91
+
92
+ // general BAM file data
93
+ int64_t m_alignmentsBeginOffset;
94
+ std::string m_filename;
95
+ RefVector m_references;
96
+
97
+ // system data
98
+ bool m_isBigEndian;
99
+
100
+ // parent BamReader
101
+ BamReader* m_parent;
102
+
103
+ // BamReaderPrivate components
104
+ BamHeader m_header;
105
+ BamRandomAccessController m_randomAccessController;
106
+ BgzfStream m_stream;
107
+ };
108
+
109
+ } // namespace Internal
110
+ } // namespace BamTools
111
+
112
+ #endif // BAMREADER_P_H