Skip to content

Instantly share code, notes, and snippets.

@drio
Created April 23, 2009 15:08
Show Gist options
  • Save drio/100536 to your computer and use it in GitHub Desktop.
Save drio/100536 to your computer and use it in GitHub Desktop.
#!/users/p-solid/local/bin/ruby19
#
# If you want to run against multiple data sets:
# ruby -e 'File.open(Dir["list*"].join).each_line{|l| puts "./create_splits.rb {File.basename(l.chomp)} #{l.chomp}"}'
#
require 'fileutils'
def run_lsf(str)
bs = "bsub -q solid -J GBM_drio_splits '#{str}'"
puts bs
system bs
end
def run(str)
puts str
system str
end
split_size = "25000000"
run_name = ARGV[0]
csfasta = ARGV[1]
if ARGV.size != 2
puts "Usage: #{__FILE__} <run_name> <csfasta>"
exit 1
end
raise "./splits not found" unless File.exists?("./splits")
Dir.chdir("./splits")
raise "#{run_name} dir already exists" if File.exists?(run_name)
FileUtils.mkdir run_name
Dir.chdir(run_name)
run_lsf "cat #{csfasta} | grep -v '^#' | split -a4 -d -l #{split_size}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment