bio-samtools 0.4.2 → 0.5.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.
- data/Gemfile.lock +1 -0
- data/README.rdoc +1 -0
- data/VERSION +1 -1
- data/bio-samtools.gemspec +19 -19
- data/doc/Bio.html +71 -4
- data/doc/Bio/DB.html +6 -4
- data/doc/Bio/DB/Alignment.html +8 -8
- data/doc/Bio/DB/Pileup.html +515 -0
- data/doc/Bio/DB/SAM.html +37 -37
- data/doc/Bio/DB/SAM/Library.html +4 -4
- data/doc/Bio/DB/SAM/Tools.html +4 -4
- data/doc/Bio/DB/SAM/Tools/Bam1CoreT.html +4 -4
- data/doc/Bio/DB/SAM/Tools/Bam1T.html +4 -4
- data/doc/Bio/DB/SAM/Tools/BamHeaderT.html +4 -4
- data/doc/Bio/DB/SAM/Tools/BamPileup1T.html +4 -4
- data/doc/Bio/DB/SAM/Tools/SamfileT.html +4 -4
- data/doc/Bio/DB/SAM/Tools/SamfileTX.html +4 -4
- data/doc/Bio/DB/SAMException.html +5 -5
- data/doc/Bio/DB/Tag.html +5 -5
- data/doc/Bio/DB/Vcf.html +467 -0
- data/doc/LICENSE_txt.html +57 -60
- data/doc/LibC.html +6 -4
- data/doc/created.rid +7 -7
- data/doc/index.html +4 -4
- data/doc/js/search_index.js +1 -1
- data/doc/lib/bio-samtools_rb.html +4 -4
- data/doc/lib/bio/db/pileup_rb.html +171 -0
- data/doc/lib/bio/db/sam/bam_rb.html +4 -4
- data/doc/lib/bio/db/sam/faidx_rb.html +4 -4
- data/doc/lib/bio/db/sam/library_rb.html +4 -4
- data/doc/lib/bio/db/sam/sam_rb.html +4 -4
- data/doc/lib/bio/db/sam_rb.html +4 -4
- data/doc/lib/bio/db/vcf_rb.html +124 -0
- data/doc/table_of_contents.html +16 -26
- data/doc/tutorial.html +26 -1
- data/doc/tutorial.pdf +0 -0
- data/lib/bio/db/{sam/pileup.rb → pileup.rb} +6 -4
- data/lib/bio/db/sam.rb +13 -12
- data/lib/bio/db/{sam/vcf.rb → vcf.rb} +6 -2
- data/test/samples/small/sorted.bam.bai +0 -0
- data/test/test_basic.rb +7 -5
- data/test/test_vcf.rb +5 -5
- metadata +29 -26
- data/test/basictest.rb +0 -322
- data/test/pileup.rb +0 -68
data/doc/Bio/DB/SAM.html
CHANGED
@@ -133,6 +133,8 @@
|
|
133
133
|
|
134
134
|
<li><a href="../../Bio/DB/Alignment.html">Bio::DB::Alignment</a>
|
135
135
|
|
136
|
+
<li><a href="../../Bio/DB/Pileup.html">Bio::DB::Pileup</a>
|
137
|
+
|
136
138
|
<li><a href="../../Bio/DB/SAM.html">Bio::DB::SAM</a>
|
137
139
|
|
138
140
|
<li><a href="../../Bio/DB/SAM/Library.html">Bio::DB::SAM::Library</a>
|
@@ -157,11 +159,9 @@
|
|
157
159
|
|
158
160
|
<li><a href="../../Bio/DB/Tag.html">Bio::DB::Tag</a>
|
159
161
|
|
160
|
-
<li><a href="../../
|
161
|
-
|
162
|
-
<li><a href="../../Pileup.html">Pileup</a>
|
162
|
+
<li><a href="../../Bio/DB/Vcf.html">Bio::DB::Vcf</a>
|
163
163
|
|
164
|
-
<li><a href="../../
|
164
|
+
<li><a href="../../LibC.html">LibC</a>
|
165
165
|
|
166
166
|
</ul>
|
167
167
|
</nav>
|
@@ -337,10 +337,10 @@ following elemets:</p>
|
|
337
337
|
<p>If the file is to be writen (false). Not supported yet.</p>
|
338
338
|
</dd></dl>
|
339
339
|
|
340
|
-
<p><strong>NOTE:</strong> you can
|
341
|
-
|
342
|
-
|
343
|
-
|
340
|
+
<p><strong>NOTE:</strong> you can't use binary and text formats simultaneusly.
|
341
|
+
To make queries, the file has to be a sorted binary. This function doesn't
|
342
|
+
actually open the file, it just prepares the object to be opened in a later
|
343
|
+
stage.</p>
|
344
344
|
|
345
345
|
|
346
346
|
|
@@ -542,14 +542,14 @@ method you must have a version of samtools that supports the pileup command
|
|
542
542
|
(< 0.1.17) otherwise the command will fail. mpileup is the preferred
|
543
543
|
method for getting pileups. With this method the sam object should be
|
544
544
|
created as usual, but you need to pass this method a string of options for
|
545
|
-
samtools you don’t need to provide the call to samtools pileup itself or
|
546
|
-
|
545
|
+
samtools you don’t need to provide the call to samtools pileup itself or -f
|
546
|
+
<fasta file> or the bam file itself, these are taken from the sam
|
547
547
|
object</p>
|
548
548
|
|
549
549
|
|
550
550
|
|
551
551
|
<div class="method-source-code" id="deprecated_pileup-source">
|
552
|
-
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line
|
552
|
+
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 473</span>
|
553
553
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">deprecated_pileup</span>( <span class="ruby-identifier">cmd</span> )
|
554
554
|
|
555
555
|
<span class="ruby-identifier">system</span>(<span class="ruby-string">'samtools pileup > /dev/null 2>&1'</span>)
|
@@ -726,7 +726,7 @@ use your own FixNum (FFI-bug?)</p>
|
|
726
726
|
|
727
727
|
|
728
728
|
<div class="method-source-code" id="index_stats-source">
|
729
|
-
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line
|
729
|
+
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 494</span>
|
730
730
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">index_stats</span>
|
731
731
|
<span class="ruby-identifier">raise</span> <span class="ruby-constant">SAMException</span>.<span class="ruby-identifier">new</span>(), <span class="ruby-string">"No BAMFile provided"</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@sam</span> <span class="ruby-keyword">and</span> <span class="ruby-ivar">@binary</span>
|
732
732
|
<span class="ruby-identifier">raise</span> <span class="ruby-constant">SAMException</span>.<span class="ruby-identifier">new</span>(), <span class="ruby-string">"No FastA provided"</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@fasta_path</span>
|
@@ -790,10 +790,10 @@ use your own FixNum (FFI-bug?)</p>
|
|
790
790
|
<p>Loads the bam index to be used for fetching. If the index doesn’t exists
|
791
791
|
the index is built provided that the user has writing access to the folder
|
792
792
|
where the BAM file is located. If the creation of the file fails a <a
|
793
|
-
href="SAMException.html">SAMException</a> is thrown. If the index
|
794
|
-
|
795
|
-
|
796
|
-
|
793
|
+
href="SAMException.html">SAMException</a> is thrown. If the index doesn’t
|
794
|
+
exist, loading it will take more time. It is suggested to generate the
|
795
|
+
index separatedly if the bam file sits on a server where the executing user
|
796
|
+
may not have writing permissions in the server.</p>
|
797
797
|
|
798
798
|
|
799
799
|
|
@@ -831,11 +831,10 @@ executing user may not have writing permissions in the server.</p>
|
|
831
831
|
<div class="method-description">
|
832
832
|
|
833
833
|
<p>Loads the reference file to be able to query regions of it. This requires
|
834
|
-
the fai index to exist in the same folder than the reference. If it
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
thrown.</p>
|
834
|
+
the fai index to exist in the same folder than the reference. If it doesn’t
|
835
|
+
exisits, this functions attempts to generate it. If user doesn’t have
|
836
|
+
writing permissions on the folder, or the creation of the fai fails for any
|
837
|
+
reason, a <a href="SAMException.html">SAMException</a> is thrown.</p>
|
839
838
|
|
840
839
|
|
841
840
|
|
@@ -877,12 +876,12 @@ thrown.</p>
|
|
877
876
|
|
878
877
|
<p>calls the mpileup function, opts is a hash of options identical to the
|
879
878
|
command line options for mpileup. is an iterator that yields a <a
|
880
|
-
href="
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
879
|
+
href="Pileup.html">Pileup</a> object for each postion the command line
|
880
|
+
options that generate/affect BCF/VCF are ignored ie (g,u,e,h,I,L,o,p) call
|
881
|
+
the option as a symbol of the flag, eg -r for region is called :r =>
|
882
|
+
“some <a href="SAM.html">SAM</a> compatible region” eg bam.mpileup(:r =>
|
883
|
+
“chr1:1000-2000”, :q => 50) gets the bases with quality > 50 on chr1
|
884
|
+
between 1000-5000</p>
|
886
885
|
|
887
886
|
|
888
887
|
|
@@ -908,15 +907,15 @@ quality > 50 on chr1 between 1000-5000</p>
|
|
908
907
|
<span class="ruby-value">:min_mapping_quality</span> =<span class="ruby-operator">></span> <span class="ruby-value">:q</span>,
|
909
908
|
<span class="ruby-value">:min_base_quality</span> =<span class="ruby-operator">></span> <span class="ruby-value">:Q</span>
|
910
909
|
}
|
911
|
-
|
912
910
|
<span class="ruby-comment">##convert any long_opts to short opts </span>
|
911
|
+
<span class="ruby-identifier">temp_opts</span> = <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">dup</span>
|
913
912
|
<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>
|
914
913
|
<span class="ruby-keyword">if</span> <span class="ruby-identifier">long_opts</span>[<span class="ruby-identifier">k</span>]
|
915
|
-
<span class="ruby-identifier">
|
916
|
-
<span class="ruby-identifier">
|
914
|
+
<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>
|
915
|
+
<span class="ruby-identifier">temp_opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">k</span>)
|
917
916
|
<span class="ruby-keyword">end</span>
|
918
917
|
<span class="ruby-keyword">end</span>
|
919
|
-
|
918
|
+
<span class="ruby-identifier">opts</span> = <span class="ruby-identifier">temp_opts</span>
|
920
919
|
<span class="ruby-comment">##remove any calls to -g or -u for mpileup, bcf output is not yet supported</span>
|
921
920
|
<span class="ruby-comment">##and also associated output options</span>
|
922
921
|
[<span class="ruby-value">:g</span>, <span class="ruby-value">:u</span>, <span class="ruby-value">:e</span>, <span class="ruby-value">:h</span>, <span class="ruby-value">:I</span>, <span class="ruby-value">:L</span>, <span class="ruby-value">:o</span>, <span class="ruby-value">:p</span>].<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">x</span>) }
|
@@ -935,7 +934,7 @@ quality > 50 on chr1 between 1000-5000</p>
|
|
935
934
|
|
936
935
|
<span class="ruby-identifier">sam_pipe</span> = <span class="ruby-constant">IO</span>.<span class="ruby-identifier">popen</span>(<span class="ruby-identifier">sam_command</span>)
|
937
936
|
<span class="ruby-keyword">while</span> <span class="ruby-identifier">line</span> = <span class="ruby-identifier">sam_pipe</span>.<span class="ruby-identifier">gets</span>
|
938
|
-
<span class="ruby-keyword">yield</span> <span class="ruby-constant">Pileup</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">line</span>)
|
937
|
+
<span class="ruby-keyword">yield</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>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">line</span>)
|
939
938
|
<span class="ruby-keyword">end</span>
|
940
939
|
<span class="ruby-identifier">sam_pipe</span>.<span class="ruby-identifier">close</span>
|
941
940
|
<span class="ruby-comment">#strptrs << FFI::MemoryPointer.from_string('-f')</span>
|
@@ -1028,13 +1027,14 @@ and supports returning of pileup vcf</p>
|
|
1028
1027
|
}
|
1029
1028
|
|
1030
1029
|
<span class="ruby-comment">##convert any long_opts to short opts </span>
|
1030
|
+
<span class="ruby-identifier">temp_opts</span> = <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">dup</span>
|
1031
1031
|
<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>
|
1032
1032
|
<span class="ruby-keyword">if</span> <span class="ruby-identifier">long_opts</span>[<span class="ruby-identifier">k</span>]
|
1033
|
-
<span class="ruby-identifier">
|
1034
|
-
<span class="ruby-identifier">
|
1033
|
+
<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>
|
1034
|
+
<span class="ruby-identifier">temp_opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">k</span>)
|
1035
1035
|
<span class="ruby-keyword">end</span>
|
1036
1036
|
<span class="ruby-keyword">end</span>
|
1037
|
-
|
1037
|
+
<span class="ruby-identifier">opts</span> = <span class="ruby-identifier">temp_opts</span>
|
1038
1038
|
<span class="ruby-comment">##remove any calls to -g or -u for mpileup, bcf output is not yet supported</span>
|
1039
1039
|
<span class="ruby-comment">##and also associated output options</span>
|
1040
1040
|
<span class="ruby-comment">#[:g, :u, :e, :h, :I, :L, :o, :p].each {|x| opts.delete(x) }</span>
|
@@ -1061,11 +1061,11 @@ and supports returning of pileup vcf</p>
|
|
1061
1061
|
<span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:u</span>]
|
1062
1062
|
<span class="ruby-keyword">while</span> <span class="ruby-identifier">line</span> = <span class="ruby-identifier">pipe</span>.<span class="ruby-identifier">gets</span>
|
1063
1063
|
<span class="ruby-keyword">next</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> <span class="ruby-comment">#skip any header or meta-lines, we dont do anything with those </span>
|
1064
|
-
<span class="ruby-keyword">yield</span> <span class="ruby-constant">Vcf</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">line</span>)
|
1064
|
+
<span class="ruby-keyword">yield</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-identifier">new</span>(<span class="ruby-identifier">line</span>)
|
1065
1065
|
<span class="ruby-keyword">end</span>
|
1066
1066
|
<span class="ruby-keyword">else</span>
|
1067
1067
|
<span class="ruby-keyword">while</span> <span class="ruby-identifier">line</span> = <span class="ruby-identifier">pipe</span>.<span class="ruby-identifier">gets</span>
|
1068
|
-
<span class="ruby-keyword">yield</span> <span class="ruby-constant">Pileup</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">line</span>)
|
1068
|
+
<span class="ruby-keyword">yield</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>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">line</span>)
|
1069
1069
|
<span class="ruby-keyword">end</span>
|
1070
1070
|
<span class="ruby-keyword">end</span>
|
1071
1071
|
<span class="ruby-identifier">pipe</span>.<span class="ruby-identifier">close</span>
|
data/doc/Bio/DB/SAM/Library.html
CHANGED
@@ -93,6 +93,8 @@
|
|
93
93
|
|
94
94
|
<li><a href="../../../Bio/DB/Alignment.html">Bio::DB::Alignment</a>
|
95
95
|
|
96
|
+
<li><a href="../../../Bio/DB/Pileup.html">Bio::DB::Pileup</a>
|
97
|
+
|
96
98
|
<li><a href="../../../Bio/DB/SAM.html">Bio::DB::SAM</a>
|
97
99
|
|
98
100
|
<li><a href="../../../Bio/DB/SAM/Library.html">Bio::DB::SAM::Library</a>
|
@@ -117,11 +119,9 @@
|
|
117
119
|
|
118
120
|
<li><a href="../../../Bio/DB/Tag.html">Bio::DB::Tag</a>
|
119
121
|
|
120
|
-
<li><a href="../../../
|
121
|
-
|
122
|
-
<li><a href="../../../Pileup.html">Pileup</a>
|
122
|
+
<li><a href="../../../Bio/DB/Vcf.html">Bio::DB::Vcf</a>
|
123
123
|
|
124
|
-
<li><a href="../../../
|
124
|
+
<li><a href="../../../LibC.html">LibC</a>
|
125
125
|
|
126
126
|
</ul>
|
127
127
|
</nav>
|
data/doc/Bio/DB/SAM/Tools.html
CHANGED
@@ -95,6 +95,8 @@
|
|
95
95
|
|
96
96
|
<li><a href="../../../Bio/DB/Alignment.html">Bio::DB::Alignment</a>
|
97
97
|
|
98
|
+
<li><a href="../../../Bio/DB/Pileup.html">Bio::DB::Pileup</a>
|
99
|
+
|
98
100
|
<li><a href="../../../Bio/DB/SAM.html">Bio::DB::SAM</a>
|
99
101
|
|
100
102
|
<li><a href="../../../Bio/DB/SAM/Library.html">Bio::DB::SAM::Library</a>
|
@@ -119,11 +121,9 @@
|
|
119
121
|
|
120
122
|
<li><a href="../../../Bio/DB/Tag.html">Bio::DB::Tag</a>
|
121
123
|
|
122
|
-
<li><a href="../../../
|
123
|
-
|
124
|
-
<li><a href="../../../Pileup.html">Pileup</a>
|
124
|
+
<li><a href="../../../Bio/DB/Vcf.html">Bio::DB::Vcf</a>
|
125
125
|
|
126
|
-
<li><a href="../../../
|
126
|
+
<li><a href="../../../LibC.html">LibC</a>
|
127
127
|
|
128
128
|
</ul>
|
129
129
|
</nav>
|
@@ -89,6 +89,8 @@
|
|
89
89
|
|
90
90
|
<li><a href="../../../../Bio/DB/Alignment.html">Bio::DB::Alignment</a>
|
91
91
|
|
92
|
+
<li><a href="../../../../Bio/DB/Pileup.html">Bio::DB::Pileup</a>
|
93
|
+
|
92
94
|
<li><a href="../../../../Bio/DB/SAM.html">Bio::DB::SAM</a>
|
93
95
|
|
94
96
|
<li><a href="../../../../Bio/DB/SAM/Library.html">Bio::DB::SAM::Library</a>
|
@@ -113,11 +115,9 @@
|
|
113
115
|
|
114
116
|
<li><a href="../../../../Bio/DB/Tag.html">Bio::DB::Tag</a>
|
115
117
|
|
116
|
-
<li><a href="../../../../
|
117
|
-
|
118
|
-
<li><a href="../../../../Pileup.html">Pileup</a>
|
118
|
+
<li><a href="../../../../Bio/DB/Vcf.html">Bio::DB::Vcf</a>
|
119
119
|
|
120
|
-
<li><a href="../../../../
|
120
|
+
<li><a href="../../../../LibC.html">LibC</a>
|
121
121
|
|
122
122
|
</ul>
|
123
123
|
</nav>
|
@@ -99,6 +99,8 @@
|
|
99
99
|
|
100
100
|
<li><a href="../../../../Bio/DB/Alignment.html">Bio::DB::Alignment</a>
|
101
101
|
|
102
|
+
<li><a href="../../../../Bio/DB/Pileup.html">Bio::DB::Pileup</a>
|
103
|
+
|
102
104
|
<li><a href="../../../../Bio/DB/SAM.html">Bio::DB::SAM</a>
|
103
105
|
|
104
106
|
<li><a href="../../../../Bio/DB/SAM/Library.html">Bio::DB::SAM::Library</a>
|
@@ -123,11 +125,9 @@
|
|
123
125
|
|
124
126
|
<li><a href="../../../../Bio/DB/Tag.html">Bio::DB::Tag</a>
|
125
127
|
|
126
|
-
<li><a href="../../../../
|
127
|
-
|
128
|
-
<li><a href="../../../../Pileup.html">Pileup</a>
|
128
|
+
<li><a href="../../../../Bio/DB/Vcf.html">Bio::DB::Vcf</a>
|
129
129
|
|
130
|
-
<li><a href="../../../../
|
130
|
+
<li><a href="../../../../LibC.html">LibC</a>
|
131
131
|
|
132
132
|
</ul>
|
133
133
|
</nav>
|
@@ -101,6 +101,8 @@
|
|
101
101
|
|
102
102
|
<li><a href="../../../../Bio/DB/Alignment.html">Bio::DB::Alignment</a>
|
103
103
|
|
104
|
+
<li><a href="../../../../Bio/DB/Pileup.html">Bio::DB::Pileup</a>
|
105
|
+
|
104
106
|
<li><a href="../../../../Bio/DB/SAM.html">Bio::DB::SAM</a>
|
105
107
|
|
106
108
|
<li><a href="../../../../Bio/DB/SAM/Library.html">Bio::DB::SAM::Library</a>
|
@@ -125,11 +127,9 @@
|
|
125
127
|
|
126
128
|
<li><a href="../../../../Bio/DB/Tag.html">Bio::DB::Tag</a>
|
127
129
|
|
128
|
-
<li><a href="../../../../
|
129
|
-
|
130
|
-
<li><a href="../../../../Pileup.html">Pileup</a>
|
130
|
+
<li><a href="../../../../Bio/DB/Vcf.html">Bio::DB::Vcf</a>
|
131
131
|
|
132
|
-
<li><a href="../../../../
|
132
|
+
<li><a href="../../../../LibC.html">LibC</a>
|
133
133
|
|
134
134
|
</ul>
|
135
135
|
</nav>
|
@@ -89,6 +89,8 @@
|
|
89
89
|
|
90
90
|
<li><a href="../../../../Bio/DB/Alignment.html">Bio::DB::Alignment</a>
|
91
91
|
|
92
|
+
<li><a href="../../../../Bio/DB/Pileup.html">Bio::DB::Pileup</a>
|
93
|
+
|
92
94
|
<li><a href="../../../../Bio/DB/SAM.html">Bio::DB::SAM</a>
|
93
95
|
|
94
96
|
<li><a href="../../../../Bio/DB/SAM/Library.html">Bio::DB::SAM::Library</a>
|
@@ -113,11 +115,9 @@
|
|
113
115
|
|
114
116
|
<li><a href="../../../../Bio/DB/Tag.html">Bio::DB::Tag</a>
|
115
117
|
|
116
|
-
<li><a href="../../../../
|
117
|
-
|
118
|
-
<li><a href="../../../../Pileup.html">Pileup</a>
|
118
|
+
<li><a href="../../../../Bio/DB/Vcf.html">Bio::DB::Vcf</a>
|
119
119
|
|
120
|
-
<li><a href="../../../../
|
120
|
+
<li><a href="../../../../LibC.html">LibC</a>
|
121
121
|
|
122
122
|
</ul>
|
123
123
|
</nav>
|
@@ -89,6 +89,8 @@
|
|
89
89
|
|
90
90
|
<li><a href="../../../../Bio/DB/Alignment.html">Bio::DB::Alignment</a>
|
91
91
|
|
92
|
+
<li><a href="../../../../Bio/DB/Pileup.html">Bio::DB::Pileup</a>
|
93
|
+
|
92
94
|
<li><a href="../../../../Bio/DB/SAM.html">Bio::DB::SAM</a>
|
93
95
|
|
94
96
|
<li><a href="../../../../Bio/DB/SAM/Library.html">Bio::DB::SAM::Library</a>
|
@@ -113,11 +115,9 @@
|
|
113
115
|
|
114
116
|
<li><a href="../../../../Bio/DB/Tag.html">Bio::DB::Tag</a>
|
115
117
|
|
116
|
-
<li><a href="../../../../
|
117
|
-
|
118
|
-
<li><a href="../../../../Pileup.html">Pileup</a>
|
118
|
+
<li><a href="../../../../Bio/DB/Vcf.html">Bio::DB::Vcf</a>
|
119
119
|
|
120
|
-
<li><a href="../../../../
|
120
|
+
<li><a href="../../../../LibC.html">LibC</a>
|
121
121
|
|
122
122
|
</ul>
|
123
123
|
</nav>
|
@@ -89,6 +89,8 @@
|
|
89
89
|
|
90
90
|
<li><a href="../../../../Bio/DB/Alignment.html">Bio::DB::Alignment</a>
|
91
91
|
|
92
|
+
<li><a href="../../../../Bio/DB/Pileup.html">Bio::DB::Pileup</a>
|
93
|
+
|
92
94
|
<li><a href="../../../../Bio/DB/SAM.html">Bio::DB::SAM</a>
|
93
95
|
|
94
96
|
<li><a href="../../../../Bio/DB/SAM/Library.html">Bio::DB::SAM::Library</a>
|
@@ -113,11 +115,9 @@
|
|
113
115
|
|
114
116
|
<li><a href="../../../../Bio/DB/Tag.html">Bio::DB::Tag</a>
|
115
117
|
|
116
|
-
<li><a href="../../../../
|
117
|
-
|
118
|
-
<li><a href="../../../../Pileup.html">Pileup</a>
|
118
|
+
<li><a href="../../../../Bio/DB/Vcf.html">Bio::DB::Vcf</a>
|
119
119
|
|
120
|
-
<li><a href="../../../../
|
120
|
+
<li><a href="../../../../LibC.html">LibC</a>
|
121
121
|
|
122
122
|
</ul>
|
123
123
|
</nav>
|
@@ -99,6 +99,8 @@
|
|
99
99
|
|
100
100
|
<li><a href="../../Bio/DB/Alignment.html">Bio::DB::Alignment</a>
|
101
101
|
|
102
|
+
<li><a href="../../Bio/DB/Pileup.html">Bio::DB::Pileup</a>
|
103
|
+
|
102
104
|
<li><a href="../../Bio/DB/SAM.html">Bio::DB::SAM</a>
|
103
105
|
|
104
106
|
<li><a href="../../Bio/DB/SAM/Library.html">Bio::DB::SAM::Library</a>
|
@@ -123,11 +125,9 @@
|
|
123
125
|
|
124
126
|
<li><a href="../../Bio/DB/Tag.html">Bio::DB::Tag</a>
|
125
127
|
|
126
|
-
<li><a href="../../
|
127
|
-
|
128
|
-
<li><a href="../../Pileup.html">Pileup</a>
|
128
|
+
<li><a href="../../Bio/DB/Vcf.html">Bio::DB::Vcf</a>
|
129
129
|
|
130
|
-
<li><a href="../../
|
130
|
+
<li><a href="../../LibC.html">LibC</a>
|
131
131
|
|
132
132
|
</ul>
|
133
133
|
</nav>
|
@@ -176,7 +176,7 @@
|
|
176
176
|
|
177
177
|
|
178
178
|
<div class="method-source-code" id="new-source">
|
179
|
-
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line
|
179
|
+
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 639</span>
|
180
180
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>()
|
181
181
|
|
182
182
|
<span class="ruby-keyword">end</span></pre>
|
data/doc/Bio/DB/Tag.html
CHANGED
@@ -99,6 +99,8 @@
|
|
99
99
|
|
100
100
|
<li><a href="../../Bio/DB/Alignment.html">Bio::DB::Alignment</a>
|
101
101
|
|
102
|
+
<li><a href="../../Bio/DB/Pileup.html">Bio::DB::Pileup</a>
|
103
|
+
|
102
104
|
<li><a href="../../Bio/DB/SAM.html">Bio::DB::SAM</a>
|
103
105
|
|
104
106
|
<li><a href="../../Bio/DB/SAM/Library.html">Bio::DB::SAM::Library</a>
|
@@ -123,11 +125,9 @@
|
|
123
125
|
|
124
126
|
<li><a href="../../Bio/DB/Tag.html">Bio::DB::Tag</a>
|
125
127
|
|
126
|
-
<li><a href="../../
|
127
|
-
|
128
|
-
<li><a href="../../Pileup.html">Pileup</a>
|
128
|
+
<li><a href="../../Bio/DB/Vcf.html">Bio::DB::Vcf</a>
|
129
129
|
|
130
|
-
<li><a href="../../
|
130
|
+
<li><a href="../../LibC.html">LibC</a>
|
131
131
|
|
132
132
|
</ul>
|
133
133
|
</nav>
|
@@ -222,7 +222,7 @@
|
|
222
222
|
|
223
223
|
|
224
224
|
<div class="method-source-code" id="set-source">
|
225
|
-
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line
|
225
|
+
<pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 540</span>
|
226
226
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">set</span>(<span class="ruby-identifier">str</span>)
|
227
227
|
<span class="ruby-identifier">v</span> = <span class="ruby-identifier">str</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">":"</span>)
|
228
228
|
<span class="ruby-ivar">@tag</span> = <span class="ruby-identifier">v</span>[<span class="ruby-value">0</span>]
|
data/doc/Bio/DB/Vcf.html
ADDED
@@ -0,0 +1,467 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
6
|
+
|
7
|
+
<title>Class: Bio::DB::Vcf</title>
|
8
|
+
|
9
|
+
<link type="text/css" media="screen" href="../../rdoc.css" rel="stylesheet">
|
10
|
+
|
11
|
+
<script type="text/javascript">
|
12
|
+
var rdoc_rel_prefix = "../../";
|
13
|
+
</script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
16
|
+
<script type="text/javascript" charset="utf-8" src="../../js/navigation.js"></script>
|
17
|
+
<script type="text/javascript" charset="utf-8" src="../../js/search_index.js"></script>
|
18
|
+
<script type="text/javascript" charset="utf-8" src="../../js/search.js"></script>
|
19
|
+
<script type="text/javascript" charset="utf-8" src="../../js/searcher.js"></script>
|
20
|
+
<script type="text/javascript" charset="utf-8" src="../../js/darkfish.js"></script>
|
21
|
+
|
22
|
+
|
23
|
+
<body id="top" class="class">
|
24
|
+
<nav id="metadata">
|
25
|
+
<nav id="home-section" class="section">
|
26
|
+
<h3 class="section-header">
|
27
|
+
<a href="../../index.html">Home</a>
|
28
|
+
<a href="../../table_of_contents.html#classes">Classes</a>
|
29
|
+
<a href="../../table_of_contents.html#methods">Methods</a>
|
30
|
+
</h3>
|
31
|
+
</nav>
|
32
|
+
|
33
|
+
|
34
|
+
<nav id="search-section" class="section project-section" class="initially-hidden">
|
35
|
+
<form action="#" method="get" accept-charset="utf-8">
|
36
|
+
<h3 class="section-header">
|
37
|
+
<input type="text" name="search" placeholder="Search" id="search-field"
|
38
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
39
|
+
</h3>
|
40
|
+
</form>
|
41
|
+
|
42
|
+
<ul id="search-results" class="initially-hidden"></ul>
|
43
|
+
</nav>
|
44
|
+
|
45
|
+
|
46
|
+
<div id="file-metadata">
|
47
|
+
<nav id="file-list-section" class="section">
|
48
|
+
<h3 class="section-header">Defined In</h3>
|
49
|
+
<ul>
|
50
|
+
<li>lib/bio/db/vcf.rb
|
51
|
+
</ul>
|
52
|
+
</nav>
|
53
|
+
|
54
|
+
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<div id="class-metadata">
|
58
|
+
|
59
|
+
<nav id="parent-class-section" class="section">
|
60
|
+
<h3 class="section-header">Parent</h3>
|
61
|
+
|
62
|
+
<p class="link">Object
|
63
|
+
|
64
|
+
</nav>
|
65
|
+
|
66
|
+
|
67
|
+
<!-- Method Quickref -->
|
68
|
+
<nav id="method-list-section" class="section">
|
69
|
+
<h3 class="section-header">Methods</h3>
|
70
|
+
|
71
|
+
<ul class="link-list">
|
72
|
+
|
73
|
+
<li><a href="#method-c-new">::new</a>
|
74
|
+
|
75
|
+
<li><a href="#method-i-int_or_raw">#int_or_raw</a>
|
76
|
+
|
77
|
+
<li><a href="#method-i-parse_line">#parse_line</a>
|
78
|
+
|
79
|
+
</ul>
|
80
|
+
</nav>
|
81
|
+
|
82
|
+
</div>
|
83
|
+
|
84
|
+
<div id="project-metadata">
|
85
|
+
<nav id="fileindex-section" class="section project-section">
|
86
|
+
<h3 class="section-header">Pages</h3>
|
87
|
+
|
88
|
+
<ul>
|
89
|
+
|
90
|
+
<li class="file"><a href="../../LICENSE_txt.html">LICENSE</a>
|
91
|
+
|
92
|
+
</ul>
|
93
|
+
</nav>
|
94
|
+
|
95
|
+
<nav id="classindex-section" class="section project-section">
|
96
|
+
<h3 class="section-header">Class and Module Index</h3>
|
97
|
+
|
98
|
+
<ul class="link-list">
|
99
|
+
|
100
|
+
<li><a href="../../Bio.html">Bio</a>
|
101
|
+
|
102
|
+
<li><a href="../../Bio/DB.html">Bio::DB</a>
|
103
|
+
|
104
|
+
<li><a href="../../Bio/DB/Alignment.html">Bio::DB::Alignment</a>
|
105
|
+
|
106
|
+
<li><a href="../../Bio/DB/Pileup.html">Bio::DB::Pileup</a>
|
107
|
+
|
108
|
+
<li><a href="../../Bio/DB/SAM.html">Bio::DB::SAM</a>
|
109
|
+
|
110
|
+
<li><a href="../../Bio/DB/SAM/Library.html">Bio::DB::SAM::Library</a>
|
111
|
+
|
112
|
+
<li><a href="../../Bio/DB/SAM/Tools.html">Bio::DB::SAM::Tools</a>
|
113
|
+
|
114
|
+
<li><a href="../../Bio/DB/SAM/Tools/Bam1CoreT.html">Bio::DB::SAM::Tools::Bam1CoreT</a>
|
115
|
+
|
116
|
+
<li><a href="../../Bio/DB/SAM/Tools/Bam1T.html">Bio::DB::SAM::Tools::Bam1T</a>
|
117
|
+
|
118
|
+
<li><a href="../../Bio/DB/SAM/Tools/BamHeaderT.html">Bio::DB::SAM::Tools::BamHeaderT</a>
|
119
|
+
|
120
|
+
<li><a href="../../Bio/DB/SAM/Tools/BamPileup1T.html">Bio::DB::SAM::Tools::BamPileup1T</a>
|
121
|
+
|
122
|
+
<li><a href="../../Bio/DB/SAM/Tools/SamfileT.html">Bio::DB::SAM::Tools::SamfileT</a>
|
123
|
+
|
124
|
+
<li><a href="../../Bio/DB/SAM/Tools/SamfileTX.html">Bio::DB::SAM::Tools::SamfileTX</a>
|
125
|
+
|
126
|
+
<li><a href="../../Bio/DB/SAMException.html">Bio::DB::SAMException</a>
|
127
|
+
|
128
|
+
<li><a href="../../Bio/DB/Sam.html">Bio::DB::Sam</a>
|
129
|
+
|
130
|
+
<li><a href="../../Bio/DB/Tag.html">Bio::DB::Tag</a>
|
131
|
+
|
132
|
+
<li><a href="../../Bio/DB/Vcf.html">Bio::DB::Vcf</a>
|
133
|
+
|
134
|
+
<li><a href="../../LibC.html">LibC</a>
|
135
|
+
|
136
|
+
</ul>
|
137
|
+
</nav>
|
138
|
+
|
139
|
+
</div>
|
140
|
+
</nav>
|
141
|
+
|
142
|
+
<div id="documentation">
|
143
|
+
<h1 class="class">class Bio::DB::Vcf</h1>
|
144
|
+
|
145
|
+
<div id="description" class="description">
|
146
|
+
|
147
|
+
</div><!-- description -->
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
<!-- Attributes -->
|
161
|
+
<section id="attribute-method-details" class="method-section section">
|
162
|
+
<h3 class="section-header">Attributes</h3>
|
163
|
+
|
164
|
+
|
165
|
+
<div id="attribute-i-alt" class="method-detail">
|
166
|
+
<div class="method-heading attribute-method-heading">
|
167
|
+
<span class="method-name">alt</span><span
|
168
|
+
class="attribute-access-type">[RW]</span>
|
169
|
+
</div>
|
170
|
+
|
171
|
+
<div class="method-description">
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
</div>
|
176
|
+
</div>
|
177
|
+
|
178
|
+
<div id="attribute-i-chrom" class="method-detail">
|
179
|
+
<div class="method-heading attribute-method-heading">
|
180
|
+
<span class="method-name">chrom</span><span
|
181
|
+
class="attribute-access-type">[RW]</span>
|
182
|
+
</div>
|
183
|
+
|
184
|
+
<div class="method-description">
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
</div>
|
189
|
+
</div>
|
190
|
+
|
191
|
+
<div id="attribute-i-filter" class="method-detail">
|
192
|
+
<div class="method-heading attribute-method-heading">
|
193
|
+
<span class="method-name">filter</span><span
|
194
|
+
class="attribute-access-type">[RW]</span>
|
195
|
+
</div>
|
196
|
+
|
197
|
+
<div class="method-description">
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
</div>
|
202
|
+
</div>
|
203
|
+
|
204
|
+
<div id="attribute-i-format" class="method-detail">
|
205
|
+
<div class="method-heading attribute-method-heading">
|
206
|
+
<span class="method-name">format</span><span
|
207
|
+
class="attribute-access-type">[RW]</span>
|
208
|
+
</div>
|
209
|
+
|
210
|
+
<div class="method-description">
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
</div>
|
215
|
+
</div>
|
216
|
+
|
217
|
+
<div id="attribute-i-id" class="method-detail">
|
218
|
+
<div class="method-heading attribute-method-heading">
|
219
|
+
<span class="method-name">id</span><span
|
220
|
+
class="attribute-access-type">[RW]</span>
|
221
|
+
</div>
|
222
|
+
|
223
|
+
<div class="method-description">
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
</div>
|
228
|
+
</div>
|
229
|
+
|
230
|
+
<div id="attribute-i-info" class="method-detail">
|
231
|
+
<div class="method-heading attribute-method-heading">
|
232
|
+
<span class="method-name">info</span><span
|
233
|
+
class="attribute-access-type">[RW]</span>
|
234
|
+
</div>
|
235
|
+
|
236
|
+
<div class="method-description">
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
</div>
|
241
|
+
</div>
|
242
|
+
|
243
|
+
<div id="attribute-i-pos" class="method-detail">
|
244
|
+
<div class="method-heading attribute-method-heading">
|
245
|
+
<span class="method-name">pos</span><span
|
246
|
+
class="attribute-access-type">[RW]</span>
|
247
|
+
</div>
|
248
|
+
|
249
|
+
<div class="method-description">
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
</div>
|
254
|
+
</div>
|
255
|
+
|
256
|
+
<div id="attribute-i-qual" class="method-detail">
|
257
|
+
<div class="method-heading attribute-method-heading">
|
258
|
+
<span class="method-name">qual</span><span
|
259
|
+
class="attribute-access-type">[RW]</span>
|
260
|
+
</div>
|
261
|
+
|
262
|
+
<div class="method-description">
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
</div>
|
267
|
+
</div>
|
268
|
+
|
269
|
+
<div id="attribute-i-ref" class="method-detail">
|
270
|
+
<div class="method-heading attribute-method-heading">
|
271
|
+
<span class="method-name">ref</span><span
|
272
|
+
class="attribute-access-type">[RW]</span>
|
273
|
+
</div>
|
274
|
+
|
275
|
+
<div class="method-description">
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
</div>
|
280
|
+
</div>
|
281
|
+
|
282
|
+
<div id="attribute-i-samples" class="method-detail">
|
283
|
+
<div class="method-heading attribute-method-heading">
|
284
|
+
<span class="method-name">samples</span><span
|
285
|
+
class="attribute-access-type">[RW]</span>
|
286
|
+
</div>
|
287
|
+
|
288
|
+
<div class="method-description">
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
</div>
|
293
|
+
</div>
|
294
|
+
|
295
|
+
</section><!-- attribute-method-details -->
|
296
|
+
|
297
|
+
|
298
|
+
<!-- Methods -->
|
299
|
+
|
300
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section section">
|
301
|
+
<h3 class="section-header">Public Class Methods</h3>
|
302
|
+
|
303
|
+
|
304
|
+
<div id="method-c-new" class="method-detail ">
|
305
|
+
|
306
|
+
<div class="method-heading">
|
307
|
+
<span class="method-name">new</span><span
|
308
|
+
class="method-args">(line=nil, sample_names=nil)</span>
|
309
|
+
<span class="method-click-advice">click to toggle source</span>
|
310
|
+
</div>
|
311
|
+
|
312
|
+
|
313
|
+
<div class="method-description">
|
314
|
+
|
315
|
+
<p>create the vcf object, use the ordered list of sample names to label
|
316
|
+
samples if provided [‘A’, ‘B’, ‘C’], otherwise uses, 1,2,3 etc vcf =
|
317
|
+
Bio::DB::Vcf(“19 111 . A C 9.6 . . GT:HQ
|
318
|
+
0|0:10,10 0|0:10,10 0/1:3,3”)</p>
|
319
|
+
|
320
|
+
|
321
|
+
|
322
|
+
<div class="method-source-code" id="new-source">
|
323
|
+
<pre><span class="ruby-comment"># File lib/bio/db/vcf.rb, line 15</span>
|
324
|
+
<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>)
|
325
|
+
<span class="ruby-ivar">@info</span> = {}
|
326
|
+
<span class="ruby-ivar">@samples</span> = {}
|
327
|
+
<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>
|
328
|
+
<span class="ruby-keyword">end</span></pre>
|
329
|
+
</div><!-- new-source -->
|
330
|
+
|
331
|
+
</div>
|
332
|
+
|
333
|
+
|
334
|
+
|
335
|
+
|
336
|
+
</div><!-- new-method -->
|
337
|
+
|
338
|
+
|
339
|
+
</section><!-- public-class-method-details -->
|
340
|
+
|
341
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
|
342
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
343
|
+
|
344
|
+
|
345
|
+
<div id="method-i-int_or_raw" class="method-detail ">
|
346
|
+
|
347
|
+
<div class="method-heading">
|
348
|
+
<span class="method-name">int_or_raw</span><span
|
349
|
+
class="method-args">(x)</span>
|
350
|
+
<span class="method-click-advice">click to toggle source</span>
|
351
|
+
</div>
|
352
|
+
|
353
|
+
|
354
|
+
<div class="method-description">
|
355
|
+
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
|
360
|
+
<div class="method-source-code" id="int_or_raw-source">
|
361
|
+
<pre><span class="ruby-comment"># File lib/bio/db/vcf.rb, line 21</span>
|
362
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">int_or_raw</span>(<span class="ruby-identifier">x</span>)
|
363
|
+
<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>
|
364
|
+
<span class="ruby-keyword">end</span></pre>
|
365
|
+
</div><!-- int_or_raw-source -->
|
366
|
+
|
367
|
+
</div>
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
|
372
|
+
</div><!-- int_or_raw-method -->
|
373
|
+
|
374
|
+
|
375
|
+
<div id="method-i-parse_line" class="method-detail ">
|
376
|
+
|
377
|
+
<div class="method-heading">
|
378
|
+
<span class="method-name">parse_line</span><span
|
379
|
+
class="method-args">(line, sample_names=nil)</span>
|
380
|
+
<span class="method-click-advice">click to toggle source</span>
|
381
|
+
</div>
|
382
|
+
|
383
|
+
|
384
|
+
<div class="method-description">
|
385
|
+
|
386
|
+
<p>gets the info in the <a href="Vcf.html">Vcf</a> lines and parses it,
|
387
|
+
setting the attributes</p>
|
388
|
+
|
389
|
+
|
390
|
+
|
391
|
+
<div class="method-source-code" id="parse_line-source">
|
392
|
+
<pre><span class="ruby-comment"># File lib/bio/db/vcf.rb, line 26</span>
|
393
|
+
<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>)
|
394
|
+
<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>
|
395
|
+
|
396
|
+
<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>)
|
397
|
+
<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>
|
398
|
+
<span class="ruby-ivar">@chrom</span> = <span class="ruby-identifier">f</span>[<span class="ruby-value">0</span>]
|
399
|
+
<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>
|
400
|
+
<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>]
|
401
|
+
<span class="ruby-ivar">@ref</span> = <span class="ruby-identifier">f</span>[<span class="ruby-value">3</span>]
|
402
|
+
<span class="ruby-ivar">@alt</span> = <span class="ruby-identifier">f</span>[<span class="ruby-value">4</span>]
|
403
|
+
<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>
|
404
|
+
<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>]
|
405
|
+
|
406
|
+
<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> {}
|
407
|
+
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@info</span>
|
408
|
+
<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>)
|
409
|
+
<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>
|
410
|
+
<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>)
|
411
|
+
<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>
|
412
|
+
<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>]
|
413
|
+
<span class="ruby-keyword">else</span> <span class="ruby-comment"># Otherwise, it's just a flag</span>
|
414
|
+
<span class="ruby-ivar">@info</span>[<span class="ruby-identifier">x</span>] = <span class="ruby-keyword">nil</span>
|
415
|
+
<span class="ruby-keyword">end</span>
|
416
|
+
<span class="ruby-keyword">end</span>
|
417
|
+
<span class="ruby-keyword">end</span>
|
418
|
+
|
419
|
+
<span class="ruby-ivar">@samples</span> = {}
|
420
|
+
<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>
|
421
|
+
<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>
|
422
|
+
|
423
|
+
<span class="ruby-ivar">@format</span> = <span class="ruby-identifier">f</span>[<span class="ruby-value">8</span>]
|
424
|
+
|
425
|
+
<span class="ruby-identifier">sample_keys</span> = <span class="ruby-ivar">@format</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">":"</span>)
|
426
|
+
|
427
|
+
<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>
|
428
|
+
|
429
|
+
<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>
|
430
|
+
<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>}
|
431
|
+
<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>
|
432
|
+
<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>
|
433
|
+
<span class="ruby-keyword">end</span>
|
434
|
+
|
435
|
+
<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>
|
436
|
+
<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>
|
437
|
+
<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>)
|
438
|
+
<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>
|
439
|
+
<span class="ruby-ivar">@samples</span>[<span class="ruby-identifier">sample_name</span>] = {}
|
440
|
+
<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>}
|
441
|
+
<span class="ruby-keyword">end</span>
|
442
|
+
|
443
|
+
<span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span>;
|
444
|
+
<span class="ruby-keyword">end</span></pre>
|
445
|
+
</div><!-- parse_line-source -->
|
446
|
+
|
447
|
+
</div>
|
448
|
+
|
449
|
+
|
450
|
+
|
451
|
+
|
452
|
+
</div><!-- parse_line-method -->
|
453
|
+
|
454
|
+
|
455
|
+
</section><!-- public-instance-method-details -->
|
456
|
+
|
457
|
+
</section><!-- 5Buntitled-5D -->
|
458
|
+
|
459
|
+
</div><!-- documentation -->
|
460
|
+
|
461
|
+
|
462
|
+
<footer id="validator-badges">
|
463
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
464
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.11.
|
465
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
466
|
+
</footer>
|
467
|
+
|