Method: Bio::Alignment::Output#output_fasta
- Defined in:
- lib/bio/alignment.rb
#output_fasta(options = {}) ⇒ Object
Generates fasta format text and returns a string.
1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 |
# File 'lib/bio/alignment.rb', line 1059 def output_fasta(={}) #(original) width = ([:width] or 70) if [:avoid_same_name] then na = __clustal_avoid_same_name(self.sequence_names, 30) else na = self.sequence_names.collect do |k| k.to_s.gsub(/[\r\n\x00]/, ' ') end end if width and width > 0 then w_reg = Regexp.new(".{1,#{width}}") self.collect do |s| ">#{na.shift}\n" + s.to_s.gsub(w_reg, "\\0\n") end.join('') else self.collect do |s| ">#{na.shift}\n" + s.to_s + "\n" end.join('') end end |