bio-samtools 0.6.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -2
- data/README.md +4 -7
- data/VERSION +1 -1
- data/bio-samtools.gemspec +47 -105
- data/doc/Bio.html +68 -131
- data/doc/Bio/DB.html +51 -111
- data/doc/Bio/DB/Alignment.html +135 -363
- data/doc/Bio/DB/Pileup.html +183 -170
- data/doc/Bio/DB/SAM.html +1396 -820
- data/doc/Bio/DB/SAM/Library.html +73 -123
- data/doc/Bio/DB/SAM/Tools.html +51 -273
- data/doc/Bio/DB/Tag.html +78 -124
- data/doc/Bio/DB/Vcf.html +111 -147
- data/doc/LICENSE_txt.html +113 -148
- data/doc/created.rid +9 -10
- data/doc/fonts.css +167 -0
- data/doc/fonts/Lato-Light.ttf +0 -0
- data/doc/fonts/Lato-LightItalic.ttf +0 -0
- data/doc/fonts/Lato-Regular.ttf +0 -0
- data/doc/fonts/Lato-RegularItalic.ttf +0 -0
- data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
- data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
- data/doc/images/add.png +0 -0
- data/doc/images/arrow_up.png +0 -0
- data/doc/images/delete.png +0 -0
- data/doc/images/tag_blue.png +0 -0
- data/doc/index.html +48 -54
- data/doc/js/darkfish.js +9 -22
- data/doc/js/search.js +20 -5
- data/doc/js/search_index.js +1 -1
- data/doc/rdoc.css +255 -218
- data/doc/table_of_contents.html +256 -137
- data/ext/Rakefile +57 -0
- data/lib/bio-samtools.rb +7 -2
- data/lib/bio/BIOExtensions.rb +89 -0
- data/lib/bio/db/alignment.rb +59 -0
- data/lib/bio/db/fastadb.rb +255 -0
- data/lib/bio/db/pileup.rb +221 -172
- data/lib/bio/db/sam.rb +639 -589
- data/lib/bio/db/sam/{faidx.rb → faidx_old.rb} +0 -0
- data/lib/bio/db/vcf.rb +69 -68
- data/test/.gitignore +1 -0
- data/test/{test_basic.rb → old_test_basic.rb} +33 -1
- data/test/samples/small/dupes.bam +0 -0
- data/test/samples/small/dupes.sam +274 -0
- data/test/samples/small/map_for_reheader.sam +8 -0
- data/test/samples/small/map_to_merge1.bam +0 -0
- data/test/samples/small/map_to_merge1.bam.bai +0 -0
- data/test/samples/small/map_to_merge1.sam +8 -0
- data/test/samples/small/map_to_merge2.bam +0 -0
- data/test/samples/small/map_to_merge2.bam.bai +0 -0
- data/test/samples/small/map_to_merge2.sam +8 -0
- data/test/samples/small/no_md.sam +8 -0
- data/test/samples/small/test_chr.fasta.1.bt2 +0 -0
- data/test/samples/small/test_chr.fasta.2.bt2 +0 -0
- data/test/samples/small/test_chr.fasta.3.bt2 +0 -0
- data/test/samples/small/test_chr.fasta.4.bt2 +0 -0
- data/test/samples/small/test_chr.fasta.rev.1.bt2 +0 -0
- data/test/samples/small/test_chr.fasta.rev.2.bt2 +0 -0
- data/test/samples/small/test_cov.svg +273 -0
- data/test/samples/small/testu.bam.bai +0 -0
- data/test/svg +133 -0
- data/test/test_pileup.rb +84 -0
- data/test/test_sam.rb +331 -0
- data/test/test_vcf.rb +11 -0
- data/{doc → tutorial}/tutorial.html +0 -0
- data/{doc → tutorial}/tutorial.pdf +0 -0
- metadata +56 -114
- data/doc/Bio/DB/SAM/Tools/Bam1CoreT.html +0 -159
- data/doc/Bio/DB/SAM/Tools/Bam1T.html +0 -220
- data/doc/Bio/DB/SAM/Tools/BamHeaderT.html +0 -249
- data/doc/Bio/DB/SAM/Tools/BamPileup1T.html +0 -159
- data/doc/Bio/DB/SAM/Tools/SamfileT.html +0 -171
- data/doc/Bio/DB/SAM/Tools/SamfileTX.html +0 -159
- data/doc/Bio/DB/SAMException.html +0 -205
- data/doc/LibC.html +0 -155
- data/doc/Pileup.html +0 -571
- data/doc/Vcf.html +0 -473
- data/doc/basic_styles.css +0 -31
- data/doc/classes/Bio.html +0 -139
- data/doc/classes/Bio/DB.html +0 -137
- data/doc/classes/Bio/DB/Alignment.html +0 -441
- data/doc/classes/Bio/DB/Alignment.src/M000012.html +0 -19
- data/doc/classes/Bio/DB/Alignment.src/M000013.html +0 -27
- data/doc/classes/Bio/DB/Alignment.src/M000014.html +0 -45
- data/doc/classes/Bio/DB/Alignment.src/M000015.html +0 -40
- data/doc/classes/Bio/DB/SAM.html +0 -510
- data/doc/classes/Bio/DB/SAM/Library.html +0 -135
- data/doc/classes/Bio/DB/SAM/Library.src/M000006.html +0 -28
- data/doc/classes/Bio/DB/SAM/Tools.html +0 -278
- data/doc/classes/Bio/DB/SAM/Tools.src/M000007.html +0 -20
- data/doc/classes/Bio/DB/SAM/Tools/Bam1CoreT.html +0 -111
- data/doc/classes/Bio/DB/SAM/Tools/Bam1T.html +0 -150
- data/doc/classes/Bio/DB/SAM/Tools/Bam1T.src/M000010.html +0 -20
- data/doc/classes/Bio/DB/SAM/Tools/BamHeaderT.html +0 -169
- data/doc/classes/Bio/DB/SAM/Tools/BamHeaderT.src/M000008.html +0 -19
- data/doc/classes/Bio/DB/SAM/Tools/BamHeaderT.src/M000009.html +0 -18
- data/doc/classes/Bio/DB/SAM/Tools/BamPileup1T.html +0 -111
- data/doc/classes/Bio/DB/SAM/Tools/SamfileT.html +0 -129
- data/doc/classes/Bio/DB/SAM/Tools/SamfileTX.html +0 -111
- data/doc/classes/Bio/DB/SAMException.html +0 -140
- data/doc/classes/Bio/DB/SAMException.src/M000016.html +0 -18
- data/doc/classes/Bio/DB/Sam.src/M000017.html +0 -43
- data/doc/classes/Bio/DB/Sam.src/M000018.html +0 -42
- data/doc/classes/Bio/DB/Sam.src/M000019.html +0 -18
- data/doc/classes/Bio/DB/Sam.src/M000020.html +0 -22
- data/doc/classes/Bio/DB/Sam.src/M000021.html +0 -19
- data/doc/classes/Bio/DB/Sam.src/M000022.html +0 -25
- data/doc/classes/Bio/DB/Sam.src/M000023.html +0 -28
- data/doc/classes/Bio/DB/Sam.src/M000024.html +0 -28
- data/doc/classes/Bio/DB/Sam.src/M000025.html +0 -46
- data/doc/classes/Bio/DB/Sam.src/M000026.html +0 -24
- data/doc/classes/Bio/DB/Sam.src/M000027.html +0 -19
- data/doc/classes/Bio/DB/Sam.src/M000028.html +0 -24
- data/doc/classes/Bio/DB/Sam.src/M000029.html +0 -41
- data/doc/classes/Bio/DB/Sam.src/M000030.html +0 -31
- data/doc/classes/Bio/DB/Sam.src/M000031.html +0 -86
- data/doc/classes/Bio/DB/Sam.src/M000032.html +0 -34
- data/doc/classes/Bio/DB/Tag.html +0 -160
- data/doc/classes/Bio/DB/Tag.src/M000011.html +0 -21
- data/doc/classes/LibC.html +0 -105
- data/doc/classes/Pileup.html +0 -374
- data/doc/classes/Pileup.src/M000001.html +0 -34
- data/doc/classes/Pileup.src/M000002.html +0 -21
- data/doc/classes/Pileup.src/M000003.html +0 -21
- data/doc/classes/Pileup.src/M000004.html +0 -21
- data/doc/classes/Pileup.src/M000005.html +0 -31
- data/doc/files/lib/bio-samtools_rb.html +0 -109
- data/doc/files/lib/bio/db/sam/bam_rb.html +0 -108
- data/doc/files/lib/bio/db/sam/faidx_rb.html +0 -108
- data/doc/files/lib/bio/db/sam/library_rb.html +0 -101
- data/doc/files/lib/bio/db/sam/pileup_rb.html +0 -178
- data/doc/files/lib/bio/db/sam/sam_rb.html +0 -113
- data/doc/files/lib/bio/db/sam_rb.html +0 -111
- data/doc/fr_class_index.html +0 -43
- data/doc/fr_file_index.html +0 -33
- data/doc/fr_method_index.html +0 -58
- data/doc/lib/bio-samtools_rb.html +0 -115
- data/doc/lib/bio/db/pileup_rb.html +0 -171
- data/doc/lib/bio/db/sam/bam_rb.html +0 -121
- data/doc/lib/bio/db/sam/faidx_rb.html +0 -117
- data/doc/lib/bio/db/sam/library_rb.html +0 -115
- data/doc/lib/bio/db/sam/pileup_rb.html +0 -171
- data/doc/lib/bio/db/sam/sam_rb.html +0 -121
- data/doc/lib/bio/db/sam/vcf_rb.html +0 -124
- data/doc/lib/bio/db/sam_rb.html +0 -115
- data/doc/lib/bio/db/vcf_rb.html +0 -124
- data/doc/rdoc-style.css +0 -208
- data/lib/bio/db/sam/bam.rb +0 -210
- data/lib/bio/db/sam/sam.rb +0 -86
- data/test/samples/pipe_char/test.bam +0 -0
- data/test/samples/pipe_char/test.bam.bai +0 -0
- data/test/samples/pipe_char/test.tam +0 -10
- data/test/samples/pipe_char/test_chr.fasta +0 -1000
- data/test/samples/pipe_char/test_chr.fasta.fai +0 -1
- data/test/samples/small/test +0 -0
- data/test/samples/small/test.bam +0 -0
- data/test/samples/small/test.fa +0 -20
- data/test/samples/small/test.fai +0 -0
data/doc/Bio/DB/SAM.html
CHANGED
@@ -2,181 +2,151 @@
|
|
2
2
|
|
3
3
|
<html>
|
4
4
|
<head>
|
5
|
-
<meta
|
5
|
+
<meta charset="UTF-8">
|
6
6
|
|
7
7
|
<title>class Bio::DB::Sam - Pileup</title>
|
8
8
|
|
9
|
-
<link
|
9
|
+
<link href="../../fonts.css" rel="stylesheet">
|
10
|
+
<link href="../../rdoc.css" rel="stylesheet">
|
10
11
|
|
11
12
|
<script type="text/javascript">
|
12
13
|
var rdoc_rel_prefix = "../../";
|
13
14
|
</script>
|
14
15
|
|
15
|
-
<script
|
16
|
-
<script
|
17
|
-
<script
|
18
|
-
<script
|
19
|
-
<script
|
20
|
-
<script
|
16
|
+
<script src="../../js/jquery.js"></script>
|
17
|
+
<script src="../../js/navigation.js"></script>
|
18
|
+
<script src="../../js/search_index.js"></script>
|
19
|
+
<script src="../../js/search.js"></script>
|
20
|
+
<script src="../../js/searcher.js"></script>
|
21
|
+
<script src="../../js/darkfish.js"></script>
|
21
22
|
|
22
23
|
|
23
|
-
<body id="top" class="class">
|
24
|
-
<nav
|
25
|
-
<
|
26
|
-
|
27
|
-
|
24
|
+
<body id="top" role="document" class="class">
|
25
|
+
<nav role="navigation">
|
26
|
+
<div id="project-navigation">
|
27
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
28
|
+
<h2>
|
29
|
+
<a href="../../index.html" rel="home">Home</a>
|
30
|
+
</h2>
|
31
|
+
|
32
|
+
<div id="table-of-contents-navigation">
|
33
|
+
<a href="../../table_of_contents.html#pages">Pages</a>
|
28
34
|
<a href="../../table_of_contents.html#classes">Classes</a>
|
29
35
|
<a href="../../table_of_contents.html#methods">Methods</a>
|
30
|
-
</
|
31
|
-
</
|
32
|
-
|
36
|
+
</div>
|
37
|
+
</div>
|
33
38
|
|
34
|
-
|
39
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
35
40
|
<form action="#" method="get" accept-charset="utf-8">
|
36
|
-
<
|
37
|
-
<input
|
41
|
+
<div id="search-field-wrapper">
|
42
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
43
|
+
aria-autocomplete="list" aria-controls="search-results"
|
44
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
38
45
|
title="Type to search, Up and Down to navigate, Enter to load">
|
39
|
-
</
|
40
|
-
</form>
|
41
|
-
|
42
|
-
<ul id="search-results" class="initially-hidden"></ul>
|
43
|
-
</nav>
|
44
|
-
|
46
|
+
</div>
|
45
47
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
</ul>
|
52
|
-
</nav>
|
48
|
+
<ul id="search-results" aria-label="Search Results"
|
49
|
+
aria-busy="false" aria-expanded="false"
|
50
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
51
|
+
</form>
|
52
|
+
</div>
|
53
53
|
|
54
|
-
|
55
54
|
</div>
|
56
55
|
|
56
|
+
|
57
|
+
|
57
58
|
<div id="class-metadata">
|
58
59
|
|
59
|
-
<
|
60
|
-
<h3
|
60
|
+
<div id="parent-class-section" class="nav-section">
|
61
|
+
<h3>Parent</h3>
|
62
|
+
|
61
63
|
|
62
64
|
<p class="link">Object
|
63
65
|
|
64
|
-
</
|
66
|
+
</div>
|
65
67
|
|
66
68
|
|
69
|
+
|
67
70
|
<!-- Method Quickref -->
|
68
|
-
<
|
69
|
-
<h3
|
71
|
+
<div id="method-list-section" class="nav-section">
|
72
|
+
<h3>Methods</h3>
|
70
73
|
|
71
|
-
<ul class="link-list">
|
74
|
+
<ul class="link-list" role="directory">
|
72
75
|
|
73
|
-
<li><a href="#method-c-
|
76
|
+
<li ><a href="#method-c-docs">::docs</a>
|
74
77
|
|
75
|
-
<li><a href="#method-c-
|
78
|
+
<li ><a href="#method-c-new">::new</a>
|
76
79
|
|
77
|
-
<li><a href="#method-
|
80
|
+
<li ><a href="#method-i-average_coverage">#average_coverage</a>
|
78
81
|
|
79
|
-
<li><a href="#method-i-
|
82
|
+
<li ><a href="#method-i-calmd">#calmd</a>
|
80
83
|
|
81
|
-
<li><a href="#method-i-
|
84
|
+
<li ><a href="#method-i-cat">#cat</a>
|
82
85
|
|
83
|
-
<li><a href="#method-i-
|
86
|
+
<li ><a href="#method-i-chromosome_coverage">#chromosome_coverage</a>
|
84
87
|
|
85
|
-
<li><a href="#method-i-
|
88
|
+
<li ><a href="#method-i-depth">#depth</a>
|
86
89
|
|
87
|
-
<li><a href="#method-i-
|
90
|
+
<li ><a href="#method-i-faidx">#faidx</a>
|
88
91
|
|
89
|
-
<li><a href="#method-i-fetch">#fetch</a>
|
92
|
+
<li ><a href="#method-i-fetch">#fetch</a>
|
90
93
|
|
91
|
-
<li><a href="#method-i-fetch_reference">#fetch_reference</a>
|
94
|
+
<li ><a href="#method-i-fetch_reference">#fetch_reference</a>
|
92
95
|
|
93
|
-
<li><a href="#method-i-fetch_with_function">#fetch_with_function</a>
|
96
|
+
<li ><a href="#method-i-fetch_with_function">#fetch_with_function</a>
|
94
97
|
|
95
|
-
<li><a href="#method-i-
|
98
|
+
<li ><a href="#method-i-fix_mates">#fix_mates</a>
|
96
99
|
|
97
|
-
<li><a href="#method-i-
|
100
|
+
<li ><a href="#method-i-fixmate">#fixmate</a>
|
98
101
|
|
99
|
-
<li><a href="#method-i-
|
102
|
+
<li ><a href="#method-i-flag_stats">#flag_stats</a>
|
100
103
|
|
101
|
-
<li><a href="#method-i-
|
104
|
+
<li ><a href="#method-i-flagstat">#flagstat</a>
|
102
105
|
|
103
|
-
<li><a href="#method-i-
|
106
|
+
<li ><a href="#method-i-idxstats">#idxstats</a>
|
104
107
|
|
105
|
-
<li><a href="#method-i-
|
108
|
+
<li ><a href="#method-i-index">#index</a>
|
106
109
|
|
107
|
-
<li><a href="#method-i-
|
110
|
+
<li ><a href="#method-i-index_stats">#index_stats</a>
|
108
111
|
|
109
|
-
<li><a href="#method-i-
|
112
|
+
<li ><a href="#method-i-merge">#merge</a>
|
113
|
+
|
114
|
+
<li ><a href="#method-i-mpileup">#mpileup</a>
|
115
|
+
|
116
|
+
<li ><a href="#method-i-open">#open</a>
|
117
|
+
|
118
|
+
<li ><a href="#method-i-phase">#phase</a>
|
119
|
+
|
120
|
+
<li ><a href="#method-i-plot_chromosome_coverage">#plot_chromosome_coverage</a>
|
121
|
+
|
122
|
+
<li ><a href="#method-i-reheader">#reheader</a>
|
123
|
+
|
124
|
+
<li ><a href="#method-i-remove_duplicates">#remove_duplicates</a>
|
125
|
+
|
126
|
+
<li ><a href="#method-i-rmdup">#rmdup</a>
|
127
|
+
|
128
|
+
<li ><a href="#method-i-sort">#sort</a>
|
129
|
+
|
130
|
+
<li ><a href="#method-i-targetcut">#targetcut</a>
|
131
|
+
|
132
|
+
<li ><a href="#method-i-tview">#tview</a>
|
133
|
+
|
134
|
+
<li ><a href="#method-i-view">#view</a>
|
110
135
|
|
111
136
|
</ul>
|
112
|
-
</
|
113
|
-
|
114
|
-
</div>
|
115
|
-
|
116
|
-
<div id="project-metadata">
|
117
|
-
<nav id="fileindex-section" class="section project-section">
|
118
|
-
<h3 class="section-header">Pages</h3>
|
119
|
-
|
120
|
-
<ul>
|
121
|
-
|
122
|
-
<li class="file"><a href="../../LICENSE_txt.html">LICENSE</a>
|
123
|
-
|
124
|
-
</ul>
|
125
|
-
</nav>
|
126
|
-
|
127
|
-
<nav id="classindex-section" class="section project-section">
|
128
|
-
<h3 class="section-header">Class and Module Index</h3>
|
129
|
-
|
130
|
-
<ul class="link-list">
|
131
|
-
|
132
|
-
<li><a href="../../Bio.html">Bio</a>
|
133
|
-
|
134
|
-
<li><a href="../../Bio/DB.html">Bio::DB</a>
|
135
|
-
|
136
|
-
<li><a href="../../Bio/DB/Alignment.html">Bio::DB::Alignment</a>
|
137
|
-
|
138
|
-
<li><a href="../../Bio/DB/Pileup.html">Bio::DB::Pileup</a>
|
139
|
-
|
140
|
-
<li><a href="../../Bio/DB/SAM.html">Bio::DB::SAM</a>
|
141
|
-
|
142
|
-
<li><a href="../../Bio/DB/SAM/Library.html">Bio::DB::SAM::Library</a>
|
143
|
-
|
144
|
-
<li><a href="../../Bio/DB/SAM/Tools.html">Bio::DB::SAM::Tools</a>
|
145
|
-
|
146
|
-
<li><a href="../../Bio/DB/SAM/Tools/Bam1CoreT.html">Bio::DB::SAM::Tools::Bam1CoreT</a>
|
147
|
-
|
148
|
-
<li><a href="../../Bio/DB/SAM/Tools/Bam1T.html">Bio::DB::SAM::Tools::Bam1T</a>
|
149
|
-
|
150
|
-
<li><a href="../../Bio/DB/SAM/Tools/BamHeaderT.html">Bio::DB::SAM::Tools::BamHeaderT</a>
|
151
|
-
|
152
|
-
<li><a href="../../Bio/DB/SAM/Tools/BamPileup1T.html">Bio::DB::SAM::Tools::BamPileup1T</a>
|
153
|
-
|
154
|
-
<li><a href="../../Bio/DB/SAM/Tools/SamfileT.html">Bio::DB::SAM::Tools::SamfileT</a>
|
155
|
-
|
156
|
-
<li><a href="../../Bio/DB/SAM/Tools/SamfileTX.html">Bio::DB::SAM::Tools::SamfileTX</a>
|
157
|
-
|
158
|
-
<li><a href="../../Bio/DB/SAMException.html">Bio::DB::SAMException</a>
|
159
|
-
|
160
|
-
<li><a href="../../Bio/DB/Sam.html">Bio::DB::Sam</a>
|
161
|
-
|
162
|
-
<li><a href="../../Bio/DB/Tag.html">Bio::DB::Tag</a>
|
163
|
-
|
164
|
-
<li><a href="../../Bio/DB/Vcf.html">Bio::DB::Vcf</a>
|
165
|
-
|
166
|
-
<li><a href="../../LibC.html">LibC</a>
|
167
|
-
|
168
|
-
</ul>
|
169
|
-
</nav>
|
137
|
+
</div>
|
170
138
|
|
171
139
|
</div>
|
172
140
|
</nav>
|
173
141
|
|
174
|
-
<
|
175
|
-
<h1
|
142
|
+
<main role="main" aria-labelledby="class-Bio::DB::Sam">
|
143
|
+
<h1 id="class-Bio::DB::Sam" class="class">
|
144
|
+
class Bio::DB::Sam
|
145
|
+
</h1>
|
176
146
|
|
177
|
-
<
|
147
|
+
<section class="description">
|
178
148
|
|
179
|
-
</
|
149
|
+
</section>
|
180
150
|
|
181
151
|
|
182
152
|
|
@@ -189,15 +159,16 @@
|
|
189
159
|
|
190
160
|
|
191
161
|
|
192
|
-
|
193
|
-
|
194
|
-
|
162
|
+
<section class="attribute-method-details" class="method-section">
|
163
|
+
<header>
|
164
|
+
<h3>Attributes</h3>
|
165
|
+
</header>
|
195
166
|
|
196
167
|
|
197
|
-
<div id="attribute-i-
|
168
|
+
<div id="attribute-i-bam" class="method-detail">
|
198
169
|
<div class="method-heading attribute-method-heading">
|
199
|
-
<span class="method-name">
|
200
|
-
class="attribute-access-type">[
|
170
|
+
<span class="method-name">bam</span><span
|
171
|
+
class="attribute-access-type">[RW]</span>
|
201
172
|
</div>
|
202
173
|
|
203
174
|
<div class="method-description">
|
@@ -207,941 +178,1093 @@
|
|
207
178
|
</div>
|
208
179
|
</div>
|
209
180
|
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
<section id="public-class-5Buntitled-5D-method-details" class="method-section section">
|
216
|
-
<h3 class="section-header">Public Class Methods</h3>
|
181
|
+
<div id="attribute-i-bcftools" class="method-detail">
|
182
|
+
<div class="method-heading attribute-method-heading">
|
183
|
+
<span class="method-name">bcftools</span><span
|
184
|
+
class="attribute-access-type">[RW]</span>
|
185
|
+
</div>
|
217
186
|
|
218
|
-
|
219
|
-
<div id="method-c-finalize" class="method-detail ">
|
187
|
+
<div class="method-description">
|
220
188
|
|
221
|
-
<div class="method-heading">
|
222
|
-
<span class="method-name">finalize</span><span
|
223
|
-
class="method-args">(id)</span>
|
224
|
-
<span class="method-click-advice">click to toggle source</span>
|
225
|
-
</div>
|
226
189
|
|
190
|
+
|
191
|
+
</div>
|
192
|
+
</div>
|
193
|
+
|
194
|
+
<div id="attribute-i-fasta" class="method-detail">
|
195
|
+
<div class="method-heading attribute-method-heading">
|
196
|
+
<span class="method-name">fasta</span><span
|
197
|
+
class="attribute-access-type">[RW]</span>
|
198
|
+
</div>
|
227
199
|
|
228
200
|
<div class="method-description">
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
<span class="
|
238
|
-
|
239
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Finalizing #{id} at #{Time.new}"</span>
|
240
|
-
<span class="ruby-keyword">end</span></pre>
|
241
|
-
</div><!-- finalize-source -->
|
242
|
-
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
</div>
|
205
|
+
</div>
|
206
|
+
|
207
|
+
<div id="attribute-i-last_command" class="method-detail">
|
208
|
+
<div class="method-heading attribute-method-heading">
|
209
|
+
<span class="method-name">last_command</span><span
|
210
|
+
class="attribute-access-type">[RW]</span>
|
243
211
|
</div>
|
244
212
|
|
213
|
+
<div class="method-description">
|
214
|
+
|
215
|
+
|
245
216
|
|
217
|
+
</div>
|
218
|
+
</div>
|
219
|
+
|
220
|
+
<div id="attribute-i-samtools" class="method-detail">
|
221
|
+
<div class="method-heading attribute-method-heading">
|
222
|
+
<span class="method-name">samtools</span><span
|
223
|
+
class="attribute-access-type">[RW]</span>
|
224
|
+
</div>
|
246
225
|
|
226
|
+
<div class="method-description">
|
227
|
+
|
228
|
+
|
247
229
|
|
248
|
-
|
230
|
+
</div>
|
231
|
+
</div>
|
232
|
+
|
233
|
+
</section>
|
234
|
+
|
249
235
|
|
250
236
|
|
251
|
-
|
237
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
238
|
+
<header>
|
239
|
+
<h3>Public Class Methods</h3>
|
240
|
+
</header>
|
241
|
+
|
242
|
+
|
243
|
+
<div id="method-c-docs" class="method-detail ">
|
252
244
|
|
253
245
|
<div class="method-heading">
|
254
|
-
<span class="method-name">
|
255
|
-
class="method-args">(
|
246
|
+
<span class="method-name">docs</span><span
|
247
|
+
class="method-args">(program, command)</span>
|
248
|
+
|
256
249
|
<span class="method-click-advice">click to toggle source</span>
|
250
|
+
|
257
251
|
</div>
|
258
252
|
|
259
253
|
|
260
254
|
<div class="method-description">
|
261
255
|
|
262
|
-
<
|
263
|
-
|
264
|
-
|
265
|
-
<
|
266
|
-
|
267
|
-
</dd><dt>merged_file
|
268
|
-
<dd>
|
269
|
-
<p>The path to the merged file</p>
|
270
|
-
</dd><dt>headers
|
271
|
-
<dd>
|
272
|
-
<p>The BAM file containing the header</p>
|
273
|
-
</dd><dt>add_RG
|
274
|
-
<dd>
|
275
|
-
<p>If true, the RG tag is added (infered from the filenames)</p>
|
276
|
-
</dd><dt>by_qname
|
277
|
-
<dd>
|
278
|
-
<p>If true, the bamfiles should by ordered by query name, if false, by
|
279
|
-
coordinates.</p>
|
280
|
-
</dd></dl>
|
256
|
+
<ul><li>
|
257
|
+
<p>program - one of 'samtools' 'bcftools'</p>
|
258
|
+
</li><li>
|
259
|
+
<p>command - one of the commands relevant to the program</p>
|
260
|
+
</li></ul>
|
281
261
|
|
282
|
-
|
283
262
|
|
284
|
-
<div class="method-source-code" id="merge-source">
|
285
|
-
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 259</span>
|
286
|
-
<span class="ruby-keyword">def</span> <span class="ruby-keyword">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>)
|
287
|
-
<span class="ruby-identifier">strptrs</span> = []
|
288
|
-
<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-string">"merge"</span>)
|
289
|
-
<span class="ruby-identifier">files</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
|
290
|
-
<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>)
|
291
|
-
<span class="ruby-keyword">end</span>
|
292
|
-
<span class="ruby-identifier">strptrs</span> <span class="ruby-operator"><<</span> <span class="ruby-keyword">nil</span>
|
293
263
|
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
<span class="ruby-keyword">
|
299
|
-
<span class="ruby-
|
300
|
-
<span class="ruby-
|
264
|
+
|
265
|
+
<div class="method-source-code" id="docs-source">
|
266
|
+
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 401</span>
|
267
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">docs</span>(<span class="ruby-identifier">program</span>, <span class="ruby-identifier">command</span>)
|
268
|
+
<span class="ruby-keyword">return</span> <span class="ruby-string">"program must be 'samtools' or 'bcftools'"</span> <span class="ruby-keyword">if</span> <span class="ruby-keyword">not</span> [<span class="ruby-string">'samtools'</span>, <span class="ruby-string">'bcftools'</span>].<span class="ruby-identifier">include?</span> <span class="ruby-identifier">program</span>
|
269
|
+
<span class="ruby-identifier">command</span> = <span class="ruby-node">"#{program} #{command}"</span>
|
270
|
+
<span class="ruby-node">%x#{command}`</span>
|
301
271
|
<span class="ruby-keyword">end</span></pre>
|
302
|
-
</div
|
272
|
+
</div>
|
303
273
|
|
304
274
|
</div>
|
305
275
|
|
306
276
|
|
307
277
|
|
308
278
|
|
309
|
-
</div
|
279
|
+
</div>
|
310
280
|
|
311
281
|
|
312
282
|
<div id="method-c-new" class="method-detail ">
|
313
283
|
|
314
284
|
<div class="method-heading">
|
315
285
|
<span class="method-name">new</span><span
|
316
|
-
class="method-args">(
|
286
|
+
class="method-args">(args)</span>
|
287
|
+
|
317
288
|
<span class="method-click-advice">click to toggle source</span>
|
289
|
+
|
318
290
|
</div>
|
319
291
|
|
320
292
|
|
321
293
|
<div class="method-description">
|
322
294
|
|
323
|
-
<p>
|
324
|
-
|
325
|
-
<
|
326
|
-
|
327
|
-
<p>
|
328
|
-
</
|
329
|
-
<
|
330
|
-
|
331
|
-
</
|
332
|
-
|
333
|
-
<p>
|
334
|
-
</
|
335
|
-
|
336
|
-
<p>If the binary file is compressed (true)</p>
|
337
|
-
</dd><dt>write
|
338
|
-
<dd>
|
339
|
-
<p>If the file is to be writen (false). Not supported yet.</p>
|
340
|
-
</dd></dl>
|
341
|
-
|
342
|
-
<p><strong>NOTE:</strong> you can’t use binary and text formats
|
343
|
-
simultaneusly. To make queries, the file has to be a sorted binary. This
|
344
|
-
function doesn’t actually open the file, it just prepares the object to
|
345
|
-
be opened in a later stage.</p>
|
295
|
+
<p>Creates a new <a href="Sam.html">Bio::DB::Sam</a> object</p>
|
296
|
+
<ul><li>
|
297
|
+
<p>fasta [String] - the path to the Fasta reference sequence</p>
|
298
|
+
</li><li>
|
299
|
+
<p>bam [String] - path to bam files</p>
|
300
|
+
</li><li>
|
301
|
+
<p>samtools [String] - path to alternative installation of samtools</p>
|
302
|
+
</li><li>
|
303
|
+
<p>bcftools [String] - path to alternative installation of bcftools</p>
|
304
|
+
</li><li>
|
305
|
+
<p>returns [Bio::DB::Sam] a new `Bio::DB::Sam` object</p>
|
306
|
+
</li></ul>
|
307
|
+
|
346
308
|
|
347
309
|
|
348
310
|
|
349
311
|
<div class="method-source-code" id="new-source">
|
350
|
-
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line
|
351
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">
|
352
|
-
<span class="ruby-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
<span class="ruby-ivar">@
|
358
|
-
<span class="ruby-ivar">@write</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:write</span>]
|
359
|
-
<span class="ruby-identifier">bam</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:bam</span>]
|
360
|
-
<span class="ruby-identifier">tam</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:tam</span>]
|
361
|
-
|
362
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">bam</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">nil</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">tam</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">nil</span> <span class="ruby-operator">&&</span> <span class="ruby-ivar">@fasta_path</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">nil</span> <span class="ruby-keyword">then</span>
|
363
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-constant">SAMException</span>.<span class="ruby-identifier">new</span>(), <span class="ruby-string">"No alignment or reference file"</span>
|
364
|
-
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">bam</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword">nil</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">tam</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword">nil</span> <span class="ruby-keyword">then</span>
|
365
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-constant">SAMException</span>.<span class="ruby-identifier">new</span>(), <span class="ruby-string">"Alignment has to be in either text or binary format, not both"</span>
|
366
|
-
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">bam</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword">nil</span> <span class="ruby-keyword">then</span>
|
367
|
-
<span class="ruby-ivar">@binary</span> = <span class="ruby-keyword">true</span>
|
368
|
-
<span class="ruby-ivar">@sam</span> = <span class="ruby-identifier">bam</span>
|
369
|
-
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">tam</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword">nil</span> <span class="ruby-keyword">then</span>
|
370
|
-
<span class="ruby-ivar">@sam</span> = <span class="ruby-identifier">tam</span>
|
371
|
-
<span class="ruby-ivar">@binary</span> = <span class="ruby-keyword">false</span>
|
372
|
-
|
373
|
-
<span class="ruby-keyword">end</span>
|
374
|
-
<span class="ruby-ivar">@fasta_file</span> = <span class="ruby-keyword">nil</span>
|
375
|
-
<span class="ruby-ivar">@sam_file</span> = <span class="ruby-keyword">nil</span>
|
312
|
+
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 13</span>
|
313
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">args</span>)
|
314
|
+
<span class="ruby-ivar">@fasta</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">:fasta</span>]
|
315
|
+
<span class="ruby-ivar">@bam</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">:bam</span>]
|
316
|
+
<span class="ruby-ivar">@samtools</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">:samtools</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-keyword">__FILE__</span>)),<span class="ruby-string">'sam'</span>,<span class="ruby-string">'external'</span>,<span class="ruby-string">'samtools'</span>)
|
317
|
+
<span class="ruby-ivar">@bcftools</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">:bcftools</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-keyword">__FILE__</span>)),<span class="ruby-string">'sam'</span>,<span class="ruby-string">'external'</span>,<span class="ruby-string">'bcftools'</span>)
|
318
|
+
|
319
|
+
<span class="ruby-ivar">@files</span> = [<span class="ruby-ivar">@files</span>] <span class="ruby-keyword">if</span> <span class="ruby-ivar">@files</span>.<span class="ruby-identifier">instance_of?</span>(<span class="ruby-constant">String</span>)
|
376
320
|
|
377
|
-
<span class="ruby-
|
321
|
+
<span class="ruby-ivar">@last_command</span> = <span class="ruby-keyword">nil</span>
|
322
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-string">"Need Fasta and at least one BAM or SAM"</span> <span class="ruby-keyword">if</span> <span class="ruby-keyword">not</span> <span class="ruby-ivar">@fasta</span> <span class="ruby-keyword">or</span> <span class="ruby-keyword">not</span> <span class="ruby-ivar">@bam</span>
|
323
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">IOError</span>, <span class="ruby-string">"File not found"</span> <span class="ruby-keyword">if</span> <span class="ruby-keyword">not</span> <span class="ruby-identifier">files_ok?</span>
|
324
|
+
<span class="ruby-ivar">@bams</span> = [<span class="ruby-ivar">@bams</span>] <span class="ruby-keyword">if</span> <span class="ruby-ivar">@bams</span>.<span class="ruby-identifier">instance_of?</span> <span class="ruby-constant">String</span>
|
325
|
+
|
378
326
|
<span class="ruby-keyword">end</span></pre>
|
379
|
-
</div
|
327
|
+
</div>
|
380
328
|
|
381
329
|
</div>
|
382
330
|
|
383
331
|
|
384
332
|
|
385
333
|
|
386
|
-
</div
|
334
|
+
</div>
|
387
335
|
|
388
336
|
|
389
|
-
</section
|
337
|
+
</section>
|
390
338
|
|
391
|
-
<section id="public-instance-5Buntitled-5D-method-details" class="method-section
|
392
|
-
|
339
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
340
|
+
<header>
|
341
|
+
<h3>Public Instance Methods</h3>
|
342
|
+
</header>
|
393
343
|
|
394
344
|
|
395
345
|
<div id="method-i-average_coverage" class="method-detail ">
|
396
346
|
|
397
347
|
<div class="method-heading">
|
398
348
|
<span class="method-name">average_coverage</span><span
|
399
|
-
class="method-args">(
|
349
|
+
class="method-args">(chr,start,length)</span>
|
350
|
+
|
400
351
|
<span class="method-click-advice">click to toggle source</span>
|
352
|
+
|
401
353
|
</div>
|
402
354
|
|
403
355
|
|
404
356
|
<div class="method-description">
|
405
357
|
|
406
|
-
<p>
|
358
|
+
<p>returns the average coverage over the region queried</p>
|
359
|
+
<ul><li>
|
360
|
+
<p>chr - the reference name</p>
|
361
|
+
</li><li>
|
362
|
+
<p>start - the start position</p>
|
363
|
+
</li><li>
|
364
|
+
<p>length - the length of the region queried</p>
|
365
|
+
</li></ul>
|
366
|
+
|
407
367
|
|
408
368
|
|
409
369
|
|
410
370
|
<div class="method-source-code" id="average_coverage-source">
|
411
|
-
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line
|
412
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">average_coverage</span>(<span class="ruby-identifier">
|
371
|
+
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 167</span>
|
372
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">average_coverage</span>(<span class="ruby-identifier">chr</span>,<span class="ruby-identifier">start</span>,<span class="ruby-identifier">length</span>)
|
373
|
+
<span class="ruby-identifier">arr</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">chromosome_coverage</span>(<span class="ruby-identifier">chr</span>,<span class="ruby-identifier">start</span>,<span class="ruby-identifier">length</span>)
|
374
|
+
<span class="ruby-identifier">arr</span>.<span class="ruby-identifier">inject</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">sum</span>, <span class="ruby-identifier">el</span><span class="ruby-operator">|</span> <span class="ruby-identifier">sum</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">el</span> }.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-identifier">arr</span>.<span class="ruby-identifier">size</span>
|
375
|
+
<span class="ruby-keyword">end</span></pre>
|
376
|
+
</div>
|
377
|
+
|
378
|
+
</div>
|
379
|
+
|
380
|
+
|
413
381
|
|
414
|
-
|
415
|
-
|
382
|
+
|
383
|
+
</div>
|
416
384
|
|
385
|
+
|
386
|
+
<div id="method-i-calmd" class="method-detail ">
|
387
|
+
|
388
|
+
<div class="method-heading">
|
389
|
+
<span class="method-name">calmd</span><span
|
390
|
+
class="method-args">(opts={}, &block)</span>
|
391
|
+
|
392
|
+
<span class="method-click-advice">click to toggle source</span>
|
393
|
+
|
394
|
+
</div>
|
395
|
+
|
417
396
|
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
397
|
+
<div class="method-description">
|
398
|
+
|
399
|
+
<p>Generate the MD tag. If the MD tag is already present, this command will
|
400
|
+
give a warning if the MD tag generated is different from the existing tag.
|
401
|
+
Output SAM by default.</p>
|
402
|
+
<ul><li>
|
403
|
+
<p>A - When used jointly with -r this option overwrites the original base
|
404
|
+
quality.</p>
|
405
|
+
</li><li>
|
406
|
+
<p>e - Convert a the read base to = if it is identical to the aligned
|
407
|
+
reference base. Indel caller does not support the = bases at the moment.</p>
|
408
|
+
</li><li>
|
409
|
+
<p>u - Output uncompressed BAM</p>
|
410
|
+
</li><li>
|
411
|
+
<p>b - Output compressed BAM</p>
|
412
|
+
</li><li>
|
413
|
+
<p>S - The input is SAM with header lines</p>
|
414
|
+
</li><li>
|
415
|
+
<p>C - [INT] Coefficient to cap mapping quality of poorly mapped reads. See
|
416
|
+
the pileup command for details. [0]</p>
|
417
|
+
</li><li>
|
418
|
+
<p>r - Compute the BQ tag (without -A) or cap base quality by BAQ (with -A).</p>
|
419
|
+
</li><li>
|
420
|
+
<p>E - Extended BAQ calculation. This option trades specificity for
|
421
|
+
sensitivity, though the effect is minor.</p>
|
422
|
+
</li></ul>
|
423
|
+
|
424
|
+
|
425
|
+
|
426
|
+
|
427
|
+
<div class="method-source-code" id="calmd-source">
|
428
|
+
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 492</span>
|
429
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">calmd</span>(<span class="ruby-identifier">opts</span>={}, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
430
|
+
<span class="ruby-identifier">command</span> = <span class="ruby-identifier">form_opt_string</span>(<span class="ruby-ivar">@samtools</span>, <span class="ruby-string">"calmd"</span>, <span class="ruby-identifier">opts</span>, [<span class="ruby-value">:E</span>, <span class="ruby-value">:e</span>, <span class="ruby-value">:u</span>, <span class="ruby-value">:b</span>, <span class="ruby-value">:S</span>, <span class="ruby-value">:r</span>] )<span class="ruby-operator">+</span> <span class="ruby-string">" "</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@fasta</span>
|
431
|
+
<span class="ruby-ivar">@last_command</span> = <span class="ruby-identifier">command</span>
|
432
|
+
<span class="ruby-identifier">type</span> = <span class="ruby-value">:text</span>
|
433
|
+
<span class="ruby-identifier">klass</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">Alignment</span>
|
434
|
+
<span class="ruby-identifier">yield_from_pipe</span>(<span class="ruby-identifier">command</span>, <span class="ruby-identifier">klass</span>, <span class="ruby-identifier">type</span>, <span class="ruby-keyword">true</span>, <span class="ruby-string">"@"</span>,<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
424
435
|
<span class="ruby-keyword">end</span></pre>
|
425
|
-
</div
|
436
|
+
</div>
|
426
437
|
|
427
438
|
</div>
|
428
439
|
|
429
440
|
|
430
441
|
|
431
442
|
|
432
|
-
</div
|
443
|
+
</div>
|
433
444
|
|
434
445
|
|
435
|
-
<div id="method-i-
|
446
|
+
<div id="method-i-cat" class="method-detail ">
|
436
447
|
|
437
448
|
<div class="method-heading">
|
438
|
-
<span class="method-name">
|
439
|
-
class="method-args">(
|
449
|
+
<span class="method-name">cat</span><span
|
450
|
+
class="method-args">(opts={})</span>
|
451
|
+
|
440
452
|
<span class="method-click-advice">click to toggle source</span>
|
453
|
+
|
441
454
|
</div>
|
442
455
|
|
443
456
|
|
444
457
|
<div class="method-description">
|
445
458
|
|
446
|
-
<p>
|
447
|
-
|
448
|
-
|
459
|
+
<p>Concatenate BAMs. The sequence dictionary of each input BAM must be
|
460
|
+
identical.</p>
|
461
|
+
<ul><li>
|
462
|
+
<p>h - header.sam</p>
|
463
|
+
</li><li>
|
464
|
+
<p>out -[FILE] out file name</p>
|
465
|
+
</li><li>
|
466
|
+
<p>bams -[FILES] or <a href="Sam.html">Bio::DB::Sam</a> list of input bams, or
|
467
|
+
<a href="Sam.html">Bio::DB::Sam</a> objects</p>
|
468
|
+
</li></ul>
|
449
469
|
|
450
|
-
|
451
470
|
|
452
|
-
<div class="method-source-code" id="chromosome_coverage-source">
|
453
|
-
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 160</span>
|
454
|
-
<span class="ruby-keyword">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>)
|
455
|
-
<span class="ruby-comment"># reference = fetch_reference(chromosome, qstart,len)</span>
|
456
|
-
<span class="ruby-comment"># len = reference.length if len > reference.length</span>
|
457
|
-
<span class="ruby-comment">#p qend.to_s + "-" + qstart.to_s + "framesize " + (qend - qstart).to_s</span>
|
458
|
-
<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>)
|
459
|
-
|
460
|
-
<span class="ruby-identifier">chr_cov_proc</span> = <span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">alignment</span><span class="ruby-operator">|</span>
|
461
|
-
<span class="ruby-comment">#last = qstart + len</span>
|
462
|
-
<span class="ruby-comment">#first = qstart</span>
|
463
|
-
<span class="ruby-comment">#last = alignment.calend if last > alignment.calend</span>
|
464
|
-
<span class="ruby-comment">#first = alignment.pos if first < alignment.pos</span>
|
465
|
-
<span class="ruby-comment"># p first</span>
|
466
|
-
<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>
|
467
|
-
<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>
|
468
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">last</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">first</span>
|
469
|
-
<span class="ruby-identifier">tmp</span> = <span class="ruby-identifier">last</span>
|
470
|
-
<span class="ruby-identifier">last</span> = <span class="ruby-identifier">first</span>
|
471
|
-
<span class="ruby-identifier">first</span> = <span class="ruby-identifier">last</span>
|
472
|
-
<span class="ruby-keyword">end</span>
|
473
471
|
|
474
|
-
|
475
|
-
|
472
|
+
|
473
|
+
<div class="method-source-code" id="cat-source">
|
474
|
+
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 383</span>
|
475
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">cat</span>(<span class="ruby-identifier">opts</span>={})
|
476
|
+
<span class="ruby-identifier">out</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:out</span>]
|
477
|
+
<span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:out</span>)
|
476
478
|
|
477
|
-
|
478
|
-
|
479
|
-
<span class="ruby-keyword">end</span>
|
479
|
+
<span class="ruby-identifier">bam_list</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:bams</span>].<span class="ruby-identifier">collect</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">b</span><span class="ruby-operator">|</span>
|
480
|
+
<span class="ruby-identifier">b</span>.<span class="ruby-identifier">bam</span> <span class="ruby-keyword">rescue</span> <span class="ruby-identifier">b</span>
|
481
|
+
<span class="ruby-keyword">end</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">' '</span>)
|
482
|
+
<span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:bams</span>)
|
483
|
+
<span class="ruby-identifier">options</span> = <span class="ruby-identifier">commandify</span>(<span class="ruby-identifier">opts</span>, [<span class="ruby-value">:h</span>] )
|
484
|
+
<span class="ruby-identifier">command</span> = <span class="ruby-node">"#{@samtools} cat #{options} -o #{out} #{bam_list}"</span>
|
485
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">command</span>
|
486
|
+
<span class="ruby-ivar">@last_command</span> = <span class="ruby-identifier">command</span>
|
487
|
+
<span class="ruby-identifier">system</span>(<span class="ruby-identifier">command</span>)
|
480
488
|
|
481
|
-
<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>)
|
482
|
-
<span class="ruby-comment">#p coverages</span>
|
483
|
-
<span class="ruby-identifier">coverages</span>
|
484
489
|
<span class="ruby-keyword">end</span></pre>
|
485
|
-
</div
|
490
|
+
</div>
|
486
491
|
|
487
492
|
</div>
|
488
493
|
|
489
494
|
|
490
495
|
|
491
496
|
|
492
|
-
</div
|
497
|
+
</div>
|
493
498
|
|
494
499
|
|
495
|
-
<div id="method-i-
|
500
|
+
<div id="method-i-chromosome_coverage" class="method-detail ">
|
496
501
|
|
497
502
|
<div class="method-heading">
|
498
|
-
<span class="method-name">
|
499
|
-
class="method-args">()</span>
|
503
|
+
<span class="method-name">chromosome_coverage</span><span
|
504
|
+
class="method-args">(chr,start,length)</span>
|
505
|
+
|
500
506
|
<span class="method-click-advice">click to toggle source</span>
|
507
|
+
|
501
508
|
</div>
|
502
509
|
|
503
510
|
|
504
511
|
<div class="method-description">
|
505
512
|
|
506
|
-
<p>
|
507
|
-
|
513
|
+
<p>returns an array of coverage for each location for which there are mapped
|
514
|
+
reads</p>
|
515
|
+
<ul><li>
|
516
|
+
<p>chr - the reference name</p>
|
517
|
+
</li><li>
|
518
|
+
<p>start - the start position</p>
|
519
|
+
</li><li>
|
520
|
+
<p>length - the length of the region queried</p>
|
521
|
+
</li></ul>
|
522
|
+
|
508
523
|
|
509
524
|
|
510
525
|
|
511
|
-
<div class="method-source-code" id="
|
512
|
-
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line
|
513
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">
|
514
|
-
<span class="ruby-
|
515
|
-
<span class="ruby-
|
516
|
-
<span class="ruby-
|
517
|
-
|
518
|
-
<span class="ruby-
|
526
|
+
<div class="method-source-code" id="chromosome_coverage-source">
|
527
|
+
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 102</span>
|
528
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">chromosome_coverage</span>(<span class="ruby-identifier">chr</span>,<span class="ruby-identifier">start</span>,<span class="ruby-identifier">length</span>)
|
529
|
+
<span class="ruby-identifier">result</span> = []
|
530
|
+
<span class="ruby-identifier">region</span> = <span class="ruby-node">"#{chr}:#{start}-#{start + length}"</span>
|
531
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">mpileup</span>(<span class="ruby-value">:r</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">region</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span>
|
532
|
+
<span class="ruby-identifier">result</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">coverage</span>
|
533
|
+
<span class="ruby-keyword">end</span>
|
534
|
+
<span class="ruby-identifier">result</span>
|
519
535
|
<span class="ruby-keyword">end</span></pre>
|
520
|
-
</div
|
536
|
+
</div>
|
521
537
|
|
522
538
|
</div>
|
523
539
|
|
524
540
|
|
525
541
|
|
526
542
|
|
527
|
-
</div
|
543
|
+
</div>
|
528
544
|
|
529
545
|
|
530
|
-
<div id="method-i-
|
546
|
+
<div id="method-i-depth" class="method-detail ">
|
531
547
|
|
532
548
|
<div class="method-heading">
|
533
|
-
<span class="method-name">
|
534
|
-
class="method-args">(
|
549
|
+
<span class="method-name">depth</span><span
|
550
|
+
class="method-args">(opts={}) { |split(/\t/)| ... }</span>
|
551
|
+
|
535
552
|
<span class="method-click-advice">click to toggle source</span>
|
553
|
+
|
536
554
|
</div>
|
537
555
|
|
538
556
|
|
539
557
|
<div class="method-description">
|
540
558
|
|
541
|
-
<p>
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
<span class="ruby-
|
562
|
-
|
563
|
-
<span class="ruby-identifier">
|
564
|
-
|
565
|
-
|
566
|
-
<span class="ruby-identifier">command</span> = <span class="ruby-string">'samtools pileup '</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">cmd</span> <span class="ruby-operator">+</span> <span class="ruby-node">" -f #{@fasta_path}"</span> <span class="ruby-operator">+</span> <span class="ruby-node">" #{@sam}"</span>
|
567
|
-
|
568
|
-
<span class="ruby-identifier">pipe</span> = <span class="ruby-constant">IO</span>.<span class="ruby-identifier">popen</span>(<span class="ruby-identifier">command</span>)
|
569
|
-
<span class="ruby-keyword">while</span> <span class="ruby-identifier">line</span> = <span class="ruby-identifier">pipe</span>.<span class="ruby-identifier">gets</span>
|
570
|
-
<span class="ruby-keyword">yield</span> <span class="ruby-constant">Pileup</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">line</span>)
|
559
|
+
<p>returns an array for each position with [sequence_name, position, depth]</p>
|
560
|
+
<ul><li>
|
561
|
+
<p>b - list of positions or regions in BED format</p>
|
562
|
+
</li><li>
|
563
|
+
<p>l - [INT] minQLen</p>
|
564
|
+
</li><li>
|
565
|
+
<p>q - [INT] base quality threshold</p>
|
566
|
+
</li><li>
|
567
|
+
<p>Q - [INT] mapping quality threshold</p>
|
568
|
+
</li><li>
|
569
|
+
<p>r - [chr:from-to] region</p>
|
570
|
+
</li></ul>
|
571
|
+
|
572
|
+
|
573
|
+
|
574
|
+
|
575
|
+
<div class="method-source-code" id="depth-source">
|
576
|
+
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 538</span>
|
577
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">depth</span>(<span class="ruby-identifier">opts</span>={})
|
578
|
+
<span class="ruby-identifier">command</span> = <span class="ruby-identifier">form_opt_string</span>(<span class="ruby-ivar">@samtools</span>, <span class="ruby-string">"depth"</span>, <span class="ruby-identifier">opts</span>)
|
579
|
+
<span class="ruby-ivar">@last_command</span> = <span class="ruby-identifier">command</span>
|
580
|
+
<span class="ruby-comment">#puts command</span>
|
581
|
+
<span class="ruby-identifier">yield_from_pipe</span>(<span class="ruby-identifier">command</span>, <span class="ruby-constant">String</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
|
582
|
+
<span class="ruby-keyword">yield</span> <span class="ruby-identifier">line</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp">/\t/</span>)
|
571
583
|
<span class="ruby-keyword">end</span>
|
572
|
-
|
584
|
+
|
573
585
|
<span class="ruby-keyword">end</span></pre>
|
574
|
-
</div
|
586
|
+
</div>
|
575
587
|
|
576
588
|
</div>
|
577
589
|
|
578
590
|
|
579
591
|
|
580
592
|
|
581
|
-
</div
|
593
|
+
</div>
|
582
594
|
|
583
595
|
|
584
|
-
<div id="method-i-
|
596
|
+
<div id="method-i-faidx" class="method-detail ">
|
585
597
|
|
586
598
|
<div class="method-heading">
|
587
|
-
<span class="method-name">
|
588
|
-
class="method-args">(
|
599
|
+
<span class="method-name">faidx</span><span
|
600
|
+
class="method-args">(opts={})</span>
|
601
|
+
|
589
602
|
<span class="method-click-advice">click to toggle source</span>
|
603
|
+
|
590
604
|
</div>
|
591
605
|
|
592
606
|
|
593
607
|
<div class="method-description">
|
594
608
|
|
595
|
-
<p>
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
<
|
602
|
-
|
603
|
-
|
604
|
-
|
609
|
+
<p>Index reference sequence in the FASTA format or extract subsequence from
|
610
|
+
indexed reference sequence. If no region is specified, faidx will index the
|
611
|
+
file and create <ref.fasta>.fai on the disk. If regions are
|
612
|
+
speficified, the subsequences will be retrieved and printed to stdout in
|
613
|
+
the FASTA format. Options - if a subsequence is required</p>
|
614
|
+
<ul><li>
|
615
|
+
<p>chr - [STRING] the reference name of the subsequence</p>
|
616
|
+
</li><li>
|
617
|
+
<p>start - [INT] the start position for the subsequence</p>
|
618
|
+
</li><li>
|
619
|
+
<p>stop - [INT] the stop position for the subsequence</p>
|
620
|
+
</li></ul>
|
621
|
+
|
622
|
+
|
623
|
+
|
624
|
+
|
625
|
+
<div class="method-source-code" id="faidx-source">
|
626
|
+
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 275</span>
|
627
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">faidx</span>(<span class="ruby-identifier">opts</span>={})
|
628
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-value">:chr</span>) <span class="ruby-keyword">and</span> <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-value">:start</span>) <span class="ruby-keyword">and</span> <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-value">:stop</span>)
|
629
|
+
<span class="ruby-identifier">opts</span>={<span class="ruby-value">:as_bio</span> =<span class="ruby-operator">></span> <span class="ruby-keyword">false</span>}
|
630
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">fetch_reference</span>(<span class="ruby-value">:chr</span>,<span class="ruby-value">:start</span>,<span class="ruby-value">:stop</span>,<span class="ruby-identifier">opts</span>)
|
631
|
+
<span class="ruby-keyword">else</span>
|
632
|
+
<span class="ruby-identifier">command</span> = <span class="ruby-node">"#{@samtools} faidx #{@fasta}"</span>
|
633
|
+
<span class="ruby-ivar">@last_command</span> = <span class="ruby-identifier">command</span>
|
634
|
+
<span class="ruby-identifier">system</span>(<span class="ruby-identifier">command</span>)
|
605
635
|
<span class="ruby-keyword">end</span>
|
606
636
|
<span class="ruby-keyword">end</span></pre>
|
607
|
-
</div
|
637
|
+
</div>
|
608
638
|
|
609
639
|
</div>
|
610
640
|
|
611
641
|
|
612
642
|
|
613
643
|
|
614
|
-
</div
|
644
|
+
</div>
|
615
645
|
|
616
646
|
|
617
647
|
<div id="method-i-fetch" class="method-detail ">
|
618
648
|
|
619
649
|
<div class="method-heading">
|
620
650
|
<span class="method-name">fetch</span><span
|
621
|
-
class="method-args">(
|
651
|
+
class="method-args">(chr, start,stop, &block)</span>
|
652
|
+
|
622
653
|
<span class="method-click-advice">click to toggle source</span>
|
654
|
+
|
623
655
|
</div>
|
624
656
|
|
625
657
|
|
626
658
|
<div class="method-description">
|
627
659
|
|
628
|
-
<p>
|
660
|
+
<p>fetches a subsequence and calls code block</p>
|
661
|
+
<ul><li>
|
662
|
+
<p>chr - the reference name for the subsequence</p>
|
663
|
+
</li><li>
|
664
|
+
<p>start - the start position for the subsequence</p>
|
665
|
+
</li><li>
|
666
|
+
<p>stop - the stop position for the subsequence</p>
|
667
|
+
</li><li>
|
668
|
+
<p>&block - the the block of code to execute</p>
|
669
|
+
</li></ul>
|
670
|
+
|
629
671
|
|
630
672
|
|
631
673
|
|
632
674
|
<div class="method-source-code" id="fetch-source">
|
633
|
-
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line
|
634
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">
|
635
|
-
<span class="ruby-identifier">
|
636
|
-
<span class="ruby-
|
637
|
-
|
638
|
-
|
639
|
-
<span class="ruby-
|
640
|
-
|
641
|
-
<span class="ruby-identifier">als</span>
|
675
|
+
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 87</span>
|
676
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">chr</span>, <span class="ruby-identifier">start</span>,<span class="ruby-identifier">stop</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
677
|
+
<span class="ruby-identifier">view</span>(
|
678
|
+
<span class="ruby-value">:chr</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">chr</span>,
|
679
|
+
<span class="ruby-value">:start</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">start</span>,
|
680
|
+
<span class="ruby-value">:stop</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">stop</span>,
|
681
|
+
<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>
|
682
|
+
)
|
642
683
|
<span class="ruby-keyword">end</span></pre>
|
643
|
-
</div
|
684
|
+
</div>
|
644
685
|
|
645
686
|
</div>
|
646
687
|
|
647
688
|
|
689
|
+
<div class="aliases">
|
690
|
+
Also aliased as: <a href="Sam.html#method-i-fetch_with_function">fetch_with_function</a>
|
691
|
+
</div>
|
692
|
+
|
648
693
|
|
649
694
|
|
650
|
-
</div
|
695
|
+
</div>
|
651
696
|
|
652
697
|
|
653
698
|
<div id="method-i-fetch_reference" class="method-detail ">
|
654
699
|
|
655
700
|
<div class="method-heading">
|
656
701
|
<span class="method-name">fetch_reference</span><span
|
657
|
-
class="method-args">(
|
702
|
+
class="method-args">(chr,start,stop, opts={:as_bio => false})</span>
|
703
|
+
|
658
704
|
<span class="method-click-advice">click to toggle source</span>
|
705
|
+
|
659
706
|
</div>
|
660
707
|
|
661
708
|
|
662
709
|
<div class="method-description">
|
663
710
|
|
664
|
-
<p>
|
711
|
+
<p>fetches a subsequence from a reference genome and option returns it as a
|
712
|
+
Bio::Sequence::NA object</p>
|
713
|
+
<ul><li>
|
714
|
+
<p>chr - [STRING] the reference name for the subsequence</p>
|
715
|
+
</li><li>
|
716
|
+
<p>start - [INT] the start position for the subsequence</p>
|
717
|
+
</li><li>
|
718
|
+
<p>stop - [INT] the stop position for the subsequence</p>
|
719
|
+
</li><li>
|
720
|
+
<p>as_bio - boolean stating if the returned object should be a
|
721
|
+
Bio::Sequence::NA object</p>
|
722
|
+
</li></ul>
|
723
|
+
|
665
724
|
|
666
725
|
|
667
726
|
|
668
727
|
<div class="method-source-code" id="fetch_reference-source">
|
669
|
-
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line
|
670
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">fetch_reference</span>(<span class="ruby-identifier">
|
671
|
-
<span class="ruby-identifier">
|
672
|
-
<span class="ruby-
|
673
|
-
<span class="ruby-
|
674
|
-
<span class="ruby-identifier">
|
675
|
-
<span class="ruby-identifier">
|
676
|
-
|
677
|
-
|
728
|
+
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 258</span>
|
729
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">fetch_reference</span>(<span class="ruby-identifier">chr</span>,<span class="ruby-identifier">start</span>,<span class="ruby-identifier">stop</span>, <span class="ruby-identifier">opts</span>={<span class="ruby-value">:as_bio</span> =<span class="ruby-operator">></span> <span class="ruby-keyword">false</span>})
|
730
|
+
<span class="ruby-identifier">command</span> = <span class="ruby-node">"#{@samtools} faidx #{@fasta} #{chr}:#{start}-#{stop}"</span>
|
731
|
+
<span class="ruby-comment">#puts command</span>
|
732
|
+
<span class="ruby-ivar">@last_command</span> = <span class="ruby-identifier">command</span>
|
733
|
+
<span class="ruby-identifier">seq</span> = <span class="ruby-string">""</span>
|
734
|
+
<span class="ruby-identifier">yield_from_pipe</span>(<span class="ruby-identifier">command</span>, <span class="ruby-constant">String</span>, <span class="ruby-value">:text</span> ) {<span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span> <span class="ruby-identifier">seq</span> = <span class="ruby-identifier">seq</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">line</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">line</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/^>/</span>}
|
735
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:as_bio</span>]
|
736
|
+
<span class="ruby-identifier">seq</span> = <span class="ruby-constant">Bio</span><span class="ruby-operator">::</span><span class="ruby-constant">Sequence</span><span class="ruby-operator">::</span><span class="ruby-constant">NA</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">seq</span>).<span class="ruby-identifier">to_fasta</span>(<span class="ruby-node">"#{chr}:#{start}-#{stop}"</span>)
|
737
|
+
<span class="ruby-keyword">end</span>
|
738
|
+
<span class="ruby-identifier">seq</span>
|
678
739
|
<span class="ruby-keyword">end</span></pre>
|
679
|
-
</div
|
740
|
+
</div>
|
680
741
|
|
681
742
|
</div>
|
682
743
|
|
683
744
|
|
684
745
|
|
685
746
|
|
686
|
-
</div
|
747
|
+
</div>
|
687
748
|
|
688
749
|
|
689
|
-
<div id="method-i-fetch_with_function" class="method-detail ">
|
750
|
+
<div id="method-i-fetch_with_function" class="method-detail method-alias">
|
690
751
|
|
691
752
|
<div class="method-heading">
|
692
753
|
<span class="method-name">fetch_with_function</span><span
|
693
|
-
class="method-args">(
|
694
|
-
|
754
|
+
class="method-args">(chr, start,stop, &block)</span>
|
755
|
+
|
695
756
|
</div>
|
696
757
|
|
697
758
|
|
698
759
|
<div class="method-description">
|
699
760
|
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
the scope of the C library. Returns the count of alignments in the region.
|
705
|
-
WARNING: Accepts an index already parsed by the library. It fails when you
|
706
|
-
use your own FixNum (FFI-bug?)</p>
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
<div class="method-source-code" id="fetch_with_function-source">
|
711
|
-
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 226</span>
|
712
|
-
<span class="ruby-keyword">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>)
|
713
|
-
<span class="ruby-identifier">load_index</span> <span class="ruby-keyword">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>
|
714
|
-
<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-value">:int</span>
|
715
|
-
<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-value">:int</span>
|
716
|
-
<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-value">:int</span>
|
717
|
-
<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>)
|
718
|
-
<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>)
|
719
|
-
<span class="ruby-identifier">header</span> = <span class="ruby-ivar">@sam_file</span>[<span class="ruby-value">:header</span>]
|
720
|
-
<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>)
|
721
|
-
<span class="ruby-comment">#raise SAMException.new(), "invalid query: " + query if(chr.read_int < 0)</span>
|
722
|
-
<span class="ruby-identifier">count</span> = <span class="ruby-value">0</span>;
|
723
|
-
|
724
|
-
<span class="ruby-identifier">fetchAlignment</span> = <span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword">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>
|
725
|
-
<span class="ruby-identifier">alignment</span> = <span class="ruby-constant">Alignment</span>.<span class="ruby-identifier">new</span>
|
726
|
-
<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>)
|
727
|
-
<span class="ruby-identifier">function</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">alignment</span>)
|
728
|
-
<span class="ruby-identifier">count</span> = <span class="ruby-identifier">count</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>
|
729
|
-
<span class="ruby-value">0</span>
|
730
|
-
<span class="ruby-keyword">end</span>
|
731
|
-
<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-value">:x</span>][<span class="ruby-value">: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">nil</span>, <span class="ruby-identifier">fetchAlignment</span>)
|
732
|
-
<span class="ruby-comment">#LibC.free chr</span>
|
733
|
-
<span class="ruby-comment">#LibC.free beg</span>
|
734
|
-
<span class="ruby-comment">#LibC.free last</span>
|
735
|
-
<span class="ruby-comment">#LibC.free qpointer</span>
|
736
|
-
<span class="ruby-identifier">count</span>
|
737
|
-
<span class="ruby-keyword">end</span></pre>
|
738
|
-
</div><!-- fetch_with_function-source -->
|
761
|
+
|
762
|
+
|
763
|
+
|
764
|
+
|
739
765
|
|
740
766
|
</div>
|
741
767
|
|
742
768
|
|
743
769
|
|
744
770
|
|
745
|
-
|
771
|
+
<div class="aliases">
|
772
|
+
Alias for: <a href="Sam.html#method-i-fetch">fetch</a>
|
773
|
+
</div>
|
774
|
+
|
775
|
+
</div>
|
746
776
|
|
747
777
|
|
748
|
-
<div id="method-i-
|
778
|
+
<div id="method-i-fix_mates" class="method-detail ">
|
749
779
|
|
750
780
|
<div class="method-heading">
|
751
|
-
<span class="method-name">
|
752
|
-
class="method-args">()</span>
|
781
|
+
<span class="method-name">fix_mates</span><span
|
782
|
+
class="method-args">(opts={})</span>
|
783
|
+
|
753
784
|
<span class="method-click-advice">click to toggle source</span>
|
785
|
+
|
754
786
|
</div>
|
755
787
|
|
756
788
|
|
757
789
|
<div class="method-description">
|
758
790
|
|
791
|
+
<p>Fill in mate coordinates, ISIZE and mate related flags from a name-sorted
|
792
|
+
alignment</p>
|
793
|
+
<ul><li>
|
794
|
+
<p>out_bam name of outfile</p>
|
795
|
+
</li><li>
|
796
|
+
<p>r - remove unmapped reads and secondary alignments</p>
|
797
|
+
</li></ul>
|
759
798
|
|
760
799
|
|
761
800
|
|
762
801
|
|
763
|
-
<div class="method-source-code" id="
|
764
|
-
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line
|
765
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">
|
766
|
-
<span class="ruby-
|
767
|
-
<span class="ruby-identifier">
|
768
|
-
<span class="ruby-identifier">
|
769
|
-
|
770
|
-
<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-ivar">@sam</span>)
|
771
|
-
<span class="ruby-identifier">strptrs</span> <span class="ruby-operator"><<</span> <span class="ruby-keyword">nil</span>
|
772
|
-
|
773
|
-
<span class="ruby-comment"># Now load all the pointers into a native memory block</span>
|
774
|
-
<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-value">:pointer</span>, <span class="ruby-identifier">strptrs</span>.<span class="ruby-identifier">length</span>)
|
775
|
-
<span class="ruby-identifier">strptrs</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">p</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
|
776
|
-
<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>)
|
802
|
+
<div class="method-source-code" id="fix_mates-source">
|
803
|
+
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 298</span>
|
804
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">fix_mates</span>(<span class="ruby-identifier">opts</span>={})
|
805
|
+
<span class="ruby-comment">#opts.merge!({:out_index=>nil})</span>
|
806
|
+
<span class="ruby-identifier">remove_reads</span> = <span class="ruby-string">""</span>
|
807
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:r</span>]
|
808
|
+
<span class="ruby-identifier">remove_reads</span> = <span class="ruby-string">"-r"</span>
|
777
809
|
<span class="ruby-keyword">end</span>
|
778
|
-
|
779
|
-
<span class="ruby-
|
780
|
-
|
781
|
-
<span class="ruby-identifier">
|
782
|
-
<span class="ruby-identifier">read_pipe</span>, <span class="ruby-identifier">write_pipe</span> = <span class="ruby-constant">IO</span>.<span class="ruby-identifier">pipe</span>()
|
783
|
-
<span class="ruby-constant">STDOUT</span>.<span class="ruby-identifier">reopen</span>(<span class="ruby-identifier">write_pipe</span>)
|
784
|
-
|
785
|
-
<span class="ruby-comment">#int bam_idxstats(int argc, char *argv[])</span>
|
786
|
-
<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_idxstats</span>(<span class="ruby-identifier">strptrs</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>,<span class="ruby-identifier">argv</span>)
|
787
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">fork</span>
|
788
|
-
<span class="ruby-identifier">write_pipe</span>.<span class="ruby-identifier">close</span>
|
789
|
-
<span class="ruby-constant">STDOUT</span>.<span class="ruby-identifier">reopen</span>(<span class="ruby-identifier">old_stdout</span>) <span class="ruby-comment">#beware .. stdout from other processes eg tests calling this method can get mixed in...</span>
|
790
|
-
<span class="ruby-keyword">begin</span>
|
791
|
-
|
792
|
-
<span class="ruby-keyword">while</span> <span class="ruby-identifier">line</span> = <span class="ruby-identifier">read_pipe</span>.<span class="ruby-identifier">readline</span> <span class="ruby-comment">#TAB delimited with each line consisting of reference sequence name, sequence length, # mapped reads and # unmapped reads.</span>
|
793
|
-
<span class="ruby-identifier">info</span> = <span class="ruby-identifier">line</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp">%r\t/</span>)
|
794
|
-
<span class="ruby-keyword">next</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">info</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">4</span>
|
795
|
-
<span class="ruby-identifier">index_stats</span>[ <span class="ruby-identifier">info</span>[<span class="ruby-value">0</span>] ] = {<span class="ruby-value">:length</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">info</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">to_i</span>, <span class="ruby-value">:mapped_reads</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">info</span>[<span class="ruby-value">2</span>].<span class="ruby-identifier">to_i</span>, <span class="ruby-value">:unmapped_reads</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">info</span>[<span class="ruby-value">3</span>].<span class="ruby-identifier">to_i</span> }
|
796
|
-
<span class="ruby-keyword">end</span>
|
797
|
-
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">EOFError</span>
|
798
|
-
<span class="ruby-identifier">read_pipe</span>.<span class="ruby-identifier">close</span>
|
799
|
-
<span class="ruby-constant">Process</span>.<span class="ruby-identifier">wait</span>
|
800
|
-
<span class="ruby-keyword">end</span>
|
801
|
-
<span class="ruby-keyword">end</span> <span class="ruby-comment">#fork</span>
|
802
|
-
<span class="ruby-identifier">index_stats</span>
|
810
|
+
<span class="ruby-identifier">command</span> = <span class="ruby-node">"#{@samtools} fixmate #{remove_reads} #{@bam} #{opts[:out_bam]}"</span>
|
811
|
+
<span class="ruby-comment">#puts command</span>
|
812
|
+
<span class="ruby-ivar">@last_command</span> = <span class="ruby-identifier">command</span>
|
813
|
+
<span class="ruby-identifier">system</span>(<span class="ruby-identifier">command</span>)
|
803
814
|
<span class="ruby-keyword">end</span></pre>
|
804
|
-
</div
|
815
|
+
</div>
|
805
816
|
|
806
817
|
</div>
|
807
818
|
|
808
819
|
|
820
|
+
<div class="aliases">
|
821
|
+
Also aliased as: <a href="Sam.html#method-i-fixmate">fixmate</a>
|
822
|
+
</div>
|
823
|
+
|
809
824
|
|
810
825
|
|
811
|
-
</div
|
826
|
+
</div>
|
812
827
|
|
813
828
|
|
814
|
-
<div id="method-i-
|
829
|
+
<div id="method-i-fixmate" class="method-detail method-alias">
|
815
830
|
|
816
831
|
<div class="method-heading">
|
817
|
-
<span class="method-name">
|
818
|
-
class="method-args">()</span>
|
819
|
-
|
832
|
+
<span class="method-name">fixmate</span><span
|
833
|
+
class="method-args">(opts={})</span>
|
834
|
+
|
820
835
|
</div>
|
821
836
|
|
822
837
|
|
823
838
|
<div class="method-description">
|
824
839
|
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
doesn’t exist, loading it will take more time. It is suggested to
|
830
|
-
generate the index separatedly if the bam file sits on a server where the
|
831
|
-
executing user may not have writing permissions in the server.</p>
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
<div class="method-source-code" id="load_index-source">
|
836
|
-
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 114</span>
|
837
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">load_index</span>()
|
838
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-constant">SAMException</span>.<span class="ruby-identifier">new</span>(), <span class="ruby-string">"Indexes are only supported by BAM files, please use samtools to convert your SAM file"</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@binary</span>
|
839
|
-
<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>)
|
840
|
-
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@sam_index</span>.<span class="ruby-identifier">null?</span> <span class="ruby-keyword">then</span>
|
841
|
-
<span class="ruby-identifier">p</span> <span class="ruby-string">"Generating index for: "</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@sam</span>
|
842
|
-
<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>)
|
843
|
-
<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>)
|
844
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-constant">SAMException</span>.<span class="ruby-identifier">new</span>(), <span class="ruby-string">"Unable to generate bam index for: "</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@sam</span> <span class="ruby-keyword">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>
|
845
|
-
<span class="ruby-keyword">end</span>
|
846
|
-
<span class="ruby-keyword">end</span></pre>
|
847
|
-
</div><!-- load_index-source -->
|
840
|
+
|
841
|
+
|
842
|
+
|
843
|
+
|
848
844
|
|
849
845
|
</div>
|
850
846
|
|
851
847
|
|
852
848
|
|
853
849
|
|
854
|
-
|
850
|
+
<div class="aliases">
|
851
|
+
Alias for: <a href="Sam.html#method-i-fix_mates">fix_mates</a>
|
852
|
+
</div>
|
853
|
+
|
854
|
+
</div>
|
855
855
|
|
856
856
|
|
857
|
-
<div id="method-i-
|
857
|
+
<div id="method-i-flag_stats" class="method-detail ">
|
858
858
|
|
859
859
|
<div class="method-heading">
|
860
|
-
<span class="method-name">
|
861
|
-
class="method-args">()</span>
|
860
|
+
<span class="method-name">flag_stats</span><span
|
861
|
+
class="method-args">(opts={})</span>
|
862
|
+
|
862
863
|
<span class="method-click-advice">click to toggle source</span>
|
864
|
+
|
863
865
|
</div>
|
864
866
|
|
865
867
|
|
866
868
|
<div class="method-description">
|
867
869
|
|
868
|
-
<p>
|
869
|
-
|
870
|
-
doesn’t exisits, this functions attempts to generate it. If user
|
871
|
-
doesn’t have writing permissions on the folder, or the creation of the
|
872
|
-
fai fails for any reason, a <a href="SAMException.html">SAMException</a> is
|
873
|
-
thrown.</p>
|
870
|
+
<p>generate simple stats with regard to the number and pairing of reads mapped
|
871
|
+
to a reference</p>
|
874
872
|
|
875
|
-
|
876
873
|
|
877
|
-
<div class="method-source-code" id="load_reference-source">
|
878
|
-
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 128</span>
|
879
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">load_reference</span>()
|
880
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-constant">SAMException</span>.<span class="ruby-identifier">new</span>(), <span class="ruby-string">"No path for the refernce fasta file. "</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@fasta_path</span>.<span class="ruby-identifier">nil?</span>
|
881
|
-
|
882
|
-
<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>)
|
883
|
-
|
884
|
-
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@fasta_index</span>.<span class="ruby-identifier">null?</span> <span class="ruby-keyword">then</span>
|
885
|
-
<span class="ruby-identifier">p</span> <span class="ruby-string">"Generating index for: "</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@fasta_path</span>
|
886
|
-
<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>)
|
887
|
-
<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>)
|
888
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-constant">SAMException</span>.<span class="ruby-identifier">new</span>(), <span class="ruby-string">"Unable to generate fasta index for: "</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@fasta_path</span> <span class="ruby-keyword">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>
|
889
|
-
<span class="ruby-keyword">end</span>
|
890
874
|
|
875
|
+
|
876
|
+
<div class="method-source-code" id="flag_stats-source">
|
877
|
+
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 313</span>
|
878
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">flag_stats</span>(<span class="ruby-identifier">opts</span>={})
|
879
|
+
<span class="ruby-identifier">command</span> = <span class="ruby-identifier">form_opt_string</span>(<span class="ruby-ivar">@samtools</span>, <span class="ruby-string">"flagstat"</span>, <span class="ruby-identifier">opts</span>, [])
|
880
|
+
<span class="ruby-comment">#puts command</span>
|
881
|
+
<span class="ruby-ivar">@last_command</span> = <span class="ruby-identifier">command</span>
|
882
|
+
<span class="ruby-identifier">strings</span> = []
|
883
|
+
<span class="ruby-identifier">yield_from_pipe</span>(<span class="ruby-identifier">command</span>,<span class="ruby-constant">String</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span> <span class="ruby-identifier">strings</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">line</span>.<span class="ruby-identifier">chomp</span>}
|
884
|
+
<span class="ruby-identifier">strings</span>
|
891
885
|
<span class="ruby-keyword">end</span></pre>
|
892
|
-
</div
|
886
|
+
</div>
|
893
887
|
|
894
888
|
</div>
|
895
889
|
|
896
890
|
|
891
|
+
<div class="aliases">
|
892
|
+
Also aliased as: <a href="Sam.html#method-i-flagstat">flagstat</a>
|
893
|
+
</div>
|
894
|
+
|
897
895
|
|
898
896
|
|
899
|
-
</div
|
897
|
+
</div>
|
900
898
|
|
901
899
|
|
902
|
-
<div id="method-i-
|
900
|
+
<div id="method-i-flagstat" class="method-detail method-alias">
|
903
901
|
|
904
902
|
<div class="method-heading">
|
905
|
-
<span class="method-name">
|
906
|
-
class="method-args">(
|
907
|
-
|
903
|
+
<span class="method-name">flagstat</span><span
|
904
|
+
class="method-args">(opts={})</span>
|
905
|
+
|
908
906
|
</div>
|
909
907
|
|
910
908
|
|
911
909
|
<div class="method-description">
|
912
910
|
|
913
|
-
|
914
|
-
|
915
|
-
href="Pileup.html">Pileup</a> object for each postion the command line
|
916
|
-
options that generate/affect BCF/VCF are ignored ie (g,u,e,h,I,L,o,p) call
|
917
|
-
the option as a symbol of the flag, eg -r for region is called :r =>
|
918
|
-
“some <a href="SAM.html">SAM</a> compatible region” eg bam.mpileup(:r
|
919
|
-
=> “chr1:1000-2000”, :q => 50) gets the bases with quality >
|
920
|
-
50 on chr1 between 1000-5000</p>
|
911
|
+
|
912
|
+
|
921
913
|
|
922
914
|
|
923
915
|
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
<
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
<
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
<
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
<
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
</div><!-- mpileup-method -->
|
1013
|
-
|
1014
|
-
|
1015
|
-
<div id="method-i-mpileup_plus" class="method-detail ">
|
1016
|
-
|
1017
|
-
<div class="method-heading">
|
1018
|
-
<span class="method-name">mpileup_plus</span><span
|
1019
|
-
class="method-args">( opts ) { |vcf| ... }</span>
|
1020
|
-
<span class="method-click-advice">click to toggle source</span>
|
916
|
+
</div>
|
917
|
+
|
918
|
+
|
919
|
+
|
920
|
+
|
921
|
+
<div class="aliases">
|
922
|
+
Alias for: <a href="Sam.html#method-i-flag_stats">flag_stats</a>
|
923
|
+
</div>
|
924
|
+
|
925
|
+
</div>
|
926
|
+
|
927
|
+
|
928
|
+
<div id="method-i-idxstats" class="method-detail method-alias">
|
929
|
+
|
930
|
+
<div class="method-heading">
|
931
|
+
<span class="method-name">idxstats</span><span
|
932
|
+
class="method-args">()</span>
|
933
|
+
|
934
|
+
</div>
|
935
|
+
|
936
|
+
|
937
|
+
<div class="method-description">
|
938
|
+
|
939
|
+
|
940
|
+
|
941
|
+
|
942
|
+
|
943
|
+
|
944
|
+
</div>
|
945
|
+
|
946
|
+
|
947
|
+
|
948
|
+
|
949
|
+
<div class="aliases">
|
950
|
+
Alias for: <a href="Sam.html#method-i-index_stats">index_stats</a>
|
951
|
+
</div>
|
952
|
+
|
953
|
+
</div>
|
954
|
+
|
955
|
+
|
956
|
+
<div id="method-i-index" class="method-detail ">
|
957
|
+
|
958
|
+
<div class="method-heading">
|
959
|
+
<span class="method-name">index</span><span
|
960
|
+
class="method-args">(opts={})</span>
|
961
|
+
|
962
|
+
<span class="method-click-advice">click to toggle source</span>
|
963
|
+
|
964
|
+
</div>
|
965
|
+
|
966
|
+
|
967
|
+
<div class="method-description">
|
968
|
+
|
969
|
+
<p>Index sorted alignment for fast random access. Index file
|
970
|
+
<aln.bam>.bai will be created of no out_index is provided.</p>
|
971
|
+
<ul><li>
|
972
|
+
<p>out_index - [STRING] name of index</p>
|
973
|
+
</li></ul>
|
974
|
+
|
975
|
+
|
976
|
+
|
977
|
+
|
978
|
+
<div class="method-source-code" id="index-source">
|
979
|
+
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 288</span>
|
980
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">index</span>(<span class="ruby-identifier">opts</span>={})
|
981
|
+
<span class="ruby-identifier">command</span> = <span class="ruby-node">"#{@samtools} index #{@bam} #{opts[:out_index]}"</span>
|
982
|
+
<span class="ruby-comment">#puts command</span>
|
983
|
+
<span class="ruby-ivar">@last_command</span> = <span class="ruby-identifier">command</span>
|
984
|
+
<span class="ruby-identifier">system</span>(<span class="ruby-identifier">command</span>)
|
985
|
+
<span class="ruby-keyword">end</span></pre>
|
986
|
+
</div>
|
987
|
+
|
988
|
+
</div>
|
989
|
+
|
990
|
+
|
991
|
+
|
992
|
+
|
993
|
+
</div>
|
994
|
+
|
995
|
+
|
996
|
+
<div id="method-i-index_stats" class="method-detail ">
|
997
|
+
|
998
|
+
<div class="method-heading">
|
999
|
+
<span class="method-name">index_stats</span><span
|
1000
|
+
class="method-args">()</span>
|
1001
|
+
|
1002
|
+
<span class="method-click-advice">click to toggle source</span>
|
1003
|
+
|
1021
1004
|
</div>
|
1022
1005
|
|
1023
1006
|
|
1024
1007
|
<div class="method-description">
|
1025
1008
|
|
1026
|
-
<p>
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
<div class="method-source-code" id="
|
1034
|
-
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line
|
1035
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
<
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
<
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
<
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1009
|
+
<p>Retrieve and print stats in the index file. The output is TAB delimited
|
1010
|
+
with each line consisting of reference sequence name, sequence length,
|
1011
|
+
number of mapped reads and number unmapped reads.</p>
|
1012
|
+
|
1013
|
+
|
1014
|
+
|
1015
|
+
|
1016
|
+
<div class="method-source-code" id="index_stats-source">
|
1017
|
+
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 325</span>
|
1018
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">index_stats</span>
|
1019
|
+
<span class="ruby-identifier">stats</span> = {}
|
1020
|
+
<span class="ruby-identifier">command</span> = <span class="ruby-identifier">form_opt_string</span>(<span class="ruby-ivar">@samtools</span>, <span class="ruby-node">"idxstats #{@bam}"</span>, {}, [])
|
1021
|
+
<span class="ruby-ivar">@last_command</span> = <span class="ruby-identifier">command</span>
|
1022
|
+
<span class="ruby-identifier">yield_from_pipe</span>(<span class="ruby-identifier">command</span>, <span class="ruby-constant">String</span>, <span class="ruby-value">:text</span>, <span class="ruby-keyword">true</span>, <span class="ruby-node">"#"</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
|
1023
|
+
<span class="ruby-identifier">info</span> = <span class="ruby-identifier">line</span>.<span class="ruby-identifier">chomp</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp">/\t/</span>)
|
1024
|
+
<span class="ruby-identifier">stats</span>[ <span class="ruby-identifier">info</span>[<span class="ruby-value">0</span>] ] = {<span class="ruby-value">:length</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">info</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">to_i</span>, <span class="ruby-value">:mapped_reads</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">info</span>[<span class="ruby-value">2</span>].<span class="ruby-identifier">to_i</span>, <span class="ruby-value">:unmapped_reads</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">info</span>[<span class="ruby-value">3</span>].<span class="ruby-identifier">to_i</span> }
|
1025
|
+
<span class="ruby-keyword">end</span>
|
1026
|
+
<span class="ruby-identifier">stats</span>
|
1027
|
+
<span class="ruby-keyword">end</span></pre>
|
1028
|
+
</div>
|
1029
|
+
|
1030
|
+
</div>
|
1031
|
+
|
1032
|
+
|
1033
|
+
<div class="aliases">
|
1034
|
+
Also aliased as: <a href="Sam.html#method-i-idxstats">idxstats</a>
|
1035
|
+
</div>
|
1036
|
+
|
1037
|
+
|
1038
|
+
|
1039
|
+
</div>
|
1040
|
+
|
1041
|
+
|
1042
|
+
<div id="method-i-merge" class="method-detail ">
|
1043
|
+
|
1044
|
+
<div class="method-heading">
|
1045
|
+
<span class="method-name">merge</span><span
|
1046
|
+
class="method-args">(opts={})</span>
|
1047
|
+
|
1048
|
+
<span class="method-click-advice">click to toggle source</span>
|
1049
|
+
|
1050
|
+
</div>
|
1051
|
+
|
1052
|
+
|
1053
|
+
<div class="method-description">
|
1054
|
+
|
1055
|
+
<p>Merge multiple sorted alignments</p>
|
1056
|
+
<ul><li>
|
1057
|
+
<p>n - sort by read names</p>
|
1058
|
+
</li><li>
|
1059
|
+
<p>r - attach RG tag (inferred from file names)</p>
|
1060
|
+
</li><li>
|
1061
|
+
<p>u - uncompressed BAM output</p>
|
1062
|
+
</li><li>
|
1063
|
+
<p>f - overwrite the output BAM if exist</p>
|
1064
|
+
</li><li>
|
1065
|
+
<p>one - compress level 1</p>
|
1066
|
+
</li><li>
|
1067
|
+
<p>l - [INT] compression level, from 0 to 9 [-1]</p>
|
1068
|
+
</li><li>
|
1069
|
+
<p>at - [INT] number of BAM compression threads [0]</p>
|
1070
|
+
</li><li>
|
1071
|
+
<p>R - [STRING] merge file in the specified region STR [all]</p>
|
1072
|
+
</li><li>
|
1073
|
+
<p>h - [FILE] copy the header in FILE to <out.bam> [in1.bam]</p>
|
1074
|
+
</li><li>
|
1075
|
+
<p>out - [FILE] out file name</p>
|
1076
|
+
</li><li>
|
1077
|
+
<p>bams - [FILES] or <a href="Sam.html">Bio::DB::Sam</a> list of input bams,
|
1078
|
+
or <a href="Sam.html">Bio::DB::Sam</a> objects</p>
|
1079
|
+
</li></ul>
|
1080
|
+
|
1081
|
+
|
1082
|
+
|
1083
|
+
|
1084
|
+
<div class="method-source-code" id="merge-source">
|
1085
|
+
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 350</span>
|
1086
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">merge</span>(<span class="ruby-identifier">opts</span>={})
|
1087
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:one</span>]
|
1088
|
+
<span class="ruby-identifier">opts</span>[<span class="ruby-string">'1'</span>] = <span class="ruby-keyword">nil</span>
|
1089
|
+
<span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:one</span>)
|
1090
|
+
<span class="ruby-keyword">end</span>
|
1091
|
+
|
1092
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:at</span>]
|
1093
|
+
<span class="ruby-identifier">opts</span>[<span class="ruby-string">'@'</span>] = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:at</span>]
|
1094
|
+
<span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:at</span>)
|
1095
|
+
<span class="ruby-keyword">end</span>
|
1096
|
+
|
1097
|
+
<span class="ruby-identifier">out</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:out</span>]
|
1098
|
+
<span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:out</span>)
|
1099
|
+
|
1100
|
+
<span class="ruby-identifier">bam_list</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:bams</span>].<span class="ruby-identifier">collect</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">b</span><span class="ruby-operator">|</span>
|
1101
|
+
<span class="ruby-identifier">b</span>.<span class="ruby-identifier">bam</span> <span class="ruby-keyword">rescue</span> <span class="ruby-identifier">b</span>
|
1102
|
+
<span class="ruby-keyword">end</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">' '</span>)
|
1103
|
+
|
1104
|
+
<span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:bams</span>)
|
1105
|
+
<span class="ruby-identifier">options</span> = <span class="ruby-identifier">commandify</span>(<span class="ruby-identifier">opts</span>, [<span class="ruby-value">:n</span>, <span class="ruby-value">:r</span>, <span class="ruby-value">:u</span>, <span class="ruby-value">:f</span>, <span class="ruby-string">'1'</span>] )
|
1106
|
+
<span class="ruby-comment">#command = "#{form_opt_string(@samtools, "merge", opts, [:n, :r, :u, :f, '1'] )} #{out} #{bam_list}"</span>
|
1107
|
+
<span class="ruby-identifier">command</span> = <span class="ruby-node">"#{@samtools} merge #{options} #{out} #{bam_list}"</span>
|
1108
|
+
|
1109
|
+
<span class="ruby-ivar">@last_command</span> = <span class="ruby-identifier">command</span>
|
1110
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">command</span>
|
1111
|
+
<span class="ruby-identifier">system</span>(<span class="ruby-identifier">command</span>)
|
1112
|
+
|
1113
|
+
<span class="ruby-keyword">end</span></pre>
|
1114
|
+
</div>
|
1115
|
+
|
1116
|
+
</div>
|
1117
|
+
|
1118
|
+
|
1119
|
+
|
1120
|
+
|
1121
|
+
</div>
|
1122
|
+
|
1123
|
+
|
1124
|
+
<div id="method-i-mpileup" class="method-detail ">
|
1125
|
+
|
1126
|
+
<div class="method-heading">
|
1127
|
+
<span class="method-name">mpileup</span><span
|
1128
|
+
class="method-args">(opts={}, &block)</span>
|
1129
|
+
|
1130
|
+
<span class="method-click-advice">click to toggle source</span>
|
1131
|
+
|
1132
|
+
</div>
|
1133
|
+
|
1134
|
+
|
1135
|
+
<div class="method-description">
|
1136
|
+
|
1137
|
+
<p>returns a <a href="Pileup.html">Bio::DB::Pileup</a> or Bio::DB::VCF object</p>
|
1138
|
+
<ul><li>
|
1139
|
+
<p>region - Only generate pileup in region [chrom:start-stop]</p>
|
1140
|
+
</li><li>
|
1141
|
+
<p>illumina_quals - Assume the quality is in the Illumina 1.3+ encoding</p>
|
1142
|
+
</li><li>
|
1143
|
+
<p>count_anomalous - Do not skip anomalous read pairs in variant calling</p>
|
1144
|
+
</li><li>
|
1145
|
+
<p>no_baq - Disable probabilistic realignment for the computation of base
|
1146
|
+
alignment quality (BAQ). BAQ is the Phred-scaled probability of a read base
|
1147
|
+
being misaligned. Applying this option greatly helps to reduce false SNPs
|
1148
|
+
caused by misalignments.</p>
|
1149
|
+
</li><li>
|
1150
|
+
<p>adjust_mapq - [INT] Coefficient for downgrading mapping quality for reads
|
1151
|
+
containing excessive mismatches. Given a read with a phred-scaled
|
1152
|
+
probability q of being generated from the mapped position, the new mapping
|
1153
|
+
quality is about sqrt((INT-q)/INT)*INT. A zero value disables this
|
1154
|
+
functionality; if enabled, the recommended value for BWA is 50. [0]</p>
|
1155
|
+
</li><li>
|
1156
|
+
<p>max_per_bam_depth - [INT] At a position, read maximally INT reads per input
|
1157
|
+
BAM. [250]</p>
|
1158
|
+
</li><li>
|
1159
|
+
<p>extended_baq - Extended BAQ computation. This option helps sensitivity
|
1160
|
+
especially for MNPs, but may hurt specificity a little bit.</p>
|
1161
|
+
</li><li>
|
1162
|
+
<p>exclude_reads_file - [FILE] exclude read groups listed in FILE [null]</p>
|
1163
|
+
</li><li>
|
1164
|
+
<p>list_of_positions - [FILE] BED or position list file containing a list of
|
1165
|
+
regions or sites where pileup or BCF should be generated [null]</p>
|
1166
|
+
</li><li>
|
1167
|
+
<p>mapping_quality_cap - [INT] cap mapping quality at INT [60]</p>
|
1168
|
+
</li><li>
|
1169
|
+
<p>ignore_rg - ignore read group tags</p>
|
1170
|
+
</li><li>
|
1171
|
+
<p>min_mapping_quality - [INT] skip alignments with mapQ smaller than INT [0]</p>
|
1172
|
+
</li><li>
|
1173
|
+
<p>min_base_quality - [INT] skip bases with baseQ/BAQ smaller than INT [13]</p>
|
1174
|
+
</li><li>
|
1175
|
+
<p>##following options are for the -g -u option</p>
|
1176
|
+
</li><li>
|
1177
|
+
<p>genotype_calling - generate BCF output (genotype likelihoods)</p>
|
1178
|
+
</li><li>
|
1179
|
+
<p>uncompressed_bcf - generate uncompress BCF output</p>
|
1180
|
+
</li><li>
|
1181
|
+
<p>extension_sequencing_probability - [INT] Phred-scaled gap extension seq
|
1182
|
+
error probability [20]</p>
|
1183
|
+
</li><li>
|
1184
|
+
<p>homopolymer_error_coefficient - [INT] coefficient for homopolymer errors
|
1185
|
+
[100]</p>
|
1186
|
+
</li><li>
|
1187
|
+
<p>no_indels - do not perform indel calling</p>
|
1188
|
+
</li><li>
|
1189
|
+
<p>skip_indel_over_average_depth - [INT] max per-sample depth for INDEL
|
1190
|
+
calling [250]</p>
|
1191
|
+
</li><li>
|
1192
|
+
<p>gap_open_sequencing_error_probability - [INT] Phred-scaled gap open
|
1193
|
+
sequencing error probability [40]</p>
|
1194
|
+
</li><li>
|
1195
|
+
<p>platforms - [STRING] comma separated list of platforms for indels [all]</p>
|
1196
|
+
</li></ul>
|
1197
|
+
|
1198
|
+
|
1199
|
+
|
1200
|
+
|
1201
|
+
<div class="method-source-code" id="mpileup-source">
|
1202
|
+
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 195</span>
|
1203
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">mpileup</span>(<span class="ruby-identifier">opts</span>={}, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
1204
|
+
<span class="ruby-comment">#long option form to short samtools form..</span>
|
1205
|
+
<span class="ruby-identifier">long_opts</span> = {
|
1206
|
+
<span class="ruby-value">:region</span> =<span class="ruby-operator">></span> <span class="ruby-value">:r</span>,
|
1207
|
+
<span class="ruby-value">:illumina_quals</span> =<span class="ruby-operator">></span> <span class="ruby-value">:six</span>,
|
1208
|
+
<span class="ruby-value">:count_anomalous</span> =<span class="ruby-operator">></span> <span class="ruby-value">:A</span>,
|
1209
|
+
<span class="ruby-value">:no_baq</span> =<span class="ruby-operator">></span> <span class="ruby-value">:B</span>,
|
1210
|
+
<span class="ruby-value">:adjust_mapq</span> =<span class="ruby-operator">></span> <span class="ruby-value">:C</span>,
|
1211
|
+
<span class="ruby-value">:max_per_bam_depth</span> =<span class="ruby-operator">></span> <span class="ruby-value">:d</span>,
|
1212
|
+
<span class="ruby-value">:extended_baq</span> =<span class="ruby-operator">></span> <span class="ruby-value">:E</span>,
|
1213
|
+
<span class="ruby-value">:exclude_reads_file</span> =<span class="ruby-operator">></span> <span class="ruby-value">:G</span>,
|
1214
|
+
<span class="ruby-value">:list_of_positions</span> =<span class="ruby-operator">></span> <span class="ruby-value">:l</span>,
|
1215
|
+
<span class="ruby-value">:mapping_quality_cap</span> =<span class="ruby-operator">></span> <span class="ruby-value">:M</span>,
|
1216
|
+
<span class="ruby-value">:ignore_rg</span> =<span class="ruby-operator">></span> <span class="ruby-value">:R</span>,
|
1217
|
+
<span class="ruby-value">:min_mapping_quality</span> =<span class="ruby-operator">></span> <span class="ruby-value">:q</span>,
|
1218
|
+
<span class="ruby-value">:min_base_quality</span> =<span class="ruby-operator">></span> <span class="ruby-value">:Q</span>,
|
1219
|
+
<span class="ruby-comment">###following options are for the -g -u option</span>
|
1220
|
+
<span class="ruby-value">:genotype_calling</span> =<span class="ruby-operator">></span> <span class="ruby-value">:g</span>,
|
1221
|
+
<span class="ruby-value">:uncompressed_bcf</span> =<span class="ruby-operator">></span> <span class="ruby-value">:u</span>,
|
1222
|
+
<span class="ruby-value">:extension_sequencing_probability</span> =<span class="ruby-operator">></span> <span class="ruby-value">:e</span>,
|
1223
|
+
<span class="ruby-value">:homopolymer_error_coefficient</span> =<span class="ruby-operator">></span> <span class="ruby-value">:h</span>,
|
1224
|
+
<span class="ruby-value">:no_indels</span> =<span class="ruby-operator">></span> <span class="ruby-value">:I</span>,
|
1225
|
+
<span class="ruby-value">:skip_indel_over_average_depth</span> =<span class="ruby-operator">></span> <span class="ruby-value">:L</span>,
|
1226
|
+
<span class="ruby-value">:gap_open_sequencing_error_probability</span> =<span class="ruby-operator">></span> <span class="ruby-value">:o</span>,
|
1227
|
+
<span class="ruby-value">:platforms</span> =<span class="ruby-operator">></span> <span class="ruby-value">:P</span>
|
1228
|
+
}
|
1229
|
+
|
1230
|
+
<span class="ruby-comment">##convert any long_opts to short opts </span>
|
1231
|
+
<span class="ruby-identifier">temp_opts</span> = <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">dup</span>
|
1232
|
+
<span class="ruby-identifier">opts</span>.<span class="ruby-identifier">each_pair</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
|
1233
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">long_opts</span>[<span class="ruby-identifier">k</span>]
|
1234
|
+
<span class="ruby-identifier">temp_opts</span>[<span class="ruby-identifier">long_opts</span>[<span class="ruby-identifier">k</span>]] = <span class="ruby-identifier">v</span>
|
1235
|
+
<span class="ruby-identifier">temp_opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">k</span>)
|
1236
|
+
<span class="ruby-keyword">end</span>
|
1237
|
+
<span class="ruby-keyword">end</span>
|
1238
|
+
<span class="ruby-identifier">opts</span> = <span class="ruby-identifier">temp_opts</span>
|
1239
|
+
<span class="ruby-identifier">opts</span>[<span class="ruby-value">:u</span>] = <span class="ruby-keyword">true</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:g</span>] <span class="ruby-comment">#so that we always get uncompressed output</span>
|
1240
|
+
<span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:g</span>)
|
1241
|
+
|
1242
|
+
<span class="ruby-identifier">opts</span>[<span class="ruby-value">:f</span>] = <span class="ruby-ivar">@fasta</span>
|
1243
|
+
|
1244
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:six</span>]
|
1245
|
+
<span class="ruby-identifier">opts</span>[<span class="ruby-string">"6"</span>] = <span class="ruby-keyword">nil</span>
|
1246
|
+
<span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:six</span>)
|
1247
|
+
<span class="ruby-keyword">end</span>
|
1248
|
+
|
1249
|
+
<span class="ruby-identifier">command</span> = <span class="ruby-identifier">form_opt_string</span>(<span class="ruby-ivar">@samtools</span>, <span class="ruby-string">"mpileup"</span>, <span class="ruby-identifier">opts</span>, [<span class="ruby-value">:R</span>, <span class="ruby-value">:B</span>, <span class="ruby-value">:E</span>, <span class="ruby-string">"6"</span>, <span class="ruby-value">:A</span>, <span class="ruby-value">:g</span>, <span class="ruby-value">:u</span>, <span class="ruby-value">:I</span>] )
|
1250
|
+
|
1251
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:u</span>]
|
1252
|
+
<span class="ruby-identifier">command</span> = <span class="ruby-identifier">command</span> <span class="ruby-operator">+</span> <span class="ruby-node">" | #{@bcftools} view -cg -"</span>
|
1253
|
+
<span class="ruby-keyword">end</span>
|
1254
|
+
|
1255
|
+
<span class="ruby-identifier">klass</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:u</span>] <span class="ruby-operator">?</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">Vcf</span> <span class="ruby-operator">:</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">Pileup</span>
|
1256
|
+
<span class="ruby-ivar">@last_command</span> = <span class="ruby-identifier">command</span>
|
1257
|
+
<span class="ruby-identifier">yield_from_pipe</span>(<span class="ruby-identifier">command</span>, <span class="ruby-identifier">klass</span>, <span class="ruby-value">:text</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
1258
|
+
|
1259
|
+
<span class="ruby-keyword">end</span></pre>
|
1260
|
+
</div>
|
1261
|
+
|
1262
|
+
</div>
|
1263
|
+
|
1264
|
+
|
1265
|
+
|
1266
|
+
|
1267
|
+
</div>
|
1145
1268
|
|
1146
1269
|
|
1147
1270
|
<div id="method-i-open" class="method-detail ">
|
@@ -1149,129 +1272,582 @@ and supports returning of pileup vcf</p>
|
|
1149
1272
|
<div class="method-heading">
|
1150
1273
|
<span class="method-name">open</span><span
|
1151
1274
|
class="method-args">()</span>
|
1275
|
+
|
1152
1276
|
<span class="method-click-advice">click to toggle source</span>
|
1277
|
+
|
1153
1278
|
</div>
|
1154
1279
|
|
1155
1280
|
|
1156
1281
|
<div class="method-description">
|
1157
1282
|
|
1158
|
-
<p>
|
1159
|
-
|
1283
|
+
<p>backward compatibility method, returns true if file exists otherwise,
|
1284
|
+
complains and quits.</p>
|
1285
|
+
|
1160
1286
|
|
1161
1287
|
|
1162
1288
|
|
1163
1289
|
<div class="method-source-code" id="open-source">
|
1164
|
-
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line
|
1165
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">open</span>
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1290
|
+
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 29</span>
|
1291
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">open</span>
|
1292
|
+
<span class="ruby-identifier">files_ok?</span>
|
1293
|
+
<span class="ruby-keyword">end</span></pre>
|
1294
|
+
</div>
|
1295
|
+
|
1296
|
+
</div>
|
1297
|
+
|
1298
|
+
|
1299
|
+
|
1300
|
+
|
1301
|
+
</div>
|
1302
|
+
|
1303
|
+
|
1304
|
+
<div id="method-i-phase" class="method-detail ">
|
1305
|
+
|
1306
|
+
<div class="method-heading">
|
1307
|
+
<span class="method-name">phase</span><span
|
1308
|
+
class="method-args">(opts={})</span>
|
1309
|
+
|
1310
|
+
<span class="method-click-advice">click to toggle source</span>
|
1311
|
+
|
1312
|
+
</div>
|
1313
|
+
|
1314
|
+
|
1315
|
+
<div class="method-description">
|
1316
|
+
|
1317
|
+
<p>Call and phase heterozygous SNPs</p>
|
1318
|
+
<ul><li>
|
1319
|
+
<p>A - Drop reads with ambiguous phase.</p>
|
1320
|
+
</li><li>
|
1321
|
+
<p>b - [STR] Prefix of BAM output. When this option is in use, phase-0 reads
|
1322
|
+
will be saved in file STR.0.bam and phase-1 reads in STR.1.bam. Phase
|
1323
|
+
unknown reads will be randomly allocated to one of the two files. Chimeric
|
1324
|
+
reads with switch errors will be saved in STR.chimeric.bam. [null]</p>
|
1325
|
+
</li><li>
|
1326
|
+
<p>F - Do not attempt to fix chimeric reads.</p>
|
1327
|
+
</li><li>
|
1328
|
+
<p>k - [INT] Maximum length for local phasing. [13]</p>
|
1329
|
+
</li><li>
|
1330
|
+
<p>q - [INT] Minimum Phred-scaled LOD to call a heterozygote. [40]</p>
|
1331
|
+
</li><li>
|
1332
|
+
<p>Q - [INT] Minimum base quality to be used in het calling. [13]</p>
|
1333
|
+
</li></ul>
|
1334
|
+
|
1335
|
+
|
1336
|
+
|
1337
|
+
|
1338
|
+
<div class="method-source-code" id="phase-source">
|
1339
|
+
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 525</span>
|
1340
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">phase</span>(<span class="ruby-identifier">opts</span>={})
|
1341
|
+
<span class="ruby-identifier">command</span> = <span class="ruby-node">"#{form_opt_string(@samtools, "phase", opts, [:A, :F] )}"</span>
|
1342
|
+
<span class="ruby-ivar">@last_command</span> = <span class="ruby-identifier">command</span>
|
1343
|
+
<span class="ruby-identifier">system</span>(<span class="ruby-identifier">command</span>)
|
1344
|
+
<span class="ruby-keyword">end</span></pre>
|
1345
|
+
</div>
|
1346
|
+
|
1347
|
+
</div>
|
1348
|
+
|
1349
|
+
|
1350
|
+
|
1351
|
+
|
1352
|
+
</div>
|
1353
|
+
|
1354
|
+
|
1355
|
+
<div id="method-i-plot_chromosome_coverage" class="method-detail ">
|
1356
|
+
|
1357
|
+
<div class="method-heading">
|
1358
|
+
<span class="method-name">plot_chromosome_coverage</span><span
|
1359
|
+
class="method-args">(chr,start,length, opts={})</span>
|
1360
|
+
|
1361
|
+
<span class="method-click-advice">click to toggle source</span>
|
1362
|
+
|
1363
|
+
</div>
|
1364
|
+
|
1365
|
+
|
1366
|
+
<div class="method-description">
|
1367
|
+
|
1368
|
+
<p>returns an array of coverage for each location for which there are mapped
|
1369
|
+
reads</p>
|
1370
|
+
<ul><li>
|
1371
|
+
<p>chr - the reference name</p>
|
1372
|
+
</li><li>
|
1373
|
+
<p>start - the start position</p>
|
1374
|
+
</li><li>
|
1375
|
+
<p>length - the length of the region queried</p>
|
1376
|
+
</li></ul>
|
1377
|
+
|
1378
|
+
<p>OPTIONS</p>
|
1379
|
+
<ul><li>
|
1380
|
+
<p>bin - the amount of bins to split the histogram into. A mean score for each
|
1381
|
+
bin will be plotted. [default 30 bins]</p>
|
1382
|
+
</li><li>
|
1383
|
+
<p>svg - a file to write the svg image to [default a String object containing
|
1384
|
+
the SVG]</p>
|
1385
|
+
</li></ul>
|
1386
|
+
|
1387
|
+
|
1388
|
+
|
1389
|
+
|
1390
|
+
<div class="method-source-code" id="plot_chromosome_coverage-source">
|
1391
|
+
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 119</span>
|
1392
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">plot_chromosome_coverage</span>(<span class="ruby-identifier">chr</span>,<span class="ruby-identifier">start</span>,<span class="ruby-identifier">length</span>, <span class="ruby-identifier">opts</span>={})
|
1393
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:bin</span>]
|
1394
|
+
<span class="ruby-identifier">bin</span> = <span class="ruby-identifier">length</span><span class="ruby-operator">/</span><span class="ruby-identifier">opts</span>[<span class="ruby-value">:bin</span>]
|
1395
|
+
<span class="ruby-keyword">else</span>
|
1396
|
+
<span class="ruby-identifier">bin</span> = <span class="ruby-identifier">length</span><span class="ruby-operator">/</span><span class="ruby-value">30</span>
|
1178
1397
|
<span class="ruby-keyword">end</span>
|
1179
|
-
<span class="ruby-identifier">
|
1180
|
-
<span class="ruby-
|
1181
|
-
|
1398
|
+
<span class="ruby-identifier">result</span> = []
|
1399
|
+
<span class="ruby-identifier">region</span> = <span class="ruby-node">"#{chr}:#{start}-#{start + length}"</span>
|
1400
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">mpileup</span>(<span class="ruby-value">:r</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">region</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span>
|
1401
|
+
<span class="ruby-identifier">result</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">coverage</span>
|
1182
1402
|
<span class="ruby-keyword">end</span>
|
1403
|
+
<span class="ruby-identifier">p</span> = <span class="ruby-constant">Bio</span><span class="ruby-operator">::</span><span class="ruby-constant">Graphics</span><span class="ruby-operator">::</span><span class="ruby-constant">Page</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">:width</span> =<span class="ruby-operator">></span> <span class="ruby-value">1000</span>,
|
1404
|
+
<span class="ruby-value">:height</span> =<span class="ruby-operator">></span> <span class="ruby-value">200</span>,
|
1405
|
+
<span class="ruby-value">:number_of_intervals</span> =<span class="ruby-operator">></span> <span class="ruby-value">10</span>,
|
1406
|
+
<span class="ruby-value">:font_size</span> =<span class="ruby-operator">></span> <span class="ruby-value">14</span>
|
1407
|
+
)
|
1408
|
+
<span class="ruby-identifier">data_track</span> = <span class="ruby-identifier">p</span>.<span class="ruby-identifier">add_track</span>(<span class="ruby-value">:glyph</span> =<span class="ruby-operator">></span> <span class="ruby-value">:histogram</span>,
|
1409
|
+
<span class="ruby-value">:stroke_color</span> =<span class="ruby-operator">></span> <span class="ruby-string">'black'</span>,
|
1410
|
+
<span class="ruby-value">:fill_color</span> =<span class="ruby-operator">></span> <span class="ruby-string">'gold'</span>,
|
1411
|
+
<span class="ruby-value">:track_height</span> =<span class="ruby-operator">></span> <span class="ruby-value">150</span>,
|
1412
|
+
<span class="ruby-value">:name</span> =<span class="ruby-operator">></span> <span class="ruby-string">'read coverage'</span>,
|
1413
|
+
<span class="ruby-value">:label</span> =<span class="ruby-operator">></span> <span class="ruby-keyword">true</span>,
|
1414
|
+
<span class="ruby-value">:stroke_width</span> =<span class="ruby-operator">></span> <span class="ruby-string">'1'</span>,
|
1415
|
+
<span class="ruby-value">:x_round</span> =<span class="ruby-operator">></span> <span class="ruby-value">1</span>,
|
1416
|
+
<span class="ruby-value">:y_round</span> =<span class="ruby-operator">></span> <span class="ruby-value">1</span> )
|
1417
|
+
<span class="ruby-identifier">index</span> = <span class="ruby-value">0</span>;
|
1418
|
+
<span class="ruby-identifier">result</span>.<span class="ruby-identifier">each_slice</span>(<span class="ruby-identifier">bin</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">slice</span><span class="ruby-operator">|</span>
|
1419
|
+
<span class="ruby-comment">#result.each_with_index {|val, index|</span>
|
1420
|
+
<span class="ruby-identifier">data_feature</span> = <span class="ruby-constant">Bio</span><span class="ruby-operator">::</span><span class="ruby-constant">Graphics</span><span class="ruby-operator">::</span><span class="ruby-constant">MiniFeature</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">:start</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">start</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">index</span>,
|
1421
|
+
<span class="ruby-value">:end</span> =<span class="ruby-operator">></span> (<span class="ruby-identifier">start</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">index</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">bin</span>),
|
1422
|
+
<span class="ruby-value">:segment_height</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">slice</span>.<span class="ruby-identifier">inject</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">sum</span>,<span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">sum</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">x</span> }.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-identifier">slice</span>.<span class="ruby-identifier">size</span>)
|
1423
|
+
<span class="ruby-identifier">data_track</span>.<span class="ruby-identifier">add</span>(<span class="ruby-identifier">data_feature</span>)
|
1424
|
+
<span class="ruby-identifier">index</span><span class="ruby-operator">+=</span><span class="ruby-identifier">bin</span>
|
1425
|
+
}
|
1426
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:svg</span>]
|
1427
|
+
<span class="ruby-identifier">svg</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:svg</span>].<span class="ruby-identifier">to_s</span>
|
1428
|
+
<span class="ruby-identifier">p</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">svg</span>)
|
1429
|
+
<span class="ruby-keyword">else</span>
|
1430
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">get_markup</span>
|
1431
|
+
<span class="ruby-keyword">end</span>
|
1432
|
+
|
1433
|
+
|
1434
|
+
<span class="ruby-keyword">end</span></pre>
|
1435
|
+
</div>
|
1436
|
+
|
1437
|
+
</div>
|
1438
|
+
|
1439
|
+
|
1440
|
+
|
1441
|
+
|
1442
|
+
</div>
|
1443
|
+
|
1444
|
+
|
1445
|
+
<div id="method-i-reheader" class="method-detail ">
|
1446
|
+
|
1447
|
+
<div class="method-heading">
|
1448
|
+
<span class="method-name">reheader</span><span
|
1449
|
+
class="method-args">(header_sam, opts={})</span>
|
1450
|
+
|
1451
|
+
<span class="method-click-advice">click to toggle source</span>
|
1452
|
+
|
1453
|
+
</div>
|
1454
|
+
|
1183
1455
|
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1456
|
+
<div class="method-description">
|
1457
|
+
|
1458
|
+
<p>Replace the header of the current bam file with the header in header_sam</p>
|
1459
|
+
<ul><li>
|
1460
|
+
<p>header_sam - the sam file from which the new header will be taken</p>
|
1461
|
+
</li><li>
|
1462
|
+
<p>out - [FILE] output bam file</p>
|
1463
|
+
</li></ul>
|
1464
|
+
|
1465
|
+
|
1466
|
+
|
1467
|
+
|
1468
|
+
<div class="method-source-code" id="reheader-source">
|
1469
|
+
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 471</span>
|
1470
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">reheader</span>(<span class="ruby-identifier">header_sam</span>, <span class="ruby-identifier">opts</span>={})
|
1471
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-value">:out</span>)
|
1472
|
+
<span class="ruby-identifier">out</span>=<span class="ruby-identifier">opts</span>[<span class="ruby-value">:out</span>]
|
1473
|
+
<span class="ruby-identifier">command</span> = <span class="ruby-node">"#{@samtools} reheader #{header_sam} #{@bam} > #{out}"</span>
|
1474
|
+
<span class="ruby-keyword">else</span>
|
1475
|
+
<span class="ruby-identifier">command</span> = <span class="ruby-node">"#{@samtools} reheader #{header_sam} #{@bam}"</span>
|
1188
1476
|
<span class="ruby-keyword">end</span>
|
1189
|
-
<span class="ruby-
|
1477
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">command</span>
|
1478
|
+
<span class="ruby-ivar">@last_command</span> = <span class="ruby-identifier">command</span>
|
1479
|
+
<span class="ruby-identifier">system</span>(<span class="ruby-identifier">command</span>)
|
1480
|
+
<span class="ruby-keyword">end</span></pre>
|
1481
|
+
</div>
|
1482
|
+
|
1483
|
+
</div>
|
1190
1484
|
|
1485
|
+
|
1486
|
+
|
1487
|
+
|
1488
|
+
</div>
|
1489
|
+
|
1490
|
+
|
1491
|
+
<div id="method-i-remove_duplicates" class="method-detail ">
|
1492
|
+
|
1493
|
+
<div class="method-heading">
|
1494
|
+
<span class="method-name">remove_duplicates</span><span
|
1495
|
+
class="method-args">(opts={})</span>
|
1496
|
+
|
1497
|
+
<span class="method-click-advice">click to toggle source</span>
|
1498
|
+
|
1499
|
+
</div>
|
1500
|
+
|
1501
|
+
|
1502
|
+
<div class="method-description">
|
1503
|
+
|
1504
|
+
<p>Remove potential PCR duplicates: if multiple read pairs have identical
|
1505
|
+
external coordinates, only retain the pair with highest mapping quality.</p>
|
1506
|
+
<ul><li>
|
1507
|
+
<p>s - rmdup for SE reads</p>
|
1508
|
+
</li><li>
|
1509
|
+
<p>S - treat PE reads as SE in rmdup (force -s)</p>
|
1510
|
+
</li><li>
|
1511
|
+
<p>out - [FILE] output bam</p>
|
1512
|
+
</li></ul>
|
1513
|
+
|
1514
|
+
|
1515
|
+
|
1516
|
+
|
1517
|
+
<div class="method-source-code" id="remove_duplicates-source">
|
1518
|
+
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 411</span>
|
1519
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">remove_duplicates</span>(<span class="ruby-identifier">opts</span>={})
|
1520
|
+
<span class="ruby-identifier">out</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:out</span>]
|
1521
|
+
<span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:out</span>)
|
1522
|
+
<span class="ruby-identifier">command</span> = <span class="ruby-node">"#{form_opt_string(@samtools, "rmdup", opts, [:s, :S])} #{out} #{@bam}"</span>
|
1523
|
+
<span class="ruby-ivar">@last_command</span> = <span class="ruby-identifier">command</span>
|
1524
|
+
<span class="ruby-identifier">system</span>(<span class="ruby-identifier">command</span>)
|
1191
1525
|
<span class="ruby-keyword">end</span></pre>
|
1192
|
-
</div
|
1526
|
+
</div>
|
1193
1527
|
|
1194
1528
|
</div>
|
1195
1529
|
|
1196
1530
|
|
1531
|
+
<div class="aliases">
|
1532
|
+
Also aliased as: <a href="Sam.html#method-i-rmdup">rmdup</a>
|
1533
|
+
</div>
|
1534
|
+
|
1197
1535
|
|
1198
1536
|
|
1199
|
-
</div
|
1537
|
+
</div>
|
1200
1538
|
|
1201
1539
|
|
1202
|
-
<div id="method-i-
|
1540
|
+
<div id="method-i-rmdup" class="method-detail method-alias">
|
1203
1541
|
|
1204
1542
|
<div class="method-heading">
|
1205
|
-
<span class="method-name">
|
1206
|
-
class="method-args">(
|
1543
|
+
<span class="method-name">rmdup</span><span
|
1544
|
+
class="method-args">(opts={})</span>
|
1545
|
+
|
1546
|
+
</div>
|
1547
|
+
|
1548
|
+
|
1549
|
+
<div class="method-description">
|
1550
|
+
|
1551
|
+
|
1552
|
+
|
1553
|
+
|
1554
|
+
|
1555
|
+
|
1556
|
+
</div>
|
1557
|
+
|
1558
|
+
|
1559
|
+
|
1560
|
+
|
1561
|
+
<div class="aliases">
|
1562
|
+
Alias for: <a href="Sam.html#method-i-remove_duplicates">remove_duplicates</a>
|
1563
|
+
</div>
|
1564
|
+
|
1565
|
+
</div>
|
1566
|
+
|
1567
|
+
|
1568
|
+
<div id="method-i-sort" class="method-detail ">
|
1569
|
+
|
1570
|
+
<div class="method-heading">
|
1571
|
+
<span class="method-name">sort</span><span
|
1572
|
+
class="method-args">(opts={})</span>
|
1573
|
+
|
1207
1574
|
<span class="method-click-advice">click to toggle source</span>
|
1575
|
+
|
1208
1576
|
</div>
|
1209
1577
|
|
1210
1578
|
|
1211
1579
|
<div class="method-description">
|
1212
1580
|
|
1213
|
-
<p>
|
1214
|
-
|
1581
|
+
<p>Sort alignments by leftmost coordinates</p>
|
1582
|
+
<ul><li>
|
1583
|
+
<p>n - sort by read name</p>
|
1584
|
+
</li><li>
|
1585
|
+
<p>f - use <out.prefix> as full file name instead of prefix</p>
|
1586
|
+
</li><li>
|
1587
|
+
<p>o - final output to stdout returns bio::db::alignment</p>
|
1588
|
+
</li><li>
|
1589
|
+
<p>l - [INT] compression level, from 0 to 9 [-1]</p>
|
1590
|
+
</li><li>
|
1591
|
+
<p>at - [INT] number of sorting and compression threads [1]</p>
|
1592
|
+
</li><li>
|
1593
|
+
<p>m - [INT] max memory per thread; suffix K/M/G recognized [768M]</p>
|
1594
|
+
</li><li>
|
1595
|
+
<p>prefix - [STRING] prefix for output bamfile</p>
|
1596
|
+
</li></ul>
|
1597
|
+
|
1598
|
+
|
1599
|
+
|
1600
|
+
|
1601
|
+
<div class="method-source-code" id="sort-source">
|
1602
|
+
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 429</span>
|
1603
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">sort</span>(<span class="ruby-identifier">opts</span>={})
|
1604
|
+
<span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">opts</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-value">:prefix</span>)
|
1605
|
+
<span class="ruby-identifier">opts</span>.<span class="ruby-identifier">merge!</span>({<span class="ruby-value">:prefix</span> =<span class="ruby-operator">></span> <span class="ruby-string">"sorted"</span>})
|
1606
|
+
<span class="ruby-keyword">end</span>
|
1607
|
+
<span class="ruby-identifier">prefix</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:prefix</span>]
|
1608
|
+
<span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:prefix</span>)
|
1609
|
+
<span class="ruby-identifier">command</span> = <span class="ruby-identifier">form_opt_string</span>(<span class="ruby-ivar">@samtools</span>, <span class="ruby-string">"sort"</span>, <span class="ruby-identifier">opts</span>, [<span class="ruby-value">:n</span>, <span class="ruby-value">:f</span>, <span class="ruby-value">:o</span>])
|
1610
|
+
<span class="ruby-identifier">command</span> = <span class="ruby-identifier">command</span> <span class="ruby-operator">+</span> <span class="ruby-string">" "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">prefix</span>
|
1611
|
+
<span class="ruby-ivar">@last_command</span> = <span class="ruby-identifier">command</span>
|
1612
|
+
<span class="ruby-comment">#puts command</span>
|
1613
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:o</span>]
|
1614
|
+
<span class="ruby-identifier">yield_from_pipe</span>(<span class="ruby-identifier">command</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">Alignment</span>)
|
1615
|
+
<span class="ruby-keyword">else</span>
|
1616
|
+
<span class="ruby-identifier">system</span>(<span class="ruby-identifier">command</span>)
|
1617
|
+
<span class="ruby-keyword">end</span>
|
1618
|
+
<span class="ruby-keyword">end</span></pre>
|
1619
|
+
</div>
|
1215
1620
|
|
1621
|
+
</div>
|
1216
1622
|
|
1623
|
+
|
1624
|
+
|
1625
|
+
|
1626
|
+
</div>
|
1627
|
+
|
1628
|
+
|
1629
|
+
<div id="method-i-targetcut" class="method-detail ">
|
1630
|
+
|
1631
|
+
<div class="method-heading">
|
1632
|
+
<span class="method-name">targetcut</span><span
|
1633
|
+
class="method-args">(opts={})</span>
|
1634
|
+
|
1635
|
+
<span class="method-click-advice">click to toggle source</span>
|
1217
1636
|
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1637
|
+
</div>
|
1638
|
+
|
1639
|
+
|
1640
|
+
<div class="method-description">
|
1641
|
+
|
1642
|
+
<p>Identifies target regions by examining the continuity of read depth,
|
1643
|
+
computes haploid consensus sequences of targets and outputs a SAM with each
|
1644
|
+
sequence corresponding to a target. When option -f is in use, BAQ will be
|
1645
|
+
applied.</p>
|
1646
|
+
<ul><li>
|
1647
|
+
<p>Q - [INT] Minimum base quality for a base to be considered [13]</p>
|
1648
|
+
</li><li>
|
1649
|
+
<p>i - in penalty</p>
|
1650
|
+
</li><li>
|
1651
|
+
<p>0 - em0</p>
|
1652
|
+
</li><li>
|
1653
|
+
<p>1 - em1</p>
|
1654
|
+
</li><li>
|
1655
|
+
<p>2 - em2</p>
|
1656
|
+
</li><li>
|
1657
|
+
<p>f - reference</p>
|
1658
|
+
</li></ul>
|
1659
|
+
|
1660
|
+
|
1661
|
+
|
1662
|
+
|
1663
|
+
<div class="method-source-code" id="targetcut-source">
|
1664
|
+
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 507</span>
|
1665
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">targetcut</span>(<span class="ruby-identifier">opts</span>={})
|
1666
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:f</span>]
|
1667
|
+
<span class="ruby-identifier">opts</span>[<span class="ruby-string">'f'</span>] = <span class="ruby-ivar">@fasta</span>
|
1668
|
+
<span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:s</span>)
|
1669
|
+
<span class="ruby-keyword">end</span>
|
1670
|
+
|
1671
|
+
<span class="ruby-identifier">command</span> = <span class="ruby-node">"#{form_opt_string(@samtools, "targetcut", opts, [] )}"</span>
|
1672
|
+
<span class="ruby-ivar">@last_command</span> = <span class="ruby-identifier">command</span>
|
1673
|
+
<span class="ruby-identifier">system</span>(<span class="ruby-identifier">command</span>)
|
1223
1674
|
<span class="ruby-keyword">end</span></pre>
|
1224
|
-
</div
|
1675
|
+
</div>
|
1225
1676
|
|
1226
1677
|
</div>
|
1227
1678
|
|
1228
1679
|
|
1229
1680
|
|
1230
1681
|
|
1231
|
-
</div
|
1682
|
+
</div>
|
1232
1683
|
|
1233
1684
|
|
1234
|
-
<div id="method-i-
|
1685
|
+
<div id="method-i-tview" class="method-detail ">
|
1235
1686
|
|
1236
1687
|
<div class="method-heading">
|
1237
|
-
<span class="method-name">
|
1238
|
-
class="method-args">()</span>
|
1688
|
+
<span class="method-name">tview</span><span
|
1689
|
+
class="method-args">(opts={})</span>
|
1690
|
+
|
1239
1691
|
<span class="method-click-advice">click to toggle source</span>
|
1692
|
+
|
1240
1693
|
</div>
|
1241
1694
|
|
1242
1695
|
|
1243
1696
|
<div class="method-description">
|
1244
1697
|
|
1245
|
-
<p>
|
1246
|
-
|
1698
|
+
<p>used to generate a text alignment viewer</p>
|
1699
|
+
<ul><li>
|
1700
|
+
<p>d - display, output as (H)tml or (C)urses or (T)ext</p>
|
1701
|
+
</li><li>
|
1702
|
+
<p>p - [chr:pos] go directly to this position</p>
|
1703
|
+
</li><li>
|
1704
|
+
<p>s - [STR] display only reads from this sample or group</p>
|
1705
|
+
</li></ul>
|
1706
|
+
|
1247
1707
|
|
1248
1708
|
|
1249
1709
|
|
1250
|
-
<div class="method-source-code" id="
|
1251
|
-
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line
|
1252
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">
|
1253
|
-
|
1710
|
+
<div class="method-source-code" id="tview-source">
|
1711
|
+
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 450</span>
|
1712
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">tview</span>(<span class="ruby-identifier">opts</span>={})
|
1713
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:d</span>]
|
1714
|
+
<span class="ruby-identifier">opts</span>[<span class="ruby-string">'d'</span>] = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:d</span>]
|
1715
|
+
<span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:d</span>)
|
1716
|
+
<span class="ruby-keyword">end</span>
|
1717
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:p</span>]
|
1718
|
+
<span class="ruby-identifier">opts</span>[<span class="ruby-string">'p'</span>] = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:p</span>]
|
1719
|
+
<span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:p</span>)
|
1720
|
+
<span class="ruby-keyword">end</span>
|
1721
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:s</span>]
|
1722
|
+
<span class="ruby-identifier">opts</span>[<span class="ruby-string">'s'</span>] = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:s</span>]
|
1723
|
+
<span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:s</span>)
|
1724
|
+
<span class="ruby-keyword">end</span>
|
1725
|
+
<span class="ruby-identifier">command</span> = <span class="ruby-node">"#{form_opt_string(@samtools, "tview", opts)}"</span>
|
1726
|
+
<span class="ruby-ivar">@last_command</span> = <span class="ruby-identifier">command</span>
|
1727
|
+
<span class="ruby-identifier">system</span>(<span class="ruby-identifier">command</span>)
|
1254
1728
|
<span class="ruby-keyword">end</span></pre>
|
1255
|
-
</div
|
1729
|
+
</div>
|
1256
1730
|
|
1257
1731
|
</div>
|
1258
1732
|
|
1259
1733
|
|
1260
1734
|
|
1261
1735
|
|
1262
|
-
</div
|
1736
|
+
</div>
|
1263
1737
|
|
1264
1738
|
|
1265
|
-
|
1739
|
+
<div id="method-i-view" class="method-detail ">
|
1740
|
+
|
1741
|
+
<div class="method-heading">
|
1742
|
+
<span class="method-name">view</span><span
|
1743
|
+
class="method-args">(opts={},&block)</span>
|
1744
|
+
|
1745
|
+
<span class="method-click-advice">click to toggle source</span>
|
1746
|
+
|
1747
|
+
</div>
|
1748
|
+
|
1749
|
+
|
1750
|
+
<div class="method-description">
|
1751
|
+
|
1752
|
+
<p>runs the samtools view command</p>
|
1753
|
+
<ul><li>
|
1754
|
+
<p>b - output BAM</p>
|
1755
|
+
</li><li>
|
1756
|
+
<p>h - print header for the SAM output</p>
|
1757
|
+
</li><li>
|
1758
|
+
<p>H - print header only (no alignments)</p>
|
1759
|
+
</li><li>
|
1760
|
+
<p>S - input is SAM</p>
|
1761
|
+
</li><li>
|
1762
|
+
<p>u - uncompressed BAM output (force -b)</p>
|
1763
|
+
</li><li>
|
1764
|
+
<p>one - fast compression (force -b)</p>
|
1765
|
+
</li><li>
|
1766
|
+
<p>x - output FLAG in HEX (samtools-C specific)</p>
|
1767
|
+
</li><li>
|
1768
|
+
<p>X - output FLAG in string (samtools-C specific)</p>
|
1769
|
+
</li><li>
|
1770
|
+
<p>c - print only the count of matching records</p>
|
1771
|
+
</li><li>
|
1772
|
+
<p>B - collapse the backward CIGAR operation</p>
|
1773
|
+
</li><li>
|
1774
|
+
<p>at - INT number of BAM compression threads [0]</p>
|
1775
|
+
</li><li>
|
1776
|
+
<p>L - FILE output alignments overlapping the input BED FILE [null]</p>
|
1777
|
+
</li><li>
|
1778
|
+
<p>t - FILE list of reference names and lengths (force -S) [null]</p>
|
1779
|
+
</li><li>
|
1780
|
+
<p>T - FILE reference sequence file (force -S) [null]</p>
|
1781
|
+
</li><li>
|
1782
|
+
<p>o - FILE output file name [stdout]</p>
|
1783
|
+
</li><li>
|
1784
|
+
<p>R - FILE list of read groups to be outputted [null]</p>
|
1785
|
+
</li><li>
|
1786
|
+
<p>f - INT required flag 0 for unset [0]</p>
|
1787
|
+
</li><li>
|
1788
|
+
<p>F - INT filtering flag 0 for unset [0]</p>
|
1789
|
+
</li><li>
|
1790
|
+
<p>q - INT minimum mapping quality [0]</p>
|
1791
|
+
</li><li>
|
1792
|
+
<p>l - STR only output reads in library STR [null]</p>
|
1793
|
+
</li><li>
|
1794
|
+
<p>r - STR only output reads in read group STR [null]</p>
|
1795
|
+
</li><li>
|
1796
|
+
<p>s - FLOAT fraction of templates to subsample; integer part as seed [-1]</p>
|
1797
|
+
</li><li>
|
1798
|
+
<p>chr - name of reference sequence to get alignments from</p>
|
1799
|
+
</li><li>
|
1800
|
+
<p>start - start position on reference sequence</p>
|
1801
|
+
</li><li>
|
1802
|
+
<p>stop - end postion on reference sequence</p>
|
1803
|
+
</li></ul>
|
1804
|
+
|
1805
|
+
|
1806
|
+
|
1807
|
+
|
1808
|
+
<div class="method-source-code" id="view-source">
|
1809
|
+
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 59</span>
|
1810
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">view</span>(<span class="ruby-identifier">opts</span>={},<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
1811
|
+
<span class="ruby-identifier">region</span> = <span class="ruby-constant">String</span>.<span class="ruby-identifier">new</span>
|
1812
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:chr</span>] <span class="ruby-keyword">and</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:start</span>] <span class="ruby-keyword">and</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:stop</span>]
|
1813
|
+
<span class="ruby-identifier">region</span> = <span class="ruby-node">"#{opts[:chr]}:#{opts[:start]}-#{opts[:stop]}"</span>
|
1814
|
+
[<span class="ruby-value">:chr</span>, <span class="ruby-value">:start</span>, <span class="ruby-value">:stop</span>].<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">o</span><span class="ruby-operator">|</span> <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">o</span>)}
|
1815
|
+
<span class="ruby-keyword">end</span>
|
1816
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:at</span>]
|
1817
|
+
<span class="ruby-identifier">opts</span>[<span class="ruby-string">'@'</span>] = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:at</span>]
|
1818
|
+
<span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:at</span>)
|
1819
|
+
<span class="ruby-keyword">end</span>
|
1266
1820
|
|
1267
|
-
</
|
1821
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:one</span>]
|
1822
|
+
<span class="ruby-identifier">opts</span>[<span class="ruby-string">'1'</span>] = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:one</span>]
|
1823
|
+
<span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:one</span>)
|
1824
|
+
<span class="ruby-keyword">end</span>
|
1825
|
+
|
1826
|
+
<span class="ruby-identifier">command</span> = <span class="ruby-identifier">form_opt_string</span>(<span class="ruby-ivar">@samtools</span>, <span class="ruby-string">'view'</span>, <span class="ruby-identifier">opts</span>, [<span class="ruby-value">:b</span>, <span class="ruby-value">:h</span>, <span class="ruby-value">:H</span>, <span class="ruby-value">:S</span>, <span class="ruby-value">:u</span>, <span class="ruby-string">'1'</span>, <span class="ruby-value">:x</span>, <span class="ruby-value">:X</span>, <span class="ruby-value">:c</span>, <span class="ruby-value">:B</span>]) <span class="ruby-operator">+</span> <span class="ruby-string">" "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">region</span>
|
1827
|
+
<span class="ruby-ivar">@last_command</span> = <span class="ruby-identifier">command</span>
|
1828
|
+
<span class="ruby-identifier">type</span> = (<span class="ruby-identifier">opts</span>[<span class="ruby-value">:u</span>] <span class="ruby-keyword">or</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:b</span>]) <span class="ruby-operator">?</span> <span class="ruby-value">:binary</span> <span class="ruby-operator">:</span> <span class="ruby-value">:text</span>
|
1829
|
+
<span class="ruby-identifier">klass</span> = (<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:binary</span>) <span class="ruby-operator">?</span> <span class="ruby-constant">String</span> <span class="ruby-operator">:</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">Alignment</span>
|
1830
|
+
<span class="ruby-identifier">yield_from_pipe</span>(<span class="ruby-identifier">command</span>, <span class="ruby-identifier">klass</span>, <span class="ruby-identifier">type</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
1831
|
+
<span class="ruby-keyword">end</span></pre>
|
1832
|
+
</div>
|
1833
|
+
|
1834
|
+
</div>
|
1835
|
+
|
1836
|
+
|
1268
1837
|
|
1269
|
-
|
1838
|
+
|
1839
|
+
</div>
|
1840
|
+
|
1841
|
+
|
1842
|
+
</section>
|
1843
|
+
|
1844
|
+
</section>
|
1845
|
+
</main>
|
1270
1846
|
|
1271
1847
|
|
1272
|
-
<footer id="validator-badges">
|
1273
|
-
<p><a href="http://validator.w3.org/check/referer">
|
1274
|
-
<p>Generated by <a href="
|
1275
|
-
<p>
|
1848
|
+
<footer id="validator-badges" role="contentinfo">
|
1849
|
+
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
1850
|
+
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.1.
|
1851
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
1276
1852
|
</footer>
|
1277
1853
|
|