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.32.4 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.32.2 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.32.1 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.32.0 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.31.15 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.31.14 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.31.13 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.31.12 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.31.11 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.31.10 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.31.9 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.31.8 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.31.7 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.31.5 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.31.4 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.31.3 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.31.2 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.31.1 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.31.0 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.30.13 lib/rbbt/workflow/integration/nextflow.rb