Class: BioVcf::VcfGenotypeField
- Inherits:
-
Object
- Object
- BioVcf::VcfGenotypeField
show all
- Defined in:
- lib/bio-vcf/vcfgenotypefield.rb
Instance Method Summary
collapse
Constructor Details
#initialize(s, format, header, alt) ⇒ VcfGenotypeField
Returns a new instance of VcfGenotypeField.
89
90
91
92
93
94
|
# File 'lib/bio-vcf/vcfgenotypefield.rb', line 89
def initialize s, format, , alt
@values = s.split(/:/)
@format = format
=
@alt = alt
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
120
121
122
123
124
125
|
# File 'lib/bio-vcf/vcfgenotypefield.rb', line 120
def method_missing(m, *args, &block)
v = @values[@format[m.to_s.upcase]]
v = v.to_i if v =~ /^\d+$/
v = v.to_f if v =~ /^\d+\.\d+$/
v
end
|
Instance Method Details
#ad ⇒ Object
100
101
102
|
# File 'lib/bio-vcf/vcfgenotypefield.rb', line 100
def ad
@values[@format['AD']].split(',').map{|i| i.to_i}
end
|
#amq ⇒ Object
116
117
118
|
# File 'lib/bio-vcf/vcfgenotypefield.rb', line 116
def amq
VcfAltInfo.new(@alt,@values[@format['AMQ']].split(','))
end
|
#bcount ⇒ Object
108
109
110
|
# File 'lib/bio-vcf/vcfgenotypefield.rb', line 108
def bcount
VcfNucleotides.new(@alt,@values[@format['BCOUNT']].split(','))
end
|
#bq ⇒ Object
112
113
114
|
# File 'lib/bio-vcf/vcfgenotypefield.rb', line 112
def bq
VcfAltInfo.new(@alt,@values[@format['BQ']].split(','))
end
|
#dp4 ⇒ Object
96
97
98
|
# File 'lib/bio-vcf/vcfgenotypefield.rb', line 96
def dp4
@values[@format['DP4']].split(',').map{|i| i.to_i}
end
|
#pl ⇒ Object
104
105
106
|
# File 'lib/bio-vcf/vcfgenotypefield.rb', line 104
def pl
@values[@format['PL']].split(',').map{|i| i.to_i}
end
|