Sha256: b76fa36a93635c64ef9442f55b4523e4b38e0a69dca1c39d624c8d0638fed9eb

Contents?: true

Size: 743 Bytes

Versions: 2

Compression:

Stored size: 743 Bytes

Contents

require 'tempfile'
require 'bio'
require 'scaffolder'

require 'scaffolder/test/sequence'
require 'scaffolder/test/unresolved'

module Scaffolder::Test
  module Helpers

    def generate_scaffold_files(entries)
      [write_scaffold_file(entries),write_sequence_file(entries)]
    end

    def write_scaffold_file(entries,file = Tempfile.new("scaffold"))
      File.open(file.path,'w') do |tmp|
        tmp.print(YAML.dump(entries.map{|e| e.to_hash }))
      end
      file
    end

    def write_sequence_file(entries,file = Tempfile.new("sequence"))
      File.open(file.path,'w') do |tmp|
        entries.each do |entry|
          tmp.puts(entry.to_fasta) if entry.respond_to? :to_fasta
        end
      end
      file
    end


  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
scaffolder-test-helpers-0.3.0 lib/scaffolder/test/helpers.rb
scaffolder-test-helpers-0.2.2 lib/scaffolder/test/helpers.rb