Skip to content

Instantly share code, notes, and snippets.

@quwubin
Created July 11, 2012 03:03
Show Gist options
  • Save quwubin/3087708 to your computer and use it in GitHub Desktop.
Save quwubin/3087708 to your computer and use it in GitHub Desktop.
Ruby tips
#!/usr/bin/env ruby
ARGV[1..-1].each do |file|
puts file
`#{ARGV[0]} #{file}`
end
# Example
# ./batch_run.rb "tar zxvf" refseq_genomic.*.gz
#!/usr/bin/env ruby
if ARGV.size != 3
$stderr.puts "Usage: #{$0} nr 9606 human.rna"
exit
else
db = ARGV[0]
tax_id = ARGV[1]
out = ARGV[2]
end
`blastdbcmd -db #{db} -entry all -outfmt "%g %T" | awk ' { if ($2 == #{tax_id}) { print $1 } } ' | blastdbcmd -db #{db} -entry_batch - -out #{out}`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment