Class: LocationFile

Inherits:
Object
  • Object
show all
Defined in:
lib/mutations_caller_pipeline/location_file.rb

Class Method Summary collapse

Class Method Details

.create(vcf_file, loction_file_output) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/mutations_caller_pipeline/location_file.rb', line 2

def self.create(vcf_file, loction_file_output)
  locations = File.open(vcf_file)
  line = locations.readline()

  locus = []
  while line.include?('#')
    location = line.scan(/##contig=<ID=+\w+/)
    if !location.empty?()
      location = location[0].split('=')
      locus << location[-1]
    end
    line = locations.readline()
  end

  locations.close()
  locus_file = File.new(location_file_output,'w')
  locus_file.write(locus.join("\n"))
  locus_file.close()
end