Class: Bio::Sim4::Report::SeqDesc

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

Overview

Bio::Sim4::Report::SeqDesc stores sequence information of query or subject of sim4 report.

Instance Attribute Summary (collapse)

Class Method Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (SeqDesc) initialize(seqid, seqdef, len, filename)

Creates a new object. It is designed to be called internally from Bio::Sim4::Report object. Users shall not use it directly.



88
89
90
91
92
93
# File 'lib/bio/appl/sim4/report.rb', line 88

def initialize(seqid, seqdef, len, filename)
  @entry_id   = seqid
  @definition = seqdef
  @len        = len
  @filename   = filename
end

Instance Attribute Details

- (Object) definition (readonly)

definition of the sequence



97
98
99
# File 'lib/bio/appl/sim4/report.rb', line 97

def definition
  @definition
end

- (Object) entry_id (readonly)

identifier of the sequence



95
96
97
# File 'lib/bio/appl/sim4/report.rb', line 95

def entry_id
  @entry_id
end

- (Object) filename (readonly)

filename of the sequence



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

def filename
  @filename
end

- (Object) len (readonly)

sequence length of the sequence



99
100
101
# File 'lib/bio/appl/sim4/report.rb', line 99

def len
  @len
end

Class Method Details

+ (Object) parse(str, str2 = nil)

Parses part of sim4 result text and creates new SeqDesc object. It is designed to be called internally from Bio::Sim4::Report object. Users shall not use it directly.



106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/bio/appl/sim4/report.rb', line 106

def self.parse(str, str2 = nil)
  /^seq[12] \= (.*)(?: \((.*)\))?\,\s*(\d+)\s*bp\s*$/ =~ str
  seqid = $2
  filename = $1
  len = $3.to_i
  if str2 then
    seqdef = str2.sub(/^\>\s*/, '')
    seqid  =seqdef.split(/\s+/, 2)[0] unless seqid
  else
    seqdef = (seqid or filename)
    seqid = filename unless seqid
  end
  self.new(seqid, seqdef, len, filename)
end