lib/cheripic/contig_pileups.rb in cheripic-1.1.0 vs lib/cheripic/contig_pileups.rb in cheripic-1.2.0
- old
+ new
@@ -129,15 +129,17 @@
#
# @param pos [Integer] position in the contig
# @return [Symbol] variant mode of the background bulk (:hom or :het) at the position
def bg_bulk_var(pos)
bg_base_hash = @bg_bulk[pos].var_base_frac
+ bg_base_hash.delete(:ref)
+ return nil if bg_base_hash.empty?
if bg_base_hash.length > 1
# taking only var mode
var_mode(bg_base_hash.values.max)
else
# taking only var mode
- var_mode(bg_base_hash[0])
+ var_mode(bg_base_hash[bg_base_hash.keys[0]])
end
end
# method stores pos as key and allele fraction as value
# to @hm_pos or @ht_pos hash based on variant type