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.
- data/README.rdoc +7 -20
- data/Rakefile +11 -0
- data/VERSION +1 -1
- data/bio-samtools.gemspec +67 -1
- data/doc/basic_styles.css +31 -0
- data/doc/classes/Bio.html +139 -0
- data/doc/classes/Bio/DB.html +137 -0
- data/doc/classes/Bio/DB/Alignment.html +441 -0
- data/doc/classes/Bio/DB/Alignment.src/M000012.html +19 -0
- data/doc/classes/Bio/DB/Alignment.src/M000013.html +27 -0
- data/doc/classes/Bio/DB/Alignment.src/M000014.html +45 -0
- data/doc/classes/Bio/DB/Alignment.src/M000015.html +40 -0
- data/doc/classes/Bio/DB/SAM.html +510 -0
- data/doc/classes/Bio/DB/SAM/Library.html +135 -0
- data/doc/classes/Bio/DB/SAM/Library.src/M000006.html +28 -0
- data/doc/classes/Bio/DB/SAM/Tools.html +278 -0
- data/doc/classes/Bio/DB/SAM/Tools.src/M000007.html +20 -0
- data/doc/classes/Bio/DB/SAM/Tools/Bam1CoreT.html +111 -0
- data/doc/classes/Bio/DB/SAM/Tools/Bam1T.html +150 -0
- data/doc/classes/Bio/DB/SAM/Tools/Bam1T.src/M000010.html +20 -0
- data/doc/classes/Bio/DB/SAM/Tools/BamHeaderT.html +169 -0
- data/doc/classes/Bio/DB/SAM/Tools/BamHeaderT.src/M000008.html +19 -0
- data/doc/classes/Bio/DB/SAM/Tools/BamHeaderT.src/M000009.html +18 -0
- data/doc/classes/Bio/DB/SAM/Tools/BamPileup1T.html +111 -0
- data/doc/classes/Bio/DB/SAM/Tools/SamfileT.html +129 -0
- data/doc/classes/Bio/DB/SAM/Tools/SamfileTX.html +111 -0
- data/doc/classes/Bio/DB/SAMException.html +140 -0
- data/doc/classes/Bio/DB/SAMException.src/M000016.html +18 -0
- data/doc/classes/Bio/DB/Sam.src/M000017.html +43 -0
- data/doc/classes/Bio/DB/Sam.src/M000018.html +42 -0
- data/doc/classes/Bio/DB/Sam.src/M000019.html +18 -0
- data/doc/classes/Bio/DB/Sam.src/M000020.html +22 -0
- data/doc/classes/Bio/DB/Sam.src/M000021.html +19 -0
- data/doc/classes/Bio/DB/Sam.src/M000022.html +25 -0
- data/doc/classes/Bio/DB/Sam.src/M000023.html +28 -0
- data/doc/classes/Bio/DB/Sam.src/M000024.html +28 -0
- data/doc/classes/Bio/DB/Sam.src/M000025.html +46 -0
- data/doc/classes/Bio/DB/Sam.src/M000026.html +24 -0
- data/doc/classes/Bio/DB/Sam.src/M000027.html +19 -0
- data/doc/classes/Bio/DB/Sam.src/M000028.html +24 -0
- data/doc/classes/Bio/DB/Sam.src/M000029.html +41 -0
- data/doc/classes/Bio/DB/Sam.src/M000030.html +31 -0
- data/doc/classes/Bio/DB/Sam.src/M000031.html +86 -0
- data/doc/classes/Bio/DB/Sam.src/M000032.html +34 -0
- data/doc/classes/Bio/DB/Tag.html +160 -0
- data/doc/classes/Bio/DB/Tag.src/M000011.html +21 -0
- data/doc/classes/LibC.html +105 -0
- data/doc/classes/Pileup.html +374 -0
- data/doc/classes/Pileup.src/M000001.html +34 -0
- data/doc/classes/Pileup.src/M000002.html +21 -0
- data/doc/classes/Pileup.src/M000003.html +21 -0
- data/doc/classes/Pileup.src/M000004.html +21 -0
- data/doc/classes/Pileup.src/M000005.html +31 -0
- data/doc/created.rid +1 -0
- data/doc/files/lib/bio-samtools_rb.html +109 -0
- data/doc/files/lib/bio/db/sam/bam_rb.html +108 -0
- data/doc/files/lib/bio/db/sam/faidx_rb.html +108 -0
- data/doc/files/lib/bio/db/sam/library_rb.html +101 -0
- data/doc/files/lib/bio/db/sam/pileup_rb.html +178 -0
- data/doc/files/lib/bio/db/sam/sam_rb.html +113 -0
- data/doc/files/lib/bio/db/sam_rb.html +111 -0
- data/doc/fr_class_index.html +43 -0
- data/doc/fr_file_index.html +33 -0
- data/doc/fr_method_index.html +58 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/doc/tutorial.html +165 -0
- data/doc/tutorial.pdf +0 -0
- data/lib/bio/db/sam.rb +163 -1
- data/lib/bio/db/sam/pileup.rb +98 -0
- data/test/basictest.rb +14 -0
- data/test/pileup.rb +68 -0
- 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">></span> <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">:bam</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">nil</span>,<span class="ruby-identifier">:tam</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">:compressed</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">true</span>, <span class="ruby-identifier">:write</span> =<span class="ruby-operator">></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">&&</span> <span class="ruby-identifier">tam</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">&&</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">"No alignment or reference file"</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">&&</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">"Alignment has to be in either text or binary format, not both"</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">"Writing not supported yet"</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">"No SAM file specified"</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">"w"</span> <span class="ruby-operator">:</span> <span class="ruby-value str">"r"</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">"b"</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">"u"</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">"r"</span>, <span class="ruby-value str">"w"</span>, <span class="ruby-value str">"wh"</span>, <span class="ruby-value str">"rb"</span>, <span class="ruby-value str">"wb"</span> , <span class="ruby-value str">"wbu"</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">"Invalid options for samopen: "</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">"File not opened: "</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">"Binary"</span> <span class="ruby-operator">:</span> <span class="ruby-value str">"Text"</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">" file: "</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@sam</span> <span class="ruby-operator">+</span> <span class="ruby-value str">" with fasta: "</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">"Finalizing #{id} at #{Time.new}"</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">"Indexes are only supported by BAM files, please use samtools to convert your SAM file"</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">"Generating index for: "</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">"Unable to generate bam index for: "</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">"No path for the refernce fasta file. "</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">"Generating index for: "</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">"Unable to generate fasta index for: "</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 > 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 > reference.length</span>
|
17
|
+
<span class="ruby-comment cmt">#p qend.to_s + "-" + qstart.to_s + "framesize " + (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 > alignment.calend</span>
|
24
|
+
<span class="ruby-comment cmt">#first = alignment.pos if first < 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"><</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 "#{first} #{last}\n"</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"><</span> <span class="ruby-identifier">len</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">></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">"Unable to get sequence for reference: "</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">":"</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">"-"</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(), "invalid query: " + query if(chr.read_int < 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"><<</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">"merge"</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"><<</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"><<</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>
|