Example for optional input in tuple?

Aperta
#42 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
30/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
Lingua principale
Nextflow
Stelle
374
Fork
73
Merge medio
15m
PR unite (30g)
1

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di nextflow-io/patterns

Tutte le issue di nextflow-io/patterns

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.