Class: Mutation::Collection

Inherits:
HashTable show all
Defined in:
lib/mutation_set.rb

Direct Known Subclasses

Maf, MuTect, VCF

Class Attribute Summary collapse

Instance Attribute Summary collapse

Attributes inherited from HashTable

#header, #types

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from HashTable

#<<, #[], #concat, #each, #formatted_header, header_off, header_on, #idx, #idx_keys, #inspect, line_class, line_type, #output, #preamble, #sample, #select!, #sort_by!, #sum, #update_index, #use_header?, use_header?, #wrap

Methods included from HashTableAux

#load_file

Methods included from Printer

#print, #write

Constructor Details

#initialize(obj = nil, opts = {}) ⇒ Collection

Returns a new instance of Collection.



131
132
133
134
135
136
137
# File 'lib/mutation_set.rb', line 131

def initialize(obj=nil,opts={})
  # get types from required
  opts[:types] = types_from_required opts
  super obj, opts
  default_header unless @header
  @mutation_config = YAML.load_file(opts[:mutation_config]) if opts[:mutation_config]
end

Class Attribute Details

.optionalObject (readonly)

Returns the value of attribute optional.



101
102
103
# File 'lib/mutation_set.rb', line 101

def optional
  @optional
end

.requiredObject (readonly)

Returns the value of attribute required.



101
102
103
# File 'lib/mutation_set.rb', line 101

def required
  @required
end

Instance Attribute Details

#mutation_configObject (readonly)

Returns the value of attribute mutation_config.



99
100
101
# File 'lib/mutation_set.rb', line 99

def mutation_config
  @mutation_config
end

Class Method Details

.comments(c) ⇒ Object



114
115
116
# File 'lib/mutation_set.rb', line 114

def comments c
  @comment = c
end

.default_sleeve(sleeve = nil) ⇒ Object



110
111
112
# File 'lib/mutation_set.rb', line 110

def default_sleeve sleeve=nil
  @default_sleeve ||= sleeve
end

.might_have(terms) ⇒ Object



106
107
108
# File 'lib/mutation_set.rb', line 106

def might_have terms
  @optional = terms
end

.requires(terms) ⇒ Object



102
103
104
# File 'lib/mutation_set.rb', line 102

def requires terms
  @required = terms
end

Instance Method Details

#clean_header(s) ⇒ Object



119
120
121
# File 'lib/mutation_set.rb', line 119

def clean_header s
  s.to_s.gsub(/\s+/,"_").gsub(/[^\w]+/,"").downcase.to_sym
end

#clean_headersObject



123
124
125
# File 'lib/mutation_set.rb', line 123

def clean_headers
  @headers.map {|h| clean_header h}
end

#requiredObject



127
128
129
# File 'lib/mutation_set.rb', line 127

def required
  self.class.required.keys
end