-
Notifications
You must be signed in to change notification settings - Fork 712
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New module: instrain/compare (#3623)
* Started instrain compare tests * instrain compare * Update modules/nf-core/instrain/compare/main.nf * Update modules/nf-core/instrain/compare/main.nf * Update modules/nf-core/instrain/compare/main.nf * Updated test.yml and added stub * Update modules/nf-core/instrain/compare/main.nf Co-authored-by: Nicolas Vannieuwkerke <[email protected]> * Update meta.yml to include meta2 * Updated test.yml output files * Changed md5 to content for several test.yml files * changed content to contains * Added another contains option in test.yml * shortened contains string to pass prettier check --------- Co-authored-by: Margot Lavitt <[email protected]> Co-authored-by: Nicolas Vannieuwkerke <[email protected]>
- Loading branch information
1 parent
8c029dd
commit 7f39bf3
Showing
6 changed files
with
174 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,57 @@ | ||
process INSTRAIN_COMPARE { | ||
tag "$meta.id" | ||
label 'process_high' | ||
|
||
conda "bioconda::instrain=1.6.1" | ||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? | ||
'https://depot.galaxyproject.org/singularity/instrain:1.6.1--pyhdfd78af_0': | ||
'biocontainers/instrain:1.6.1--pyhdfd78af_0' }" | ||
|
||
input: | ||
tuple val(meta), path(profiles) | ||
tuple val(meta2), path(bams) | ||
path stb_file | ||
|
||
output: | ||
tuple val(meta), path("*.IS_compare") , emit: compare | ||
path "versions.yml" , emit: versions | ||
|
||
when: | ||
task.ext.when == null || task.ext.when | ||
|
||
script: | ||
def args = task.ext.args ?: '' | ||
def prefix = task.ext.prefix ?: "${meta.id}" | ||
def stb_args = stb_file ? "-s ${stb_file}": '' | ||
""" | ||
inStrain \\ | ||
compare \\ | ||
-i $profiles \\ | ||
-o ${prefix}.IS_compare \\ | ||
--processes $task.cpus \\ | ||
--bams $bams \\ | ||
$args | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
instrain: \$(echo \$(inStrain compare --version 2>&1) | awk 'NF{ print \$NF }') | ||
END_VERSIONS | ||
""" | ||
|
||
stub: | ||
def args = task.ext.args ?: '' | ||
def prefix = task.ext.prefix ?: "${meta.id}" | ||
def stb_args = stb_file ? "-s ${stb_file}": '' | ||
""" | ||
mkdir -p ${prefix}.IS_compare/output | ||
touch ${prefix}.IS_compare/output/${prefix}.IS_compare_pooled_SNV_info.tsv | ||
touch ${prefix}.IS_compare/output/${prefix}.IS_compare_comparisonsTable.tsv | ||
touch ${prefix}.IS_compare/output/${prefix}.IS_compare_pooled_SNV_data.tsv | ||
touch ${prefix}.IS_compare/output/${prefix}.IS_compare_pooled_SNV_data_keys.tsv | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
instrain: \$(echo \$(inStrain compare --version 2>&1) | awk 'NF{ print \$NF }') | ||
END_VERSIONS | ||
""" | ||
} |
This file contains 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,59 @@ | ||
name: "instrain_compare" | ||
description: Strain-level comparisons across multiple inStrain profiles | ||
keywords: | ||
- instrain | ||
- compare | ||
- align | ||
- diversity | ||
- coverage | ||
tools: | ||
- "instrain": | ||
description: "Calculation of strain-level metrics" | ||
homepage: https://github.com/MrOlm/instrain | ||
documentation: https://instrain.readthedocs.io/en/latest/ | ||
tool_dev_url: https://github.com/MrOlm/instrain | ||
doi: 10.1038/s41587-020-00797-0 | ||
licence: "['MIT']" | ||
|
||
input: | ||
- meta: | ||
type: map | ||
description: | | ||
Groovy Map containing sample information | ||
e.g. `[ id:'test', single_end:false ]` | ||
- meta2: | ||
type: map | ||
description: | | ||
Groovy Map containing sample information | ||
e.g. `[ id:'test', single_end:false ]` | ||
- profiles: | ||
type: directory | ||
description: InStrain profile folders | ||
pattern: "*.IS/" | ||
- bams: | ||
type: file | ||
description: Path to .bam files that were profiled | ||
pattern: "*.{bam,sam}" | ||
- stb_file: | ||
type: file | ||
description: Path to .stb (scaffold to bin) file that was profiled | ||
pattern: "*.stb" | ||
|
||
output: | ||
- meta: | ||
type: map | ||
description: | | ||
Groovy Map containing sample information | ||
e.g. `[ id:'test', single_end:false ]` | ||
- versions: | ||
type: file | ||
description: File containing software versions | ||
pattern: "versions.yml" | ||
- compare: | ||
type: directory | ||
description: inStrain compare folders | ||
pattern: "*.IS_compare/" | ||
|
||
authors: | ||
- "@margotl9" | ||
- "@CarsonJM" |
This file contains 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
This file contains 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,22 @@ | ||
#!/usr/bin/env nextflow | ||
|
||
nextflow.enable.dsl = 2 | ||
|
||
include { INSTRAIN_COMPARE } from '../../../../../modules/nf-core/instrain/compare/main.nf' | ||
include { INSTRAIN_PROFILE } from '../../../../../modules/nf-core/instrain/profile/main.nf' | ||
|
||
workflow test_instrain_compare { | ||
|
||
input = Channel.of( | ||
[[ id:'test1', single_end:true ], file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true)], | ||
[[ id:'test2', single_end:true ], file(params.test_data['homo_sapiens']['illumina']['test2_paired_end_sorted_bam'], checkIfExists: true)] | ||
) | ||
genome_fasta = file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true) | ||
|
||
INSTRAIN_PROFILE ( input , genome_fasta , [] , [] ) | ||
instrain_profiles = INSTRAIN_PROFILE.out.profile.map{ [[id:"test"], it[1]] }.groupTuple() | ||
input_bams = input.map{ [[id:"test"], it[1]] }.groupTuple() | ||
|
||
INSTRAIN_COMPARE ( instrain_profiles , input_bams , [] ) | ||
|
||
} |
This file contains 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,5 @@ | ||
process { | ||
|
||
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } | ||
|
||
} |
This file contains 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,27 @@ | ||
- name: instrain compare test_instrain_compare | ||
command: nextflow run ./tests/modules/nf-core/instrain/compare -entry test_instrain_compare -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/instrain/compare/nextflow.config | ||
tags: | ||
- instrain | ||
- instrain/compare | ||
files: | ||
- path: output/instrain/test.IS_compare/output/test.IS_compare_comparisonsTable.tsv | ||
contains: ["test2.paired_end.sorted.bam 0.9516129032258064 944 0.0235994100147496 40001 0 0 1.0 1.0"] | ||
- path: output/instrain/test.IS_compare/output/test.IS_compare_pooled_SNV_data.tsv | ||
contains: ["0 1981 119 0 0 24"] | ||
- path: output/instrain/test.IS_compare/output/test.IS_compare_pooled_SNV_data_keys.tsv | ||
contains: ["paired_end.sorted.bam chr22"] | ||
- path: output/instrain/test.IS_compare/output/test.IS_compare_pooled_SNV_info.tsv | ||
md5sum: 7ed4894afbc4f1abd8692c4a65003a27 | ||
- path: output/instrain/versions.yml | ||
|
||
- name: instrain compare test_instrain_compare_stub | ||
command: nextflow run ./tests/modules/nf-core/instrain/compare -entry test_instrain_compare -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/instrain/compare/nextflow.config -stub-run | ||
tags: | ||
- instrain | ||
- instrain/compare | ||
files: | ||
- path: output/instrain/test.IS_compare/output/test.IS_compare_comparisonsTable.tsv | ||
- path: output/instrain/test.IS_compare/output/test.IS_compare_pooled_SNV_data.tsv | ||
- path: output/instrain/test.IS_compare/output/test.IS_compare_pooled_SNV_data_keys.tsv | ||
- path: output/instrain/test.IS_compare/output/test.IS_compare_pooled_SNV_info.tsv | ||
- path: output/instrain/versions.yml |