Skip to content

Commit

Permalink
fixed check of multiple identical fastq files which are forbitten
Browse files Browse the repository at this point in the history
  • Loading branch information
mazzalab committed Oct 11, 2024
1 parent 83b7d48 commit d9aaac4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 29 deletions.
4 changes: 4 additions & 0 deletions dataset/samplesheet.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sample,fastq_1,fastq_2
mysampleA,./dataset/sample_R1.fastq.gz,./dataset/sample_R2.fastq.gz
mysampleB,./dataset/sample_R3.fastq.gz,./dataset/sample_R4.fastq.gz
mysampleC,./dataset/sample_R5.fastq.gz
44 changes: 15 additions & 29 deletions subworkflows/local/utils_nfcore_fastqrepair_pipeline/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -98,24 +98,8 @@ workflow PIPELINE_INITIALISATION {

//
// Check that any fastq file is not analyzed multiple times
// .flatten()
temp1 = ch_samplesheet.map{ meta, fastq -> fastq}.collect()
// hasDuplicates = temp1.size() != temp1.toSet().size()
hasDuplicates = temp1.count() != temp1.unique().count()
temp1.view()
temp1.unique().view()
println hasDuplicates

// println(temp1.unique().count().toInteger().view() == 1)
// println(temp1.count().toInteger().view() == '5')
// if(temp1.count().toInteger().view(){ $it } == 5){
// print("HEREEEE")
// }

// println(temp1)
// println(temp2)

// validateInputSamplesheet2(ch_samplesheet.map{ meta, fastq -> fastq}.collect().toList())
//
validateInputSamplesheet2(ch_samplesheet.map{ meta, fastq -> fastq}.collect())

emit:
samplesheet = ch_samplesheet
Expand Down Expand Up @@ -190,17 +174,19 @@ def validateInputSamplesheet(input) {
// Same fastq files are not allowed to be analyzed multiple times in the same run
//
def validateInputSamplesheet2(input) {
def all_fastq_files = input.map(m -> m)
def all_fastq_files_unique = all_fastq_files.unique()

println "Validation!"
println all_fastq_files
println all_fastq_files.view()
println all_fastq_files_unique

// if(all_fastq_files.count() != all_fastq_files_unique.size){
// error("\nPlease check input samplesheet -> Multiple runs of a fastq file are not allowed")
// }
s = 0
input.size().map{
s = it

sunique = 0
input.toSet().size().map{
sunique = it

if(s != sunique){
error("\nPlease check input samplesheet -> Multiple runs of a fastq file are not allowed")
}
}
}
}

//
Expand Down

0 comments on commit d9aaac4

Please sign in to comment.