Class: Coopy::IndexPair

Inherits:
Object
  • Object
show all
Defined in:
lib/lib/coopy/index_pair.rb

Instance Method Summary collapse

Constructor Details

#initialize(flags) ⇒ IndexPair

Returns a new instance of IndexPair.



7
8
9
10
11
12
13
# File 'lib/lib/coopy/index_pair.rb', line 7

def initialize(flags)
  @flags = flags
  @ia = ::Coopy::Index.new(flags)
  @ib = ::Coopy::Index.new(flags)
  @quality = 0
  @hdr = 0
end

Instance Method Details

#add_columns(ca, cb) ⇒ Object



25
26
27
28
# File 'lib/lib/coopy/index_pair.rb', line 25

def add_columns(ca,cb)
  @ia.add_column(ca)
  @ib.add_column(cb)
end

#get_qualityObject



89
90
91
# File 'lib/lib/coopy/index_pair.rb', line 89

def get_quality 
  @quality
end

#get_top_freqObject



84
85
86
87
# File 'lib/lib/coopy/index_pair.rb', line 84

def get_top_freq 
  return @ib.top_freq if @ib.top_freq > @ia.top_freq
  @ia.top_freq
end

#index_tables(a, b, hdr) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/lib/coopy/index_pair.rb', line 30

def index_tables(a,b,hdr)
  @ia.index_table(a,hdr)
  @ib.index_table(b,hdr)
  @hdr = hdr
  good = 0
  _it = ::Rb::RubyIterator.new(@ia.items.keys)
  while(_it.has_next) do
    key = _it._next
    item_a = @ia.items[key]
    spot_a = item_a.lst.length
    item_b = @ib.items[key]
    spot_b = 0
    spot_b = item_b.lst.length if item_b != nil
    good+=1 if spot_a == 1 && spot_b == 1
  end
  @quality = good / lambda{|_this_| b1 = a.get_height
  _r2 = [1.0,b1].max}.call(self)
end

#local_key(row) ⇒ Object



76
77
78
# File 'lib/lib/coopy/index_pair.rb', line 76

def local_key(row)
  @ia.to_key(@ia.get_table,row)
end

#query_by_content(row) ⇒ Object



65
66
67
68
69
# File 'lib/lib/coopy/index_pair.rb', line 65

def query_by_content(row)
  result = ::Coopy::CrossMatch.new
  ka = @ia.to_key_by_content(row)
  self.query_by_key(ka)
end

#query_local(row) ⇒ Object



71
72
73
74
# File 'lib/lib/coopy/index_pair.rb', line 71

def query_local(row)
  ka = @ia.to_key(@ia.get_table,row)
  self.query_by_key(ka)
end

#remote_key(row) ⇒ Object



80
81
82
# File 'lib/lib/coopy/index_pair.rb', line 80

def remote_key(row)
  @ib.to_key(@ib.get_table,row)
end