Class: VCF

Inherits:
Mutation::Collection show all
Defined in:
lib/vcf.rb

Defined Under Namespace

Classes: Genotype, Line, Preamble

Instance Attribute Summary collapse

Attributes inherited from Mutation::Collection

#mutation_config

Attributes inherited from HashTable

#header, #types

Instance Method Summary collapse

Methods inherited from Mutation::Collection

#clean_header, #clean_headers, comments, default_sleeve, #initialize, might_have, #required, requires

Methods inherited from HashTable

#<<, #[], #concat, #each, #formatted_header, header_off, header_on, #idx, #idx_keys, #initialize, #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

This class inherits a constructor from Mutation::Collection

Instance Attribute Details

#samplesObject (readonly)

Returns the value of attribute samples.



10
11
12
# File 'lib/vcf.rb', line 10

def samples
  @samples
end

Instance Method Details

#enforce_headerObject



42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/vcf.rb', line 42

def enforce_header
  # kludge for empty vcf with no format line
  super

  if header.size > required.size
    @samples = @header - required - [ :format ]
    # recover the original sample name from the sleeve
    new_samples = @samples.map do |s|
      @sleeve[s].to_sym
    end
    @header = @header - @samples + new_samples
    @samples = new_samples
  end
end