bio-samtools-wrapper 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/.travis.yml +27 -0
- data/Gemfile +20 -0
- data/LICENSE.txt +702 -0
- data/README.md +501 -0
- data/Rakefile +73 -0
- data/VERSION +1 -0
- data/bin/bam_consensus.rb +85 -0
- data/bio-samtools-wrapper.gemspec +181 -0
- data/doc/Bio/DB/Alignment.html +552 -0
- data/doc/Bio/DB/Pileup.html +711 -0
- data/doc/Bio/DB/SAM/Library.html +167 -0
- data/doc/Bio/DB/SAM/Tools.html +109 -0
- data/doc/Bio/DB/SAM.html +1853 -0
- data/doc/Bio/DB/Tag.html +208 -0
- data/doc/Bio/DB/Vcf.html +431 -0
- data/doc/Bio/DB.html +105 -0
- data/doc/Bio.html +175 -0
- data/doc/LICENSE_txt.html +846 -0
- data/doc/created.rid +9 -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/fonts.css +167 -0
- data/doc/images/add.png +0 -0
- data/doc/images/arrow_up.png +0 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/delete.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_blue.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/transparent.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +106 -0
- data/doc/js/darkfish.js +140 -0
- data/doc/js/jquery.js +18 -0
- data/doc/js/navigation.js +142 -0
- data/doc/js/search.js +109 -0
- data/doc/js/search_index.js +1 -0
- data/doc/js/searcher.js +228 -0
- data/doc/rdoc.css +580 -0
- data/doc/table_of_contents.html +305 -0
- data/ext/Makefile-bioruby.patch +12 -0
- data/ext/Makefile-suse.patch +11 -0
- data/ext/mkrf_conf.rb +118 -0
- data/lib/bio/BIOExtensions.rb +89 -0
- data/lib/bio/db/alignment.rb +64 -0
- data/lib/bio/db/fastadb.rb +320 -0
- data/lib/bio/db/pileup.rb +273 -0
- data/lib/bio/db/sam/external/COPYING +21 -0
- data/lib/bio/db/sam/external/VERSION +1 -0
- data/lib/bio/db/sam/library.rb +32 -0
- data/lib/bio/db/sam.rb +778 -0
- data/lib/bio/db/vcf.rb +105 -0
- data/lib/bio-samtools-wrapper.rb +9 -0
- data/test/.gitignore +1 -0
- data/test/helper.rb +18 -0
- data/test/sample.vcf +24 -0
- data/test/samples/.gitignore +1 -0
- data/test/samples/LCI/NC_001988.ffn +2 -0
- data/test/samples/LCI/test.bam +0 -0
- data/test/samples/LCI/test.bam.bai +0 -0
- data/test/samples/small/dupes.bam +0 -0
- data/test/samples/small/dupes.sam +274 -0
- data/test/samples/small/ids2.txt +1 -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/sorted.bam +0 -0
- data/test/samples/small/sorted.bam.bai +0 -0
- data/test/samples/small/test.sai +0 -0
- data/test/samples/small/test.tam +10 -0
- data/test/samples/small/test_chr.fasta +1000 -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.amb +2 -0
- data/test/samples/small/test_chr.fasta.ann +3 -0
- data/test/samples/small/test_chr.fasta.bwt +0 -0
- data/test/samples/small/test_chr.fasta.pac +0 -0
- data/test/samples/small/test_chr.fasta.rbwt +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_chr.fasta.rpac +0 -0
- data/test/samples/small/test_chr.fasta.rsa +0 -0
- data/test/samples/small/test_chr.fasta.sa +0 -0
- data/test/samples/small/test_cov.svg +273 -0
- data/test/samples/small/test_fastadb.fasta +34 -0
- data/test/samples/small/testu.bam +0 -0
- data/test/samples/small/testu.bed +2 -0
- data/test/test_bio-samtools-wrapper.rb +1 -0
- data/test/test_fastadb.rb +89 -0
- data/test/test_pileup.rb +90 -0
- data/test/test_sam.rb +421 -0
- data/test/test_vcf.rb +79 -0
- data/tutorial/tutorial.html +474 -0
- data/tutorial/tutorial.md +424 -0
- data/tutorial/tutorial.pdf +0 -0
- metadata +254 -0
data/doc/Bio/DB/Tag.html
ADDED
@@ -0,0 +1,208 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class Bio::DB::Tag - Pileup</title>
|
8
|
+
|
9
|
+
<link href="../../fonts.css" rel="stylesheet">
|
10
|
+
<link href="../../rdoc.css" rel="stylesheet">
|
11
|
+
|
12
|
+
<script type="text/javascript">
|
13
|
+
var rdoc_rel_prefix = "../../";
|
14
|
+
</script>
|
15
|
+
|
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>
|
22
|
+
|
23
|
+
|
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>
|
34
|
+
<a href="../../table_of_contents.html#classes">Classes</a>
|
35
|
+
<a href="../../table_of_contents.html#methods">Methods</a>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
|
39
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
40
|
+
<form action="#" method="get" accept-charset="utf-8">
|
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"
|
45
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
46
|
+
</div>
|
47
|
+
|
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
|
+
|
54
|
+
</div>
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
<div id="class-metadata">
|
59
|
+
|
60
|
+
<div id="parent-class-section" class="nav-section">
|
61
|
+
<h3>Parent</h3>
|
62
|
+
|
63
|
+
|
64
|
+
<p class="link">Object
|
65
|
+
|
66
|
+
</div>
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
<!-- Method Quickref -->
|
71
|
+
<div id="method-list-section" class="nav-section">
|
72
|
+
<h3>Methods</h3>
|
73
|
+
|
74
|
+
<ul class="link-list" role="directory">
|
75
|
+
|
76
|
+
<li ><a href="#method-i-set">#set</a>
|
77
|
+
|
78
|
+
</ul>
|
79
|
+
</div>
|
80
|
+
|
81
|
+
</div>
|
82
|
+
</nav>
|
83
|
+
|
84
|
+
<main role="main" aria-labelledby="class-Bio::DB::Tag">
|
85
|
+
<h1 id="class-Bio::DB::Tag" class="class">
|
86
|
+
class Bio::DB::Tag
|
87
|
+
</h1>
|
88
|
+
|
89
|
+
<section class="description">
|
90
|
+
|
91
|
+
<p>a class to represent the SAM OPT values, presented in SAM as
|
92
|
+
TAG:VTYPE:VALUE</p>
|
93
|
+
|
94
|
+
</section>
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
<section class="attribute-method-details" class="method-section">
|
108
|
+
<header>
|
109
|
+
<h3>Attributes</h3>
|
110
|
+
</header>
|
111
|
+
|
112
|
+
|
113
|
+
<div id="attribute-i-tag" class="method-detail">
|
114
|
+
<div class="method-heading attribute-method-heading">
|
115
|
+
<span class="method-name">tag</span><span
|
116
|
+
class="attribute-access-type">[RW]</span>
|
117
|
+
</div>
|
118
|
+
|
119
|
+
<div class="method-description">
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
</div>
|
124
|
+
</div>
|
125
|
+
|
126
|
+
<div id="attribute-i-type" class="method-detail">
|
127
|
+
<div class="method-heading attribute-method-heading">
|
128
|
+
<span class="method-name">type</span><span
|
129
|
+
class="attribute-access-type">[RW]</span>
|
130
|
+
</div>
|
131
|
+
|
132
|
+
<div class="method-description">
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
</div>
|
137
|
+
</div>
|
138
|
+
|
139
|
+
<div id="attribute-i-value" class="method-detail">
|
140
|
+
<div class="method-heading attribute-method-heading">
|
141
|
+
<span class="method-name">value</span><span
|
142
|
+
class="attribute-access-type">[RW]</span>
|
143
|
+
</div>
|
144
|
+
|
145
|
+
<div class="method-description">
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
</div>
|
150
|
+
</div>
|
151
|
+
|
152
|
+
</section>
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
157
|
+
<header>
|
158
|
+
<h3>Public Instance Methods</h3>
|
159
|
+
</header>
|
160
|
+
|
161
|
+
|
162
|
+
<div id="method-i-set" class="method-detail ">
|
163
|
+
|
164
|
+
<div class="method-heading">
|
165
|
+
<span class="method-name">set</span><span
|
166
|
+
class="method-args">(str)</span>
|
167
|
+
|
168
|
+
<span class="method-click-advice">click to toggle source</span>
|
169
|
+
|
170
|
+
</div>
|
171
|
+
|
172
|
+
|
173
|
+
<div class="method-description">
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
<div class="method-source-code" id="set-source">
|
181
|
+
<pre><span class="ruby-comment"># File lib/bio/db/alignment.rb, line 7</span>
|
182
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">set</span>(<span class="ruby-identifier">str</span>)
|
183
|
+
<span class="ruby-ivar">@tag</span> = <span class="ruby-identifier">str</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">1</span>]
|
184
|
+
<span class="ruby-ivar">@type</span> = <span class="ruby-identifier">str</span>[<span class="ruby-value">3</span>]
|
185
|
+
<span class="ruby-ivar">@value</span> = <span class="ruby-identifier">str</span>[<span class="ruby-value">5</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
|
186
|
+
<span class="ruby-keyword">end</span></pre>
|
187
|
+
</div>
|
188
|
+
|
189
|
+
</div>
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
</div>
|
195
|
+
|
196
|
+
|
197
|
+
</section>
|
198
|
+
|
199
|
+
</section>
|
200
|
+
</main>
|
201
|
+
|
202
|
+
|
203
|
+
<footer id="validator-badges" role="contentinfo">
|
204
|
+
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
205
|
+
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.1.
|
206
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
207
|
+
</footer>
|
208
|
+
|
data/doc/Bio/DB/Vcf.html
ADDED
@@ -0,0 +1,431 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class Bio::DB::Vcf - Pileup</title>
|
8
|
+
|
9
|
+
<link href="../../fonts.css" rel="stylesheet">
|
10
|
+
<link href="../../rdoc.css" rel="stylesheet">
|
11
|
+
|
12
|
+
<script type="text/javascript">
|
13
|
+
var rdoc_rel_prefix = "../../";
|
14
|
+
</script>
|
15
|
+
|
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>
|
22
|
+
|
23
|
+
|
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>
|
34
|
+
<a href="../../table_of_contents.html#classes">Classes</a>
|
35
|
+
<a href="../../table_of_contents.html#methods">Methods</a>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
|
39
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
40
|
+
<form action="#" method="get" accept-charset="utf-8">
|
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"
|
45
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
46
|
+
</div>
|
47
|
+
|
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
|
+
|
54
|
+
</div>
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
<div id="class-metadata">
|
59
|
+
|
60
|
+
<div id="parent-class-section" class="nav-section">
|
61
|
+
<h3>Parent</h3>
|
62
|
+
|
63
|
+
|
64
|
+
<p class="link">Object
|
65
|
+
|
66
|
+
</div>
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
<!-- Method Quickref -->
|
71
|
+
<div id="method-list-section" class="nav-section">
|
72
|
+
<h3>Methods</h3>
|
73
|
+
|
74
|
+
<ul class="link-list" role="directory">
|
75
|
+
|
76
|
+
<li ><a href="#method-c-new">::new</a>
|
77
|
+
|
78
|
+
<li ><a href="#method-i-int_or_raw">#int_or_raw</a>
|
79
|
+
|
80
|
+
<li ><a href="#method-i-parse_line">#parse_line</a>
|
81
|
+
|
82
|
+
</ul>
|
83
|
+
</div>
|
84
|
+
|
85
|
+
</div>
|
86
|
+
</nav>
|
87
|
+
|
88
|
+
<main role="main" aria-labelledby="class-Bio::DB::Vcf">
|
89
|
+
<h1 id="class-Bio::DB::Vcf" class="class">
|
90
|
+
class Bio::DB::Vcf
|
91
|
+
</h1>
|
92
|
+
|
93
|
+
<section class="description">
|
94
|
+
|
95
|
+
</section>
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
<section class="attribute-method-details" class="method-section">
|
109
|
+
<header>
|
110
|
+
<h3>Attributes</h3>
|
111
|
+
</header>
|
112
|
+
|
113
|
+
|
114
|
+
<div id="attribute-i-alt" class="method-detail">
|
115
|
+
<div class="method-heading attribute-method-heading">
|
116
|
+
<span class="method-name">alt</span><span
|
117
|
+
class="attribute-access-type">[RW]</span>
|
118
|
+
</div>
|
119
|
+
|
120
|
+
<div class="method-description">
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
</div>
|
125
|
+
</div>
|
126
|
+
|
127
|
+
<div id="attribute-i-chrom" class="method-detail">
|
128
|
+
<div class="method-heading attribute-method-heading">
|
129
|
+
<span class="method-name">chrom</span><span
|
130
|
+
class="attribute-access-type">[RW]</span>
|
131
|
+
</div>
|
132
|
+
|
133
|
+
<div class="method-description">
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
</div>
|
138
|
+
</div>
|
139
|
+
|
140
|
+
<div id="attribute-i-filter" class="method-detail">
|
141
|
+
<div class="method-heading attribute-method-heading">
|
142
|
+
<span class="method-name">filter</span><span
|
143
|
+
class="attribute-access-type">[RW]</span>
|
144
|
+
</div>
|
145
|
+
|
146
|
+
<div class="method-description">
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
</div>
|
151
|
+
</div>
|
152
|
+
|
153
|
+
<div id="attribute-i-format" class="method-detail">
|
154
|
+
<div class="method-heading attribute-method-heading">
|
155
|
+
<span class="method-name">format</span><span
|
156
|
+
class="attribute-access-type">[RW]</span>
|
157
|
+
</div>
|
158
|
+
|
159
|
+
<div class="method-description">
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
</div>
|
164
|
+
</div>
|
165
|
+
|
166
|
+
<div id="attribute-i-id" class="method-detail">
|
167
|
+
<div class="method-heading attribute-method-heading">
|
168
|
+
<span class="method-name">id</span><span
|
169
|
+
class="attribute-access-type">[RW]</span>
|
170
|
+
</div>
|
171
|
+
|
172
|
+
<div class="method-description">
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
</div>
|
177
|
+
</div>
|
178
|
+
|
179
|
+
<div id="attribute-i-info" class="method-detail">
|
180
|
+
<div class="method-heading attribute-method-heading">
|
181
|
+
<span class="method-name">info</span><span
|
182
|
+
class="attribute-access-type">[RW]</span>
|
183
|
+
</div>
|
184
|
+
|
185
|
+
<div class="method-description">
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
</div>
|
190
|
+
</div>
|
191
|
+
|
192
|
+
<div id="attribute-i-pos" class="method-detail">
|
193
|
+
<div class="method-heading attribute-method-heading">
|
194
|
+
<span class="method-name">pos</span><span
|
195
|
+
class="attribute-access-type">[RW]</span>
|
196
|
+
</div>
|
197
|
+
|
198
|
+
<div class="method-description">
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
</div>
|
203
|
+
</div>
|
204
|
+
|
205
|
+
<div id="attribute-i-qual" class="method-detail">
|
206
|
+
<div class="method-heading attribute-method-heading">
|
207
|
+
<span class="method-name">qual</span><span
|
208
|
+
class="attribute-access-type">[RW]</span>
|
209
|
+
</div>
|
210
|
+
|
211
|
+
<div class="method-description">
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
</div>
|
216
|
+
</div>
|
217
|
+
|
218
|
+
<div id="attribute-i-ref" class="method-detail">
|
219
|
+
<div class="method-heading attribute-method-heading">
|
220
|
+
<span class="method-name">ref</span><span
|
221
|
+
class="attribute-access-type">[RW]</span>
|
222
|
+
</div>
|
223
|
+
|
224
|
+
<div class="method-description">
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
</div>
|
229
|
+
</div>
|
230
|
+
|
231
|
+
<div id="attribute-i-samples" class="method-detail">
|
232
|
+
<div class="method-heading attribute-method-heading">
|
233
|
+
<span class="method-name">samples</span><span
|
234
|
+
class="attribute-access-type">[RW]</span>
|
235
|
+
</div>
|
236
|
+
|
237
|
+
<div class="method-description">
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
</div>
|
242
|
+
</div>
|
243
|
+
|
244
|
+
</section>
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
249
|
+
<header>
|
250
|
+
<h3>Public Class Methods</h3>
|
251
|
+
</header>
|
252
|
+
|
253
|
+
|
254
|
+
<div id="method-c-new" class="method-detail ">
|
255
|
+
|
256
|
+
<div class="method-heading">
|
257
|
+
<span class="method-name">new</span><span
|
258
|
+
class="method-args">(line=nil, sample_names=nil)</span>
|
259
|
+
|
260
|
+
<span class="method-click-advice">click to toggle source</span>
|
261
|
+
|
262
|
+
</div>
|
263
|
+
|
264
|
+
|
265
|
+
<div class="method-description">
|
266
|
+
|
267
|
+
<p>create the vcf object, use the ordered list of sample names to label
|
268
|
+
samples if provided ['A', 'B', 'C'], otherwise
|
269
|
+
uses, 1,2,3 etc</p>
|
270
|
+
|
271
|
+
<pre>vcf = Bio::DB::Vcf("19 111 . A C 9.6 . . GT:HQ 0|0:10,10 0|0:10,10 0/1:3,3")</pre>
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
|
276
|
+
<div class="method-source-code" id="new-source">
|
277
|
+
<pre><span class="ruby-comment"># File lib/bio/db/vcf.rb, line 15</span>
|
278
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">line</span>=<span class="ruby-keyword">nil</span>, <span class="ruby-identifier">sample_names</span>=<span class="ruby-keyword">nil</span>)
|
279
|
+
<span class="ruby-ivar">@info</span> = {}
|
280
|
+
<span class="ruby-ivar">@samples</span> = {}
|
281
|
+
<span class="ruby-identifier">parse_line</span>(<span class="ruby-identifier">line</span>, <span class="ruby-identifier">sample_names</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">line</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword">nil</span>
|
282
|
+
<span class="ruby-keyword">end</span></pre>
|
283
|
+
</div>
|
284
|
+
|
285
|
+
</div>
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
|
290
|
+
</div>
|
291
|
+
|
292
|
+
|
293
|
+
</section>
|
294
|
+
|
295
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
296
|
+
<header>
|
297
|
+
<h3>Public Instance Methods</h3>
|
298
|
+
</header>
|
299
|
+
|
300
|
+
|
301
|
+
<div id="method-i-int_or_raw" class="method-detail ">
|
302
|
+
|
303
|
+
<div class="method-heading">
|
304
|
+
<span class="method-name">int_or_raw</span><span
|
305
|
+
class="method-args">(x)</span>
|
306
|
+
|
307
|
+
<span class="method-click-advice">click to toggle source</span>
|
308
|
+
|
309
|
+
</div>
|
310
|
+
|
311
|
+
|
312
|
+
<div class="method-description">
|
313
|
+
|
314
|
+
<p>tests if the current variable is an Integer</p>
|
315
|
+
<ul><li>
|
316
|
+
<p>x - any variable</p>
|
317
|
+
</li></ul>
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
|
322
|
+
<div class="method-source-code" id="int_or_raw-source">
|
323
|
+
<pre><span class="ruby-comment"># File lib/bio/db/vcf.rb, line 23</span>
|
324
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">int_or_raw</span>(<span class="ruby-identifier">x</span>)
|
325
|
+
<span class="ruby-constant">Integer</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">x</span>) <span class="ruby-keyword">rescue</span> <span class="ruby-identifier">x</span>
|
326
|
+
<span class="ruby-keyword">end</span></pre>
|
327
|
+
</div>
|
328
|
+
|
329
|
+
</div>
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
|
334
|
+
</div>
|
335
|
+
|
336
|
+
|
337
|
+
<div id="method-i-parse_line" class="method-detail ">
|
338
|
+
|
339
|
+
<div class="method-heading">
|
340
|
+
<span class="method-name">parse_line</span><span
|
341
|
+
class="method-args">(line, sample_names=nil)</span>
|
342
|
+
|
343
|
+
<span class="method-click-advice">click to toggle source</span>
|
344
|
+
|
345
|
+
</div>
|
346
|
+
|
347
|
+
|
348
|
+
<div class="method-description">
|
349
|
+
|
350
|
+
<p>gets the info in the <a href="Vcf.html">Vcf</a> lines and parses it,
|
351
|
+
setting the attributes</p>
|
352
|
+
|
353
|
+
|
354
|
+
|
355
|
+
|
356
|
+
<div class="method-source-code" id="parse_line-source">
|
357
|
+
<pre><span class="ruby-comment"># File lib/bio/db/vcf.rb, line 28</span>
|
358
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">parse_line</span>(<span class="ruby-identifier">line</span>, <span class="ruby-identifier">sample_names</span>=<span class="ruby-keyword">nil</span>)
|
359
|
+
<span class="ruby-keyword">return</span> <span class="ruby-keyword">false</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">line</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-string">'#'</span>
|
360
|
+
|
361
|
+
<span class="ruby-identifier">f</span> = <span class="ruby-identifier">line</span>.<span class="ruby-identifier">chomp</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">"\t"</span>, <span class="ruby-value">-1</span>)
|
362
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-string">"VCF lines must have at least 8 fields"</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator"><</span> <span class="ruby-value">8</span>
|
363
|
+
<span class="ruby-ivar">@chrom</span> = <span class="ruby-identifier">f</span>[<span class="ruby-value">0</span>]
|
364
|
+
<span class="ruby-ivar">@pos</span> = <span class="ruby-identifier">f</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">to_i</span>
|
365
|
+
<span class="ruby-ivar">@id</span> = <span class="ruby-string">'.'</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">f</span>[<span class="ruby-value">2</span>] <span class="ruby-operator">?</span> <span class="ruby-keyword">nil</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">f</span>[<span class="ruby-value">2</span>]
|
366
|
+
<span class="ruby-ivar">@ref</span> = <span class="ruby-identifier">f</span>[<span class="ruby-value">3</span>]
|
367
|
+
<span class="ruby-ivar">@alt</span> = <span class="ruby-identifier">f</span>[<span class="ruby-value">4</span>]
|
368
|
+
<span class="ruby-ivar">@qual</span> = <span class="ruby-identifier">f</span>[<span class="ruby-value">5</span>].<span class="ruby-identifier">to_f</span>
|
369
|
+
<span class="ruby-ivar">@filter</span> = <span class="ruby-string">'.'</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">f</span>[<span class="ruby-value">6</span>] <span class="ruby-operator">?</span> <span class="ruby-keyword">nil</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">f</span>[<span class="ruby-value">6</span>]
|
370
|
+
|
371
|
+
<span class="ruby-ivar">@info</span> = <span class="ruby-string">'.'</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">f</span>[<span class="ruby-value">7</span>] <span class="ruby-operator">?</span> <span class="ruby-keyword">nil</span> <span class="ruby-operator">:</span> {}
|
372
|
+
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@info</span>
|
373
|
+
<span class="ruby-identifier">info_vec</span> = <span class="ruby-identifier">f</span>[<span class="ruby-value">7</span>].<span class="ruby-identifier">split</span>(<span class="ruby-string">";"</span>)
|
374
|
+
<span class="ruby-identifier">info_vec</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span>
|
375
|
+
<span class="ruby-identifier">keyval</span> = <span class="ruby-identifier">x</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">"="</span>, <span class="ruby-value">-1</span>)
|
376
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">keyval</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">2</span> <span class="ruby-comment"># If it's key=value</span>
|
377
|
+
<span class="ruby-ivar">@info</span>[<span class="ruby-identifier">keyval</span>[<span class="ruby-value">0</span>]] = <span class="ruby-identifier">keyval</span>[<span class="ruby-value">1</span>]
|
378
|
+
<span class="ruby-keyword">else</span> <span class="ruby-comment"># Otherwise, it's just a flag</span>
|
379
|
+
<span class="ruby-ivar">@info</span>[<span class="ruby-identifier">x</span>] = <span class="ruby-keyword">nil</span>
|
380
|
+
<span class="ruby-keyword">end</span>
|
381
|
+
<span class="ruby-keyword">end</span>
|
382
|
+
<span class="ruby-keyword">end</span>
|
383
|
+
|
384
|
+
<span class="ruby-ivar">@samples</span> = {}
|
385
|
+
<span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">8</span> <span class="ruby-comment"># Has just upto info</span>
|
386
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-string">"Can't have format with no samples"</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">9</span>
|
387
|
+
|
388
|
+
<span class="ruby-ivar">@format</span> = <span class="ruby-identifier">f</span>[<span class="ruby-value">8</span>]
|
389
|
+
|
390
|
+
<span class="ruby-identifier">sample_keys</span> = <span class="ruby-ivar">@format</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">":"</span>)
|
391
|
+
|
392
|
+
<span class="ruby-identifier">num_samples</span> = <span class="ruby-identifier">f</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">-</span> <span class="ruby-value">9</span> <span class="ruby-comment"># How many fields are past the format</span>
|
393
|
+
|
394
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">sample_names</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">nil</span> <span class="ruby-comment"># Make the sample names just ["1", "2", ... , "num_samples}"</span>
|
395
|
+
<span class="ruby-identifier">sample_names</span> = (<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-identifier">num_samples</span>).<span class="ruby-identifier">to_a</span>.<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">i</span>.<span class="ruby-identifier">to_s</span>}
|
396
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">sample_names</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">num_samples</span>
|
397
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-node">"Unexpected number of samples (#{num_samples}) based on the provided sample names (#{sample_names.inspect})"</span>
|
398
|
+
<span class="ruby-keyword">end</span>
|
399
|
+
|
400
|
+
<span class="ruby-identifier">sample_names</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">sample_name</span>, <span class="ruby-identifier">sample_index</span><span class="ruby-operator">|</span>
|
401
|
+
<span class="ruby-identifier">i</span> = <span class="ruby-identifier">sample_index</span> <span class="ruby-operator">+</span> <span class="ruby-value">9</span> <span class="ruby-comment"># index into columns (f)</span>
|
402
|
+
<span class="ruby-identifier">sample_values</span> = <span class="ruby-identifier">f</span>[<span class="ruby-identifier">i</span>].<span class="ruby-identifier">split</span>(<span class="ruby-string">":"</span>)
|
403
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-node">"Expected number of sample values to be <= number of sample keys in FORMAT column Format=#{@format} but sample=#{f[i]}"</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">sample_values</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">></span> <span class="ruby-identifier">sample_keys</span>.<span class="ruby-identifier">size</span>
|
404
|
+
<span class="ruby-ivar">@samples</span>[<span class="ruby-identifier">sample_name</span>] = {}
|
405
|
+
<span class="ruby-identifier">sample_keys</span>.<span class="ruby-identifier">each_with_index</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value_index</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@samples</span>[<span class="ruby-identifier">sample_name</span>][<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">sample_values</span>[<span class="ruby-identifier">value_index</span>] <span class="ruby-operator">||</span> <span class="ruby-string">""</span>}
|
406
|
+
<span class="ruby-keyword">end</span>
|
407
|
+
|
408
|
+
<span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span>;
|
409
|
+
<span class="ruby-keyword">end</span></pre>
|
410
|
+
</div>
|
411
|
+
|
412
|
+
</div>
|
413
|
+
|
414
|
+
|
415
|
+
|
416
|
+
|
417
|
+
</div>
|
418
|
+
|
419
|
+
|
420
|
+
</section>
|
421
|
+
|
422
|
+
</section>
|
423
|
+
</main>
|
424
|
+
|
425
|
+
|
426
|
+
<footer id="validator-badges" role="contentinfo">
|
427
|
+
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
428
|
+
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.1.
|
429
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
430
|
+
</footer>
|
431
|
+
|