bio-samtools 0.6.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (160) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -2
  3. data/README.md +4 -7
  4. data/VERSION +1 -1
  5. data/bio-samtools.gemspec +47 -105
  6. data/doc/Bio.html +68 -131
  7. data/doc/Bio/DB.html +51 -111
  8. data/doc/Bio/DB/Alignment.html +135 -363
  9. data/doc/Bio/DB/Pileup.html +183 -170
  10. data/doc/Bio/DB/SAM.html +1396 -820
  11. data/doc/Bio/DB/SAM/Library.html +73 -123
  12. data/doc/Bio/DB/SAM/Tools.html +51 -273
  13. data/doc/Bio/DB/Tag.html +78 -124
  14. data/doc/Bio/DB/Vcf.html +111 -147
  15. data/doc/LICENSE_txt.html +113 -148
  16. data/doc/created.rid +9 -10
  17. data/doc/fonts.css +167 -0
  18. data/doc/fonts/Lato-Light.ttf +0 -0
  19. data/doc/fonts/Lato-LightItalic.ttf +0 -0
  20. data/doc/fonts/Lato-Regular.ttf +0 -0
  21. data/doc/fonts/Lato-RegularItalic.ttf +0 -0
  22. data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
  23. data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
  24. data/doc/images/add.png +0 -0
  25. data/doc/images/arrow_up.png +0 -0
  26. data/doc/images/delete.png +0 -0
  27. data/doc/images/tag_blue.png +0 -0
  28. data/doc/index.html +48 -54
  29. data/doc/js/darkfish.js +9 -22
  30. data/doc/js/search.js +20 -5
  31. data/doc/js/search_index.js +1 -1
  32. data/doc/rdoc.css +255 -218
  33. data/doc/table_of_contents.html +256 -137
  34. data/ext/Rakefile +57 -0
  35. data/lib/bio-samtools.rb +7 -2
  36. data/lib/bio/BIOExtensions.rb +89 -0
  37. data/lib/bio/db/alignment.rb +59 -0
  38. data/lib/bio/db/fastadb.rb +255 -0
  39. data/lib/bio/db/pileup.rb +221 -172
  40. data/lib/bio/db/sam.rb +639 -589
  41. data/lib/bio/db/sam/{faidx.rb → faidx_old.rb} +0 -0
  42. data/lib/bio/db/vcf.rb +69 -68
  43. data/test/.gitignore +1 -0
  44. data/test/{test_basic.rb → old_test_basic.rb} +33 -1
  45. data/test/samples/small/dupes.bam +0 -0
  46. data/test/samples/small/dupes.sam +274 -0
  47. data/test/samples/small/map_for_reheader.sam +8 -0
  48. data/test/samples/small/map_to_merge1.bam +0 -0
  49. data/test/samples/small/map_to_merge1.bam.bai +0 -0
  50. data/test/samples/small/map_to_merge1.sam +8 -0
  51. data/test/samples/small/map_to_merge2.bam +0 -0
  52. data/test/samples/small/map_to_merge2.bam.bai +0 -0
  53. data/test/samples/small/map_to_merge2.sam +8 -0
  54. data/test/samples/small/no_md.sam +8 -0
  55. data/test/samples/small/test_chr.fasta.1.bt2 +0 -0
  56. data/test/samples/small/test_chr.fasta.2.bt2 +0 -0
  57. data/test/samples/small/test_chr.fasta.3.bt2 +0 -0
  58. data/test/samples/small/test_chr.fasta.4.bt2 +0 -0
  59. data/test/samples/small/test_chr.fasta.rev.1.bt2 +0 -0
  60. data/test/samples/small/test_chr.fasta.rev.2.bt2 +0 -0
  61. data/test/samples/small/test_cov.svg +273 -0
  62. data/test/samples/small/testu.bam.bai +0 -0
  63. data/test/svg +133 -0
  64. data/test/test_pileup.rb +84 -0
  65. data/test/test_sam.rb +331 -0
  66. data/test/test_vcf.rb +11 -0
  67. data/{doc → tutorial}/tutorial.html +0 -0
  68. data/{doc → tutorial}/tutorial.pdf +0 -0
  69. metadata +56 -114
  70. data/doc/Bio/DB/SAM/Tools/Bam1CoreT.html +0 -159
  71. data/doc/Bio/DB/SAM/Tools/Bam1T.html +0 -220
  72. data/doc/Bio/DB/SAM/Tools/BamHeaderT.html +0 -249
  73. data/doc/Bio/DB/SAM/Tools/BamPileup1T.html +0 -159
  74. data/doc/Bio/DB/SAM/Tools/SamfileT.html +0 -171
  75. data/doc/Bio/DB/SAM/Tools/SamfileTX.html +0 -159
  76. data/doc/Bio/DB/SAMException.html +0 -205
  77. data/doc/LibC.html +0 -155
  78. data/doc/Pileup.html +0 -571
  79. data/doc/Vcf.html +0 -473
  80. data/doc/basic_styles.css +0 -31
  81. data/doc/classes/Bio.html +0 -139
  82. data/doc/classes/Bio/DB.html +0 -137
  83. data/doc/classes/Bio/DB/Alignment.html +0 -441
  84. data/doc/classes/Bio/DB/Alignment.src/M000012.html +0 -19
  85. data/doc/classes/Bio/DB/Alignment.src/M000013.html +0 -27
  86. data/doc/classes/Bio/DB/Alignment.src/M000014.html +0 -45
  87. data/doc/classes/Bio/DB/Alignment.src/M000015.html +0 -40
  88. data/doc/classes/Bio/DB/SAM.html +0 -510
  89. data/doc/classes/Bio/DB/SAM/Library.html +0 -135
  90. data/doc/classes/Bio/DB/SAM/Library.src/M000006.html +0 -28
  91. data/doc/classes/Bio/DB/SAM/Tools.html +0 -278
  92. data/doc/classes/Bio/DB/SAM/Tools.src/M000007.html +0 -20
  93. data/doc/classes/Bio/DB/SAM/Tools/Bam1CoreT.html +0 -111
  94. data/doc/classes/Bio/DB/SAM/Tools/Bam1T.html +0 -150
  95. data/doc/classes/Bio/DB/SAM/Tools/Bam1T.src/M000010.html +0 -20
  96. data/doc/classes/Bio/DB/SAM/Tools/BamHeaderT.html +0 -169
  97. data/doc/classes/Bio/DB/SAM/Tools/BamHeaderT.src/M000008.html +0 -19
  98. data/doc/classes/Bio/DB/SAM/Tools/BamHeaderT.src/M000009.html +0 -18
  99. data/doc/classes/Bio/DB/SAM/Tools/BamPileup1T.html +0 -111
  100. data/doc/classes/Bio/DB/SAM/Tools/SamfileT.html +0 -129
  101. data/doc/classes/Bio/DB/SAM/Tools/SamfileTX.html +0 -111
  102. data/doc/classes/Bio/DB/SAMException.html +0 -140
  103. data/doc/classes/Bio/DB/SAMException.src/M000016.html +0 -18
  104. data/doc/classes/Bio/DB/Sam.src/M000017.html +0 -43
  105. data/doc/classes/Bio/DB/Sam.src/M000018.html +0 -42
  106. data/doc/classes/Bio/DB/Sam.src/M000019.html +0 -18
  107. data/doc/classes/Bio/DB/Sam.src/M000020.html +0 -22
  108. data/doc/classes/Bio/DB/Sam.src/M000021.html +0 -19
  109. data/doc/classes/Bio/DB/Sam.src/M000022.html +0 -25
  110. data/doc/classes/Bio/DB/Sam.src/M000023.html +0 -28
  111. data/doc/classes/Bio/DB/Sam.src/M000024.html +0 -28
  112. data/doc/classes/Bio/DB/Sam.src/M000025.html +0 -46
  113. data/doc/classes/Bio/DB/Sam.src/M000026.html +0 -24
  114. data/doc/classes/Bio/DB/Sam.src/M000027.html +0 -19
  115. data/doc/classes/Bio/DB/Sam.src/M000028.html +0 -24
  116. data/doc/classes/Bio/DB/Sam.src/M000029.html +0 -41
  117. data/doc/classes/Bio/DB/Sam.src/M000030.html +0 -31
  118. data/doc/classes/Bio/DB/Sam.src/M000031.html +0 -86
  119. data/doc/classes/Bio/DB/Sam.src/M000032.html +0 -34
  120. data/doc/classes/Bio/DB/Tag.html +0 -160
  121. data/doc/classes/Bio/DB/Tag.src/M000011.html +0 -21
  122. data/doc/classes/LibC.html +0 -105
  123. data/doc/classes/Pileup.html +0 -374
  124. data/doc/classes/Pileup.src/M000001.html +0 -34
  125. data/doc/classes/Pileup.src/M000002.html +0 -21
  126. data/doc/classes/Pileup.src/M000003.html +0 -21
  127. data/doc/classes/Pileup.src/M000004.html +0 -21
  128. data/doc/classes/Pileup.src/M000005.html +0 -31
  129. data/doc/files/lib/bio-samtools_rb.html +0 -109
  130. data/doc/files/lib/bio/db/sam/bam_rb.html +0 -108
  131. data/doc/files/lib/bio/db/sam/faidx_rb.html +0 -108
  132. data/doc/files/lib/bio/db/sam/library_rb.html +0 -101
  133. data/doc/files/lib/bio/db/sam/pileup_rb.html +0 -178
  134. data/doc/files/lib/bio/db/sam/sam_rb.html +0 -113
  135. data/doc/files/lib/bio/db/sam_rb.html +0 -111
  136. data/doc/fr_class_index.html +0 -43
  137. data/doc/fr_file_index.html +0 -33
  138. data/doc/fr_method_index.html +0 -58
  139. data/doc/lib/bio-samtools_rb.html +0 -115
  140. data/doc/lib/bio/db/pileup_rb.html +0 -171
  141. data/doc/lib/bio/db/sam/bam_rb.html +0 -121
  142. data/doc/lib/bio/db/sam/faidx_rb.html +0 -117
  143. data/doc/lib/bio/db/sam/library_rb.html +0 -115
  144. data/doc/lib/bio/db/sam/pileup_rb.html +0 -171
  145. data/doc/lib/bio/db/sam/sam_rb.html +0 -121
  146. data/doc/lib/bio/db/sam/vcf_rb.html +0 -124
  147. data/doc/lib/bio/db/sam_rb.html +0 -115
  148. data/doc/lib/bio/db/vcf_rb.html +0 -124
  149. data/doc/rdoc-style.css +0 -208
  150. data/lib/bio/db/sam/bam.rb +0 -210
  151. data/lib/bio/db/sam/sam.rb +0 -86
  152. data/test/samples/pipe_char/test.bam +0 -0
  153. data/test/samples/pipe_char/test.bam.bai +0 -0
  154. data/test/samples/pipe_char/test.tam +0 -10
  155. data/test/samples/pipe_char/test_chr.fasta +0 -1000
  156. data/test/samples/pipe_char/test_chr.fasta.fai +0 -1
  157. data/test/samples/small/test +0 -0
  158. data/test/samples/small/test.bam +0 -0
  159. data/test/samples/small/test.fa +0 -20
  160. data/test/samples/small/test.fai +0 -0
@@ -1,19 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html>
7
- <head>
8
- <title>new (Bio::DB::Alignment)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/bio/db/sam.rb, line 391</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>
15
- <span class="ruby-constant">ObjectSpace</span>.<span class="ruby-identifier">define_finalizer</span>(<span class="ruby-keyword kw">self</span>,
16
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">method</span>(<span class="ruby-identifier">:finalize</span>).<span class="ruby-identifier">to_proc</span>)
17
- <span class="ruby-keyword kw">end</span></pre>
18
- </body>
19
- </html>
@@ -1,27 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html>
7
- <head>
8
- <title>finalize (Bio::DB::Alignment)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/bio/db/sam.rb, line 395</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Alignment</span>.<span class="ruby-identifier">finalize</span>(<span class="ruby-identifier">object_id</span>)
15
-
16
- <span class="ruby-comment cmt"># puts &quot;Object #{object_id} dying at #{Time.new}&quot;</span>
17
- <span class="ruby-comment cmt"># p &quot;?&quot; . object_id.al</span>
18
- <span class="ruby-comment cmt"># p object_id.al</span>
19
- <span class="ruby-constant">LibC</span>.<span class="ruby-identifier">free</span> <span class="ruby-identifier">object_id</span>.<span class="ruby-identifier">al</span>
20
- <span class="ruby-constant">LibC</span>.<span class="ruby-identifier">free</span> <span class="ruby-identifier">object_id</span>.<span class="ruby-identifier">sam</span>
21
- <span class="ruby-constant">LibC</span>.<span class="ruby-identifier">free</span> <span class="ruby-identifier">object_id</span>.<span class="ruby-identifier">calend</span>
22
- <span class="ruby-constant">LibC</span>.<span class="ruby-identifier">free</span> <span class="ruby-identifier">object_id</span>.<span class="ruby-identifier">qlen</span>
23
-
24
- <span class="ruby-constant">LibC</span>.<span class="ruby-identifier">free</span> <span class="ruby-identifier">object_id</span>.<span class="ruby-identifier">samstr</span>
25
- <span class="ruby-keyword kw">end</span></pre>
26
- </body>
27
- </html>
@@ -1,45 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html>
7
- <head>
8
- <title>set (Bio::DB::Alignment)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/bio/db/sam.rb, line 417</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set</span>(<span class="ruby-identifier">bam_alignment</span>, <span class="ruby-identifier">header</span>)
15
- <span class="ruby-comment cmt">#Create the FFI object</span>
16
- <span class="ruby-ivar">@al</span> = <span class="ruby-constant">Bio</span><span class="ruby-operator">::</span><span class="ruby-constant">DB</span><span class="ruby-operator">::</span><span class="ruby-constant">SAM</span><span class="ruby-operator">::</span><span class="ruby-constant">Tools</span><span class="ruby-operator">::</span><span class="ruby-constant">Bam1T</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">bam_alignment</span>)
17
-
18
- <span class="ruby-comment cmt">#set the raw data</span>
19
- <span class="ruby-identifier">tmp_str</span> = <span class="ruby-constant">Bio</span><span class="ruby-operator">::</span><span class="ruby-constant">DB</span><span class="ruby-operator">::</span><span class="ruby-constant">SAM</span><span class="ruby-operator">::</span><span class="ruby-constant">Tools</span>.<span class="ruby-identifier">bam_format1</span>(<span class="ruby-identifier">header</span>,<span class="ruby-identifier">al</span>)
20
- <span class="ruby-comment cmt">#self.sam = tmp_str</span>
21
- <span class="ruby-comment cmt">#ObjectSpace.define_finalizer(self, proc {|id| puts &quot;Finalizer one on #{id}&quot; })</span>
22
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">sam</span> = <span class="ruby-constant">String</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">tmp_str</span>)
23
- <span class="ruby-comment cmt">#LibC.free tmp_str</span>
24
- <span class="ruby-comment cmt">#Set values calculated by libbam</span>
25
- <span class="ruby-identifier">core</span> = <span class="ruby-identifier">al</span>[<span class="ruby-identifier">:core</span>]
26
- <span class="ruby-identifier">cigar</span> = <span class="ruby-identifier">al</span>[<span class="ruby-identifier">:data</span>][<span class="ruby-identifier">core</span>[<span class="ruby-identifier">:l_qname</span>]]<span class="ruby-comment cmt">#define bam1_cigar(b) ((uint32_t*)((b)-&gt;data + (b)-&gt;core.l_qname)) </span>
27
- <span class="ruby-ivar">@calend</span> = <span class="ruby-constant">Bio</span><span class="ruby-operator">::</span><span class="ruby-constant">DB</span><span class="ruby-operator">::</span><span class="ruby-constant">SAM</span><span class="ruby-operator">::</span><span class="ruby-constant">Tools</span>.<span class="ruby-identifier">bam_calend</span>(<span class="ruby-identifier">core</span>,<span class="ruby-identifier">cigar</span>)
28
- <span class="ruby-ivar">@qlen</span> = <span class="ruby-constant">Bio</span><span class="ruby-operator">::</span><span class="ruby-constant">DB</span><span class="ruby-operator">::</span><span class="ruby-constant">SAM</span><span class="ruby-operator">::</span><span class="ruby-constant">Tools</span>.<span class="ruby-identifier">bam_cigar2qlen</span>(<span class="ruby-identifier">core</span>,<span class="ruby-identifier">cigar</span>)
29
-
30
- <span class="ruby-comment cmt">#process the flags</span>
31
- <span class="ruby-ivar">@is_paired</span> = <span class="ruby-ivar">@flag</span> <span class="ruby-operator">&amp;</span> <span class="ruby-value">0x0001</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
32
- <span class="ruby-ivar">@is_mapped</span> = <span class="ruby-ivar">@flag</span> <span class="ruby-operator">&amp;</span> <span class="ruby-value">0x0002</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
33
- <span class="ruby-ivar">@query_unmapped</span> = <span class="ruby-ivar">@flag</span> <span class="ruby-operator">&amp;</span> <span class="ruby-value">0x0004</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
34
- <span class="ruby-ivar">@mate_unmapped</span> = <span class="ruby-ivar">@flag</span> <span class="ruby-operator">&amp;</span> <span class="ruby-value">0x0008</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
35
- <span class="ruby-ivar">@query_strand</span> = <span class="ruby-operator">!</span>(<span class="ruby-ivar">@flag</span> <span class="ruby-operator">&amp;</span> <span class="ruby-value">0x0010</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>)
36
- <span class="ruby-ivar">@mate_strand</span> = <span class="ruby-operator">!</span>(<span class="ruby-ivar">@flag</span> <span class="ruby-operator">&amp;</span> <span class="ruby-value">0x0020</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>)
37
- <span class="ruby-ivar">@first_in_pair</span> = <span class="ruby-ivar">@flag</span> <span class="ruby-operator">&amp;</span> <span class="ruby-value">0x0040</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
38
- <span class="ruby-ivar">@second_in_pair</span> = <span class="ruby-ivar">@flag</span> <span class="ruby-operator">&amp;</span> <span class="ruby-value">0x0080</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
39
- <span class="ruby-ivar">@primary</span> = <span class="ruby-operator">!</span>(<span class="ruby-ivar">@flag</span> <span class="ruby-operator">&amp;</span> <span class="ruby-value">0x0100</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>)
40
- <span class="ruby-ivar">@failed_quality</span> = <span class="ruby-ivar">@flag</span> <span class="ruby-operator">&amp;</span> <span class="ruby-value">0x0200</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
41
- <span class="ruby-ivar">@is_duplicate</span> = <span class="ruby-ivar">@flag</span> <span class="ruby-operator">&amp;</span> <span class="ruby-value">0x0400</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
42
-
43
- <span class="ruby-keyword kw">end</span></pre>
44
- </body>
45
- </html>
@@ -1,40 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html>
7
- <head>
8
- <title>sam= (Bio::DB::Alignment)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/bio/db/sam.rb, line 449</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sam=</span>(<span class="ruby-identifier">sam</span>)
15
- <span class="ruby-comment cmt">#p sam</span>
16
- <span class="ruby-identifier">s</span> = <span class="ruby-identifier">sam</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">&quot;\t&quot;</span>)
17
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">qname</span> = <span class="ruby-identifier">s</span>[<span class="ruby-value">0</span>]
18
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">flag</span> = <span class="ruby-identifier">s</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">to_i</span>
19
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">rname</span> = <span class="ruby-identifier">s</span>[<span class="ruby-value">2</span>]
20
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">pos</span> = <span class="ruby-identifier">s</span>[<span class="ruby-value">3</span>].<span class="ruby-identifier">to_i</span>
21
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">mapq</span> = <span class="ruby-identifier">s</span>[<span class="ruby-value">4</span>].<span class="ruby-identifier">to_i</span>
22
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">cigar</span> = <span class="ruby-identifier">s</span>[<span class="ruby-value">5</span>]
23
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">mrnm</span> = <span class="ruby-identifier">s</span>[<span class="ruby-value">6</span>]
24
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">mpos</span> = <span class="ruby-identifier">s</span>[<span class="ruby-value">7</span>].<span class="ruby-identifier">to_i</span>
25
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">isize</span> = <span class="ruby-identifier">s</span>[<span class="ruby-value">8</span>].<span class="ruby-identifier">to_i</span>
26
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">seq</span> = <span class="ruby-identifier">s</span>[<span class="ruby-value">9</span>]
27
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">qual</span> = <span class="ruby-identifier">s</span>[<span class="ruby-value">10</span>]
28
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">tags</span> = {}
29
- <span class="ruby-value">11</span>.<span class="ruby-identifier">upto</span>(<span class="ruby-identifier">s</span>.<span class="ruby-identifier">size</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">n</span><span class="ruby-operator">|</span>
30
- <span class="ruby-identifier">t</span> = <span class="ruby-constant">Tag</span>.<span class="ruby-identifier">new</span>
31
- <span class="ruby-identifier">t</span>.<span class="ruby-identifier">set</span>(<span class="ruby-identifier">s</span>[<span class="ruby-identifier">n</span>])
32
- <span class="ruby-identifier">tags</span>[<span class="ruby-identifier">t</span>.<span class="ruby-identifier">tag</span>] = <span class="ruby-identifier">t</span>
33
- }
34
-
35
-
36
- <span class="ruby-comment cmt">#&lt;QNAME&gt; &lt;FLAG&gt; &lt;RNAME&gt; &lt;POS&gt; &lt;MAPQ&gt; &lt;CIGAR&gt; &lt;MRNM&gt; &lt;MPOS&gt; &lt;ISIZE&gt; &lt;SEQ&gt; &lt;QUAL&gt; #[&lt;TAG&gt;:&lt;VTYPE&gt;:&lt;VALUE&gt; [...]] </span>
37
-
38
- <span class="ruby-keyword kw">end</span></pre>
39
- </body>
40
- </html>
@@ -1,510 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>Class: Bio::DB::Sam</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="classHeader">
50
- <table class="header-table">
51
- <tr class="top-aligned-row">
52
- <td><strong>Class</strong></td>
53
- <td class="class-name-in-header">Bio::DB::Sam</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../../../files/lib/bio/db/sam_rb.html">
59
- lib/bio/db/sam.rb
60
- </a>
61
- <br />
62
- </td>
63
- </tr>
64
-
65
- <tr class="top-aligned-row">
66
- <td><strong>Parent:</strong></td>
67
- <td>
68
- Object
69
- </td>
70
- </tr>
71
- </table>
72
- </div>
73
- <!-- banner header -->
74
-
75
- <div id="bodyContent">
76
-
77
-
78
-
79
- <div id="contextContent">
80
-
81
-
82
-
83
- </div>
84
-
85
- <div id="method-list">
86
- <h3 class="section-bar">Methods</h3>
87
-
88
- <div class="name-list">
89
- <a href="#M000024">average_coverage</a>&nbsp;&nbsp;
90
- <a href="#M000025">chromosome_coverage</a>&nbsp;&nbsp;
91
- <a href="#M000020">close</a>&nbsp;&nbsp;
92
- <a href="#M000032">deprecated_pileup</a>&nbsp;&nbsp;
93
- <a href="#M000028">fetch</a>&nbsp;&nbsp;
94
- <a href="#M000026">fetch_reference</a>&nbsp;&nbsp;
95
- <a href="#M000029">fetch_with_function</a>&nbsp;&nbsp;
96
- <a href="#M000021">finalize</a>&nbsp;&nbsp;
97
- <a href="#M000022">load_index</a>&nbsp;&nbsp;
98
- <a href="#M000023">load_reference</a>&nbsp;&nbsp;
99
- <a href="#M000030">merge</a>&nbsp;&nbsp;
100
- <a href="#M000031">mpileup</a>&nbsp;&nbsp;
101
- <a href="#M000017">new</a>&nbsp;&nbsp;
102
- <a href="#M000018">open</a>&nbsp;&nbsp;
103
- <a href="#M000027">query_string</a>&nbsp;&nbsp;
104
- <a href="#M000019">to_s</a>&nbsp;&nbsp;
105
- </div>
106
- </div>
107
-
108
- </div>
109
-
110
-
111
- <!-- if includes -->
112
-
113
- <div id="section">
114
-
115
-
116
-
117
-
118
-
119
- <div id="attribute-list">
120
- <h3 class="section-bar">Attributes</h3>
121
-
122
- <div class="name-list">
123
- <table>
124
- <tr class="top-aligned-row context-row">
125
- <td class="context-item-name">sam_file</td>
126
- <td class="context-item-value">&nbsp;[R]&nbsp;</td>
127
- <td class="context-item-desc"></td>
128
- </tr>
129
- </table>
130
- </div>
131
- </div>
132
-
133
-
134
-
135
- <!-- if method_list -->
136
- <div id="methods">
137
- <h3 class="section-bar">Public Class methods</h3>
138
-
139
- <div id="method-M000021" class="method-detail">
140
- <a name="M000021"></a>
141
-
142
- <div class="method-heading">
143
- <a href="Sam.src/M000021.html" target="Code" class="method-signature"
144
- onclick="popupCode('Sam.src/M000021.html');return false;">
145
- <span class="method-name">finalize</span><span class="method-args">(id)</span>
146
- </a>
147
- </div>
148
-
149
- <div class="method-description">
150
- <p>
151
- Destructor method that closes the file before letting the object be garbage
152
- collected.
153
- </p>
154
- </div>
155
- </div>
156
-
157
- <div id="method-M000030" class="method-detail">
158
- <a name="M000030"></a>
159
-
160
- <div class="method-heading">
161
- <a href="Sam.src/M000030.html" target="Code" class="method-signature"
162
- onclick="popupCode('Sam.src/M000030.html');return false;">
163
- <span class="method-name">merge</span><span class="method-args">(files, merged_file, headers, add_RG, by_qname)</span>
164
- </a>
165
- </div>
166
-
167
- <div class="method-description">
168
- <p>
169
- Merges n BAM files. This doesn&#8216;t require to create a <a
170
- href="SAM.html">SAM</a> object
171
- </p>
172
- <table>
173
- <tr><td valign="top">files:</td><td>An array with the paths to the files.
174
-
175
- </td></tr>
176
- <tr><td valign="top">merged_file:</td><td>The path to the merged file
177
-
178
- </td></tr>
179
- <tr><td valign="top">headers:</td><td>The BAM file containing the header
180
-
181
- </td></tr>
182
- <tr><td valign="top">add_RG:</td><td>If true, the RG tag is added (infered from the filenames)
183
-
184
- </td></tr>
185
- <tr><td valign="top">by_qname:</td><td>If true, the bamfiles should by ordered by query name, if false, by
186
- coordinates.
187
-
188
- </td></tr>
189
- </table>
190
- </div>
191
- </div>
192
-
193
- <div id="method-M000017" class="method-detail">
194
- <a name="M000017"></a>
195
-
196
- <div class="method-heading">
197
- <a href="Sam.src/M000017.html" target="Code" class="method-signature"
198
- onclick="popupCode('Sam.src/M000017.html');return false;">
199
- <span class="method-name">new</span><span class="method-args">(optsa={})</span>
200
- </a>
201
- </div>
202
-
203
- <div class="method-description">
204
- <p>
205
- To make a <a href="Sam.html#M000017">new</a> sam object. Initialize expects
206
- a hash optsa with the following elemets:
207
- </p>
208
- <table>
209
- <tr><td valign="top">fasta:</td><td>The fasta file with the reference. (nil)
210
-
211
- </td></tr>
212
- <tr><td valign="top">bam:</td><td>path to a binary <a href="SAM.html">SAM</a> file (nil)
213
-
214
- </td></tr>
215
- <tr><td valign="top">tam:</td><td>path to a text <a href="SAM.html">SAM</a> file (nil)
216
-
217
- </td></tr>
218
- <tr><td valign="top">compressed:</td><td>If the binary file is compressed (true)
219
-
220
- </td></tr>
221
- <tr><td valign="top">write:</td><td>If the file is to be writen (false). Not supported yet.
222
-
223
- </td></tr>
224
- </table>
225
- <p>
226
- *NOTE:* you can&#8216;t use binary and text formats simultaneusly. To make
227
- queries, the file has to be a sorted binary. This function doesn&#8216;t
228
- actually <a href="Sam.html#M000018">open</a> the file, it just prepares the
229
- object to be opened in a later stage.
230
- </p>
231
- </div>
232
- </div>
233
-
234
- <h3 class="section-bar">Public Instance methods</h3>
235
-
236
- <div id="method-M000024" class="method-detail">
237
- <a name="M000024"></a>
238
-
239
- <div class="method-heading">
240
- <a href="Sam.src/M000024.html" target="Code" class="method-signature"
241
- onclick="popupCode('Sam.src/M000024.html');return false;">
242
- <span class="method-name">average_coverage</span><span class="method-args">(chromosome, qstart, len)</span>
243
- </a>
244
- </div>
245
-
246
- <div class="method-description">
247
- <p>
248
- Returns the average coverage of a region in a bam file.
249
- </p>
250
- </div>
251
- </div>
252
-
253
- <div id="method-M000025" class="method-detail">
254
- <a name="M000025"></a>
255
-
256
- <div class="method-heading">
257
- <a href="Sam.src/M000025.html" target="Code" class="method-signature"
258
- onclick="popupCode('Sam.src/M000025.html');return false;">
259
- <span class="method-name">chromosome_coverage</span><span class="method-args">(chromosome, qstart, len)</span>
260
- </a>
261
- </div>
262
-
263
- <div class="method-description">
264
- <p>
265
- Returns an array with the coverage at each possition in the queried region
266
- This is a simple average coverage just calculated with the first and last
267
- possition of the alignment, ignoring the gaps.
268
- </p>
269
- </div>
270
- </div>
271
-
272
- <div id="method-M000020" class="method-detail">
273
- <a name="M000020"></a>
274
-
275
- <div class="method-heading">
276
- <a href="Sam.src/M000020.html" target="Code" class="method-signature"
277
- onclick="popupCode('Sam.src/M000020.html');return false;">
278
- <span class="method-name">close</span><span class="method-args">()</span>
279
- </a>
280
- </div>
281
-
282
- <div class="method-description">
283
- <p>
284
- Closes the sam file and destroys the C pointers using the functions
285
- provided by libbam
286
- </p>
287
- </div>
288
- </div>
289
-
290
- <div id="method-M000032" class="method-detail">
291
- <a name="M000032"></a>
292
-
293
- <div class="method-heading">
294
- <a href="Sam.src/M000032.html" target="Code" class="method-signature"
295
- onclick="popupCode('Sam.src/M000032.html');return false;">
296
- <span class="method-name">deprecated_pileup</span><span class="method-args">( cmd ) {|Pileup.new(line)| ...}</span>
297
- </a>
298
- </div>
299
-
300
- <div class="method-description">
301
- <p>
302
- utility method that does not use the samtools API, it calls samtools
303
- directly as if on the command line and catches the output, to use this
304
- method you must have a version of samtools that supports the pileup command
305
- (&lt; 0.1.17) otherwise the command will fail. <a
306
- href="Sam.html#M000031">mpileup</a> is the preferred method for getting
307
- pileups. With this method the sam object should be created as usual, but
308
- you need to pass this method a string of options for samtools you
309
- don&#8216;t need to provide the call to samtools pileup itself or -f
310
- &lt;fasta file&gt; or the bam file itself, these are taken from the sam
311
- object
312
- </p>
313
- </div>
314
- </div>
315
-
316
- <div id="method-M000028" class="method-detail">
317
- <a name="M000028"></a>
318
-
319
- <div class="method-heading">
320
- <a href="Sam.src/M000028.html" target="Code" class="method-signature"
321
- onclick="popupCode('Sam.src/M000028.html');return false;">
322
- <span class="method-name">fetch</span><span class="method-args">(chromosome, qstart, qend)</span>
323
- </a>
324
- </div>
325
-
326
- <div class="method-description">
327
- <p>
328
- Returns an array of Alignments on a given region.
329
- </p>
330
- </div>
331
- </div>
332
-
333
- <div id="method-M000026" class="method-detail">
334
- <a name="M000026"></a>
335
-
336
- <div class="method-heading">
337
- <a href="Sam.src/M000026.html" target="Code" class="method-signature"
338
- onclick="popupCode('Sam.src/M000026.html');return false;">
339
- <span class="method-name">fetch_reference</span><span class="method-args">(chromosome, qstart,qend)</span>
340
- </a>
341
- </div>
342
-
343
- <div class="method-description">
344
- <p>
345
- Returns the sequence for a given region.
346
- </p>
347
- </div>
348
- </div>
349
-
350
- <div id="method-M000029" class="method-detail">
351
- <a name="M000029"></a>
352
-
353
- <div class="method-heading">
354
- <a href="Sam.src/M000029.html" target="Code" class="method-signature"
355
- onclick="popupCode('Sam.src/M000029.html');return false;">
356
- <span class="method-name">fetch_with_function</span><span class="method-args">(chromosome, qstart, qend, function)</span>
357
- </a>
358
- </div>
359
-
360
- <div class="method-description">
361
- <p>
362
- Executes a function on each <a href="Alignment.html">Alignment</a> inside
363
- the queried region of the chromosome. The chromosome can be either the
364
- textual name or a FixNum with the internal index. However, you need to get
365
- the internal index with the provided API, otherwise the pointer is outside
366
- the scope of the C library. Returns the count of alignments in the region.
367
- WARNING: Accepts an index already parsed by the library. It fails when you
368
- use your own FixNum (FFI-bug?)
369
- </p>
370
- </div>
371
- </div>
372
-
373
- <div id="method-M000022" class="method-detail">
374
- <a name="M000022"></a>
375
-
376
- <div class="method-heading">
377
- <a href="Sam.src/M000022.html" target="Code" class="method-signature"
378
- onclick="popupCode('Sam.src/M000022.html');return false;">
379
- <span class="method-name">load_index</span><span class="method-args">()</span>
380
- </a>
381
- </div>
382
-
383
- <div class="method-description">
384
- <p>
385
- Loads the bam index to be used for fetching. If the index doesn&#8216;t
386
- exists the index is built provided that the user has writing access to the
387
- folder where the BAM file is located. If the creation of the file fails a
388
- <a href="SAMException.html">SAMException</a> is thrown. If the index
389
- doesn&#8216;t exist, loading it will take more time. It is suggested to
390
- generate the index separatedly if the bam file sits on a server where the
391
- executing user may not have writing permissions in the server.
392
- </p>
393
- </div>
394
- </div>
395
-
396
- <div id="method-M000023" class="method-detail">
397
- <a name="M000023"></a>
398
-
399
- <div class="method-heading">
400
- <a href="Sam.src/M000023.html" target="Code" class="method-signature"
401
- onclick="popupCode('Sam.src/M000023.html');return false;">
402
- <span class="method-name">load_reference</span><span class="method-args">()</span>
403
- </a>
404
- </div>
405
-
406
- <div class="method-description">
407
- <p>
408
- Loads the reference file to be able to query regions of it. This requires
409
- the fai index to exist in the same folder than the reference. If it
410
- doesn&#8216;t exisits, this functions attempts to generate it. If user
411
- doesn&#8216;t have writing permissions on the folder, or the creation of
412
- the fai fails for any reason, a <a
413
- href="SAMException.html">SAMException</a> is thrown.
414
- </p>
415
- </div>
416
- </div>
417
-
418
- <div id="method-M000031" class="method-detail">
419
- <a name="M000031"></a>
420
-
421
- <div class="method-heading">
422
- <a href="Sam.src/M000031.html" target="Code" class="method-signature"
423
- onclick="popupCode('Sam.src/M000031.html');return false;">
424
- <span class="method-name">mpileup</span><span class="method-args">( opts ) {|Pileup.new(line)| ...}</span>
425
- </a>
426
- </div>
427
-
428
- <div class="method-description">
429
- <p>
430
- calls the <a href="Sam.html#M000031">mpileup</a> function, opts is a hash
431
- of options identical to the command line options for <a
432
- href="Sam.html#M000031">mpileup</a>. is an iterator that yields a <a
433
- href="../../Pileup.html">Pileup</a> object for each postion the command
434
- line options that generate/affect BCF/VCF are ignored ie (g,u,e,h,I,L,o,p)
435
- call the option as a symbol of the flag, eg -r for region is called :r
436
- =&gt; &quot;some <a href="SAM.html">SAM</a> compatible region&quot; eg
437
- bam.mpileup(:r =&gt; &quot;chr1:1000-2000&quot;, :q =&gt; 50) gets the
438
- bases with quality &gt; 50 on chr1 between 1000-5000
439
- </p>
440
- </div>
441
- </div>
442
-
443
- <div id="method-M000018" class="method-detail">
444
- <a name="M000018"></a>
445
-
446
- <div class="method-heading">
447
- <a href="Sam.src/M000018.html" target="Code" class="method-signature"
448
- onclick="popupCode('Sam.src/M000018.html');return false;">
449
- <span class="method-name">open</span><span class="method-args">()</span>
450
- </a>
451
- </div>
452
-
453
- <div class="method-description">
454
- <p>
455
- Function that actually opens the sam file Throws a <a
456
- href="SAMException.html">SAMException</a> if the file can&#8216;t be <a
457
- href="Sam.html#M000018">open</a>.
458
- </p>
459
- </div>
460
- </div>
461
-
462
- <div id="method-M000027" class="method-detail">
463
- <a name="M000027"></a>
464
-
465
- <div class="method-heading">
466
- <a href="Sam.src/M000027.html" target="Code" class="method-signature"
467
- onclick="popupCode('Sam.src/M000027.html');return false;">
468
- <span class="method-name">query_string</span><span class="method-args">(chromosome, qstart,qend)</span>
469
- </a>
470
- </div>
471
-
472
- <div class="method-description">
473
- <p>
474
- Generates a query sting to be used by the region parser in samtools. In
475
- principle, you shouldn&#8216;t need to use this function.
476
- </p>
477
- </div>
478
- </div>
479
-
480
- <div id="method-M000019" class="method-detail">
481
- <a name="M000019"></a>
482
-
483
- <div class="method-heading">
484
- <a href="Sam.src/M000019.html" target="Code" class="method-signature"
485
- onclick="popupCode('Sam.src/M000019.html');return false;">
486
- <span class="method-name">to_s</span><span class="method-args">()</span>
487
- </a>
488
- </div>
489
-
490
- <div class="method-description">
491
- <p>
492
- Prints a description of the sam file in a text format containg if it is
493
- binary or text, the path and the fasta file of the reference
494
- </p>
495
- </div>
496
- </div>
497
-
498
-
499
- </div>
500
-
501
-
502
- </div>
503
-
504
-
505
- <div id="validator-badges">
506
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
507
- </div>
508
-
509
- </body>
510
- </html>