Class: Bio::SignalP::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/bio/appl/signalp.rb

Overview

The result of a SignalP program. Create using the output from -format short output and create_from_line()

Constant Summary collapse

@@nn_results =
[:nn_Cmax, :nn_Cmax_position, :nn_Cmax_prediction, 
:nn_Ymax, :nn_Ymax_position, :nn_Ymax_prediction, 
:nn_Smax, :nn_Smax_position, :nn_Smax_prediction, 
:nn_Smean, :nn_Smean_prediction,
:nn_D, :nn_D_prediction]
@@hmm_results =
[
:hmm_result, :hmm_Cmax, :hmm_Cmax_position, :hmm_Cmax_prediction, :hmm_Sprob, :hmm_Sprob_prediction]

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.all_result_namesObject

Return an array of symbols representing the names of the columns



129
130
131
# File 'lib/bio/appl/signalp.rb', line 129

def self.all_result_names
  return [@@nn_results, @@hmm_results].flatten
end

.create_from_line(line) ⇒ Object

Create a new SignalpResult using a line from the signal p ‘short’ output format, version 3.0



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/bio/appl/signalp.rb', line 53

def self.create_from_line(line)
  # e.g.
  # # name                Cmax  pos ?  Ymax  pos ?  Smax  pos ?  Smean ?  D     ?   # name      !  Cmax  pos ?  Sprob ?
  # 526.m04658            0.734  19 Y  0.686  19 Y  0.933   6 Y  0.760 Y  0.723 Y 526.m04658  Q  0.037  19 N  0.004 N
  matches = line.split(/[ \t]+/)
  if matches.length != 21
    raise Exception, "Bad SignalP Short Line Found (#{matches.length}): '#{line}'"
  end
  
  i = 1
  result = Result.new
  result.nn_Cmax = matches[i].to_f; i += 1
  result.nn_Cmax_position = matches[i].to_i; i += 1
  result.nn_Cmax_prediction = to_bool matches[i]; i += 1
  result.nn_Ymax = matches[i].to_f; i += 1
  result.nn_Ymax_position = matches[i].to_i; i += 1
  result.nn_Ymax_prediction = to_bool matches[i]; i += 1
  result.nn_Smax = matches[i].to_f; i += 1
  result.nn_Smax_position = matches[i].to_i; i += 1
  result.nn_Smax_prediction = to_bool matches[i]; i += 1
  result.nn_Smean = matches[i].to_f; i += 1
  result.nn_Smean_prediction = to_bool matches[i]; i += 1
  result.nn_D = matches[i].to_f; i += 1
  result.nn_D_prediction = to_bool matches[i]; i += 1
  
  i+= 1
  result.hmm_result = matches[i]; i += 1
  result.hmm_Cmax = matches[i].to_f; i += 1
  result.hmm_Cmax_position = matches[i].to_i; i += 1
  result.hmm_Cmax_prediction = to_bool matches[i]; i += 1
  result.hmm_Sprob = matches[i].to_f; i += 1
  result.hmm_Sprob_prediction = to_bool matches[i]; i += 1
  
  return result
end

.to_bool(string) ⇒ Object



89
90
91
92
93
94
95
96
97
# File 'lib/bio/appl/signalp.rb', line 89

def self.to_bool(string)
  if string === 'Y'
    return true
  elsif string === 'N'
    return false
  else
    return nil
  end
end

Instance Method Details

#all_resultsObject

Return an array of all the results. NN then HMM, as per SignalP short format



114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/bio/appl/signalp.rb', line 114

def all_results
  all = []
  
  @@nn_results.each do |sym|
    all.push self.send(sym)
  end
  
  @@hmm_results.each do |sym|
    all.push self.send(sym)
  end
  
  return all
end

#classical_signal_sequence?Boolean

Returns:

  • (Boolean)


105
106
107
# File 'lib/bio/appl/signalp.rb', line 105

def classical_signal_sequence?
  return @nn_D_prediction
end

#cleavage_siteObject

Return the number of the residue after the cleavage site ie. the first residue of the mature protein Taken from the Y score, as it was decided this is the best prediction



136
137
138
# File 'lib/bio/appl/signalp.rb', line 136

def cleavage_site
  @nn_Ymax_position
end

#cleave(sequence) ⇒ Object

Given an amino acid sequence (as a string), chop it off and return the remnants



142
143
144
145
146
147
148
# File 'lib/bio/appl/signalp.rb', line 142

def cleave(sequence)
  if signal?
    return sequence[cleavage_site-1..sequence.length-1]
  else
    return sequence
  end
end

#signal?(clazz = self) ⇒ Boolean

Does it have a signal peptide? It can be this class (default), or another class that responds to :nn_D_prediction and :hmm_Sprob_prediction

Returns:

  • (Boolean)


101
102
103
# File 'lib/bio/appl/signalp.rb', line 101

def signal?(clazz=self)
  return (clazz.send(:nn_D_prediction) or clazz.send(:hmm_Sprob_prediction))
end

#signal_anchor?Boolean

Returns:

  • (Boolean)


109
110
111
# File 'lib/bio/appl/signalp.rb', line 109

def signal_anchor?
  return @hmm_Sprob_prediction
end