Class: Bio::CNLS::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/bio-cnls_screenscraper.rb

Defined Under Namespace

Classes: BipartiteNLS, MonopartiteNLS, NLS

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeResult

Returns a new instance of Result.



16
17
18
# File 'lib/bio-cnls_screenscraper.rb', line 16

def initialize
  @signals = []
end

Instance Attribute Details

#signalsObject

Returns the value of attribute signals.



14
15
16
# File 'lib/bio-cnls_screenscraper.rb', line 14

def signals
  @signals
end

Instance Method Details

#bipartite_predicted?(minimum_score = nil) ⇒ Boolean

Returns:

  • (Boolean)


46
47
48
49
50
51
52
53
54
# File 'lib/bio-cnls_screenscraper.rb', line 46

def bipartite_predicted?(minimum_score=nil)
  @signals.each do |s|
    if s.kind_of?(BipartiteNLS)
      return true if minimum_score.nil? #if no cutoff, return true
      return true if s.score >= minimum_score #otherwise apply the cutoff
    end
  end
  return false
end

#max_bipartite_scoreObject



66
67
68
69
70
71
72
73
74
# File 'lib/bio-cnls_screenscraper.rb', line 66

def max_bipartite_score
  max = 0.0
  @signals.each do |s|
    if s.kind_of?(BipartiteNLS) and s.score > max
      max = s.score
    end
  end
  return max
end

#max_monopartite_scoreObject



56
57
58
59
60
61
62
63
64
# File 'lib/bio-cnls_screenscraper.rb', line 56

def max_monopartite_score
  max = 0.0
  @signals.each do |s|
    if s.kind_of?(MonopartiteNLS) and s.score > max
      max = s.score
    end
  end
  return max
end

#monopartite_predicted?(minimum_score = nil) ⇒ Boolean

Returns:

  • (Boolean)


36
37
38
39
40
41
42
43
44
# File 'lib/bio-cnls_screenscraper.rb', line 36

def monopartite_predicted?(minimum_score=nil)
  @signals.each do |s|
    if s.kind_of?(MonopartiteNLS)
      return true if minimum_score.nil? #if no cutoff, return true
      return true if s.score >= minimum_score #otherwise apply the cutoff
    end
  end
  return false
end

#predicted?Boolean

Is this result a positive prediction or negative prediction?

Returns:

  • (Boolean)


32
33
34
# File 'lib/bio-cnls_screenscraper.rb', line 32

def predicted?
  !signals.nil? and !signals.empty? 
end