Class: MutantAllele

Inherits:
Object
  • Object
show all
Defined in:
lib/bio-sam-mutation/bio/mutantallele.rb

Overview

Used for tracking mutations appearing more than once and cacheing VEP lookups

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mutations: nil, count: 0, example: nil, seq: nil) ⇒ MutantAllele

Returns a new instance of MutantAllele.



9
10
11
12
13
# File 'lib/bio-sam-mutation/bio/mutantallele.rb', line 9

def initialize (mutations: nil, count: 0, example: nil, seq: nil)
  @mutations = mutations
  @count = count
  @example = example
end

Class Attribute Details

.previous_lookupsObject

Returns the value of attribute previous_lookups.



5
6
7
# File 'lib/bio-sam-mutation/bio/mutantallele.rb', line 5

def previous_lookups
  @previous_lookups
end

Instance Attribute Details

#countObject

Returns the value of attribute count.



3
4
5
# File 'lib/bio-sam-mutation/bio/mutantallele.rb', line 3

def count
  @count
end

#exampleObject

Returns the value of attribute example.



3
4
5
# File 'lib/bio-sam-mutation/bio/mutantallele.rb', line 3

def example
  @example
end

#mutationsObject

Returns the value of attribute mutations.



3
4
5
# File 'lib/bio-sam-mutation/bio/mutantallele.rb', line 3

def mutations
  @mutations
end

#seqObject

Returns the value of attribute seq.



3
4
5
# File 'lib/bio-sam-mutation/bio/mutantallele.rb', line 3

def seq
  @seq
end

Instance Method Details

#lookup(species = "human", ref_type = nil) ⇒ Object

Returns JSON from Ensembl VEP



16
17
18
19
20
21
22
23
# File 'lib/bio-sam-mutation/bio/mutantallele.rb', line 16

def lookup species="human", ref_type=nil
  key = mutations.to_hgvs(ref_type)
  if key && (MutantAllele.previous_lookups.keys.include? key)
    MutantAllele.previous_lookups[key]
  else
    mutations.vep(species,ref_type)
  end
end