Sha256: fbe405020bca953b60cd70f91cbda44b64a329ba2c8f379ce9f3a626117ab32f

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

#!/usr/bin/env ruby

require 'json'

if ARGV.count<1 
  puts "Usage: #{$0} stats1.json [stats2.json stats3.json,...]"
  exit -1
end

# print header  
if ARGV[0]=='-t'
	heads=['sample_name','input_count','sequence_count_paired','sequence_count_single','rejected','rejected_percent']
	puts heads.join("\t")
	ARGV.shift
end


ARGV.each do |file_path|
	sample_name = File.basename(File.expand_path(File.join(file_path,'..','..')))

	stats=JSON::parse(File.read(file_path))

	res=[]

	begin
		res << sample_name
		res << stats['sequences']['count']['input_count']
		res << stats['sequences']['count']['output_seqs_paired'] 
		res << stats['sequences']['count']['output_seqs'] 
		res << stats['sequences']['count']['rejected'] 
		#res << sprintf('%.2f',(stats['sequences']['count']['rejected'].to_f/(stats['sequences']['count']['output_seqs_paired'].to_i+stats['sequences']['count']['output_seqs'].to_i).to_f)*100) 
		res << sprintf('%.2f',(stats['sequences']['count']['rejected'].to_f/stats['sequences']['count']['input_count'].to_f)*100)
		
	rescue Excepcion => e

	   puts "Error reading #{file_path}"
	end

	puts res.join("\t")

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
seqtrimnext-2.0.68 bin/resume_stn_stats.rb