Permalink
Browse files

Rake task to generate genome size data

  • Loading branch information...
1 parent 9528284 commit 11a04323c943fb975bf992862459d8763942c03c @michaelbarton committed Jul 14, 2011
Showing with 39 additions and 1 deletion.
  1. +18 −1 Rakefile
  2. +21 −0 data/genome_size.csv
View
19 Rakefile
@@ -1,4 +1,6 @@
task :env do
+ require 'pp'
+
@tmp = "tmp"
@genome = "genome.fna"
end
@@ -28,6 +30,21 @@ namespace :data do
`sort #{@tmp}/*.coords -o data/alignment/nucmer.coords`
end
+ desc "Calculate genome sizes"
+ #task :size => [:env,:tmp,'fasta:all'] do
+ task :size => [:env] do
+ require 'bio'
+
+ File.open('data/genome_size.csv','w') do |out|
+ out.puts %W|species source size| * ','
+ Dir['tmp/*.fna'].each do |file|
+ dna = Bio::FlatFile.auto(file).first.to_biosequence
+ source = dna.definition =~ /genome/ ? 'genome' : 'plasmid'
+ out.puts([dna.definition.split('_').first,source,dna.seq.length] * ',')
+ end
+ end
+ end
+
end
namespace :fasta do
@@ -51,7 +68,7 @@ namespace :fasta do
task :scaffold => [:env,:tmp] do
Dir.chdir('data/genome/assembly') do
- `scaffolder sequence genome.scaffold.yml draft.fna > #{@tmp}/#{@genome}`
+ `scaffolder sequence genome.scaffold.yml draft.fna --definition="fluorescens_r124_genome" > #{@tmp}/#{@genome}`
end
end
View
21 data/genome_size.csv
@@ -0,0 +1,21 @@
+species,source,size
+aeruginosa,genome,6264404
+fluorescens,genome,6438405
+fluorescens,genome,7074893
+fluorescens,plasmid,83042
+fluorescens,genome,6722539
+fluorescens,plasmid,425094
+fluorescens,genome,6256692
+mendocina,genome,5072807
+putida,genome,6078430
+putida,genome,6588339
+stutzeri,genome,4567418
+syringae,genome,5928787
+syringae,plasmid,131950
+syringae,plasmid,51711
+syringae,genome,6093698
+syringae,plasmid,46697
+syringae,plasmid,40110
+syringae,plasmid,8244
+syringae,plasmid,4833
+syringae,plasmid,4217

0 comments on commit 11a0432

Please sign in to comment.