Class: TopPred::Index

Inherits:
Hash show all
Includes:
TransmemIndex
Defined in:
lib/transmembrane/toppred.rb

Instance Method Summary collapse

Constructor Details

#initialize(file, kind = :default) ⇒ Index

Returns a new instance of Index.



31
32
33
34
35
36
37
38
# File 'lib/transmembrane/toppred.rb', line 31

def initialize(file, kind=:default)
  case kind
  when :default
    TopPred.default_index(file, self)
  else
    abort "can't do #{kind}"
  end
end

Instance Method Details

#reference_to_key(reference) ⇒ Object

we need to match whatever function toppred uses to generate identifiers if we want derivative processes to be fast and accurate



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/transmembrane/toppred.rb', line 12

def reference_to_key(reference)
  if reference
    ri = reference.index(' ')
    frst =
      if ri 
        reference[0...reference.index(' ')]
      else 
        reference
      end
    if frst
      frst.gsub(/[^0-9a-zA-Z]/,'_')
    else
      nil
    end
  else
    nil
  end
end