Class: Bio::ExportPred::Result

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

Constant Summary collapse

@@all_result_names =
[
  :predicted_rle,
  :predicted_kld,
  :score
]

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.all_result_namesObject



82
83
84
# File 'lib/bio/appl/exportpred.rb', line 82

def self.all_result_names
  @@all_result_names
end

.create_from_line(line, options = {}) ⇒ Object

Given the STDOUT from the ExportPred program, create a programmatically manipulatable Bio::ExportPred::Result object

TODO: explain options={}

Raises:

  • (Exception)


54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/bio/appl/exportpred.rb', line 54

def self.create_from_line(line, options={})
  result = Result.new
  if !line or line == ''
    result.predicted_rle = false unless options[:no_RLE]
    result.predicted_kld = false unless options[:no_KLD]
    return result
  end
  
  # line is going to be something like
  # metoo	RLE	6.44141	[a-met:M][a-leader:AVSTYNNTRRNGLRYVLKRR][a-hydrophobic:TILSVFAVICMLSL][a-spacer:NLSIFENNNNNYGFHCNKRH][a-RLE:FKSLAEA][a-tail:SPEEHNNLRSHSTSDPKKNEEKSLSDEINKCDMKKYTAEEINEMINSSNEFINRNDMNIIFSYVHESEREKFKKVEENIFKFIQSIVETYKIPDEYKMRKFKFAHFEMQGYALKQEKFLLEYAFLSLNGKLCERKKFKEVLEYVKREWIEFRKSMFDVWKEKLASEFREHGEMLNQKRKLKQHELDRRAQREKMLEEHSRGIFAKGYLGEVESETIKKKTEHHENVNEDNVEKPKLQQHKVQPPKVQQQKVQPPKSQQQKVQPPKSQQQKVQPPKVQQQKVQPPKVQKPKLQNQKGQKQVSPKAKGNNQAKPTKGNKLKKN]
  splits = line.split("\t")
  raise Exception, "Badly parsed line: #{line}" if splits.length != 4
  if splits[1] == 'RLE'
    result.predicted_rle = true
  elsif splits[1] = 'KLD'
    result.predicted_kld = true
  end
  result.score = splits[2].to_f
  return result
end

Instance Method Details

#predicted?Boolean Also known as: signal?

Returns:

  • (Boolean)


75
76
77
# File 'lib/bio/appl/exportpred.rb', line 75

def predicted?
  @predicted_rle or @predicted_kld
end