Skip to content

Commit

Permalink
Merge pull request #3 from CarsonJM/fix-samplesheet
Browse files Browse the repository at this point in the history
Re-structured pipeline so tests run
  • Loading branch information
CarsonJM authored May 10, 2024
2 parents f5502a1 + f9ce173 commit 5fcbb12
Show file tree
Hide file tree
Showing 13 changed files with 186 additions and 48 deletions.
6 changes: 3 additions & 3 deletions assets/samplesheet.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
sample,fastq_1,fastq_2
SAMPLE_PAIRED_END,/path/to/fastq/files/AEG588A1_S1_L002_R1_001.fastq.gz,/path/to/fastq/files/AEG588A1_S1_L002_R2_001.fastq.gz
SAMPLE_SINGLE_END,/path/to/fastq/files/AEG588A4_S4_L003_R1_001.fastq.gz,
sample,fasta
test1,/workspace/rnafoldanalyzer/assets/test-datasets/input/test_alphavirus.fasta.gz
test2,/workspace/rnafoldanalyzer/assets/test-datasets/input/test_alphavirus.fasta.gz
15 changes: 4 additions & 11 deletions assets/schema_input.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,14 @@
"errorMessage": "Sample name must be provided and cannot contain spaces",
"meta": ["id"]
},
"fastq_1": {
"fasta": {
"type": "string",
"format": "file-path",
"exists": true,
"pattern": "^\\S+\\.f(ast)?q\\.gz$",
"errorMessage": "FastQ file for reads 1 must be provided, cannot contain spaces and must have extension '.fq.gz' or '.fastq.gz'"
},
"fastq_2": {
"type": "string",
"format": "file-path",
"exists": true,
"pattern": "^\\S+\\.f(ast)?q\\.gz$",
"errorMessage": "FastQ file for reads 2 cannot contain spaces and must have extension '.fq.gz' or '.fastq.gz'"
"pattern": "^\\S+\\.f(ast|n)?a\\.gz$",
"errorMessage": "FastA file must be provided, cannot contain spaces and must have extension '.fa.gz', '.fna.gz', or '.fasta.gz'"
}
},
"required": ["sample", "fastq_1"]
"required": ["sample", "fasta"]
}
}
Binary file not shown.
7 changes: 1 addition & 6 deletions conf/test.config
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,5 @@ params {
max_time = '6.h'

// Input data
// TODO nf-core: Specify the paths to your test data on nf-core/test-datasets
// TODO nf-core: Give any required params for the test so that command line flags are not needed
input = 'https://raw.githubusercontent.com/nf-core/test-datasets/viralrecon/samplesheet/samplesheet_test_illumina_amplicon.csv'

// Genome references
genome = 'R64-1-1'
input = "${projectDir}/assets/samplesheet.csv"
}
5 changes: 5 additions & 0 deletions modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
"git_sha": "f4ae1d942bd50c5c0b9bd2de1393ce38315ba57c",
"installed_by": ["modules"]
},
"gunzip": {
"branch": "master",
"git_sha": "3a5fef109d113b4997c9822198664ca5f2716208",
"installed_by": ["modules"]
},
"multiqc": {
"branch": "master",
"git_sha": "b7ebe95761cd389603f9cc0e0dc384c0f663815a",
Expand Down
7 changes: 7 additions & 0 deletions modules/nf-core/gunzip/environment.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 48 additions & 0 deletions modules/nf-core/gunzip/main.nf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 39 additions & 0 deletions modules/nf-core/gunzip/meta.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions modules/nf-core/gunzip/tests/main.nf.test

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions modules/nf-core/gunzip/tests/main.nf.test.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions modules/nf-core/gunzip/tests/tags.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 2 additions & 21 deletions subworkflows/local/utils_nfcore_rnafoldanalyzer_pipeline/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -82,22 +82,9 @@ workflow PIPELINE_INITIALISATION {
//
Channel
.fromSamplesheet("input")
.map {
meta, fastq_1, fastq_2 ->
if (!fastq_2) {
return [ meta.id, meta + [ single_end:true ], [ fastq_1 ] ]
} else {
return [ meta.id, meta + [ single_end:false ], [ fastq_1, fastq_2 ] ]
}
}
.groupTuple()
.map {
validateInputSamplesheet(it)
}
.map {
meta, fastqs ->
return [ meta, fastqs.flatten() ]
}
.set { ch_samplesheet }

emit:
Expand Down Expand Up @@ -158,15 +145,9 @@ def validateInputParameters() {
// Validate channels from input samplesheet
//
def validateInputSamplesheet(input) {
def (metas, fastqs) = input[1..2]

// Check that multiple runs of the same sample are of the same datatype i.e. single-end / paired-end
def endedness_ok = metas.collect{ it.single_end }.unique().size == 1
if (!endedness_ok) {
error("Please check input samplesheet -> Multiple runs of a sample must be of the same datatype i.e. single-end or paired-end: ${metas[0].id}")
}
def (metas, fasta) = input

return [ metas[0], fastqs ]
return [ metas, fasta ]
}
//
// Get attribute from genome config file e.g. fasta
Expand Down
15 changes: 8 additions & 7 deletions workflows/rnafoldanalyzer.nf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ include { paramsSummaryMultiqc } from '../subworkflows/nf-core/utils_nfcore_pi
include { softwareVersionsToYAML } from '../subworkflows/nf-core/utils_nfcore_pipeline'
include { methodsDescriptionText } from '../subworkflows/local/utils_nfcore_rnafoldanalyzer_pipeline'

include { GUNZIP } from '../modules/nf-core/gunzip/main'
include { CLUSTALO_ALIGN } from '../modules/nf-core/clustalo/align/main'
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -28,19 +29,19 @@ workflow RNAFOLDANALYZER {
ch_versions = Channel.empty()
ch_multiqc_files = Channel.empty()

ch_samplesheet.view()

//
// MODULE: Run FastQC
// MODULE: Gunzip FASTA files for input into Clustal Omega
//
FASTQC (
ch_samplesheet
)
ch_multiqc_files = ch_multiqc_files.mix(FASTQC.out.zip.collect{it[1]})
ch_versions = ch_versions.mix(FASTQC.out.versions.first())
ch_fasta = GUNZIP ( ch_samplesheet ).gunzip
ch_versions = ch_versions.mix ( GUNZIP.out.versions )

//
// MODULE: Run Clustal Omega align
//
CLUSTALO_ALIGN ( <fasta>, <tree>, true )
CLUSTALO_ALIGN ( ch_fasta, [[:],[]], true )
ch_versions = ch_versions.mix( CLUSTALO_ALIGN.out.versions )

//
// Collate and save software versions
Expand Down

0 comments on commit 5fcbb12

Please sign in to comment.