Method: Bio::Alignment::OriginalAlignment#to_fasta_array
- Defined in:
- lib/bio/alignment.rb
#to_fasta_array(*arg) ⇒ Object
Convert to fasta format and returns an array of strings.
It will be obsoleted.
2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 |
# File 'lib/bio/alignment.rb', line 2096 def to_fasta_array(*arg) #(original) width = nil if arg[0].is_a?(Integer) then width = arg.shift end = (arg.shift or {}) width = [:width] unless width if [:avoid_same_name] then na = __clustal_avoid_same_name(self.keys, 30) else na = self.keys.collect { |k| k.to_s.gsub(/[\r\n\x00]/, ' ') } end a = self.collect do |s| ">#{na.shift}\n" + if width then s.to_s.gsub(Regexp.new(".{1,#{width}}"), "\\0\n") else s.to_s + "\n" end end a end |