Sha256: 2151a3e51e929766a8c85fb449839c4a94bb8339b2d0d64e64caf542cd7cc63f
Contents?: true
Size: 1.84 KB
Versions: 1
Compression:
Stored size: 1.84 KB
Contents
#!/usr/bin/env ruby # # An script to compare two 23andme SNP data files. # # Author: Preston Lee # License: Apache 2 # Runtime libraries: require 'erb' # 3rd-party libraries: require 'getopt/long' require 'multimarkdown' # Our libraries: current_dir = File.dirname(File.expand_path(__FILE__)) gem_dir = File.join(current_dir, '..') lib_path = File.join(gem_dir, 'lib') $LOAD_PATH.unshift lib_path require 'youandme' def print_help_and_exit puts "Usage:" puts "\t#{$0} --directory <output_directory> --left <23andme_data_file.txt> --right <23andme_data_file.txt>" puts "\t#{$0} -d <output_directory> -l <23andme_data_file.txt> -r <23andme_data_file.txt>" exit(1) end begin opt = Getopt::Long.getopts( ["--left", "-l", Getopt::REQUIRED], ["--right", "-r", Getopt::REQUIRED], ["--directory", "-d", Getopt::REQUIRED], ["--help", "-h", Getopt::BOOLEAN] ) rescue print_help_and_exit end if(opt['help']) print_help_and_exit end puts "Checking data file existyness..." loader = YouAndMe::RawDataFileLoader.new left_file = opt['left'] right_file = opt['right'] unless(loader.check_file(left_file) and loader.check_file(right_file)) puts "Please specify valid data files!" print_help_and_exit end puts "Parsing data files... (may take a while)" max_rows = 1000 left = loader.load_file(left_file, max_rows).sort{|a,b| a[:rsid] <=> b[:rsid]} puts "\tLoaded #{left.length} SNPs from #{left_file}" # y left[0..4] right = loader.load_file(right_file, max_rows).sort{|a,b| a[:rsid] <=> b[:rsid]} puts "\tLoaded #{right.length} SNPs from #{right_file}" processor = YouAndMe::DataProcessor.new(left, right) processor.process(true) puts "Writing reports..." processor.to_multimarkdown(left_file, right_file) path = File.expand_path("#{opt['directory']}") processor.write_multimarkdown(path) processor.write_latex(path) processor.write_html(path) puts "Done!"
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
youandme-0.2.0 | bin/youandme |