Sha256: 0e452754fde3e7db770d391a7a9468b96fcb4f6925c1b1d8a681fea88ab5ef79

Contents?: true

Size: 1008 Bytes

Versions: 1

Compression:

Stored size: 1008 Bytes

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) 
		
	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.66 bin/resume_stn_stats.rb