Sha256: 4d6a4a918cd94a28e802a74c3ef69bb067657c208ab32d742c80373059b97e8d

Contents?: true

Size: 717 Bytes

Versions: 7

Compression:

Stored size: 717 Bytes

Contents

#!/usr/bin/env ruby
require 'bio'

def load_blat_alignments (blat_filename, best_aln)
  blat_aln = Bio::Blat::Report.new(Bio::FlatFile.open(blat_filename).to_io)
  blat_aln.each_hit() do |hit|
    current_matches = hit.match 
    current_name = hit.query_id
    current_identity = hit.percent_identity
    current_score = hit.score
    #p current_name

    best = best_aln[current_name]

    if best == nil 
      best_aln[current_name] = hit
    else
      if current_score > best.score
        best_aln[current_name] = hit
      end
    end
  end
end

blat_file=ARGV[0]
best_aln = Hash.new

load_blat_alignments( blat_file,best_aln)
puts "QUERY\tTARGET"
best_aln.each do |k, hit|
  puts "#{k}\t#{hit.target_id}"
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
bio-polyploid-tools-0.4.2 bin/find_best_blat_hit.rb
bio-polyploid-tools-0.4.1 bin/find_best_blat_hit.rb
bio-polyploid-tools-0.4.0 bin/find_best_blat_hit.rb
bio-polyploid-tools-0.3.3 bin/find_best_blat_hit.rb
bio-polyploid-tools-0.3.1 bin/find_best_blat_hit.rb
bio-polyploid-tools-0.2.3 bin/find_best_blat_hit.rb
bio-polyploid-tools-0.1.0 bin/find_best_blat_hit.rb