Sha256: cc304eecdbcec77e0d54cd19fafa1ca58a77d943499b37df55efb76632a91812

Contents?: true

Size: 746 Bytes

Versions: 47

Compression:

Stored size: 746 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}"
   puts hit.data.join("\t")
end

Version data entries

47 entries across 47 versions & 2 rubygems

Version Path
bio-polymarker-1.3.3 bin/find_best_blat_hit.rb
bio-polymarker-1.3.2 bin/find_best_blat_hit.rb
bio-polymarker-1.3.1 bin/find_best_blat_hit.rb
bio-polymarker-1.3.0 bin/find_best_blat_hit.rb
bio-polyploid-tools-1.2.1 bin/find_best_blat_hit.rb
bio-polyploid-tools-1.2.0 bin/find_best_blat_hit.rb
bio-polyploid-tools-1.1.2 bin/find_best_blat_hit.rb
bio-polyploid-tools-1.1.1 bin/find_best_blat_hit.rb
bio-polyploid-tools-1.1.0 bin/find_best_blat_hit.rb
bio-polyploid-tools-1.0.0 bin/find_best_blat_hit.rb
bio-polyploid-tools-0.10.1 bin/find_best_blat_hit.rb
bio-polyploid-tools-0.10.0 bin/find_best_blat_hit.rb
bio-polyploid-tools-0.9.10 bin/find_best_blat_hit.rb
bio-polyploid-tools-0.9.9 bin/find_best_blat_hit.rb
bio-polyploid-tools-0.9.8 bin/find_best_blat_hit.rb
bio-polyploid-tools-0.9.7 bin/find_best_blat_hit.rb
bio-polyploid-tools-0.9.6 bin/find_best_blat_hit.rb
bio-polyploid-tools-0.9.5 bin/find_best_blat_hit.rb
bio-polyploid-tools-0.9.4 bin/find_best_blat_hit.rb
bio-polyploid-tools-0.9.3 bin/find_best_blat_hit.rb