Created
January 24, 2010 16:41
-
-
Save michaelbarton/285296 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'open-uri' | |
| FILE = 'SBW25.fna' | |
| URL = "ftp://ftp.ncbi.nih.gov/genbank/genomes/Bacteria/Pseudomonas_fluorescens_SBW25/AM181176.fna" | |
| READS = [200_000] | |
| N_SIMULATIONS = 5 | |
| METASIM = 'metasim' | |
| desc "Fetches SBW25 genome sequence" | |
| task :fetch do | |
| unless File.exists?(FILE) | |
| File.open(FILE,'w') do |f| | |
| open(URL) do |url| | |
| url.each_line { |line| f.write(line) } | |
| end | |
| end | |
| end | |
| end | |
| desc "Simulates genome sequencing" | |
| task :sequence => :fetch do | |
| READS.each do |reads| | |
| dir = mkdir(reads) | |
| 0.upto(N_SIMULATIONS - 1) do | |
| `#{METASIM} cmd --reads #{reads} --454 --output-dir #{dir} #{FILE}` | |
| end | |
| end | |
| end | |
| private | |
| def mkdir(reads) | |
| dir = "#{reads/1_000}k" | |
| Dir.mkdir(dir) unless File.exists?(dir) | |
| dir | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment