Sha256: e01826cde760e40b90e87737302c3862c70c9da37acbd0240b4ee73f1eac2c42

Contents?: true

Size: 884 Bytes

Versions: 1

Compression:

Stored size: 884 Bytes

Contents

#!/usr/bin/env ruby

require 'bio'
require 'rubygems'
require 'pathname'
require 'bio-samtools'

require 'set'

$: << File.expand_path(File.dirname(__FILE__) + '/../lib')
$: << File.expand_path('.')
path= File.expand_path(File.dirname(__FILE__) + '/../lib/bioruby-polyploid-tools.rb')
require path

puts  ARGV[0]

fasta_db = Bio::DB::Fasta::FastaFile.new( ARGV[0])
fasta_db.load_fai_entries
bam1 =  Bio::DB::Sam.new({:fasta=>ARGV[0], :bam=>ARGV[1]})

fasta_db.index.entries.each do | r |
  #Np r.get_full_region
  #container.process_region( { :region => r.get_full_region.to_s, :output_file => output_file } )
  region=r.get_full_region
  
  

  cons_1 = bam1.consensus_with_ambiguities({:region=>region, :case=>true})

  snps = cons_1.count_ambiguities
 
  snps_per_1k = (1000 * snps.to_f ) / region.size
  
  puts "#{r.id}\t#{region.size}\t#{snps}\t#{snps_per_1k}\n#{cons_1}"
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bio-polyploid-tools-0.1.0 bin/count_variations.rb