Example for optional input in tuple?

オープン
#42 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
30/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞

調査の方向性

Start with the tuple input declaration and the map expression in main.nf; the example reports Not a valid path value: NO_FILE when the optional reverse-read path is represented by that string. Check how this repository’s patterns handle optional tuple paths and compare with the Nextflow input documentation. Done means the example runs with and without an R2 file and publishes the expected BAM outputs.

索引モデルが issue の本文から書いたものです。

説明

I am trying to run a configuration where the input is a tuple of paths, some of which are optional. The pattern in this repository works for separate path inputs (or, so says the author), but extending it to my use case results in the error Not a valid path value: NO_FILE.

In this simple example demonstrating the issue, the input is a CSV file defining RNA-seq sample names, forward and reverse read fastqs, and a STAR genome index to align them to. The reverse read is optional.

My question to the community is how I can work around this issue.

Repository setup

nextflow.config

params {
  manifest = null  // csv file name,R1,R2?,index
  outdir = "outs"  // save output bams
}
profiles {
  conda {
    conda.enabled = true
    process.conda = "star samtools"
  }
}

main.nf

process MyProcess {
  publishDir outdir, mode: "copy"
  input:
    tuple val(name), path(R1), path(R2), path(index)
    path outdir
  output:
    path "${name}_Aligned.out.sortedByCoord.bam"
    path "${name}_Aligned.out.sortedByCoord.bam.bai"
  script:
    R2_arg = R2.name == "NO_FILE" ? "" : R2
"""
STAR --readFilesIn $R1 $R2_arg --readFilesCommand gunzip -c \
     --genomeDir $index --outSAMtype BAM SortedByCoordinate \
     --outFileNamePrefix ${name}_
samtools index ${name}_Aligned.out.sortedByCoord.bam
"""
}

workflow {
  MyProcess(
    file(manifest).read().splitCsv(header: ["name", "R1", "R2", "index"]).map{it.R2 = it.R2 ?: "NO_FILE"},
    params.outdir
  )
}

Run

nextflow run main.nf [-profile conda] --manifest path/to/manifest.csv
主要言語
Nextflow
スター
374
フォーク
73
平均マージ
15分
マージ済み PR(30日)
1

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

nextflow-io/patterns のほかの issue

nextflow-io/patterns の issue をすべて見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。