Skip to content

Commit

Permalink
Add support for samplesheet input
Browse files Browse the repository at this point in the history
  • Loading branch information
dfornika committed Oct 12, 2023
1 parent ebc34c2 commit ef52b2c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
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 ef52b2c

Please sign in to comment.