bio-samtools 0.2.5 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. data/README.rdoc +7 -20
  2. data/Rakefile +11 -0
  3. data/VERSION +1 -1
  4. data/bio-samtools.gemspec +67 -1
  5. data/doc/basic_styles.css +31 -0
  6. data/doc/classes/Bio.html +139 -0
  7. data/doc/classes/Bio/DB.html +137 -0
  8. data/doc/classes/Bio/DB/Alignment.html +441 -0
  9. data/doc/classes/Bio/DB/Alignment.src/M000012.html +19 -0
  10. data/doc/classes/Bio/DB/Alignment.src/M000013.html +27 -0
  11. data/doc/classes/Bio/DB/Alignment.src/M000014.html +45 -0
  12. data/doc/classes/Bio/DB/Alignment.src/M000015.html +40 -0
  13. data/doc/classes/Bio/DB/SAM.html +510 -0
  14. data/doc/classes/Bio/DB/SAM/Library.html +135 -0
  15. data/doc/classes/Bio/DB/SAM/Library.src/M000006.html +28 -0
  16. data/doc/classes/Bio/DB/SAM/Tools.html +278 -0
  17. data/doc/classes/Bio/DB/SAM/Tools.src/M000007.html +20 -0
  18. data/doc/classes/Bio/DB/SAM/Tools/Bam1CoreT.html +111 -0
  19. data/doc/classes/Bio/DB/SAM/Tools/Bam1T.html +150 -0
  20. data/doc/classes/Bio/DB/SAM/Tools/Bam1T.src/M000010.html +20 -0
  21. data/doc/classes/Bio/DB/SAM/Tools/BamHeaderT.html +169 -0
  22. data/doc/classes/Bio/DB/SAM/Tools/BamHeaderT.src/M000008.html +19 -0
  23. data/doc/classes/Bio/DB/SAM/Tools/BamHeaderT.src/M000009.html +18 -0
  24. data/doc/classes/Bio/DB/SAM/Tools/BamPileup1T.html +111 -0
  25. data/doc/classes/Bio/DB/SAM/Tools/SamfileT.html +129 -0
  26. data/doc/classes/Bio/DB/SAM/Tools/SamfileTX.html +111 -0
  27. data/doc/classes/Bio/DB/SAMException.html +140 -0
  28. data/doc/classes/Bio/DB/SAMException.src/M000016.html +18 -0
  29. data/doc/classes/Bio/DB/Sam.src/M000017.html +43 -0
  30. data/doc/classes/Bio/DB/Sam.src/M000018.html +42 -0
  31. data/doc/classes/Bio/DB/Sam.src/M000019.html +18 -0
  32. data/doc/classes/Bio/DB/Sam.src/M000020.html +22 -0
  33. data/doc/classes/Bio/DB/Sam.src/M000021.html +19 -0
  34. data/doc/classes/Bio/DB/Sam.src/M000022.html +25 -0
  35. data/doc/classes/Bio/DB/Sam.src/M000023.html +28 -0
  36. data/doc/classes/Bio/DB/Sam.src/M000024.html +28 -0
  37. data/doc/classes/Bio/DB/Sam.src/M000025.html +46 -0
  38. data/doc/classes/Bio/DB/Sam.src/M000026.html +24 -0
  39. data/doc/classes/Bio/DB/Sam.src/M000027.html +19 -0
  40. data/doc/classes/Bio/DB/Sam.src/M000028.html +24 -0
  41. data/doc/classes/Bio/DB/Sam.src/M000029.html +41 -0
  42. data/doc/classes/Bio/DB/Sam.src/M000030.html +31 -0
  43. data/doc/classes/Bio/DB/Sam.src/M000031.html +86 -0
  44. data/doc/classes/Bio/DB/Sam.src/M000032.html +34 -0
  45. data/doc/classes/Bio/DB/Tag.html +160 -0
  46. data/doc/classes/Bio/DB/Tag.src/M000011.html +21 -0
  47. data/doc/classes/LibC.html +105 -0
  48. data/doc/classes/Pileup.html +374 -0
  49. data/doc/classes/Pileup.src/M000001.html +34 -0
  50. data/doc/classes/Pileup.src/M000002.html +21 -0
  51. data/doc/classes/Pileup.src/M000003.html +21 -0
  52. data/doc/classes/Pileup.src/M000004.html +21 -0
  53. data/doc/classes/Pileup.src/M000005.html +31 -0
  54. data/doc/created.rid +1 -0
  55. data/doc/files/lib/bio-samtools_rb.html +109 -0
  56. data/doc/files/lib/bio/db/sam/bam_rb.html +108 -0
  57. data/doc/files/lib/bio/db/sam/faidx_rb.html +108 -0
  58. data/doc/files/lib/bio/db/sam/library_rb.html +101 -0
  59. data/doc/files/lib/bio/db/sam/pileup_rb.html +178 -0
  60. data/doc/files/lib/bio/db/sam/sam_rb.html +113 -0
  61. data/doc/files/lib/bio/db/sam_rb.html +111 -0
  62. data/doc/fr_class_index.html +43 -0
  63. data/doc/fr_file_index.html +33 -0
  64. data/doc/fr_method_index.html +58 -0
  65. data/doc/index.html +24 -0
  66. data/doc/rdoc-style.css +208 -0
  67. data/doc/tutorial.html +165 -0
  68. data/doc/tutorial.pdf +0 -0
  69. data/lib/bio/db/sam.rb +163 -1
  70. data/lib/bio/db/sam/pileup.rb +98 -0
  71. data/test/basictest.rb +14 -0
  72. data/test/pileup.rb +68 -0
  73. metadata +84 -18
@@ -0,0 +1,18 @@
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::SAMException)</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 480</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>()
15
+
16
+ <span class="ruby-keyword kw">end</span></pre>
17
+ </body>
18
+ </html>
@@ -0,0 +1,43 @@
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::Sam)</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 27</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">optsa</span>={})
15
+ <span class="ruby-identifier">opts</span> = { <span class="ruby-identifier">:fasta</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">:bam</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">nil</span>,<span class="ruby-identifier">:tam</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">:compressed</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">true</span>, <span class="ruby-identifier">:write</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span> }.<span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">optsa</span>)
16
+
17
+
18
+
19
+ <span class="ruby-ivar">@fasta_path</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:fasta</span>]
20
+ <span class="ruby-ivar">@compressed</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:compressed</span>]
21
+ <span class="ruby-ivar">@write</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:write</span>]
22
+ <span class="ruby-identifier">bam</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:bam</span>]
23
+ <span class="ruby-identifier">tam</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:tam</span>]
24
+
25
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">bam</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">tam</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-ivar">@fasta_path</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">then</span>
26
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">SAMException</span>.<span class="ruby-identifier">new</span>(), <span class="ruby-value str">&quot;No alignment or reference file&quot;</span>
27
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">bam</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">tam</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">then</span>
28
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">SAMException</span>.<span class="ruby-identifier">new</span>(), <span class="ruby-value str">&quot;Alignment has to be in either text or binary format, not both&quot;</span>
29
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">bam</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">then</span>
30
+ <span class="ruby-ivar">@binary</span> = <span class="ruby-keyword kw">true</span>
31
+ <span class="ruby-ivar">@sam</span> = <span class="ruby-identifier">bam</span>
32
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">tam</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">then</span>
33
+ <span class="ruby-ivar">@sam</span> = <span class="ruby-identifier">tam</span>
34
+ <span class="ruby-ivar">@binary</span> = <span class="ruby-keyword kw">false</span>
35
+
36
+ <span class="ruby-keyword kw">end</span>
37
+ <span class="ruby-ivar">@fasta_file</span> = <span class="ruby-keyword kw">nil</span>
38
+ <span class="ruby-ivar">@sam_file</span> = <span class="ruby-keyword kw">nil</span>
39
+
40
+ <span class="ruby-constant">ObjectSpace</span>.<span class="ruby-identifier">define_finalizer</span>(<span class="ruby-keyword kw">self</span>, <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>)
41
+ <span class="ruby-keyword kw">end</span></pre>
42
+ </body>
43
+ </html>
@@ -0,0 +1,42 @@
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>open (Bio::DB::Sam)</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 58</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">open</span>()
15
+
16
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">SAMException</span>.<span class="ruby-identifier">new</span>(), <span class="ruby-value str">&quot;Writing not supported yet&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@write</span>
17
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">SAMException</span>.<span class="ruby-identifier">new</span>(), <span class="ruby-value str">&quot;No SAM file specified&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@sam</span>
18
+
19
+ <span class="ruby-identifier">opts</span> = <span class="ruby-ivar">@write</span> <span class="ruby-operator">?</span> <span class="ruby-value str">&quot;w&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-value str">&quot;r&quot;</span>
20
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@binary</span> <span class="ruby-keyword kw">then</span>
21
+ <span class="ruby-identifier">opts</span> <span class="ruby-operator">+=</span> <span class="ruby-value str">&quot;b&quot;</span>
22
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@write</span> <span class="ruby-keyword kw">then</span>
23
+ <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@compressed</span> <span class="ruby-keyword kw">then</span>
24
+ <span class="ruby-identifier">opts</span> <span class="ruby-operator">+=</span> <span class="ruby-value str">&quot;u&quot;</span>
25
+ <span class="ruby-keyword kw">end</span>
26
+ <span class="ruby-keyword kw">end</span>
27
+ <span class="ruby-keyword kw">end</span>
28
+ <span class="ruby-identifier">valid</span> = [<span class="ruby-value str">&quot;r&quot;</span>, <span class="ruby-value str">&quot;w&quot;</span>, <span class="ruby-value str">&quot;wh&quot;</span>, <span class="ruby-value str">&quot;rb&quot;</span>, <span class="ruby-value str">&quot;wb&quot;</span> , <span class="ruby-value str">&quot;wbu&quot;</span>]
29
+ <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">valid</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">opts</span>) <span class="ruby-keyword kw">then</span>
30
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">SAMException</span>.<span class="ruby-identifier">new</span>(), <span class="ruby-value str">&quot;Invalid options for samopen: &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">opts</span>
31
+ <span class="ruby-keyword kw">end</span>
32
+
33
+ <span class="ruby-identifier">samFile</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">samopen</span>(<span class="ruby-ivar">@sam</span>, <span class="ruby-identifier">opts</span>, <span class="ruby-keyword kw">nil</span>)
34
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">samFile</span>.<span class="ruby-identifier">null?</span> <span class="ruby-keyword kw">then</span>
35
+ <span class="ruby-ivar">@sam_file</span> = <span class="ruby-keyword kw">nil</span>
36
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">SAMException</span>.<span class="ruby-identifier">new</span>(), <span class="ruby-value str">&quot;File not opened: &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@sam</span>
37
+ <span class="ruby-keyword kw">end</span>
38
+ <span class="ruby-ivar">@sam_file</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">SamfileT</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">samFile</span>)
39
+
40
+ <span class="ruby-keyword kw">end</span></pre>
41
+ </body>
42
+ </html>
@@ -0,0 +1,18 @@
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>to_s (Bio::DB::Sam)</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 88</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>()
15
+ (<span class="ruby-ivar">@binary</span> <span class="ruby-operator">?</span> <span class="ruby-value str">&quot;Binary&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-value str">&quot;Text&quot;</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">&quot; file: &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@sam</span> <span class="ruby-operator">+</span> <span class="ruby-value str">&quot; with fasta: &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@fasta_path</span>
16
+ <span class="ruby-keyword kw">end</span></pre>
17
+ </body>
18
+ </html>
@@ -0,0 +1,22 @@
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>close (Bio::DB::Sam)</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 93</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">close</span>()
15
+ <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">fai_destroy</span>(<span class="ruby-ivar">@fasta_index</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@fasta_index</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@fasta_index</span>.<span class="ruby-identifier">null?</span>
16
+ <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_index_destroy</span>(<span class="ruby-ivar">@sam_index</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@sam_index</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@sam_index</span>.<span class="ruby-identifier">null?</span>
17
+ <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">samclose</span>(<span class="ruby-ivar">@sam_file</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@sam_file</span>.<span class="ruby-identifier">nil?</span>
18
+ <span class="ruby-ivar">@sam_file</span> = <span class="ruby-keyword kw">nil</span>
19
+ <span class="ruby-ivar">@fasta_index</span> = <span class="ruby-keyword kw">nil</span>
20
+ <span class="ruby-keyword kw">end</span></pre>
21
+ </body>
22
+ </html>
@@ -0,0 +1,19 @@
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::Sam)</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 102</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Sam</span>.<span class="ruby-identifier">finalize</span>(<span class="ruby-identifier">id</span>)
15
+ <span class="ruby-identifier">id</span>.<span class="ruby-identifier">close</span>()
16
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Finalizing #{id} at #{Time.new}&quot;</span>
17
+ <span class="ruby-keyword kw">end</span></pre>
18
+ </body>
19
+ </html>
@@ -0,0 +1,25 @@
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>load_index (Bio::DB::Sam)</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 112</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">load_index</span>()
15
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">SAMException</span>.<span class="ruby-identifier">new</span>(), <span class="ruby-value str">&quot;Indexes are only supported by BAM files, please use samtools to convert your SAM file&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@binary</span>
16
+ <span class="ruby-ivar">@sam_index</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_index_load</span>(<span class="ruby-ivar">@sam</span>)
17
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@sam_index</span>.<span class="ruby-identifier">null?</span> <span class="ruby-keyword kw">then</span>
18
+ <span class="ruby-identifier">p</span> <span class="ruby-value str">&quot;Generating index for: &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@sam</span>
19
+ <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_index_build</span>(<span class="ruby-ivar">@sam</span>)
20
+ <span class="ruby-ivar">@sam_index</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_index_load</span>(<span class="ruby-ivar">@sam</span>)
21
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">SAMException</span>.<span class="ruby-identifier">new</span>(), <span class="ruby-value str">&quot;Unable to generate bam index for: &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@sam</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@sam_index</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@sam_index</span>.<span class="ruby-identifier">null?</span>
22
+ <span class="ruby-keyword kw">end</span>
23
+ <span class="ruby-keyword kw">end</span></pre>
24
+ </body>
25
+ </html>
@@ -0,0 +1,28 @@
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>load_reference (Bio::DB::Sam)</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 126</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">load_reference</span>()
15
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">SAMException</span>.<span class="ruby-identifier">new</span>(), <span class="ruby-value str">&quot;No path for the refernce fasta file. &quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@fasta_path</span>.<span class="ruby-identifier">nil?</span>
16
+
17
+ <span class="ruby-ivar">@fasta_index</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">fai_load</span>(<span class="ruby-ivar">@fasta_path</span>)
18
+
19
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@fasta_index</span>.<span class="ruby-identifier">null?</span> <span class="ruby-keyword kw">then</span>
20
+ <span class="ruby-identifier">p</span> <span class="ruby-value str">&quot;Generating index for: &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@fasta_path</span>
21
+ <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">fai_build</span>(<span class="ruby-ivar">@fasta_path</span>)
22
+ <span class="ruby-ivar">@fasta_index</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">fai_load</span>(<span class="ruby-ivar">@fasta_path</span>)
23
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">SAMException</span>.<span class="ruby-identifier">new</span>(), <span class="ruby-value str">&quot;Unable to generate fasta index for: &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@fasta_path</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@fasta_index</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@fasta_index</span>.<span class="ruby-identifier">null?</span>
24
+ <span class="ruby-keyword kw">end</span>
25
+
26
+ <span class="ruby-keyword kw">end</span></pre>
27
+ </body>
28
+ </html>
@@ -0,0 +1,28 @@
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>average_coverage (Bio::DB::Sam)</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 141</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">average_coverage</span>(<span class="ruby-identifier">chromosome</span>, <span class="ruby-identifier">qstart</span>, <span class="ruby-identifier">len</span>)
15
+
16
+ <span class="ruby-comment cmt">#reference = fetch_reference(chromosome, qstart,len)</span>
17
+ <span class="ruby-comment cmt"># len = reference.length if len &gt; reference.length</span>
18
+
19
+
20
+ <span class="ruby-identifier">coverages</span> = <span class="ruby-identifier">chromosome_coverage</span>(<span class="ruby-identifier">chromosome</span>, <span class="ruby-identifier">qstart</span>, <span class="ruby-identifier">len</span>)
21
+ <span class="ruby-identifier">total</span> = <span class="ruby-value">0</span>
22
+ <span class="ruby-identifier">len</span>.<span class="ruby-identifier">times</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">total</span>= <span class="ruby-identifier">total</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">coverages</span>[<span class="ruby-identifier">i</span>] }
23
+ <span class="ruby-identifier">avg_cov</span> = <span class="ruby-identifier">total</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-identifier">len</span>
24
+ <span class="ruby-comment cmt">#LibC.free reference</span>
25
+ <span class="ruby-identifier">avg_cov</span>
26
+ <span class="ruby-keyword kw">end</span></pre>
27
+ </body>
28
+ </html>
@@ -0,0 +1,46 @@
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>chromosome_coverage (Bio::DB::Sam)</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 158</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">chromosome_coverage</span>(<span class="ruby-identifier">chromosome</span>, <span class="ruby-identifier">qstart</span>, <span class="ruby-identifier">len</span>)
15
+ <span class="ruby-comment cmt"># reference = fetch_reference(chromosome, qstart,len)</span>
16
+ <span class="ruby-comment cmt"># len = reference.length if len &gt; reference.length</span>
17
+ <span class="ruby-comment cmt">#p qend.to_s + &quot;-&quot; + qstart.to_s + &quot;framesize &quot; + (qend - qstart).to_s</span>
18
+ <span class="ruby-identifier">coverages</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">len</span>, <span class="ruby-value">0</span>)
19
+
20
+ <span class="ruby-identifier">chr_cov_proc</span> = <span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">alignment</span><span class="ruby-operator">|</span>
21
+ <span class="ruby-comment cmt">#last = qstart + len</span>
22
+ <span class="ruby-comment cmt">#first = qstart</span>
23
+ <span class="ruby-comment cmt">#last = alignment.calend if last &gt; alignment.calend</span>
24
+ <span class="ruby-comment cmt">#first = alignment.pos if first &lt; alignment.pos</span>
25
+ <span class="ruby-comment cmt"># p first</span>
26
+ <span class="ruby-identifier">last</span> = <span class="ruby-identifier">alignment</span>.<span class="ruby-identifier">calend</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">qstart</span>
27
+ <span class="ruby-identifier">first</span> = <span class="ruby-identifier">alignment</span>.<span class="ruby-identifier">pos</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">qstart</span>
28
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">last</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">first</span>
29
+ <span class="ruby-identifier">tmp</span> = <span class="ruby-identifier">last</span>
30
+ <span class="ruby-identifier">last</span> = <span class="ruby-identifier">first</span>
31
+ <span class="ruby-identifier">first</span> = <span class="ruby-identifier">last</span>
32
+ <span class="ruby-keyword kw">end</span>
33
+
34
+ <span class="ruby-comment cmt"># STDERR.puts &quot;#{first} #{last}\n&quot;</span>
35
+ <span class="ruby-identifier">first</span>.<span class="ruby-identifier">upto</span>(<span class="ruby-identifier">last</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
36
+
37
+ <span class="ruby-identifier">coverages</span>[<span class="ruby-identifier">i</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>] = <span class="ruby-value">1</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">coverages</span>[<span class="ruby-identifier">i</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">i</span><span class="ruby-operator">-</span><span class="ruby-value">1</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">len</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
38
+ }
39
+ <span class="ruby-keyword kw">end</span>
40
+
41
+ <span class="ruby-identifier">fetch_with_function</span>(<span class="ruby-identifier">chromosome</span>, <span class="ruby-identifier">qstart</span>, <span class="ruby-identifier">qstart</span><span class="ruby-operator">+</span><span class="ruby-identifier">len</span>, <span class="ruby-identifier">chr_cov_proc</span>)
42
+ <span class="ruby-comment cmt">#p coverages</span>
43
+ <span class="ruby-identifier">coverages</span>
44
+ <span class="ruby-keyword kw">end</span></pre>
45
+ </body>
46
+ </html>
@@ -0,0 +1,24 @@
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>fetch_reference (Bio::DB::Sam)</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 191</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fetch_reference</span>(<span class="ruby-identifier">chromosome</span>, <span class="ruby-identifier">qstart</span>,<span class="ruby-identifier">qend</span>)
15
+ <span class="ruby-identifier">load_reference</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@fasta_index</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@fasta_index</span>.<span class="ruby-identifier">null?</span>
16
+ <span class="ruby-identifier">query</span> = <span class="ruby-identifier">query_string</span>(<span class="ruby-identifier">chromosome</span>, <span class="ruby-identifier">qstart</span>,<span class="ruby-identifier">qend</span>)
17
+ <span class="ruby-identifier">len</span> = <span class="ruby-constant">FFI</span><span class="ruby-operator">::</span><span class="ruby-constant">MemoryPointer</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">:int</span>
18
+ <span class="ruby-identifier">reference</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">fai_fetch</span>(<span class="ruby-ivar">@fasta_index</span>, <span class="ruby-identifier">query</span>, <span class="ruby-identifier">len</span>)
19
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">SAMException</span>.<span class="ruby-identifier">new</span>(), <span class="ruby-value str">&quot;Unable to get sequence for reference: &quot;</span><span class="ruby-operator">+</span><span class="ruby-identifier">query</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">reference</span>.<span class="ruby-identifier">nil?</span>
20
+
21
+ <span class="ruby-identifier">reference</span>
22
+ <span class="ruby-keyword kw">end</span></pre>
23
+ </body>
24
+ </html>
@@ -0,0 +1,19 @@
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>query_string (Bio::DB::Sam)</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 203</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">query_string</span>(<span class="ruby-identifier">chromosome</span>, <span class="ruby-identifier">qstart</span>,<span class="ruby-identifier">qend</span>)
15
+ <span class="ruby-identifier">query</span> = <span class="ruby-identifier">chromosome</span> <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;:&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">qstart</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;-&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">qend</span>.<span class="ruby-identifier">to_s</span>
16
+ <span class="ruby-identifier">query</span>
17
+ <span class="ruby-keyword kw">end</span></pre>
18
+ </body>
19
+ </html>
@@ -0,0 +1,24 @@
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>fetch (Bio::DB::Sam)</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 209</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">chromosome</span>, <span class="ruby-identifier">qstart</span>, <span class="ruby-identifier">qend</span>)
15
+ <span class="ruby-identifier">als</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
16
+ <span class="ruby-identifier">fetchAlignment</span> = <span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">alignment</span><span class="ruby-operator">|</span>
17
+ <span class="ruby-identifier">als</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">alignment</span>.<span class="ruby-identifier">clone</span>)
18
+ <span class="ruby-value">0</span>
19
+ <span class="ruby-keyword kw">end</span>
20
+ <span class="ruby-identifier">fetch_with_function</span>(<span class="ruby-identifier">chromosome</span>, <span class="ruby-identifier">qstart</span>, <span class="ruby-identifier">qend</span>, <span class="ruby-identifier">fetchAlignment</span>)
21
+ <span class="ruby-identifier">als</span>
22
+ <span class="ruby-keyword kw">end</span></pre>
23
+ </body>
24
+ </html>
@@ -0,0 +1,41 @@
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>fetch_with_function (Bio::DB::Sam)</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 224</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fetch_with_function</span>(<span class="ruby-identifier">chromosome</span>, <span class="ruby-identifier">qstart</span>, <span class="ruby-identifier">qend</span>, <span class="ruby-identifier">function</span>)
15
+ <span class="ruby-identifier">load_index</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@sam_index</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@sam_index</span>.<span class="ruby-identifier">null?</span>
16
+ <span class="ruby-identifier">chr</span> = <span class="ruby-constant">FFI</span><span class="ruby-operator">::</span><span class="ruby-constant">MemoryPointer</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">:int</span>
17
+ <span class="ruby-identifier">beg</span> = <span class="ruby-constant">FFI</span><span class="ruby-operator">::</span><span class="ruby-constant">MemoryPointer</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">:int</span>
18
+ <span class="ruby-identifier">last</span> = <span class="ruby-constant">FFI</span><span class="ruby-operator">::</span><span class="ruby-constant">MemoryPointer</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">:int</span>
19
+ <span class="ruby-identifier">query</span> = <span class="ruby-identifier">query_string</span>(<span class="ruby-identifier">chromosome</span>, <span class="ruby-identifier">qstart</span>,<span class="ruby-identifier">qend</span>)
20
+ <span class="ruby-identifier">qpointer</span> = <span class="ruby-constant">FFI</span><span class="ruby-operator">::</span><span class="ruby-constant">MemoryPointer</span>.<span class="ruby-identifier">from_string</span>(<span class="ruby-identifier">query</span>)
21
+ <span class="ruby-identifier">header</span> = <span class="ruby-ivar">@sam_file</span>[<span class="ruby-identifier">:header</span>]
22
+ <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_parse_region</span>(<span class="ruby-identifier">header</span>,<span class="ruby-identifier">qpointer</span>, <span class="ruby-identifier">chr</span>, <span class="ruby-identifier">beg</span>, <span class="ruby-identifier">last</span>)
23
+ <span class="ruby-comment cmt">#raise SAMException.new(), &quot;invalid query: &quot; + query if(chr.read_int &lt; 0)</span>
24
+ <span class="ruby-identifier">count</span> = <span class="ruby-value">0</span>;
25
+
26
+ <span class="ruby-identifier">fetchAlignment</span> = <span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">bam_alignment</span>, <span class="ruby-identifier">data</span><span class="ruby-operator">|</span>
27
+ <span class="ruby-identifier">alignment</span> = <span class="ruby-constant">Alignment</span>.<span class="ruby-identifier">new</span>
28
+ <span class="ruby-identifier">alignment</span>.<span class="ruby-identifier">set</span>(<span class="ruby-identifier">bam_alignment</span>, <span class="ruby-identifier">header</span>)
29
+ <span class="ruby-identifier">function</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">alignment</span>)
30
+ <span class="ruby-identifier">count</span> = <span class="ruby-identifier">count</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>
31
+ <span class="ruby-value">0</span>
32
+ <span class="ruby-keyword kw">end</span>
33
+ <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_fetch</span>(<span class="ruby-ivar">@sam_file</span>[<span class="ruby-identifier">:x</span>][<span class="ruby-identifier">:bam</span>], <span class="ruby-ivar">@sam_index</span>,<span class="ruby-identifier">chr</span>.<span class="ruby-identifier">read_int</span>,<span class="ruby-identifier">beg</span>.<span class="ruby-identifier">read_int</span>, <span class="ruby-identifier">last</span>.<span class="ruby-identifier">read_int</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">fetchAlignment</span>)
34
+ <span class="ruby-comment cmt">#LibC.free chr</span>
35
+ <span class="ruby-comment cmt">#LibC.free beg</span>
36
+ <span class="ruby-comment cmt">#LibC.free last</span>
37
+ <span class="ruby-comment cmt">#LibC.free qpointer</span>
38
+ <span class="ruby-identifier">count</span>
39
+ <span class="ruby-keyword kw">end</span></pre>
40
+ </body>
41
+ </html>
@@ -0,0 +1,31 @@
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>merge (Bio::DB::Sam)</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 257</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">files</span>, <span class="ruby-identifier">merged_file</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">add_RG</span>, <span class="ruby-identifier">by_qname</span>)
15
+ <span class="ruby-identifier">strptrs</span> = []
16
+ <span class="ruby-identifier">strptrs</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">FFI</span><span class="ruby-operator">::</span><span class="ruby-constant">MemoryPointer</span>.<span class="ruby-identifier">from_string</span>(<span class="ruby-value str">&quot;merge&quot;</span>)
17
+ <span class="ruby-identifier">files</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
18
+ <span class="ruby-identifier">strptrs</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">FFI</span><span class="ruby-operator">::</span><span class="ruby-constant">MemoryPointer</span>.<span class="ruby-identifier">from_string</span>(<span class="ruby-identifier">file</span>)
19
+ <span class="ruby-keyword kw">end</span>
20
+ <span class="ruby-identifier">strptrs</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword kw">nil</span>
21
+
22
+ <span class="ruby-comment cmt"># Now load all the pointers into a native memory block</span>
23
+ <span class="ruby-identifier">argv</span> = <span class="ruby-constant">FFI</span><span class="ruby-operator">::</span><span class="ruby-constant">MemoryPointer</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">:pointer</span>, <span class="ruby-identifier">strptrs</span>.<span class="ruby-identifier">length</span>)
24
+ <span class="ruby-identifier">strptrs</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">p</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
25
+ <span class="ruby-identifier">argv</span>[<span class="ruby-identifier">i</span>].<span class="ruby-identifier">put_pointer</span>(<span class="ruby-value">0</span>, <span class="ruby-identifier">p</span>)
26
+ <span class="ruby-keyword kw">end</span>
27
+ <span class="ruby-comment cmt">#void bam_merge_core(int by_qname, const char *out, const char *headers, int n, char * const *fn, int add_RG)</span>
28
+ <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_merge_core</span>(<span class="ruby-identifier">by_qname</span>, <span class="ruby-identifier">merged_file</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">strptrs</span>.<span class="ruby-identifier">length</span>, <span class="ruby-identifier">argv</span>, <span class="ruby-identifier">add_RG</span>)
29
+ <span class="ruby-keyword kw">end</span></pre>
30
+ </body>
31
+ </html>