Module: GenomicMutation

Extended by:
Entity
Defined in:
lib/rbbt/entity/genomic_mutation.rb

Constant Summary

Constants included from Entity

Entity::UNPERSISTED_PREFIX

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Entity

extended

Class Method Details

.COSMIC_index(organism) ⇒ Object



74
75
76
77
78
79
80
81
82
83
# File 'lib/rbbt/entity/genomic_mutation.rb', line 74

def self.COSMIC_index(organism)
  build = Organism.hg_build(organism)
  field = {
    "hg19" => "Mutation GRCh37 genome position",
    "hg18" => "Mutation NCBI36 genome position",
  
  }[build]
  @@COSMIC_index ||= {}
  @@COSMIC_index[build] ||= COSMIC.Mutations.tsv :key_field => field, :unnamed => true, :fields => ["Mutation ID"], :type => :single, :persist => true
end

.dbSNP_index(organism) ⇒ Object



85
86
87
88
89
# File 'lib/rbbt/entity/genomic_mutation.rb', line 85

def self.dbSNP_index(organism)
  build = Organism.hg_build(organism)
  @@dbSNP_index ||= {}
  @@dbSNP_index[build] ||= DbSNP[build == "hg19" ? "mutations" : "mutations_hg18"].tsv :key_field => "Genomic Mutation", :unnamed => true,  :type => :single, :persist => true
end

.dbSNP_position_index(organism) ⇒ Object



91
92
93
94
95
96
97
98
99
100
# File 'lib/rbbt/entity/genomic_mutation.rb', line 91

def self.dbSNP_position_index(organism)
  build = Organism.hg_build(organism)

  @@dbSNP_position_index ||= {}

  @@dbSNP_position_index[build] ||= TSV.open(
    CMD::cmd('sed "s/\([[:alnum:]]\+\):\([[:digit:]]\+\):\([ACTG+-]\+\)/\1:\2/" ', :in => DbSNP[build == "hg19" ? "mutations" : "mutations_hg18"].open, :pipe => true), 
    :key_field => "Genomic Mutation", :unnamed => true,  :type => :single, :persist => true)

end

.exon_position_index(organism) ⇒ Object



58
59
60
61
# File 'lib/rbbt/entity/genomic_mutation.rb', line 58

def self.exon_position_index(organism)
  @@exon_position_indices ||= {}
  @@exon_position_indices[organism] ||= Organism.exons(organism).tsv :persist => true, :type => :list, :cast => :to_i, :fields => ["Exon Strand", "Exon Chr Start", "Exon Chr End"], :unnamed => true
end

.exon_rank_index(organism) ⇒ Object



53
54
55
56
# File 'lib/rbbt/entity/genomic_mutation.rb', line 53

def self.exon_rank_index(organism)
  @@exon_rank_indices ||= {}
  @@exon_rank_indices[organism] ||= Organism.transcript_exons(organism).tsv :persist => true, :type => :double, :unnamed => true
end

.genomes_1000_index(organism) ⇒ Object



68
69
70
71
72
# File 'lib/rbbt/entity/genomic_mutation.rb', line 68

def self.genomes_1000_index(organism)
  build = Organism.hg_build(organism)
  @@genomes_1000_index ||= {}
  @@genomes_1000_index[build] ||= Genomes1000[build == "hg19" ? "mutations" : "mutations_hg18"].tsv :key_field => "Genomic Mutation", :unnamed => true, :fields => ["Variant ID"], :type => :single, :persist => true
end

.transcripts_for_exon_index(organism) ⇒ Object



63
64
65
66
# File 'lib/rbbt/entity/genomic_mutation.rb', line 63

def self.transcripts_for_exon_index(organism)
  @@transcript_for_exon_indices ||= {}
  @@transcript_for_exon_indices[organism] ||= Organism.transcript_exons(organism).tsv :persist => true, :type => :flat, :key_field => "Ensembl Exon ID", :fields => ["Ensembl Transcript ID"], :unnamed => true
end

Instance Method Details

#orig_watsonObject



49
50
51
# File 'lib/rbbt/entity/genomic_mutation.rb', line 49

def orig_watson
  @watson
end

#watsonObject

persist :guess_watson



36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/rbbt/entity/genomic_mutation.rb', line 36

def watson
  if @current_watson.nil?
    current = annotation_values[:watson]
    if current.nil? and Array === self
      watson = current = guess_watson
    else
      current
    end
    @current_watson = current
  end
  @current_watson
end