bio-velvet_underground 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (286) hide show
  1. checksums.yaml +7 -0
  2. data/.document +5 -0
  3. data/.gitmodules +3 -0
  4. data/.travis.yml +13 -0
  5. data/Gemfile +19 -0
  6. data/LICENSE.txt +20 -0
  7. data/README.md +53 -0
  8. data/Rakefile +51 -0
  9. data/VERSION +1 -0
  10. data/ext/bioruby.patch +60 -0
  11. data/ext/mkrf_conf.rb +50 -0
  12. data/ext/src/Makefile +125 -0
  13. data/ext/src/src/allocArray.c +305 -0
  14. data/ext/src/src/allocArray.h +86 -0
  15. data/ext/src/src/autoOpen.c +107 -0
  16. data/ext/src/src/autoOpen.h +18 -0
  17. data/ext/src/src/binarySequences.c +813 -0
  18. data/ext/src/src/binarySequences.h +125 -0
  19. data/ext/src/src/concatenatedGraph.c +233 -0
  20. data/ext/src/src/concatenatedGraph.h +30 -0
  21. data/ext/src/src/concatenatedPreGraph.c +262 -0
  22. data/ext/src/src/concatenatedPreGraph.h +29 -0
  23. data/ext/src/src/correctedGraph.c +2642 -0
  24. data/ext/src/src/correctedGraph.h +32 -0
  25. data/ext/src/src/dfib.c +509 -0
  26. data/ext/src/src/dfib.h +69 -0
  27. data/ext/src/src/dfibHeap.c +89 -0
  28. data/ext/src/src/dfibHeap.h +39 -0
  29. data/ext/src/src/dfibpriv.h +105 -0
  30. data/ext/src/src/fib.c +628 -0
  31. data/ext/src/src/fib.h +78 -0
  32. data/ext/src/src/fibHeap.c +79 -0
  33. data/ext/src/src/fibHeap.h +41 -0
  34. data/ext/src/src/fibpriv.h +110 -0
  35. data/ext/src/src/globals.h +153 -0
  36. data/ext/src/src/graph.c +3983 -0
  37. data/ext/src/src/graph.h +233 -0
  38. data/ext/src/src/graphReConstruction.c +1472 -0
  39. data/ext/src/src/graphReConstruction.h +30 -0
  40. data/ext/src/src/graphStats.c +2167 -0
  41. data/ext/src/src/graphStats.h +72 -0
  42. data/ext/src/src/kmer.c +652 -0
  43. data/ext/src/src/kmer.h +73 -0
  44. data/ext/src/src/kmerOccurenceTable.c +236 -0
  45. data/ext/src/src/kmerOccurenceTable.h +44 -0
  46. data/ext/src/src/kseq.h +223 -0
  47. data/ext/src/src/locallyCorrectedGraph.c +557 -0
  48. data/ext/src/src/locallyCorrectedGraph.h +40 -0
  49. data/ext/src/src/passageMarker.c +677 -0
  50. data/ext/src/src/passageMarker.h +137 -0
  51. data/ext/src/src/preGraph.c +1717 -0
  52. data/ext/src/src/preGraph.h +106 -0
  53. data/ext/src/src/preGraphConstruction.c +990 -0
  54. data/ext/src/src/preGraphConstruction.h +26 -0
  55. data/ext/src/src/readCoherentGraph.c +557 -0
  56. data/ext/src/src/readCoherentGraph.h +30 -0
  57. data/ext/src/src/readSet.c +1734 -0
  58. data/ext/src/src/readSet.h +67 -0
  59. data/ext/src/src/recycleBin.c +199 -0
  60. data/ext/src/src/recycleBin.h +58 -0
  61. data/ext/src/src/roadMap.c +342 -0
  62. data/ext/src/src/roadMap.h +65 -0
  63. data/ext/src/src/run.c +318 -0
  64. data/ext/src/src/run.h +52 -0
  65. data/ext/src/src/run2.c +712 -0
  66. data/ext/src/src/scaffold.c +1876 -0
  67. data/ext/src/src/scaffold.h +64 -0
  68. data/ext/src/src/shortReadPairs.c +1243 -0
  69. data/ext/src/src/shortReadPairs.h +32 -0
  70. data/ext/src/src/splay.c +259 -0
  71. data/ext/src/src/splay.h +43 -0
  72. data/ext/src/src/splayTable.c +1315 -0
  73. data/ext/src/src/splayTable.h +31 -0
  74. data/ext/src/src/tightString.c +362 -0
  75. data/ext/src/src/tightString.h +82 -0
  76. data/ext/src/src/utility.c +199 -0
  77. data/ext/src/src/utility.h +98 -0
  78. data/ext/src/third-party/zlib-1.2.3/ChangeLog +855 -0
  79. data/ext/src/third-party/zlib-1.2.3/FAQ +339 -0
  80. data/ext/src/third-party/zlib-1.2.3/INDEX +51 -0
  81. data/ext/src/third-party/zlib-1.2.3/Makefile +154 -0
  82. data/ext/src/third-party/zlib-1.2.3/Makefile.in +154 -0
  83. data/ext/src/third-party/zlib-1.2.3/README +125 -0
  84. data/ext/src/third-party/zlib-1.2.3/adler32.c +149 -0
  85. data/ext/src/third-party/zlib-1.2.3/algorithm.txt +209 -0
  86. data/ext/src/third-party/zlib-1.2.3/amiga/Makefile.pup +66 -0
  87. data/ext/src/third-party/zlib-1.2.3/amiga/Makefile.sas +65 -0
  88. data/ext/src/third-party/zlib-1.2.3/as400/bndsrc +132 -0
  89. data/ext/src/third-party/zlib-1.2.3/as400/compile.clp +123 -0
  90. data/ext/src/third-party/zlib-1.2.3/as400/readme.txt +111 -0
  91. data/ext/src/third-party/zlib-1.2.3/as400/zlib.inc +331 -0
  92. data/ext/src/third-party/zlib-1.2.3/compress.c +79 -0
  93. data/ext/src/third-party/zlib-1.2.3/configure +459 -0
  94. data/ext/src/third-party/zlib-1.2.3/contrib/README.contrib +71 -0
  95. data/ext/src/third-party/zlib-1.2.3/contrib/ada/buffer_demo.adb +106 -0
  96. data/ext/src/third-party/zlib-1.2.3/contrib/ada/mtest.adb +156 -0
  97. data/ext/src/third-party/zlib-1.2.3/contrib/ada/read.adb +156 -0
  98. data/ext/src/third-party/zlib-1.2.3/contrib/ada/readme.txt +65 -0
  99. data/ext/src/third-party/zlib-1.2.3/contrib/ada/test.adb +463 -0
  100. data/ext/src/third-party/zlib-1.2.3/contrib/ada/zlib-streams.adb +225 -0
  101. data/ext/src/third-party/zlib-1.2.3/contrib/ada/zlib-streams.ads +114 -0
  102. data/ext/src/third-party/zlib-1.2.3/contrib/ada/zlib-thin.adb +141 -0
  103. data/ext/src/third-party/zlib-1.2.3/contrib/ada/zlib-thin.ads +450 -0
  104. data/ext/src/third-party/zlib-1.2.3/contrib/ada/zlib.adb +701 -0
  105. data/ext/src/third-party/zlib-1.2.3/contrib/ada/zlib.ads +328 -0
  106. data/ext/src/third-party/zlib-1.2.3/contrib/ada/zlib.gpr +20 -0
  107. data/ext/src/third-party/zlib-1.2.3/contrib/asm586/README.586 +43 -0
  108. data/ext/src/third-party/zlib-1.2.3/contrib/asm586/match.S +364 -0
  109. data/ext/src/third-party/zlib-1.2.3/contrib/asm686/README.686 +34 -0
  110. data/ext/src/third-party/zlib-1.2.3/contrib/asm686/match.S +329 -0
  111. data/ext/src/third-party/zlib-1.2.3/contrib/blast/Makefile +8 -0
  112. data/ext/src/third-party/zlib-1.2.3/contrib/blast/README +4 -0
  113. data/ext/src/third-party/zlib-1.2.3/contrib/blast/blast.c +444 -0
  114. data/ext/src/third-party/zlib-1.2.3/contrib/blast/blast.h +71 -0
  115. data/ext/src/third-party/zlib-1.2.3/contrib/blast/test.pk +0 -0
  116. data/ext/src/third-party/zlib-1.2.3/contrib/blast/test.txt +1 -0
  117. data/ext/src/third-party/zlib-1.2.3/contrib/delphi/ZLib.pas +557 -0
  118. data/ext/src/third-party/zlib-1.2.3/contrib/delphi/ZLibConst.pas +11 -0
  119. data/ext/src/third-party/zlib-1.2.3/contrib/delphi/readme.txt +76 -0
  120. data/ext/src/third-party/zlib-1.2.3/contrib/delphi/zlibd32.mak +93 -0
  121. data/ext/src/third-party/zlib-1.2.3/contrib/dotzlib/DotZLib.build +33 -0
  122. data/ext/src/third-party/zlib-1.2.3/contrib/dotzlib/DotZLib.chm +0 -0
  123. data/ext/src/third-party/zlib-1.2.3/contrib/dotzlib/DotZLib.sln +21 -0
  124. data/ext/src/third-party/zlib-1.2.3/contrib/dotzlib/DotZLib/AssemblyInfo.cs +58 -0
  125. data/ext/src/third-party/zlib-1.2.3/contrib/dotzlib/DotZLib/ChecksumImpl.cs +202 -0
  126. data/ext/src/third-party/zlib-1.2.3/contrib/dotzlib/DotZLib/CircularBuffer.cs +83 -0
  127. data/ext/src/third-party/zlib-1.2.3/contrib/dotzlib/DotZLib/CodecBase.cs +198 -0
  128. data/ext/src/third-party/zlib-1.2.3/contrib/dotzlib/DotZLib/Deflater.cs +106 -0
  129. data/ext/src/third-party/zlib-1.2.3/contrib/dotzlib/DotZLib/DotZLib.cs +288 -0
  130. data/ext/src/third-party/zlib-1.2.3/contrib/dotzlib/DotZLib/DotZLib.csproj +141 -0
  131. data/ext/src/third-party/zlib-1.2.3/contrib/dotzlib/DotZLib/GZipStream.cs +301 -0
  132. data/ext/src/third-party/zlib-1.2.3/contrib/dotzlib/DotZLib/Inflater.cs +105 -0
  133. data/ext/src/third-party/zlib-1.2.3/contrib/dotzlib/DotZLib/UnitTests.cs +274 -0
  134. data/ext/src/third-party/zlib-1.2.3/contrib/dotzlib/LICENSE_1_0.txt +23 -0
  135. data/ext/src/third-party/zlib-1.2.3/contrib/dotzlib/readme.txt +58 -0
  136. data/ext/src/third-party/zlib-1.2.3/contrib/infback9/README +1 -0
  137. data/ext/src/third-party/zlib-1.2.3/contrib/infback9/infback9.c +608 -0
  138. data/ext/src/third-party/zlib-1.2.3/contrib/infback9/infback9.h +37 -0
  139. data/ext/src/third-party/zlib-1.2.3/contrib/infback9/inffix9.h +107 -0
  140. data/ext/src/third-party/zlib-1.2.3/contrib/infback9/inflate9.h +47 -0
  141. data/ext/src/third-party/zlib-1.2.3/contrib/infback9/inftree9.c +323 -0
  142. data/ext/src/third-party/zlib-1.2.3/contrib/infback9/inftree9.h +55 -0
  143. data/ext/src/third-party/zlib-1.2.3/contrib/inflate86/inffas86.c +1157 -0
  144. data/ext/src/third-party/zlib-1.2.3/contrib/inflate86/inffast.S +1368 -0
  145. data/ext/src/third-party/zlib-1.2.3/contrib/iostream/test.cpp +24 -0
  146. data/ext/src/third-party/zlib-1.2.3/contrib/iostream/zfstream.cpp +329 -0
  147. data/ext/src/third-party/zlib-1.2.3/contrib/iostream/zfstream.h +128 -0
  148. data/ext/src/third-party/zlib-1.2.3/contrib/iostream2/zstream.h +307 -0
  149. data/ext/src/third-party/zlib-1.2.3/contrib/iostream2/zstream_test.cpp +25 -0
  150. data/ext/src/third-party/zlib-1.2.3/contrib/iostream3/README +35 -0
  151. data/ext/src/third-party/zlib-1.2.3/contrib/iostream3/TODO +17 -0
  152. data/ext/src/third-party/zlib-1.2.3/contrib/iostream3/test.cc +50 -0
  153. data/ext/src/third-party/zlib-1.2.3/contrib/iostream3/zfstream.cc +479 -0
  154. data/ext/src/third-party/zlib-1.2.3/contrib/iostream3/zfstream.h +466 -0
  155. data/ext/src/third-party/zlib-1.2.3/contrib/masm686/match.asm +413 -0
  156. data/ext/src/third-party/zlib-1.2.3/contrib/masmx64/bld_ml64.bat +2 -0
  157. data/ext/src/third-party/zlib-1.2.3/contrib/masmx64/gvmat64.asm +513 -0
  158. data/ext/src/third-party/zlib-1.2.3/contrib/masmx64/gvmat64.obj +0 -0
  159. data/ext/src/third-party/zlib-1.2.3/contrib/masmx64/inffas8664.c +186 -0
  160. data/ext/src/third-party/zlib-1.2.3/contrib/masmx64/inffasx64.asm +392 -0
  161. data/ext/src/third-party/zlib-1.2.3/contrib/masmx64/inffasx64.obj +0 -0
  162. data/ext/src/third-party/zlib-1.2.3/contrib/masmx64/readme.txt +28 -0
  163. data/ext/src/third-party/zlib-1.2.3/contrib/masmx86/bld_ml32.bat +2 -0
  164. data/ext/src/third-party/zlib-1.2.3/contrib/masmx86/gvmat32.asm +972 -0
  165. data/ext/src/third-party/zlib-1.2.3/contrib/masmx86/gvmat32.obj +0 -0
  166. data/ext/src/third-party/zlib-1.2.3/contrib/masmx86/gvmat32c.c +62 -0
  167. data/ext/src/third-party/zlib-1.2.3/contrib/masmx86/inffas32.asm +1083 -0
  168. data/ext/src/third-party/zlib-1.2.3/contrib/masmx86/inffas32.obj +0 -0
  169. data/ext/src/third-party/zlib-1.2.3/contrib/masmx86/mkasm.bat +3 -0
  170. data/ext/src/third-party/zlib-1.2.3/contrib/masmx86/readme.txt +21 -0
  171. data/ext/src/third-party/zlib-1.2.3/contrib/minizip/ChangeLogUnzip +67 -0
  172. data/ext/src/third-party/zlib-1.2.3/contrib/minizip/Makefile +25 -0
  173. data/ext/src/third-party/zlib-1.2.3/contrib/minizip/crypt.h +132 -0
  174. data/ext/src/third-party/zlib-1.2.3/contrib/minizip/ioapi.c +177 -0
  175. data/ext/src/third-party/zlib-1.2.3/contrib/minizip/ioapi.h +75 -0
  176. data/ext/src/third-party/zlib-1.2.3/contrib/minizip/iowin32.c +270 -0
  177. data/ext/src/third-party/zlib-1.2.3/contrib/minizip/iowin32.h +21 -0
  178. data/ext/src/third-party/zlib-1.2.3/contrib/minizip/miniunz.c +585 -0
  179. data/ext/src/third-party/zlib-1.2.3/contrib/minizip/minizip.c +420 -0
  180. data/ext/src/third-party/zlib-1.2.3/contrib/minizip/mztools.c +281 -0
  181. data/ext/src/third-party/zlib-1.2.3/contrib/minizip/mztools.h +31 -0
  182. data/ext/src/third-party/zlib-1.2.3/contrib/minizip/unzip.c +1598 -0
  183. data/ext/src/third-party/zlib-1.2.3/contrib/minizip/unzip.h +354 -0
  184. data/ext/src/third-party/zlib-1.2.3/contrib/minizip/zip.c +1219 -0
  185. data/ext/src/third-party/zlib-1.2.3/contrib/minizip/zip.h +235 -0
  186. data/ext/src/third-party/zlib-1.2.3/contrib/pascal/example.pas +599 -0
  187. data/ext/src/third-party/zlib-1.2.3/contrib/pascal/readme.txt +76 -0
  188. data/ext/src/third-party/zlib-1.2.3/contrib/pascal/zlibd32.mak +93 -0
  189. data/ext/src/third-party/zlib-1.2.3/contrib/pascal/zlibpas.pas +236 -0
  190. data/ext/src/third-party/zlib-1.2.3/contrib/puff/Makefile +8 -0
  191. data/ext/src/third-party/zlib-1.2.3/contrib/puff/README +63 -0
  192. data/ext/src/third-party/zlib-1.2.3/contrib/puff/puff.c +837 -0
  193. data/ext/src/third-party/zlib-1.2.3/contrib/puff/puff.h +31 -0
  194. data/ext/src/third-party/zlib-1.2.3/contrib/puff/zeros.raw +0 -0
  195. data/ext/src/third-party/zlib-1.2.3/contrib/testzlib/testzlib.c +275 -0
  196. data/ext/src/third-party/zlib-1.2.3/contrib/testzlib/testzlib.txt +10 -0
  197. data/ext/src/third-party/zlib-1.2.3/contrib/untgz/Makefile +14 -0
  198. data/ext/src/third-party/zlib-1.2.3/contrib/untgz/Makefile.msc +17 -0
  199. data/ext/src/third-party/zlib-1.2.3/contrib/untgz/untgz.c +674 -0
  200. data/ext/src/third-party/zlib-1.2.3/contrib/vstudio/readme.txt +73 -0
  201. data/ext/src/third-party/zlib-1.2.3/contrib/vstudio/vc7/miniunz.vcproj +126 -0
  202. data/ext/src/third-party/zlib-1.2.3/contrib/vstudio/vc7/minizip.vcproj +126 -0
  203. data/ext/src/third-party/zlib-1.2.3/contrib/vstudio/vc7/testzlib.vcproj +126 -0
  204. data/ext/src/third-party/zlib-1.2.3/contrib/vstudio/vc7/zlib.rc +32 -0
  205. data/ext/src/third-party/zlib-1.2.3/contrib/vstudio/vc7/zlibstat.vcproj +246 -0
  206. data/ext/src/third-party/zlib-1.2.3/contrib/vstudio/vc7/zlibvc.def +92 -0
  207. data/ext/src/third-party/zlib-1.2.3/contrib/vstudio/vc7/zlibvc.sln +78 -0
  208. data/ext/src/third-party/zlib-1.2.3/contrib/vstudio/vc7/zlibvc.vcproj +445 -0
  209. data/ext/src/third-party/zlib-1.2.3/contrib/vstudio/vc8/miniunz.vcproj +566 -0
  210. data/ext/src/third-party/zlib-1.2.3/contrib/vstudio/vc8/minizip.vcproj +563 -0
  211. data/ext/src/third-party/zlib-1.2.3/contrib/vstudio/vc8/testzlib.vcproj +948 -0
  212. data/ext/src/third-party/zlib-1.2.3/contrib/vstudio/vc8/testzlibdll.vcproj +567 -0
  213. data/ext/src/third-party/zlib-1.2.3/contrib/vstudio/vc8/zlib.rc +32 -0
  214. data/ext/src/third-party/zlib-1.2.3/contrib/vstudio/vc8/zlibstat.vcproj +870 -0
  215. data/ext/src/third-party/zlib-1.2.3/contrib/vstudio/vc8/zlibvc.def +92 -0
  216. data/ext/src/third-party/zlib-1.2.3/contrib/vstudio/vc8/zlibvc.sln +144 -0
  217. data/ext/src/third-party/zlib-1.2.3/contrib/vstudio/vc8/zlibvc.vcproj +1219 -0
  218. data/ext/src/third-party/zlib-1.2.3/crc32.c +423 -0
  219. data/ext/src/third-party/zlib-1.2.3/crc32.h +441 -0
  220. data/ext/src/third-party/zlib-1.2.3/deflate.c +1736 -0
  221. data/ext/src/third-party/zlib-1.2.3/deflate.h +331 -0
  222. data/ext/src/third-party/zlib-1.2.3/example.c +565 -0
  223. data/ext/src/third-party/zlib-1.2.3/examples/README.examples +42 -0
  224. data/ext/src/third-party/zlib-1.2.3/examples/fitblk.c +233 -0
  225. data/ext/src/third-party/zlib-1.2.3/examples/gun.c +693 -0
  226. data/ext/src/third-party/zlib-1.2.3/examples/gzappend.c +500 -0
  227. data/ext/src/third-party/zlib-1.2.3/examples/gzjoin.c +448 -0
  228. data/ext/src/third-party/zlib-1.2.3/examples/gzlog.c +413 -0
  229. data/ext/src/third-party/zlib-1.2.3/examples/gzlog.h +58 -0
  230. data/ext/src/third-party/zlib-1.2.3/examples/zlib_how.html +523 -0
  231. data/ext/src/third-party/zlib-1.2.3/examples/zpipe.c +191 -0
  232. data/ext/src/third-party/zlib-1.2.3/examples/zran.c +404 -0
  233. data/ext/src/third-party/zlib-1.2.3/gzio.c +1026 -0
  234. data/ext/src/third-party/zlib-1.2.3/infback.c +623 -0
  235. data/ext/src/third-party/zlib-1.2.3/inffast.c +318 -0
  236. data/ext/src/third-party/zlib-1.2.3/inffast.h +11 -0
  237. data/ext/src/third-party/zlib-1.2.3/inffixed.h +94 -0
  238. data/ext/src/third-party/zlib-1.2.3/inflate.c +1368 -0
  239. data/ext/src/third-party/zlib-1.2.3/inflate.h +115 -0
  240. data/ext/src/third-party/zlib-1.2.3/inftrees.c +329 -0
  241. data/ext/src/third-party/zlib-1.2.3/inftrees.h +55 -0
  242. data/ext/src/third-party/zlib-1.2.3/make_vms.com +461 -0
  243. data/ext/src/third-party/zlib-1.2.3/minigzip.c +322 -0
  244. data/ext/src/third-party/zlib-1.2.3/msdos/Makefile.bor +109 -0
  245. data/ext/src/third-party/zlib-1.2.3/msdos/Makefile.dj2 +104 -0
  246. data/ext/src/third-party/zlib-1.2.3/msdos/Makefile.emx +69 -0
  247. data/ext/src/third-party/zlib-1.2.3/msdos/Makefile.msc +106 -0
  248. data/ext/src/third-party/zlib-1.2.3/msdos/Makefile.tc +94 -0
  249. data/ext/src/third-party/zlib-1.2.3/old/Makefile.riscos +151 -0
  250. data/ext/src/third-party/zlib-1.2.3/old/README +3 -0
  251. data/ext/src/third-party/zlib-1.2.3/old/descrip.mms +48 -0
  252. data/ext/src/third-party/zlib-1.2.3/old/os2/Makefile.os2 +136 -0
  253. data/ext/src/third-party/zlib-1.2.3/old/os2/zlib.def +51 -0
  254. data/ext/src/third-party/zlib-1.2.3/old/visual-basic.txt +160 -0
  255. data/ext/src/third-party/zlib-1.2.3/old/zlib.html +971 -0
  256. data/ext/src/third-party/zlib-1.2.3/projects/README.projects +41 -0
  257. data/ext/src/third-party/zlib-1.2.3/projects/visualc6/README.txt +73 -0
  258. data/ext/src/third-party/zlib-1.2.3/projects/visualc6/example.dsp +278 -0
  259. data/ext/src/third-party/zlib-1.2.3/projects/visualc6/minigzip.dsp +278 -0
  260. data/ext/src/third-party/zlib-1.2.3/projects/visualc6/zlib.dsp +609 -0
  261. data/ext/src/third-party/zlib-1.2.3/projects/visualc6/zlib.dsw +59 -0
  262. data/ext/src/third-party/zlib-1.2.3/qnx/package.qpg +141 -0
  263. data/ext/src/third-party/zlib-1.2.3/trees.c +1219 -0
  264. data/ext/src/third-party/zlib-1.2.3/trees.h +128 -0
  265. data/ext/src/third-party/zlib-1.2.3/uncompr.c +61 -0
  266. data/ext/src/third-party/zlib-1.2.3/win32/DLL_FAQ.txt +397 -0
  267. data/ext/src/third-party/zlib-1.2.3/win32/Makefile.bor +107 -0
  268. data/ext/src/third-party/zlib-1.2.3/win32/Makefile.emx +69 -0
  269. data/ext/src/third-party/zlib-1.2.3/win32/Makefile.gcc +141 -0
  270. data/ext/src/third-party/zlib-1.2.3/win32/Makefile.msc +126 -0
  271. data/ext/src/third-party/zlib-1.2.3/win32/VisualC.txt +3 -0
  272. data/ext/src/third-party/zlib-1.2.3/win32/zlib.def +60 -0
  273. data/ext/src/third-party/zlib-1.2.3/win32/zlib1.rc +39 -0
  274. data/ext/src/third-party/zlib-1.2.3/zconf.h +332 -0
  275. data/ext/src/third-party/zlib-1.2.3/zconf.in.h +332 -0
  276. data/ext/src/third-party/zlib-1.2.3/zlib.3 +159 -0
  277. data/ext/src/third-party/zlib-1.2.3/zlib.h +1357 -0
  278. data/ext/src/third-party/zlib-1.2.3/zutil.c +318 -0
  279. data/ext/src/third-party/zlib-1.2.3/zutil.h +269 -0
  280. data/lib/bio-velvet_underground.rb +12 -0
  281. data/lib/bio-velvet_underground/external/VERSION +1 -0
  282. data/lib/bio-velvet_underground/velvet_underground.rb +72 -0
  283. data/spec/binary_sequence_store_spec.rb +27 -0
  284. data/spec/data/1/CnyUnifiedSeq +0 -0
  285. data/spec/spec_helper.rb +31 -0
  286. metadata +456 -0
@@ -0,0 +1,73 @@
1
+ /*
2
+ Copyright 2007, 2008, 2009 Daniel Zerbino (zerbino@ebi.ac.uk)
3
+
4
+ This file is part of Velvet.
5
+
6
+ Velvet is free software; you can redistribute it and/or modify
7
+ it under the terms of the GNU General Public License as published by
8
+ the Free Software Foundation; either version 2 of the License, or
9
+ (at your option) any later version.
10
+
11
+ Velvet is distributed in the hope that it will be useful,
12
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ GNU General Public License for more details.
15
+
16
+ You should have received a copy of the GNU General Public License
17
+ along with Velvet; if not, write to the Free Software
18
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
+
20
+ */
21
+ #ifndef _KMER_H_
22
+ #define _KMER_H_
23
+
24
+ #include <stdint.h>
25
+
26
+ #include "globals.h"
27
+
28
+ void copyKmers(Kmer* k1, Kmer* k2);
29
+
30
+ void pushNucleotide(Kmer * kmer, Nucleotide nucleotide);
31
+ Nucleotide popNucleotide(Kmer * kmer);
32
+
33
+ int compareKmers(Kmer* k1, Kmer* k2);
34
+
35
+ void reversePushNucleotide(Kmer * kmer, Nucleotide nucleotide);
36
+
37
+ KmerKey getKmerKey(Kmer * kmer);
38
+
39
+ void printKmer(Kmer * kmer);
40
+
41
+ void clearKmer(Kmer * kmer);
42
+
43
+ void resetWordFilter(int wordLength);
44
+ void resetKeyFilter(int keyLength);
45
+
46
+ #define KMER_QUOTIENT (MAXKMERLENGTH / 4)
47
+ #define KMER_REMAINDER (MAXKMERLENGTH % 4)
48
+ #if KMER_REMAINDER
49
+ #define KMER_BYTE_SIZE (KMER_QUOTIENT + 1)
50
+ #else
51
+ #define KMER_BYTE_SIZE KMER_QUOTIENT
52
+ #endif
53
+ #define KMER_LONGLONGS (KMER_BYTE_SIZE / 8)
54
+ #define KMER_LONGS ((KMER_BYTE_SIZE % 8) / 4)
55
+ #define KMER_INTS ((KMER_BYTE_SIZE % 4) / 2)
56
+ #define KMER_CHARS (KMER_BYTE_SIZE % 2)
57
+
58
+ struct kmer_st {
59
+ #if KMER_LONGLONGS
60
+ uint64_t longlongs[KMER_LONGLONGS];
61
+ #endif
62
+ #if KMER_LONGS
63
+ uint32_t longs;
64
+ #endif
65
+ #if KMER_INTS
66
+ uint16_t ints;
67
+ #endif
68
+ #if KMER_CHARS
69
+ uint8_t chars;
70
+ #endif
71
+ } ATTRIBUTE_PACKED;
72
+
73
+ #endif
@@ -0,0 +1,236 @@
1
+ /*
2
+ Copyright 2010 Daniel Zerbino (zerbino@ebi.ac.uk)
3
+
4
+ This file is part of Velvet.
5
+
6
+ Velvet is free software; you can redistribute it and/or modify
7
+ it under the terms of the GNU General Public License as published by
8
+ the Free Software Foundation; either version 2 of the License, or
9
+ (at your option) any later version.
10
+
11
+ Velvet is distributed in the hope that it will be useful,
12
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ GNU General Public License for more details.
15
+
16
+ You should have received a copy of the GNU General Public License
17
+ along with Velvet; if not, write to the Free Software
18
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
+
20
+ */
21
+ #include <stdlib.h>
22
+ #include <stdio.h>
23
+ #include <string.h>
24
+ #include <limits.h>
25
+
26
+ #include "globals.h"
27
+ #include "graph.h"
28
+ #include "passageMarker.h"
29
+ #include "readSet.h"
30
+ #include "tightString.h"
31
+ #include "recycleBin.h"
32
+ #include "utility.h"
33
+ #include "kmer.h"
34
+
35
+ // Internal structure used to mark the ends of an Annotation
36
+ struct kmerOccurence_st {
37
+ IDnum position;
38
+ IDnum nodeID;
39
+ IDnum offset;
40
+ Kmer kmer;
41
+ } ATTRIBUTE_PACKED;
42
+
43
+ struct kmerOccurenceTable_st {
44
+ KmerOccurence *kmerTable;
45
+ KmerOccurence * kmerOccurencePtr;
46
+ IDnum *accelerationTable;
47
+ IDnum kmerTableSize;
48
+ IDnum kmerOccurenceIndex;
49
+ short int accelerationShift;
50
+ short int accelerationBits;
51
+ };
52
+
53
+ int compareKmerOccurences(void const *A, void const *B)
54
+ {
55
+ KmerOccurence *a = (KmerOccurence *) A;
56
+ KmerOccurence *b = (KmerOccurence *) B;
57
+ return compareKmers(&(a->kmer), &(b->kmer));
58
+ }
59
+
60
+ static inline KmerKey keyInAccelerationTable(Kmer * kmer,
61
+ KmerOccurenceTable * table)
62
+ {
63
+ return getKmerKey(kmer);
64
+ }
65
+
66
+ KmerOccurence *findKmerInKmerOccurenceTable(Kmer * kmer,
67
+ KmerOccurenceTable *
68
+ table)
69
+ {
70
+ KmerOccurence *array = table->kmerTable;
71
+ KmerKey key = keyInAccelerationTable(kmer, table);
72
+ Coordinate leftIndex, rightIndex, middleIndex;
73
+ int diff;
74
+
75
+ if (table->accelerationTable != NULL) {
76
+ leftIndex = table->accelerationTable[key];
77
+ rightIndex = table->accelerationTable[key + 1];
78
+ } else {
79
+ leftIndex = 0;
80
+ rightIndex = table->kmerTableSize;
81
+ }
82
+
83
+ while (true) {
84
+ middleIndex = (rightIndex + leftIndex) / 2;
85
+
86
+ if (leftIndex >= rightIndex)
87
+ return NULL;
88
+
89
+ diff = compareKmers(&(array[middleIndex].kmer), kmer);
90
+
91
+ if (diff == 0) {
92
+ middleIndex -= array[middleIndex].offset;
93
+ return &(array[middleIndex]);
94
+ } else if (leftIndex == middleIndex)
95
+ return NULL;
96
+ else if (diff > 0)
97
+ rightIndex = middleIndex;
98
+ else
99
+ leftIndex = middleIndex;
100
+ }
101
+ }
102
+
103
+ KmerOccurenceTable * newKmerOccurenceTable(short int accelerationBits, int wordLength) {
104
+ KmerOccurenceTable * kmerTable = mallocOrExit(1, KmerOccurenceTable);
105
+
106
+ if (accelerationBits > 2 * wordLength)
107
+ accelerationBits = 2 * wordLength;
108
+
109
+ if (accelerationBits > 32)
110
+ accelerationBits = 32;
111
+
112
+ if (accelerationBits > 0) {
113
+ resetKeyFilter(accelerationBits);
114
+ kmerTable->accelerationBits = accelerationBits;
115
+ kmerTable->accelerationTable =
116
+ callocOrExit((((size_t) 1) << accelerationBits) + 1,
117
+ IDnum);
118
+ kmerTable->accelerationShift =
119
+ (short int) 2 *wordLength - accelerationBits;
120
+ } else {
121
+ kmerTable->accelerationBits = 0;
122
+ kmerTable->accelerationTable = NULL;
123
+ kmerTable->accelerationShift = 0;
124
+ }
125
+
126
+ return kmerTable;
127
+ }
128
+
129
+ void allocateKmerOccurences(IDnum kmerCount, KmerOccurenceTable * table) {
130
+ KmerOccurence * kmerOccurences = callocOrExit(kmerCount + 1, KmerOccurence);
131
+ kmerOccurences[kmerCount].position = -1;
132
+ kmerOccurences[kmerCount].nodeID = 0;
133
+
134
+ table->kmerTable = kmerOccurences;
135
+ table->kmerTableSize = kmerCount;
136
+ table->kmerOccurencePtr = kmerOccurences;
137
+ table->kmerOccurenceIndex = 0;
138
+ }
139
+
140
+ void recordKmerOccurence(Kmer * kmer, IDnum nodeID, Coordinate position, KmerOccurenceTable * table) {
141
+ KmerOccurence * kmerOccurence;
142
+
143
+ #ifdef _OPENMP
144
+ #pragma omp critical
145
+ #endif
146
+ {
147
+ kmerOccurence = table->kmerOccurencePtr++;
148
+ table->kmerOccurenceIndex++;
149
+ }
150
+
151
+ copyKmers(&(kmerOccurence->kmer), kmer);
152
+ kmerOccurence->nodeID = nodeID;
153
+ kmerOccurence->position = position;
154
+
155
+ }
156
+
157
+ void sortKmerOccurenceTable(KmerOccurenceTable * table) {
158
+ KmerKey lastHeader = 0;
159
+ KmerKey header;
160
+ IDnum *accelPtr = NULL;
161
+ IDnum kmerOccurenceIndex;
162
+ KmerOccurence * kmerOccurence, * previous;
163
+
164
+ velvetLog("Sorting kmer occurence table ... \n");
165
+
166
+ qsort(table->kmerTable, table->kmerTableSize, sizeof(KmerOccurence),
167
+ compareKmerOccurences);
168
+
169
+ velvetLog("Sorting done.\n");
170
+
171
+ velvetLog("Computing acceleration table... \n");
172
+
173
+ // Fill up acceleration table
174
+ if (table->accelerationTable != NULL) {
175
+ accelPtr = table->accelerationTable;
176
+ *accelPtr = (IDnum) 0;
177
+ for (kmerOccurenceIndex = 0;
178
+ kmerOccurenceIndex < table->kmerTableSize;
179
+ kmerOccurenceIndex++) {
180
+ header =
181
+ keyInAccelerationTable(&table->kmerTable
182
+ [kmerOccurenceIndex].
183
+ kmer, table);
184
+ while (lastHeader < header) {
185
+ lastHeader++;
186
+ accelPtr++;
187
+ *accelPtr = kmerOccurenceIndex;
188
+ }
189
+ }
190
+
191
+ while (lastHeader < (KmerKey) 1 << table->accelerationBits) {
192
+ lastHeader++;
193
+ accelPtr++;
194
+ *accelPtr = table->kmerTableSize;
195
+ }
196
+ }
197
+
198
+ velvetLog("Computing offsets... \n");
199
+
200
+ // Compute offsets
201
+ kmerOccurence = table->kmerTable;
202
+ previous = NULL;
203
+ for (kmerOccurenceIndex = 1;
204
+ kmerOccurenceIndex < table->kmerTableSize;
205
+ kmerOccurenceIndex++) {
206
+ if (previous && compareKmerOccurences(kmerOccurence, previous) == 0)
207
+ kmerOccurence->offset = previous->offset + 1;
208
+ previous = kmerOccurence;
209
+ kmerOccurence++;
210
+ }
211
+ }
212
+
213
+ KmerOccurence * getNextKmerOccurence(KmerOccurence * current) {
214
+ register KmerOccurence * next = current + 1;
215
+ if (next->nodeID == 0 || next->offset == 0)
216
+ return NULL;
217
+ else
218
+ return next;
219
+ }
220
+
221
+ void destroyKmerOccurenceTable(KmerOccurenceTable * kmerTable) {
222
+ if (kmerTable == NULL)
223
+ return;
224
+
225
+ free(kmerTable->kmerTable);
226
+ free(kmerTable->accelerationTable);
227
+ free(kmerTable);
228
+ }
229
+
230
+ IDnum getKmerOccurenceNodeID(KmerOccurence * occurence) {
231
+ return occurence->nodeID;
232
+ }
233
+
234
+ Coordinate getKmerOccurencePosition(KmerOccurence * occurence) {
235
+ return occurence->position;
236
+ }
@@ -0,0 +1,44 @@
1
+ /*
2
+ Copyright 2010 Daniel Zerbino (zerbino@ebi.ac.uk)
3
+
4
+ This file is part of Velvet.
5
+
6
+ Velvet is free software; you can redistribute it and/or modify
7
+ it under the terms of the GNU General Public License as published by
8
+ the Free Software Foundation; either version 2 of the License, or
9
+ (at your option) any later version.
10
+
11
+ Velvet is distributed in the hope that it will be useful,
12
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ GNU General Public License for more details.
15
+
16
+ You should have received a copy of the GNU General Public License
17
+ along with Velvet; if not, write to the Free Software
18
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
+
20
+ */
21
+ #ifndef _KMEROCCURENCETABLE_H_
22
+ #define _KMEROCCURENCETABLE_H_
23
+
24
+ // Table operations
25
+ KmerOccurenceTable * newKmerOccurenceTable(short int accelerationBits, int wordLength);
26
+
27
+ void allocateKmerOccurences(IDnum kmerCount, KmerOccurenceTable * table);
28
+
29
+ void recordKmerOccurence(Kmer * kmer, IDnum nodeID, Coordinate position, KmerOccurenceTable * table);
30
+
31
+ void sortKmerOccurenceTable(KmerOccurenceTable * table);
32
+
33
+ KmerOccurence *findKmerInKmerOccurenceTable(Kmer * kmer,
34
+ KmerOccurenceTable *
35
+ table);
36
+
37
+
38
+ void destroyKmerOccurenceTable(KmerOccurenceTable * kmerTable);
39
+
40
+ // Node operations
41
+ KmerOccurence * getNextKmerOccurence(KmerOccurence * current);
42
+ IDnum getKmerOccurenceNodeID(KmerOccurence * occurence);
43
+ Coordinate getKmerOccurencePosition(KmerOccurence * occurence);
44
+ #endif
@@ -0,0 +1,223 @@
1
+ /* The MIT License
2
+
3
+ Copyright (c) 2008 Genome Research Ltd (GRL).
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
20
+ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21
+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
24
+ */
25
+
26
+ /* Contact: Heng Li <lh3@sanger.ac.uk> */
27
+
28
+ /* Last Modified: 12APR2009 */
29
+
30
+ #ifndef AC_KSEQ_H
31
+ #define AC_KSEQ_H
32
+
33
+ #include <ctype.h>
34
+ #include <string.h>
35
+ #include <stdlib.h>
36
+
37
+ #define KS_SEP_SPACE 0 // isspace(): \t, \n, \v, \f, \r
38
+ #define KS_SEP_TAB 1 // isspace() && !' '
39
+ #define KS_SEP_MAX 1
40
+
41
+ #define __KS_TYPE(type_t) \
42
+ typedef struct __kstream_t { \
43
+ char *buf; \
44
+ int begin, end, is_eof; \
45
+ type_t f; \
46
+ } kstream_t;
47
+
48
+ #define ks_eof(ks) ((ks)->is_eof && (ks)->begin >= (ks)->end)
49
+ #define ks_rewind(ks) ((ks)->is_eof = (ks)->begin = (ks)->end = 0)
50
+
51
+ #define __KS_BASIC(type_t, __bufsize) \
52
+ static inline kstream_t *ks_init(type_t f) \
53
+ { \
54
+ kstream_t *ks = (kstream_t*)calloc(1, sizeof(kstream_t)); \
55
+ ks->f = f; \
56
+ ks->buf = (char*)malloc(__bufsize); \
57
+ return ks; \
58
+ } \
59
+ static inline void ks_destroy(kstream_t *ks) \
60
+ { \
61
+ if (ks) { \
62
+ free(ks->buf); \
63
+ free(ks); \
64
+ } \
65
+ }
66
+
67
+ #define __KS_GETC(__read, __bufsize) \
68
+ static inline int ks_getc(kstream_t *ks) \
69
+ { \
70
+ if (ks->is_eof && ks->begin >= ks->end) return -1; \
71
+ if (ks->begin >= ks->end) { \
72
+ ks->begin = 0; \
73
+ ks->end = __read(ks->f, ks->buf, __bufsize); \
74
+ if (ks->end < __bufsize) ks->is_eof = 1; \
75
+ if (ks->end == 0) return -1; \
76
+ } \
77
+ return (int)ks->buf[ks->begin++]; \
78
+ }
79
+
80
+ #ifndef KSTRING_T
81
+ #define KSTRING_T kstring_t
82
+ typedef struct __kstring_t {
83
+ size_t l, m;
84
+ char *s;
85
+ } kstring_t;
86
+ #endif
87
+
88
+ #ifndef kroundup32
89
+ #define kroundup32(x) (--(x), (x)|=(x)>>1, (x)|=(x)>>2, (x)|=(x)>>4, (x)|=(x)>>8, (x)|=(x)>>16, ++(x))
90
+ #endif
91
+
92
+ #define __KS_GETUNTIL(__read, __bufsize) \
93
+ static int ks_getuntil(kstream_t *ks, int delimiter, kstring_t *str, int *dret) \
94
+ { \
95
+ if (dret) *dret = 0; \
96
+ str->l = 0; \
97
+ if (ks->begin >= ks->end && ks->is_eof) return -1; \
98
+ for (;;) { \
99
+ int i; \
100
+ if (ks->begin >= ks->end) { \
101
+ if (!ks->is_eof) { \
102
+ ks->begin = 0; \
103
+ ks->end = __read(ks->f, ks->buf, __bufsize); \
104
+ if (ks->end < __bufsize) ks->is_eof = 1; \
105
+ if (ks->end == 0) break; \
106
+ } else break; \
107
+ } \
108
+ if (delimiter > KS_SEP_MAX) { \
109
+ for (i = ks->begin; i < ks->end; ++i) \
110
+ if (ks->buf[i] == delimiter) break; \
111
+ } else if (delimiter == KS_SEP_SPACE) { \
112
+ for (i = ks->begin; i < ks->end; ++i) \
113
+ if (isspace(ks->buf[i])) break; \
114
+ } else if (delimiter == KS_SEP_TAB) { \
115
+ for (i = ks->begin; i < ks->end; ++i) \
116
+ if (isspace(ks->buf[i]) && ks->buf[i] != ' ') break; \
117
+ } else i = 0; /* never come to here! */ \
118
+ if (str->m - str->l < i - ks->begin + 1) { \
119
+ str->m = str->l + (i - ks->begin) + 1; \
120
+ kroundup32(str->m); \
121
+ str->s = (char*)realloc(str->s, str->m); \
122
+ } \
123
+ memcpy(str->s + str->l, ks->buf + ks->begin, i - ks->begin); \
124
+ str->l = str->l + (i - ks->begin); \
125
+ ks->begin = i + 1; \
126
+ if (i < ks->end) { \
127
+ if (dret) *dret = ks->buf[i]; \
128
+ break; \
129
+ } \
130
+ } \
131
+ if (str->l == 0) { \
132
+ str->m = 1; \
133
+ str->s = (char*)calloc(1, 1); \
134
+ } \
135
+ str->s[str->l] = '\0'; \
136
+ return str->l; \
137
+ }
138
+
139
+ #define KSTREAM_INIT(type_t, __read, __bufsize) \
140
+ __KS_TYPE(type_t) \
141
+ __KS_BASIC(type_t, __bufsize) \
142
+ __KS_GETC(__read, __bufsize) \
143
+ __KS_GETUNTIL(__read, __bufsize)
144
+
145
+ #define __KSEQ_BASIC(type_t) \
146
+ static inline kseq_t *kseq_init(type_t fd) \
147
+ { \
148
+ kseq_t *s = (kseq_t*)calloc(1, sizeof(kseq_t)); \
149
+ s->f = ks_init(fd); \
150
+ return s; \
151
+ } \
152
+ static inline void kseq_rewind(kseq_t *ks) \
153
+ { \
154
+ ks->last_char = 0; \
155
+ ks->f->is_eof = ks->f->begin = ks->f->end = 0; \
156
+ } \
157
+ static inline void kseq_destroy(kseq_t *ks) \
158
+ { \
159
+ if (!ks) return; \
160
+ free(ks->name.s); free(ks->comment.s); free(ks->seq.s); free(ks->qual.s); \
161
+ ks_destroy(ks->f); \
162
+ free(ks); \
163
+ }
164
+
165
+ /* Return value:
166
+ >=0 length of the sequence (normal)
167
+ -1 end-of-file
168
+ -2 truncated quality string
169
+ */
170
+ #define __KSEQ_READ \
171
+ static int kseq_read(kseq_t *seq) \
172
+ { \
173
+ int c; \
174
+ kstream_t *ks = seq->f; \
175
+ if (seq->last_char == 0) { /* then jump to the next header line */ \
176
+ while ((c = ks_getc(ks)) != -1 && c != '>' && c != '@'); \
177
+ if (c == -1) return -1; /* end of file */ \
178
+ seq->last_char = c; \
179
+ } /* the first header char has been read */ \
180
+ seq->comment.l = seq->seq.l = seq->qual.l = 0; \
181
+ if (ks_getuntil(ks, 0, &seq->name, &c) < 0) return -1; \
182
+ if (c != '\n') ks_getuntil(ks, '\n', &seq->comment, 0); \
183
+ while ((c = ks_getc(ks)) != -1 && c != '>' && c != '+' && c != '@') { \
184
+ if (isgraph(c)) { /* printable non-space character */ \
185
+ if (seq->seq.l + 1 >= seq->seq.m) { /* double the memory */ \
186
+ seq->seq.m = seq->seq.l + 2; \
187
+ kroundup32(seq->seq.m); /* rounded to next closest 2^k */ \
188
+ seq->seq.s = (char*)realloc(seq->seq.s, seq->seq.m); \
189
+ } \
190
+ seq->seq.s[seq->seq.l++] = (char)c; \
191
+ } \
192
+ } \
193
+ if (c == '>' || c == '@') seq->last_char = c; /* the first header char has been read */ \
194
+ seq->seq.s[seq->seq.l] = 0; /* null terminated string */ \
195
+ if (c != '+') return seq->seq.l; /* FASTA */ \
196
+ if (seq->qual.m < seq->seq.m) { /* allocate enough memory */ \
197
+ seq->qual.m = seq->seq.m; \
198
+ seq->qual.s = (char*)realloc(seq->qual.s, seq->qual.m); \
199
+ } \
200
+ while ((c = ks_getc(ks)) != -1 && c != '\n'); /* skip the rest of '+' line */ \
201
+ if (c == -1) return -2; /* we should not stop here */ \
202
+ while ((c = ks_getc(ks)) != -1 && seq->qual.l < seq->seq.l) \
203
+ if (c >= 33 && c <= 127) seq->qual.s[seq->qual.l++] = (unsigned char)c; \
204
+ seq->qual.s[seq->qual.l] = 0; /* null terminated string */ \
205
+ seq->last_char = 0; /* we have not come to the next header line */ \
206
+ if (seq->seq.l != seq->qual.l) return -2; /* qual string is shorter than seq string */ \
207
+ return seq->seq.l; \
208
+ }
209
+
210
+ #define __KSEQ_TYPE(type_t) \
211
+ typedef struct { \
212
+ kstring_t name, comment, seq, qual; \
213
+ int last_char; \
214
+ kstream_t *f; \
215
+ } kseq_t;
216
+
217
+ #define KSEQ_INIT(type_t, __read) \
218
+ KSTREAM_INIT(type_t, __read, 4096) \
219
+ __KSEQ_TYPE(type_t) \
220
+ __KSEQ_BASIC(type_t) \
221
+ __KSEQ_READ
222
+
223
+ #endif