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,37 @@
1
+ // ***************************************************************************
2
+ // bamtools_sort.h (c) 2010 Derek Barnett, Erik Garrison
3
+ // Marth Lab, Department of Biology, Boston College
4
+ // ---------------------------------------------------------------------------
5
+ // Last modified: 7 April 2011 (DB)
6
+ // ---------------------------------------------------------------------------
7
+ // Sorts a BAM file
8
+ // ***************************************************************************
9
+
10
+ #ifndef BAMTOOLS_SORT_H
11
+ #define BAMTOOLS_SORT_H
12
+
13
+ #include "bamtools_tool.h"
14
+
15
+ namespace BamTools {
16
+
17
+ class SortTool : public AbstractTool {
18
+
19
+ public:
20
+ SortTool(void);
21
+ ~SortTool(void);
22
+
23
+ public:
24
+ int Help(void);
25
+ int Run(int argc, char* argv[]);
26
+
27
+ private:
28
+ struct SortSettings;
29
+ SortSettings* m_settings;
30
+
31
+ struct SortToolPrivate;
32
+ SortToolPrivate* m_impl;
33
+ };
34
+
35
+ } // namespace BamTools
36
+
37
+ #endif // BAMTOOLS_SORT_H
@@ -0,0 +1,551 @@
1
+ // ***************************************************************************
2
+ // bamtools_split.cpp (c) 2010 Derek Barnett, Erik Garrison
3
+ // Marth Lab, Department of Biology, Boston College
4
+ // ---------------------------------------------------------------------------
5
+ // Last modified: 7 April 2011 (DB)
6
+ // ---------------------------------------------------------------------------
7
+ // Splits a BAM file on user-specified property, creating a new BAM output
8
+ // file for each value found
9
+ // ***************************************************************************
10
+
11
+ #include "bamtools_split.h"
12
+
13
+ #include <api/BamConstants.h>
14
+ #include <api/BamReader.h>
15
+ #include <api/BamWriter.h>
16
+ #include <utils/bamtools_options.h>
17
+ #include <utils/bamtools_variant.h>
18
+ using namespace BamTools;
19
+
20
+ #include <ctime>
21
+ #include <iostream>
22
+ #include <map>
23
+ #include <sstream>
24
+ #include <string>
25
+ #include <vector>
26
+ using namespace std;
27
+
28
+ namespace BamTools {
29
+
30
+ // string constants
31
+ static const string SPLIT_MAPPED_TOKEN = ".MAPPED";
32
+ static const string SPLIT_UNMAPPED_TOKEN = ".UNMAPPED";
33
+ static const string SPLIT_PAIRED_TOKEN = ".PAIRED_END";
34
+ static const string SPLIT_SINGLE_TOKEN = ".SINGLE_END";
35
+ static const string SPLIT_REFERENCE_TOKEN = ".REF_";
36
+
37
+ string GetTimestampString(void) {
38
+
39
+ // get human readable timestamp
40
+ time_t currentTime;
41
+ time(&currentTime);
42
+ stringstream timeStream("");
43
+ timeStream << ctime(&currentTime);
44
+
45
+ // convert whitespace to '_'
46
+ string timeString = timeStream.str();
47
+ size_t found = timeString.find(" ");
48
+ while (found != string::npos) {
49
+ timeString.replace(found, 1, "_");
50
+ found = timeString.find(" ", found+1);
51
+ }
52
+ return timeString;
53
+ }
54
+
55
+ // remove copy of filename without extension
56
+ // (so /path/to/file.txt becomes /path/to/file )
57
+ string RemoveFilenameExtension(const string& filename) {
58
+ size_t found = filename.rfind(".");
59
+ return filename.substr(0, found);
60
+ }
61
+
62
+ } // namespace BamTools
63
+
64
+ // ---------------------------------------------
65
+ // SplitSettings implementation
66
+
67
+ struct SplitTool::SplitSettings {
68
+
69
+ // flags
70
+ bool HasInputFilename;
71
+ bool HasCustomOutputStub;
72
+ bool IsSplittingMapped;
73
+ bool IsSplittingPaired;
74
+ bool IsSplittingReference;
75
+ bool IsSplittingTag;
76
+
77
+ // string args
78
+ string CustomOutputStub;
79
+ string InputFilename;
80
+ string TagToSplit;
81
+
82
+ // constructor
83
+ SplitSettings(void)
84
+ : HasInputFilename(false)
85
+ , HasCustomOutputStub(false)
86
+ , IsSplittingMapped(false)
87
+ , IsSplittingPaired(false)
88
+ , IsSplittingReference(false)
89
+ , IsSplittingTag(false)
90
+ , CustomOutputStub("")
91
+ , InputFilename(Options::StandardIn())
92
+ , TagToSplit("")
93
+ { }
94
+ };
95
+
96
+ // ---------------------------------------------
97
+ // SplitToolPrivate declaration
98
+
99
+ class SplitTool::SplitToolPrivate {
100
+
101
+ // ctor & dtor
102
+ public:
103
+ SplitToolPrivate(SplitTool::SplitSettings* settings)
104
+ : m_settings(settings)
105
+ { }
106
+
107
+ ~SplitToolPrivate(void) {
108
+ m_reader.Close();
109
+ }
110
+
111
+ // 'public' interface
112
+ public:
113
+ bool Run(void);
114
+
115
+ // internal methods
116
+ private:
117
+ // close & delete BamWriters in map
118
+ template<typename T>
119
+ void CloseWriters(map<T, BamWriter*>& writers);
120
+ // calculate output stub based on IO args given
121
+ void DetermineOutputFilenameStub(void);
122
+ // open our BamReader
123
+ bool OpenReader(void);
124
+ // split alignments in BAM file based on isMapped property
125
+ bool SplitMapped(void);
126
+ // split alignments in BAM file based on isPaired property
127
+ bool SplitPaired(void);
128
+ // split alignments in BAM file based on refID property
129
+ bool SplitReference(void);
130
+ // finds first alignment and calls corresponding SplitTagImpl<>
131
+ // depending on tag type
132
+ bool SplitTag(void);
133
+ // templated split tag implementation
134
+ // handle the various types that are possible for tags
135
+ template<typename T>
136
+ bool SplitTagImpl(BamAlignment& al);
137
+
138
+ // data members
139
+ private:
140
+ SplitTool::SplitSettings* m_settings;
141
+ string m_outputFilenameStub;
142
+ BamReader m_reader;
143
+ string m_header;
144
+ RefVector m_references;
145
+ };
146
+
147
+ void SplitTool::SplitToolPrivate::DetermineOutputFilenameStub(void) {
148
+
149
+ // if user supplied output filename stub, use that
150
+ if ( m_settings->HasCustomOutputStub )
151
+ m_outputFilenameStub = m_settings->CustomOutputStub;
152
+
153
+ // else if user supplied input BAM filename, use that (minus ".bam" extension) as stub
154
+ else if ( m_settings->HasInputFilename )
155
+ m_outputFilenameStub = RemoveFilenameExtension(m_settings->InputFilename);
156
+
157
+ // otherwise, user did not specify -stub, and input is coming from STDIN
158
+ // generate stub from timestamp
159
+ else m_outputFilenameStub = GetTimestampString();
160
+ }
161
+
162
+ bool SplitTool::SplitToolPrivate::OpenReader(void) {
163
+
164
+ // attempt to open BAM file
165
+ if ( !m_reader.Open(m_settings->InputFilename) ) {
166
+ cerr << "bamtools split ERROR: could not open BAM file: " << m_settings->InputFilename << endl;
167
+ return false;
168
+ }
169
+
170
+ // save file 'metadata' & return success
171
+ m_header = m_reader.GetHeaderText();
172
+ m_references = m_reader.GetReferenceData();
173
+ return true;
174
+ }
175
+
176
+ bool SplitTool::SplitToolPrivate::Run(void) {
177
+
178
+ // determine output stub
179
+ DetermineOutputFilenameStub();
180
+
181
+ // open up BamReader
182
+ if ( !OpenReader() )
183
+ return false;
184
+
185
+ // determine split type from settings
186
+ if ( m_settings->IsSplittingMapped ) return SplitMapped();
187
+ if ( m_settings->IsSplittingPaired ) return SplitPaired();
188
+ if ( m_settings->IsSplittingReference ) return SplitReference();
189
+ if ( m_settings->IsSplittingTag ) return SplitTag();
190
+
191
+ // if we get here, no property was specified
192
+ cerr << "bamtools split ERROR: no property given to split on... " << endl
193
+ << "Please use -mapped, -paired, -reference, or -tag TAG to specifiy desired split behavior." << endl;
194
+ return false;
195
+ }
196
+
197
+ bool SplitTool::SplitToolPrivate::SplitMapped(void) {
198
+
199
+ // set up splitting data structure
200
+ map<bool, BamWriter*> outputFiles;
201
+ map<bool, BamWriter*>::iterator writerIter;
202
+
203
+ // iterate through alignments
204
+ BamAlignment al;
205
+ BamWriter* writer;
206
+ bool isCurrentAlignmentMapped;
207
+ while ( m_reader.GetNextAlignment(al) ) {
208
+
209
+ // see if bool value exists
210
+ isCurrentAlignmentMapped = al.IsMapped();
211
+ writerIter = outputFiles.find(isCurrentAlignmentMapped);
212
+
213
+ // if no writer associated with this value
214
+ if ( writerIter == outputFiles.end() ) {
215
+
216
+ // open new BamWriter
217
+ const string outputFilename = m_outputFilenameStub + ( isCurrentAlignmentMapped
218
+ ? SPLIT_MAPPED_TOKEN
219
+ : SPLIT_UNMAPPED_TOKEN ) + ".bam";
220
+ writer = new BamWriter;
221
+ if ( !writer->Open(outputFilename, m_header, m_references) ) {
222
+ cerr << "bamtools split ERROR: could not open " << outputFilename
223
+ << " for writing." << endl;
224
+ return false;
225
+ }
226
+
227
+ // store in map
228
+ outputFiles.insert( make_pair(isCurrentAlignmentMapped, writer) );
229
+ }
230
+
231
+ // else grab corresponding writer
232
+ else writer = (*writerIter).second;
233
+
234
+ // store alignment in proper BAM output file
235
+ if ( writer )
236
+ writer->SaveAlignment(al);
237
+ }
238
+
239
+ // clean up BamWriters
240
+ CloseWriters(outputFiles);
241
+
242
+ // return success
243
+ return true;
244
+ }
245
+
246
+ bool SplitTool::SplitToolPrivate::SplitPaired(void) {
247
+
248
+ // set up splitting data structure
249
+ map<bool, BamWriter*> outputFiles;
250
+ map<bool, BamWriter*>::iterator writerIter;
251
+
252
+ // iterate through alignments
253
+ BamAlignment al;
254
+ BamWriter* writer;
255
+ bool isCurrentAlignmentPaired;
256
+ while ( m_reader.GetNextAlignment(al) ) {
257
+
258
+ // see if bool value exists
259
+ isCurrentAlignmentPaired = al.IsPaired();
260
+ writerIter = outputFiles.find(isCurrentAlignmentPaired);
261
+
262
+ // if no writer associated with this value
263
+ if ( writerIter == outputFiles.end() ) {
264
+
265
+ // open new BamWriter
266
+ const string outputFilename = m_outputFilenameStub + ( isCurrentAlignmentPaired
267
+ ? SPLIT_PAIRED_TOKEN
268
+ : SPLIT_SINGLE_TOKEN ) + ".bam";
269
+ writer = new BamWriter;
270
+ if ( !writer->Open(outputFilename, m_header, m_references) ) {
271
+ cerr << "bamtool split ERROR: could not open " << outputFilename
272
+ << " for writing." << endl;
273
+ return false;
274
+ }
275
+
276
+ // store in map
277
+ outputFiles.insert( make_pair(isCurrentAlignmentPaired, writer) );
278
+ }
279
+
280
+ // else grab corresponding writer
281
+ else writer = (*writerIter).second;
282
+
283
+ // store alignment in proper BAM output file
284
+ if ( writer )
285
+ writer->SaveAlignment(al);
286
+ }
287
+
288
+ // clean up BamWriters
289
+ CloseWriters(outputFiles);
290
+
291
+ // return success
292
+ return true;
293
+ }
294
+
295
+ bool SplitTool::SplitToolPrivate::SplitReference(void) {
296
+
297
+ // set up splitting data structure
298
+ map<int32_t, BamWriter*> outputFiles;
299
+ map<int32_t, BamWriter*>::iterator writerIter;
300
+
301
+ // iterate through alignments
302
+ BamAlignment al;
303
+ BamWriter* writer;
304
+ int32_t currentRefId;
305
+ while ( m_reader.GetNextAlignment(al) ) {
306
+
307
+ // see if bool value exists
308
+ currentRefId = al.RefID;
309
+ writerIter = outputFiles.find(currentRefId);
310
+
311
+ // if no writer associated with this value
312
+ if ( writerIter == outputFiles.end() ) {
313
+
314
+ // open new BamWriter
315
+ const string refName = m_references.at(currentRefId).RefName;
316
+ const string outputFilename = m_outputFilenameStub + SPLIT_REFERENCE_TOKEN + refName + ".bam";
317
+ writer = new BamWriter;
318
+ if ( !writer->Open(outputFilename, m_header, m_references) ) {
319
+ cerr << "bamtools split ERROR: could not open " << outputFilename
320
+ << " for writing." << endl;
321
+ return false;
322
+ }
323
+
324
+ // store in map
325
+ outputFiles.insert( make_pair(currentRefId, writer) );
326
+ }
327
+
328
+ // else grab corresponding writer
329
+ else writer = (*writerIter).second;
330
+
331
+ // store alignment in proper BAM output file
332
+ if ( writer )
333
+ writer->SaveAlignment(al);
334
+ }
335
+
336
+ // clean up BamWriters
337
+ CloseWriters(outputFiles);
338
+
339
+ // return success
340
+ return true;
341
+ }
342
+
343
+ // finds first alignment and calls corresponding SplitTagImpl<>() depending on tag type
344
+ bool SplitTool::SplitToolPrivate::SplitTag(void) {
345
+
346
+ // iterate through alignments, until we hit TAG
347
+ BamAlignment al;
348
+ while ( m_reader.GetNextAlignment(al) ) {
349
+
350
+ // look for tag in this alignment and get tag type
351
+ char tagType(0);
352
+ if ( !al.GetTagType(m_settings->TagToSplit, tagType) )
353
+ continue;
354
+
355
+ // request split method based on tag type
356
+ // pass it the current alignment found
357
+ switch ( tagType ) {
358
+
359
+ case (Constants::BAM_TAG_TYPE_INT8) :
360
+ case (Constants::BAM_TAG_TYPE_INT16) :
361
+ case (Constants::BAM_TAG_TYPE_INT32) :
362
+ return SplitTagImpl<int32_t>(al);
363
+
364
+ case (Constants::BAM_TAG_TYPE_UINT8) :
365
+ case (Constants::BAM_TAG_TYPE_UINT16) :
366
+ case (Constants::BAM_TAG_TYPE_UINT32) :
367
+ return SplitTagImpl<uint32_t>(al);
368
+
369
+ case (Constants::BAM_TAG_TYPE_FLOAT) :
370
+ return SplitTagImpl<float>(al);
371
+
372
+ case (Constants::BAM_TAG_TYPE_ASCII) :
373
+ case (Constants::BAM_TAG_TYPE_STRING) :
374
+ case (Constants::BAM_TAG_TYPE_HEX) :
375
+ return SplitTagImpl<string>(al);
376
+
377
+ default:
378
+ fprintf(stderr, "bamtools split ERROR: unknown tag type encountered: [%c]\n", tagType);
379
+ return false;
380
+ }
381
+ }
382
+
383
+ // tag not found, but that's not an error - return success
384
+ return true;
385
+ }
386
+
387
+ // --------------------------------------------------------------------------------
388
+ // template method implementation
389
+ // *Technical Note* - use of template methods declared & defined in ".cpp" file
390
+ // goes against normal practices, but works here because these
391
+ // are purely internal (no one can call from outside this file)
392
+
393
+ // close BamWriters & delete pointers
394
+ template<typename T>
395
+ void SplitTool::SplitToolPrivate::CloseWriters(map<T, BamWriter*>& writers) {
396
+
397
+ typedef map<T, BamWriter*> WriterMap;
398
+ typedef typename WriterMap::iterator WriterMapIterator;
399
+
400
+ // iterate over writers
401
+ WriterMapIterator writerIter = writers.begin();
402
+ WriterMapIterator writerEnd = writers.end();
403
+ for ( ; writerIter != writerEnd; ++writerIter ) {
404
+ BamWriter* writer = (*writerIter).second;
405
+ if ( writer == 0 ) continue;
406
+
407
+ // close BamWriter
408
+ writer->Close();
409
+
410
+ // destroy BamWriter
411
+ delete writer;
412
+ writer = 0;
413
+ }
414
+
415
+ // clear the container (destroying the items doesn't remove them)
416
+ writers.clear();
417
+ }
418
+
419
+ // handle the various types that are possible for tags
420
+ template<typename T>
421
+ bool SplitTool::SplitToolPrivate::SplitTagImpl(BamAlignment& al) {
422
+
423
+ typedef T TagValueType;
424
+ typedef map<TagValueType, BamWriter*> WriterMap;
425
+ typedef typename WriterMap::iterator WriterMapIterator;
426
+
427
+ // set up splitting data structure
428
+ WriterMap outputFiles;
429
+ WriterMapIterator writerIter;
430
+
431
+ // local variables
432
+ const string tag = m_settings->TagToSplit;
433
+ BamWriter* writer;
434
+ stringstream outputFilenameStream("");
435
+ TagValueType currentValue;
436
+
437
+ // retrieve first alignment tag value
438
+ if ( al.GetTag(tag, currentValue) ) {
439
+
440
+ // open new BamWriter, save first alignment
441
+ outputFilenameStream << m_outputFilenameStub << ".TAG_" << tag << "_" << currentValue << ".bam";
442
+ writer = new BamWriter;
443
+ if ( !writer->Open(outputFilenameStream.str(), m_header, m_references) ) {
444
+ cerr << "bamtools split ERROR: could not open " << outputFilenameStream.str()
445
+ << " for writing." << endl;
446
+ return false;
447
+ }
448
+ writer->SaveAlignment(al);
449
+
450
+ // store in map
451
+ outputFiles.insert( make_pair(currentValue, writer) );
452
+
453
+ // reset stream
454
+ outputFilenameStream.str("");
455
+ }
456
+
457
+ // iterate through remaining alignments
458
+ while ( m_reader.GetNextAlignment(al) ) {
459
+
460
+ // skip if this alignment doesn't have TAG
461
+ if ( !al.GetTag(tag, currentValue) ) continue;
462
+
463
+ // look up tag value in map
464
+ writerIter = outputFiles.find(currentValue);
465
+
466
+ // if no writer associated with this value
467
+ if ( writerIter == outputFiles.end() ) {
468
+
469
+ // open new BamWriter
470
+ outputFilenameStream << m_outputFilenameStub << ".TAG_" << tag << "_" << currentValue << ".bam";
471
+ writer = new BamWriter;
472
+ if ( !writer->Open(outputFilenameStream.str(), m_header, m_references) ) {
473
+ cerr << "bamtool split ERROR: could not open " << outputFilenameStream.str()
474
+ << " for writing." << endl;
475
+ return false;
476
+ }
477
+
478
+ // store in map
479
+ outputFiles.insert( make_pair(currentValue, writer) );
480
+
481
+ // reset stream
482
+ outputFilenameStream.str("");
483
+ }
484
+
485
+ // else grab corresponding writer
486
+ else writer = (*writerIter).second;
487
+
488
+ // store alignment in proper BAM output file
489
+ if ( writer )
490
+ writer->SaveAlignment(al);
491
+ }
492
+
493
+ // clean up BamWriters
494
+ CloseWriters(outputFiles);
495
+
496
+ // return success
497
+ return true;
498
+ }
499
+
500
+ // ---------------------------------------------
501
+ // SplitTool implementation
502
+
503
+ SplitTool::SplitTool(void)
504
+ : AbstractTool()
505
+ , m_settings(new SplitSettings)
506
+ , m_impl(0)
507
+ {
508
+ // set program details
509
+ Options::SetProgramInfo("bamtools split", "splits a BAM file on user-specified property, creating a new BAM output file for each value found", "[-in <filename>] [-stub <filename stub>] < -mapped | -paired | -reference | -tag <TAG> > ");
510
+
511
+ // set up options
512
+ OptionGroup* IO_Opts = Options::CreateOptionGroup("Input & Output");
513
+ Options::AddValueOption("-in", "BAM filename", "the input BAM file", "", m_settings->HasInputFilename, m_settings->InputFilename, IO_Opts, Options::StandardIn());
514
+ Options::AddValueOption("-stub", "filename stub", "prefix stub for output BAM files (default behavior is to use input filename, without .bam extension, as stub). If input is stdin and no stub provided, a timestamp is generated as the stub.", "", m_settings->HasCustomOutputStub, m_settings->CustomOutputStub, IO_Opts);
515
+
516
+ OptionGroup* SplitOpts = Options::CreateOptionGroup("Split Options");
517
+ Options::AddOption("-mapped", "split mapped/unmapped alignments", m_settings->IsSplittingMapped, SplitOpts);
518
+ Options::AddOption("-paired", "split single-end/paired-end alignments", m_settings->IsSplittingPaired, SplitOpts);
519
+ Options::AddOption("-reference", "split alignments by reference", m_settings->IsSplittingReference, SplitOpts);
520
+ Options::AddValueOption("-tag", "tag name", "splits alignments based on all values of TAG encountered (i.e. -tag RG creates a BAM file for each read group in original BAM file)", "",
521
+ m_settings->IsSplittingTag, m_settings->TagToSplit, SplitOpts);
522
+ }
523
+
524
+ SplitTool::~SplitTool(void) {
525
+
526
+ delete m_settings;
527
+ m_settings = 0;
528
+
529
+ delete m_impl;
530
+ m_impl = 0;
531
+ }
532
+
533
+ int SplitTool::Help(void) {
534
+ Options::DisplayHelp();
535
+ return 0;
536
+ }
537
+
538
+ int SplitTool::Run(int argc, char* argv[]) {
539
+
540
+ // parse command line arguments
541
+ Options::Parse(argc, argv, 1);
542
+
543
+ // initialize SplitTool with settings
544
+ m_impl = new SplitToolPrivate(m_settings);
545
+
546
+ // run SplitTool, return success/fail
547
+ if ( m_impl->Run() )
548
+ return 0;
549
+ else
550
+ return 1;
551
+ }
@@ -0,0 +1,38 @@
1
+ // ***************************************************************************
2
+ // bamtools_split.h (c) 2010 Derek Barnett, Erik Garrison
3
+ // Marth Lab, Department of Biology, Boston College
4
+ // ---------------------------------------------------------------------------
5
+ // Last modified: 7 April 2011 (DB)
6
+ // ---------------------------------------------------------------------------
7
+ // Splits a BAM file on user-specified property, creating a new BAM output
8
+ // file for each value found
9
+ // ***************************************************************************
10
+
11
+ #ifndef BAMTOOLS_SPLIT_H
12
+ #define BAMTOOLS_SPLIT_H
13
+
14
+ #include "bamtools_tool.h"
15
+
16
+ namespace BamTools {
17
+
18
+ class SplitTool : public AbstractTool {
19
+
20
+ public:
21
+ SplitTool(void);
22
+ ~SplitTool(void);
23
+
24
+ public:
25
+ int Help(void);
26
+ int Run(int argc, char* argv[]);
27
+
28
+ private:
29
+ struct SplitSettings;
30
+ SplitSettings* m_settings;
31
+
32
+ struct SplitToolPrivate;
33
+ SplitToolPrivate* m_impl;
34
+ };
35
+
36
+ } // namespace BamTools
37
+
38
+ #endif // BAMTOOLS_SPLIT_H