Sha256: 14aa9d6d25a14a07f520b000becc7a7691bf327e98c87b4cd4062147d6a4d770

Contents?: true

Size: 1.11 KB

Versions: 168

Compression:

Stored size: 1.11 KB

Contents

module Workflow
  def nextflow_file(file, name = nil)
    file = file + '.nf' unless File.exists?(file) || ! File.exists?(file + '.nf')
    file = File.expand_path(file)
    name ||= File.basename(file).sub(/\.nf$/,'')
    params = Open.read(file).scan(/params\.\w+/).collect{|p| p.split(".").last}.uniq

    params.each do |param|
      input param, :string
    end
    task name => :text do 
      work = file('work')
      output = file('output')
      profile = config :profile, :nextflow
      Misc.in_dir output do
        if profile
          cmd("nextflow run -work-dir #{work} -name #{clean_name} -ansi-log false  -profile #{profile} #{file}", inputs.to_hash.merge('add_option_dashes' => true))
        else
          cmd("nextflow run -work-dir #{work} -name #{clean_name} -ansi-log false #{file}", inputs.to_hash.merge('add_option_dashes' => true))
        end
      end
    end
  end

  def nextflow_dir(path)
    main = File.join(path, 'main.nf')
    nextflow_file main, File.basename(path)
  end

  def nextflow(path)
    if File.directory?(path)
      nextflow_dir path
    else
      nextflow_file path
    end
  end
end

Version data entries

168 entries across 168 versions & 1 rubygems

Version Path
rbbt-util-5.26.85 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.26.84 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.26.83 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.26.82 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.26.81 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.26.80 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.26.79 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.26.78 lib/rbbt/workflow/integration/nextflow.rb