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.134 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.26.133 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.26.132 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.26.131 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.26.130 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.26.129 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.26.128 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.26.126 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.26.125 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.26.123 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.26.122 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.26.121 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.26.120 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.26.119 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.26.118 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.26.117 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.26.116 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.26.115 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.26.114 lib/rbbt/workflow/integration/nextflow.rb
rbbt-util-5.26.113 lib/rbbt/workflow/integration/nextflow.rb