Class: HTS::Bcf::Format::GenotypeView
- Inherits:
-
Object
- Object
- HTS::Bcf::Format::GenotypeView
- Includes:
- Enumerable
- Defined in:
- lib/hts/bcf/format.rb
Instance Method Summary collapse
Instance Method Details
#each_allele ⇒ Object Also known as: each
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/hts/bcf/format.rb', line 61 def each_allele return to_enum(__method__) unless block_given? ensure_valid! @values.each_with_index do |encoded, index| break if encoded == GT_VECTOR_END missing = gt_missing?(encoded) # The phase bit describes the separator before this allele. It has # no semantic meaning for the first allele, and HTSlib versions do # not consistently clear it while parsing VCF text. phased = index.positive? && gt_phased?(encoded) yield(missing ? nil : gt_allele(encoded), phased, missing) end self end |
#reset(values, buffer, generation) ⇒ Object
54 55 56 57 58 59 |
# File 'lib/hts/bcf/format.rb', line 54 def reset(values, buffer, generation) @values = values @buffer = buffer @generation = generation self end |
#to_s ⇒ Object
78 79 80 81 82 83 84 85 |
# File 'lib/hts/bcf/format.rb', line 78 def to_s result = +"" each_allele.with_index do |(allele, phased, missing), index| result << (phased && index.positive? ? "|" : "/") if index.positive? result << (missing ? "." : allele.to_s) end result end |