Class: Mutation
- Inherits:
-
Object
- Object
- Mutation
- Includes:
- GenomicLocus, Oncotate
- Defined in:
- lib/mutation.rb,
lib/oncotator.rb,
lib/mutation_set.rb,
lib/mutation_set.rb
Defined Under Namespace
Modules: Filtering, Oncotate Classes: Collection, Record
Constant Summary collapse
- VALID_ALLELE =
This is a generic description of a mutation.
/^[ATGCNatgcn]+$/
Instance Attribute Summary collapse
-
#alt ⇒ Object
readonly
Returns the value of attribute alt.
-
#alt_count ⇒ Object
readonly
Returns the value of attribute alt_count.
-
#pos ⇒ Object
(also: #start)
readonly
Returns the value of attribute pos.
-
#ref ⇒ Object
readonly
Returns the value of attribute ref.
-
#ref_count ⇒ Object
readonly
Returns the value of attribute ref_count.
-
#seqname ⇒ Object
readonly
Returns the value of attribute seqname.
Instance Method Summary collapse
- #alt_at(loc) ⇒ Object
-
#initialize(seqname, pos, ref, alt, ref_count = nil, alt_count = nil) ⇒ Mutation
constructor
A new instance of Mutation.
- #is_valid? ⇒ Boolean
- #ref_at(loc) ⇒ Object
- #stop ⇒ Object
- #to_s ⇒ Object
- #var_freq ⇒ Object
Methods included from Oncotate
#discard_onco, #in_cosmic, #inspect, #onco, #to_ot
Methods included from GenomicLocus
#default_stop, #loc, #long_chrom, #range, #short_chrom
Methods included from IntervalList::Interval
#above?, #below?, #center, #clone, #contains?, #diff, #dist, #intersect, #overlaps?, #size, #union
Constructor Details
#initialize(seqname, pos, ref, alt, ref_count = nil, alt_count = nil) ⇒ Mutation
Returns a new instance of Mutation.
10 11 12 |
# File 'lib/mutation.rb', line 10 def initialize seqname, pos, ref, alt, ref_count=nil, alt_count=nil @seqname, @pos, @ref, @alt, @ref_count, @alt_count = seqname, pos, ref, alt, ref_count, alt_count end |
Instance Attribute Details
#alt ⇒ Object (readonly)
Returns the value of attribute alt.
8 9 10 |
# File 'lib/mutation.rb', line 8 def alt @alt end |
#alt_count ⇒ Object (readonly)
Returns the value of attribute alt_count.
8 9 10 |
# File 'lib/mutation.rb', line 8 def alt_count @alt_count end |
#pos ⇒ Object (readonly) Also known as: start
Returns the value of attribute pos.
8 9 10 |
# File 'lib/mutation.rb', line 8 def pos @pos end |
#ref ⇒ Object (readonly)
Returns the value of attribute ref.
8 9 10 |
# File 'lib/mutation.rb', line 8 def ref @ref end |
#ref_count ⇒ Object (readonly)
Returns the value of attribute ref_count.
8 9 10 |
# File 'lib/mutation.rb', line 8 def ref_count @ref_count end |
#seqname ⇒ Object (readonly)
Returns the value of attribute seqname.
8 9 10 |
# File 'lib/mutation.rb', line 8 def seqname @seqname end |
Instance Method Details
#alt_at(loc) ⇒ Object
37 38 39 40 |
# File 'lib/mutation.rb', line 37 def alt_at loc return nil unless contains? loc alt[pos - loc.pos] end |
#is_valid? ⇒ Boolean
22 23 24 |
# File 'lib/mutation.rb', line 22 def is_valid? ref =~ VALID_ALLELE && alt =~ VALID_ALLELE end |
#ref_at(loc) ⇒ Object
26 27 28 29 |
# File 'lib/mutation.rb', line 26 def ref_at loc return nil unless contains? loc ref[pos - loc.pos] end |
#stop ⇒ Object
14 15 16 |
# File 'lib/mutation.rb', line 14 def stop start + ref.size - 1 end |
#to_s ⇒ Object
18 19 20 |
# File 'lib/mutation.rb', line 18 def to_s range.to_s + ":#{ref}-#{alt}" end |
#var_freq ⇒ Object
31 32 33 34 35 |
# File 'lib/mutation.rb', line 31 def var_freq if ref_count && alt_count ref_count / alt_count end end |