Module: GENOME
- Defined in:
- lib/genome.rb,
lib/genome/snp.rb,
lib/genome/genome.rb,
lib/genome/version.rb,
lib/genome/genotype.rb
Defined Under Namespace
Classes: Error, Genome, Genotype, SNP
Constant Summary
collapse
- VERSION =
'0.1.0'.freeze
Class Method Summary
collapse
Class Method Details
.ancestry_reader(line) ⇒ Object
18
19
20
21
22
23
24
25
|
# File 'lib/genome.rb', line 18
def self.ancestry_reader(line)
rsid, chromosome, position, allele1, allele2 = line.split
genotype = allele1 + allele2
snp = SNP.new(chromosome = chromosome,
position = position,
genotype = Genotype.new(genotype))
[rsid, snp]
end
|
.load(_filename, _provider = '23andme') ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/genome.rb', line 27
def self.load(_filename, _provider = '23andme')
genome = Genome.new(name = _filename)
File.open(_filename).each do |line|
next if line.start_with?('#') || line.start_with?('rsid')
if _provider.casecmp? '23andme'
rsid, snp = ttandme_reader line
else
rsid, snp = ancestry_reader line
end
genome[rsid] = snp
end
genome
end
|
.ttandme_reader(line) ⇒ Object
10
11
12
13
14
15
16
|
# File 'lib/genome.rb', line 10
def self.ttandme_reader(line)
rsid, chromosome, position, genotype = line.split
snp = SNP.new(chromosome = chromosome,
position = position,
genotype = Genotype.new(genotype))
[rsid, snp]
end
|