Class: Maf::Line

Inherits:
Mutation::Record show all
Defined in:
lib/maf.rb

Instance Attribute Summary

Attributes inherited from Mutation::Record

#muts

Instance Method Summary collapse

Methods inherited from Mutation::Record

#copy, #mut, #skip_oncotator?

Methods included from Mutation::Filtering

#criteria_failed?, #criterion_ok?

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

Methods inherited from HashTable::HashLine

#[], #[]=, alias_key, #approve!, #format_column, #invalid?, #invalidate!, #set_table, #to_s, #update

Constructor Details

#initialize(h, table) ⇒ Line

Returns a new instance of Line.



59
60
61
62
# File 'lib/maf.rb', line 59

def initialize h, table
  super h, table
  @muts.push Mutation.new(seqname, pos, ref, alt, ref_count, alt_count)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args, &block) ⇒ Object



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/maf.rb', line 68

def method_missing sym, *args, &block
  if sym == :ref_count
    [ :t_ref_count, :tumor_ref_count ].each do |s|
      return send(s) if respond_to? s
    end
    nil
  elsif sym == :alt_count
    [ :t_alt_count, :tumor_alt_count ].each do |s|
      return send(s) if respond_to? s
    end
    nil
  else
    super
  end
end

Instance Method Details

#altObject



55
56
57
# File 'lib/maf.rb', line 55

def alt
  tumor_seq_allele1 == reference_allele ? tumor_seq_allele2 : tumor_seq_allele1
end

#gene_nameObject



84
85
86
87
88
89
90
# File 'lib/maf.rb', line 84

def gene_name
  if !hugo_symbol || hugo_symbol.size == 0
    onco.txp_gene
  else
    hugo_symbol
  end
end

#respond_to_missing?(sym, include_all = false) ⇒ Boolean

Returns:

  • (Boolean)


64
65
66
# File 'lib/maf.rb', line 64

def respond_to_missing? sym, include_all = false
  [ :ref_count, :alt_count ].include?(sym) || super
end