-
Notifications
You must be signed in to change notification settings - Fork 931
Add fastq seqkit sana pair #9185
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
c02364d
FASTQ_SEQKIT_SANA_PAIR subworkflow init
vagkaratzas cb70501
more tests and meta added
vagkaratzas 9a1222f
unnecessary operations removed
vagkaratzas 27c868b
in one line
vagkaratzas 9ad059c
Merge branch 'master' into add-fastq_seqkit_sana_pair
vagkaratzas 89d7cdf
Update subworkflows/nf-core/fastq_seqkit_sana_pair/main.nf
vagkaratzas 1975250
meta descr and keywords updated
vagkaratzas c3cd96b
descr updated
vagkaratzas f66c534
renamed and removed the copying mechanism, replaced with adding/remov…
vagkaratzas 7056ba4
Merge branch 'master' into add-fastq_seqkit_sana_pair
vagkaratzas fae4a41
mandatory config
vagkaratzas 8768b03
Merge branch 'master' into add-fastq_seqkit_sana_pair
vagkaratzas a201a7f
meta single_end checks
vagkaratzas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| include { SEQKIT_SANA } from '../../../modules/nf-core/seqkit/sana/main' | ||
| include { SEQKIT_PAIR } from '../../../modules/nf-core/seqkit/pair/main' | ||
|
|
||
| workflow FASTQ_SANITISE_SEQKIT { | ||
|
|
||
| take: | ||
| ch_reads // channel: [ val(meta), [ fastq ] ] | ||
|
|
||
| main: | ||
| ch_versions = Channel.empty() | ||
|
|
||
| // Add strandness information to meta | ||
| ch_reads_with_strandness = ch_reads | ||
| // seqkit/sana can only receive one file at a time | ||
| .flatMap { meta, reads -> | ||
| if (meta.single_end) { | ||
| if (reads instanceof List && reads.size() != 1) { | ||
| error("Error: Check your meta.single_end value. Single-end reads should contain one file only.") | ||
| } | ||
| return [[ meta + [strandness: 'single'], reads ]] | ||
| } else { | ||
| if (!(reads instanceof List) || reads.size() != 2) { | ||
| error("Error: Check your meta.single_end value. Paired-end reads should contain two files; a forward and a reverse.") | ||
| } | ||
| return [ | ||
| [ meta + [strandness: 'R1'], reads[0] ], | ||
vagkaratzas marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| [ meta + [strandness: 'R2'], reads[1] ] | ||
| ] | ||
| } | ||
| } | ||
|
|
||
| SEQKIT_SANA( ch_reads_with_strandness ) | ||
| ch_versions = ch_versions.mix(SEQKIT_SANA.out.versions.first()) | ||
|
|
||
| ch_sanitized_reads = SEQKIT_SANA.out.reads | ||
| .map { meta, fastq -> | ||
| // Remove strandness field from meta to merge back together | ||
| def clean_meta = meta.findAll { key, value -> key != 'strandness' } | ||
| return [ clean_meta, fastq ] | ||
| } | ||
| .groupTuple(by: 0) | ||
| .branch { | ||
| meta, fastq -> | ||
| single_end: meta.single_end | ||
| return [ meta, fastq ] | ||
| paired_end: !meta.single_end | ||
| return [ meta, fastq ] | ||
vagkaratzas marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| SEQKIT_PAIR ( ch_sanitized_reads.paired_end ) | ||
| ch_versions = ch_versions.mix(SEQKIT_PAIR.out.versions.first()) | ||
|
|
||
| ch_reads = ch_sanitized_reads.single_end.mix(SEQKIT_PAIR.out.reads, SEQKIT_PAIR.out.unpaired_reads) | ||
|
|
||
| emit: | ||
| reads = ch_reads // channel: [ val(meta), [ fastq ] ] | ||
| versions = ch_versions // channel: [ versions.yml ] | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| # yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/subworkflows/yaml-schema.json | ||
| name: "fastq_sanitise_seqkit" | ||
| description: | | ||
| Filters and reports malformed FASTQ sequences with seqkit/sana, | ||
| and then pairs any paired-end files using seqkit/pair | ||
| keywords: | ||
| - fastq | ||
| - quality control | ||
| - filtering | ||
| - malformed | ||
| - pairing | ||
| - seqkit | ||
| - preprocessing | ||
| components: | ||
| - seqkit/sana | ||
| - seqkit/pair | ||
| input: | ||
| - ch_reads: | ||
| type: channel | ||
| description: | | ||
| Channel containing sample metadata and FASTQ files. | ||
| Structure: [ val(meta), [ fastq ] ] | ||
| Where meta is a map containing at least: | ||
| - id: sample identifier | ||
| - single_end: boolean indicating if data is single-end (true) or paired-end (false) | ||
| pattern: "*.{fastq,fastq.gz,fq,fq.gz}" | ||
| output: | ||
| - reads: | ||
| type: channel | ||
| description: | | ||
| Channel containing filtered (i.e., non-malformed) and paired FASTQ files. | ||
| For single-end data: returns filtered reads | ||
| For paired-end data: returns properly paired reads and any unpaired reads | ||
| Structure: [ val(meta), [ fastq ] ] | ||
| pattern: "*.{fastq,fastq.gz,fq,fq.gz}" | ||
| - versions: | ||
| type: file | ||
| description: | | ||
| File containing software versions | ||
| Structure: [ path(versions.yml) ] | ||
| pattern: "versions.yml" | ||
| authors: | ||
| - "@vagkaratzas" | ||
| maintainers: | ||
| - "@vagkaratzas" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| // IMPORTANT: This config file should be included to ensure that the subworkflow works properly. | ||
| process { | ||
|
|
||
| withName: SEQKIT_SANA { | ||
| ext.prefix = { "${meta.id}_${meta.strandness}" } | ||
| } | ||
|
|
||
| } |
123 changes: 123 additions & 0 deletions
123
subworkflows/nf-core/fastq_sanitise_seqkit/tests/main.nf.test
vagkaratzas marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,123 @@ | ||
| nextflow_workflow { | ||
|
|
||
| name "Test Subworkflow FASTQ_SANITISE_SEQKIT" | ||
| script "../main.nf" | ||
| workflow "FASTQ_SANITISE_SEQKIT" | ||
| config './nextflow.config' | ||
|
|
||
| tag "subworkflows" | ||
| tag "subworkflows_nfcore" | ||
| tag "subworkflows/fastq_sanitise_seqkit" | ||
| tag "seqkit" | ||
| tag "seqkit/sana" | ||
| tag "seqkit/pair" | ||
|
|
||
|
|
||
| test("sarscov2 - fastq - single_end") { | ||
|
|
||
| when { | ||
| workflow { | ||
| """ | ||
| input[0] = Channel.of([ | ||
| [ id:'test_single', single_end:true ], // meta map | ||
| file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true) | ||
| ]) | ||
| """ | ||
| } | ||
| } | ||
|
|
||
| then { | ||
| assertAll( | ||
| { assert workflow.success}, | ||
| { assert snapshot( | ||
| workflow.out, | ||
| workflow.out.versions.collect{ path(it).yaml }.unique() | ||
| ).match() } | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| test("sarscov2 - fastq - paired_end") { | ||
|
|
||
| when { | ||
| workflow { | ||
| """ | ||
| input[0] = Channel.of([ | ||
| [ id:'test_paired', single_end:false ], // meta map | ||
| [ | ||
| file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), | ||
| file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true) | ||
| ] | ||
| ]) | ||
| """ | ||
| } | ||
| } | ||
|
|
||
| then { | ||
| assertAll( | ||
| { assert workflow.success}, | ||
| { assert snapshot( | ||
| workflow.out, | ||
| workflow.out.versions.collect{ path(it).yaml }.unique() | ||
| ).match() } | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| test("sarscov2 - fastq - both with single broken") { | ||
|
|
||
| when { | ||
| workflow { | ||
| """ | ||
| input[0] = Channel.of([ | ||
| [ id:'test_both', single_end:true ], // meta map | ||
| file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1_broken.fastq.gz', checkIfExists: true) | ||
| ], | ||
| [ | ||
| [ id:'test_both', single_end:false ], // meta map | ||
| [ | ||
| file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), | ||
| file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true) | ||
| ] | ||
| ]) | ||
| """ | ||
| } | ||
| } | ||
|
|
||
| then { | ||
| assertAll( | ||
| { assert workflow.success}, | ||
| { assert snapshot( | ||
| workflow.out, | ||
| workflow.out.versions.collect{ path(it).yaml }.unique() | ||
| ).match() } | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| test("sarscov2 - fastq - stub") { | ||
|
|
||
| options "-stub" | ||
|
|
||
| when { | ||
| workflow { | ||
| """ | ||
| input[0] = Channel.of([ | ||
| [ id: 'test_stub', single_end:true ], | ||
| file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1_broken.fastq.gz', checkIfExists: true) | ||
| ]) | ||
| """ | ||
| } | ||
| } | ||
|
|
||
| then { | ||
| assertAll( | ||
| { assert workflow.success }, | ||
| { assert snapshot( | ||
| workflow.out, | ||
| workflow.out.versions.collect{ path(it).yaml }.unique() | ||
| ).match() } | ||
| ) | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.