Skip to content

Commit

Permalink
Add support for samplesheet input (#54)
Browse files Browse the repository at this point in the history
* Add support for samplesheet input

* Update README
  • Loading branch information
dfornika authored Oct 16, 2023
1 parent ebc34c2 commit 8f5a4af
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 5 deletions.
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This Nextflow pipeline automates the ARTIC network [nCoV-2019 novel coronavirus
##### Illumina

```
nextflow run BCCDC-PHL/ncov2019-artic-nf [-profile conda,singularity,docker,slurm,lsf] \
nextflow run BCCDC-PHL/ncov2019-artic-nf -profile conda \
--illumina --prefix "output_file_prefix" \
--primer_pairs_tsv /path/to/primer_pairs_tsv \
--composite_ref /path/to/human_and_sars-cov-2_composite_ref \
Expand All @@ -27,6 +27,24 @@ For production use at large scale, where you will run the workflow many times, y

Alternatively you can avoid just the cloning of the scheme repository to remain on a fixed revision of it over time by passing --schemeRepoURL /path/to/own/clone/of/github.com/artic-network/artic-ncov2019. This removes any internet access from the workflow except for the optional upload steps.

###### SampleSheet Input

Samples can also be provided to the pipeline via a `samplesheet.csv` file:

```
nextflow run BCCDC-PHL/ncov2019-artic-nf -profile conda \
--illumina --prefix "output_file_prefix" \
--primer_pairs_tsv /path/to/primer_pairs_tsv \
--composite_ref /path/to/human_and_sars-cov-2_composite_ref \
--samplesheet_input /path/to/samplesheet.csv
```

The `samplesheet.csv` file must include the headers:

`ID,R1,R2`

...and each record should be a comma-separated line consisting of the sample ID, the path to the R1 fastq file for that sample, and the path to the R2 fastq file for that sample.

##### Nanopore
###### Nanopolish

Expand Down
4 changes: 4 additions & 0 deletions conf/illumina.config
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ params {
fastq_exts = ['.fastq.gz', '.fq.gz']

fastqSearchPath = makeFastqSearchPath( params.illuminaSuffixes, params.fastq_exts )

// Provide sample ID and fastq paths via a samplesheet.csv with fields:
// ID,R1,R2
samplesheet_input = 'NO_FILE'

// Use cram input instead of fastq files
cram = false
Expand Down
16 changes: 12 additions & 4 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ if (params.profile){
}

if ( params.illumina ) {
if ( !params.directory ) {
if ( !params.directory && params.samplesheet_input == "NO_FILE" ) {
println("Please supply a directory containing fastqs or CRAMs with --directory. Specify --cram if supplying a CRAMs directory")
println("Or provide a samplesheet (headers: ID,R1,R2) with --samplesheet_input")
println("Use --help to print help")
System.exit(1)
}
Expand Down Expand Up @@ -78,9 +79,16 @@ workflow {
.set{ ch_cramFiles }
}
else {
Channel.fromFilePairs( params.fastqSearchPath, flat: true)
.filter{ !( it[0] =~ /Undetermined/ ) }
.set{ ch_filePairs }
if ( params.samplesheet_input != "NO_FILE" ) {
Channel.fromPath(params.samplesheet_input)
.splitCsv(header: true).map{ it -> [it['ID'], it['R1'], it['R2']] }
.set{ ch_filePairs }
}
else {
Channel.fromFilePairs( params.fastqSearchPath, flat: true)
.filter{ !( it[0] =~ /Undetermined/ ) }
.set{ ch_filePairs }
}
}
}
else {
Expand Down

0 comments on commit 8f5a4af

Please sign in to comment.