Method: Ytilib.read_mfa2array

Defined in:
lib/sequence_logo/ytilib/ytilib.rb

.read_mfa2array(path) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/sequence_logo/ytilib/ytilib.rb', line 50

def Ytilib.read_mfa2array(path)
  input_fasta_f = File.new(path, "r")
  seqs, seq_name = [], nil
  input_fasta_f.each_line { |line|
    if line[0,1] == ">"
      seq_name = line[1..-1].strip
      yield seq_name if block_given?
      seqs << ""
    elsif seq_name != nil
      seqs.last << line.strip
    end
  }
  input_fasta_f.close
  return seqs
end