File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -272,8 +272,11 @@ def base(n)
272272 SEQ_NT16_STR [ LibHTS . bam_seqi ( r , n ) ]
273273 end
274274
275- # Get the base qualities.
276- # @return [Array] base qualities
275+ # Get the base qualities as raw PHRED bytes.
276+ # Ruby has no UInt8 type, so this returns an Array<Integer> with values in 0..255,
277+ # corresponding to Crystal's Array(UInt8).
278+ # Use qual_string for the SAM-style ASCII representation.
279+ # @return [Array<Integer>] base qualities as unsigned bytes
277280 def qual
278281 q_ptr = LibHTS . bam_get_qual ( @bam1 )
279282 q_ptr . read_array_of_uint8 ( len )
Original file line number Diff line number Diff line change @@ -214,6 +214,8 @@ def test_base
214214 def test_qual
215215 assert_equal ( [ 17 ] * 70 ) , @aln1 . qual
216216 assert_equal ( [ 255 ] * 10 ) , @aln2 . qual
217+ assert_equal true , @aln1 . qual . all? { |q | q . is_a? ( Integer ) && q . between? ( 0 , 255 ) }
218+ assert_equal true , @aln2 . qual . all? { |q | q . is_a? ( Integer ) && q . between? ( 0 , 255 ) }
217219 end
218220
219221 def test_base_qual
You can’t perform that action at this time.
0 commit comments