class MgNu::Parser::Prodigal::Sequence
yielded from MgNu::Parser::Prodigal
Attributes
definition[RW]
features[RW]
gc_cont[RW]
length[RW]
name[RW]
seqhdr[RW]
seqnum[RW]
transl_table[RW]
Public Class Methods
new(options = {})
click to toggle source
# File lib/mgnu/parser/prodigal.rb, line 76 def initialize(options = {}) @name = options.has_key?(:name) ? options[:name] : "" @length = options.has_key?(:length) ? options[:length] : "" @definition = options.has_key?(:definition) ? options[:definition] : "" @seqnum = options.has_key?(:seqnum) ? options[:seqnum] : "" @seqhdr = options.has_key?(:seqhdr) ? options[:seqhdr] : "" @gc_cont = options.has_key?(:gc_cont) ? options[:gc_cont] : "" @transl_table = options.has_key?(:transl_table) ? options[:transl_table] : "" @features = Array.new end
Public Instance Methods
parse_features(buffer)
click to toggle source
# File lib/mgnu/parser/prodigal.rb, line 88 def parse_features(buffer) buffer.shift if buffer[0] =~ /^FEATURES/ all_features = split_at_features(buffer.join("\n")) all_features.each do |feature_str| @features << MgNu::Genbank::Feature.parse(feature_str) end end
split_at_features(str)
click to toggle source
# File lib/mgnu/parser/prodigal.rb, line 97 def split_at_features(str) sep = "\001" str.gsub(/\n(\s{5}\S)/, "\n#{sep}\\1").split(sep) end
to_s()
click to toggle source
# File lib/mgnu/parser/prodigal.rb, line 102 def to_s str = "DEFINITION seqnum=#{@seqnum};seqlen=#{@length};seqhdr=\"#{@seqhdr}\";gc_cont=#{@gc_cont};transl_table=#{@transl_table}\n" str += "FEATURES Location/Qualifiers\n" @features.each do |f| str += "#{f.to_s}\n" end str += '//' return str end