Class: Bio::MAF::FASTAWriter
- Inherits:
-
Object
- Object
- Bio::MAF::FASTAWriter
- Defined in:
- lib/bio/maf/writer.rb
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(outf) ⇒ FASTAWriter
constructor
A new instance of FASTAWriter.
- #write_block(block) ⇒ Object
- #write_sequence(seq) ⇒ Object
Constructor Details
#initialize(outf) ⇒ FASTAWriter
Returns a new instance of FASTAWriter.
67 68 69 |
# File 'lib/bio/maf/writer.rb', line 67 def initialize(outf) @f = outf end |
Instance Method Details
#close ⇒ Object
84 85 86 |
# File 'lib/bio/maf/writer.rb', line 84 def close @f.close end |
#write_block(block) ⇒ Object
71 72 73 74 75 |
# File 'lib/bio/maf/writer.rb', line 71 def write_block(block) block.sequences.each do |seq| write_sequence(seq) unless seq.empty? end end |
#write_sequence(seq) ⇒ Object
77 78 79 80 81 82 |
# File 'lib/bio/maf/writer.rb', line 77 def write_sequence(seq) @f.puts(">#{seq.fasta_desc}") 0.step(seq.text.size, FASTA_LINE_LEN) do |pos| @f.puts(seq.text.slice(pos, FASTA_LINE_LEN)) end end |