Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Input check filename uniqueness #77

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions subworkflows/local/utils_nfcore_createtaxdb_pipeline/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,25 @@ workflow PIPELINE_INITIALISATION {

ch_samplesheet = Channel.fromList(samplesheetToList(params.input, "assets/schema_input.json"))

// Validate we have unique file names for DNA FASTAs
ch_samplesheet
.filter { meta, fasta_dna, fasta_aa -> fasta_dna }
.map { meta, fasta_dna, fasta_aa ->
fasta_dna.getBaseName(fasta_dna.name.endsWith('.gz') ? 1 : 0)
}
.collect()
.dump(tag: 'post_collect')
.map { fasta_dna ->
if (fasta_dna.size() > fasta_dna.sort().unique().size()) {
// NOT WORKING - rREPORTING FALSE
def notunique = fasta_dna.toList().any { !fasta_dna.toList().sort().unique().contains(it) }
error("[nf-core/createtaxdb] ERROR: All filenames after decompressing must be unique! Check ${notunique}")
}
}

// Validate we have unique file names for AA FASTAs
println('TODO')

emit:
samplesheet = ch_samplesheet
versions = ch_versions
Expand Down