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