sushi_fabric 0.4.9 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: utf-8
3
- # Version = '20151029-161011'
3
+ # Version = '20151106-140410'
4
4
 
5
5
  require 'csv'
6
6
  require 'fileutils'
@@ -382,6 +382,7 @@ cd $SCRATCH_DIR || exit 1
382
382
  @out.print <<-EOF
383
383
  cd #{SCRATCH_DIR}
384
384
  rm -rf #{@scratch_dir} || exit 1
385
+
385
386
  EOF
386
387
 
387
388
  end
@@ -496,8 +497,12 @@ rm -rf #{@scratch_dir} || exit 1
496
497
  @workflow_manager.default_node
497
498
  end
498
499
 
499
- def make_job_script
500
- @out = open(@job_script, 'w')
500
+ def make_job_script(append = false)
501
+ @out = if append
502
+ open(@job_script, 'a')
503
+ else
504
+ open(@job_script, 'w')
505
+ end
501
506
  job_header
502
507
  job_main
503
508
  job_footer
@@ -528,6 +533,19 @@ rm -rf #{@scratch_dir} || exit 1
528
533
  @job_scripts << @job_script
529
534
  @result_dataset << next_dataset
530
535
  end
536
+ def batch_mode
537
+ @job_script = if @dataset_sushi_id and dataset = DataSet.find_by_id(@dataset_sushi_id.to_i)
538
+ File.join(@job_script_dir, @analysis_category + '_' + dataset.name.gsub(/\s+/,'_') + '.sh')
539
+ else
540
+ File.join(@job_script_dir, @analysis_category + '_' + 'job_script.sh')
541
+ end
542
+ @dataset_hash.each do |row|
543
+ @dataset = Hash[*row.map{|key,value| [key.gsub(/\[.+\]/,'').strip, value]}.flatten]
544
+ make_job_script('append')
545
+ @result_dataset << next_dataset
546
+ end
547
+ @job_scripts << @job_script
548
+ end
531
549
  def save_data_set(data_set_arr, headers, rows, user=nil)
532
550
  data_set_hash = Hash[*data_set_arr]
533
551
  unless project = Project.find_by_number(data_set_hash['ProjectNumber'].to_i)
@@ -581,6 +599,8 @@ rm -rf #{@scratch_dir} || exit 1
581
599
  sample_mode
582
600
  elsif @params['process_mode'] == 'DATASET'
583
601
  dataset_mode
602
+ elsif @params['process_mode'] == 'BATCH'
603
+ batch_mode
584
604
  else
585
605
  #stop
586
606
  warn "the process mode (#{@params['process_mode']}) is not defined"
@@ -1,3 +1,3 @@
1
1
  module SushiFabric
2
- VERSION = "0.4.9"
2
+ VERSION = "0.5.0"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: sushi_fabric
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.4.9
5
+ version: 0.5.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Functional Genomics Center Zurich
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2015-10-29 00:00:00 Z
13
+ date: 2015-11-06 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler