class Bio::Blat::StreamedReport

Public Class Methods

each_best_hit(text = '') { |val| ... } click to toggle source
# File lib/bio-blat-tools/blat-tools.rb, line 31
def self.each_best_hit(text = '')

    best_aln = Hash.new
    self.each_hit(text) do |hit|
            current_matches = hit.match 
            current_name = hit.query_id
            current_identity = hit.percent_identity
            current_score = hit.score
            best_aln[current_name] = hit if best_aln[current_name] == nil or current_score > best_aln[current_name] .score
    end
    best_aln.each_value { |val| yield  val }
end
each_hit(text = '') { |hit| ... } click to toggle source
# File lib/bio-blat-tools/blat-tools.rb, line 7
            def self.each_hit(text = '')
                    flag = false
                    head = []

                    text.each_line do |line|
                            if flag then
                                    yield Hit.new(line)
                            else

                    if /^\d/ =~ line then # for headerless data
                            flag = true
                            redo
                    end
                    line = line.chomp
                    if /\A\-+\s*\z/ =~ line
                            flag = true
                    else
                            head << line
                    end
            end
    end
end