rput 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/lib/starter.rb +13 -14
  3. data/rput.gemspec +2 -2
  4. metadata +4 -4
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
data/lib/starter.rb CHANGED
@@ -9,9 +9,7 @@ class CycleController
9
9
  def initialize(opts)
10
10
  @opts = opts
11
11
  @opts[:num_ptrees] ||= @opts[:num_parsi_trees]
12
- @script = "raxml_batch_cycle.sh"
13
12
  @numtaxa, @seqlen = File.open(@opts[:phy]).readlines.first.split.map{|w| w.to_i}
14
- raise "#{@script} missing" unless File.exist?(@script)
15
13
  end
16
14
  def parsimonator_requirements
17
15
  bytes_inner = @numtaxa.to_f * @seqlen.to_f
@@ -30,7 +28,8 @@ class CycleController
30
28
  puts required_MB
31
29
  required_MB.to_i.to_s
32
30
  end
33
- def run_as_batch
31
+ def run_as_batch(script)
32
+ raise "#{script} missing" unless File.exist?(script)
34
33
  raise "User Number of parsimony trees not set" unless @opts[:num_parsi_trees] > 0
35
34
  raise "Total Number of parsimony trees not set" unless @opts[:num_ptrees] > 0
36
35
  opts = @opts[:iter].to_s
@@ -42,15 +41,15 @@ class CycleController
42
41
  opts += " " + @opts[:num_bestML_trees].to_s
43
42
  opts += " " + @opts[:exp_name].to_s
44
43
  opts += " " + @opts[:base_dir].to_s
45
- puts "./#{@script} #{opts}"
46
- system "./#{@script} #{opts}"
44
+ puts "./#{script} #{opts}"
45
+ system "./#{script} #{opts}"
47
46
  end
48
47
  end
49
48
 
50
49
  class TreeBunchStarter
51
50
  # Given an initial alignment, it creates a initial bunch of ML trees in bunch_0 dir
52
51
  # should log results
53
- attr_reader :cluster
52
+ attr_reader :cluster_batch
54
53
  def initialize(opts)
55
54
  @phylip = opts[:phylip]
56
55
  @base_dir = opts[:base_dir]
@@ -72,7 +71,7 @@ class TreeBunchStarter
72
71
  @CAT_topology_bunch_order = File.join @ml_trees_dir, "CAT_topology_bunch_order.txt"
73
72
  @bestML_bunch = File.join @bestML_trees_dir, "best_bunch.nw"
74
73
  @prev_bestML_bunch = File.join @prev_dir, "best_ml_trees", "best_bunch.nw" unless @prev_dir.nil?
75
- @cluster = opts[:cluster] || false
74
+ @cluster_batch = opts[:cluster_batch]
76
75
  end
77
76
  def logput(msg, error = false)
78
77
  @logger ||= Logger.new(File.join @base_dir, "starter.log")
@@ -116,17 +115,17 @@ class TreeBunchStarter
116
115
  if num_bestML_trees > num_parsi_trees * prev_trees.size
117
116
  raise "#bestML trees (#{num_bestML_trees}) is too higher than trees from previous round"
118
117
  end
119
- if @cluster
118
+ unless @cluster_batch.empty?
120
119
  logput "Exp #{opts[:exp_name]}, your cluster will take care of this update no #{@update_id}. stay tuned"
121
120
  c = CycleController.new(:iter => @update_id,
122
- :phy => @phylip_updated,
121
+ :phy => @phylip_updated,
123
122
  :num_parsi_trees => num_parsi_trees,
124
123
  :num_ptrees => num_parsi_trees * prev_trees.size,
125
124
  :num_bestML_trees => num_bestML_trees,
126
125
  :base_dir => @base_dir,
127
126
  :exp_name => opts[:exp_name]
128
127
  )
129
- c.run_as_batch
128
+ c.run_as_batch(@cluster_batch)
130
129
  "cluster"
131
130
  else
132
131
  logput "****** Start update no #{@update_id} ********"
@@ -173,16 +172,16 @@ class TreeBunchStarter
173
172
  raise "#bestML trees (#{num_bestML_trees}) cant be higher than #parsi trees(#{num_parsi_trees})"
174
173
  end
175
174
  # phases 2 and 3 can be done in paralell
176
- if @cluster
175
+ unless @cluster_batch.empty?
177
176
  logput "your cluster will take care of this start #{@update_id}. Stay tuned"
178
177
  c = CycleController.new(:iter => 0,
179
- :phy => @phylip,
178
+ :phy => @phylip,
180
179
  :num_parsi_trees => num_parsi_trees,
181
180
  :num_bestML_trees => num_bestML_trees,
182
181
  :base_dir => @base_dir,
183
182
  :exp_name => opts[:exp_name]
184
183
  )
185
- c.run_as_batch
184
+ c.run_as_batch(@cluster_batch)
186
185
  "cluster"
187
186
  else
188
187
  logput "Start generating initial bunch"
@@ -204,7 +203,7 @@ class TreeBunchStarter
204
203
  end
205
204
  private
206
205
  def check_options(opts)
207
- supported_opts = [:num_parsi_trees, :num_bestML_trees, :exp_name]
206
+ supported_opts = [:num_parsi_trees, :num_bestML_trees, :exp_name, :cycle_batch_script]
208
207
  opts.keys.each do |key|
209
208
  unless supported_opts.include?(key)
210
209
  logput "Option #{key} is unknwon"
data/rput.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rput}
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{Fernando Izquierdo-Carrasco}]
12
- s.date = %q{2012-03-29}
12
+ s.date = %q{2012-04-03}
13
13
  s.description = %q{Automated iterations of raxml runs over externally-extended phylip files}
14
14
  s.email = %q{fer.izquierdo@gmail.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rput
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Fernando Izquierdo-Carrasco
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-03-29 00:00:00 Z
18
+ date: 2012-04-03 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  type: :development