Class: BioDSL::Mummer
- Inherits:
-
Object
- Object
- BioDSL::Mummer
- Defined in:
- lib/BioDSL/mummer.rb
Overview
Class for executing MUMmer and parsing MUMmer results.
Defined Under Namespace
Classes: Match
Class Method Summary collapse
Instance Method Summary collapse
-
#each_mem {|Mummer::Match| ... } ⇒ Enumerable
An Enumerable.
-
#initialize(seq1, seq2, options = {}) ⇒ Mummer
constructor
Constructor for Mummer class.
Constructor Details
#initialize(seq1, seq2, options = {}) ⇒ Mummer
Constructor for Mummer class.
59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/BioDSL/mummer.rb', line 59 def initialize(seq1, seq2, = {}) @seq1 = seq1 @seq2 = seq2 @options = @command = [] @q_id = nil @dir = nil end |
Class Method Details
.each_mem(seq1, seq2, options = {}) {|Mummer::Match| ... } ⇒ Enumerable
Returns An Enumerable.
42 43 44 45 46 47 48 49 50 |
# File 'lib/BioDSL/mummer.rb', line 42 def self.each_mem(seq1, seq2, = {}) mummer = new(seq1, seq2, ) if block_given? mummer.each_mem { |mem| yield mem } else mummer.each_mem end end |
Instance Method Details
#each_mem {|Mummer::Match| ... } ⇒ Enumerable
Returns An Enumerable.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/BioDSL/mummer.rb', line 73 def each_mem return to_enum :each_mem unless block_given? TmpDir.create('in1', 'in2', 'out') do |file_in1, file_in2, file_out| BioDSL::Fasta.open(file_in1, 'w') { |io| io.puts @seq1.to_fasta } BioDSL::Fasta.open(file_in2, 'w') { |io| io.puts @seq2.to_fasta } execute(file_in1, file_in2, file_out) File.open(file_out) do |io| while (match = get_match(io)) yield match end end end end |