forked from nf-core/modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Picard extractfingerprint (nf-core#4506)
* first commit - Picard picard_extractfingerprint * add nf-tests * improved bam list declaration Co-authored-by: Adam Talbot <[email protected]> * change for alphabetical order Co-authored-by: Adam Talbot <[email protected]> * add tags to main.nf.test * updated snap * new snap * picard version 3.1.0 * changed tests * add test for tbi * change test solving snapshot issue * using new nf-test version * add EOL * adde new EOL * correct typo in tags * version 3.0.0 * revert to version 3.1.1 (latest) * add linesGzip test * remove samtools version from main.nf * fix stub * fix version.yml --------- Co-authored-by: Adam Talbot <[email protected]>
- Loading branch information
1 parent
3b248b8
commit 3aaf92f
Showing
6 changed files
with
184 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,7 @@ | ||
name: picard_extractfingerprint | ||
channels: | ||
- conda-forge | ||
- bioconda | ||
- defaults | ||
dependencies: | ||
- bioconda::picard=3.1.1 |
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,66 @@ | ||
process PICARD_EXTRACTFINGERPRINT { | ||
tag "$meta.id" | ||
label 'process_medium' | ||
|
||
conda "${moduleDir}/environment.yml" | ||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? | ||
'https://depot.galaxyproject.org/singularity/picard:3.1.1--hdfd78af_0' : | ||
'biocontainers/picard:3.1.1--hdfd78af_0' }" | ||
|
||
input: | ||
tuple val(meta), path(bam), path(bai) | ||
path haplotype_map | ||
path fasta | ||
path fasta_fai | ||
path sequence_dictionary | ||
|
||
output: | ||
tuple val(meta), path("*.vcf.gz") , emit: vcf | ||
tuple val(meta), path("*.vcf.gz.tbi"), emit: tbi | ||
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 reference = fasta ? "--REFERENCE_SEQUENCE ${fasta}" : "" | ||
def bam_name = bam.simpleName | ||
|
||
def avail_mem = 3072 | ||
if (!task.memory) { | ||
log.info '[PICARD ExtractFingerprint] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.' | ||
} else { | ||
avail_mem = (task.memory.mega*0.8).intValue() | ||
} | ||
|
||
""" | ||
picard \\ | ||
-Xmx${avail_mem}M \\ | ||
ExtractFingerprint \\ | ||
--INPUT ${bam} \\ | ||
--HAPLOTYPE_MAP ${haplotype_map} \\ | ||
--OUTPUT ${prefix}.vcf.gz \\ | ||
${reference} \\ | ||
$args | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
picard: \$(echo \$(picard ExtractFingerprint --version 2>&1) | grep -o 'Version:.*' | cut -f2- -d:) | ||
END_VERSIONS | ||
""" | ||
|
||
stub: | ||
def prefix = task.ext.prefix ?: "${meta.id}" | ||
""" | ||
touch ${prefix}.vcf | ||
touch ${prefix}.vcf.gz.tbi | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
picard: \$(echo \$(picard ExtractFingerprint --version 2>&1) | grep -o 'Version:.*' | cut -f2- -d:) | ||
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,46 @@ | ||
name: "picard_extractfingerprint" | ||
description: Computes/Extracts the fingerprint genotype likelihoods from the supplied file. It is given as a list of PLs at the fingerprinting sites. | ||
keywords: | ||
- picard | ||
- extract | ||
- fingerprint | ||
- bam | ||
tools: | ||
- picard: | ||
description: | | ||
A set of command line tools (in Java) for manipulating high-throughput sequencing (HTS) | ||
data and formats such as SAM/BAM/CRAM and VCF. | ||
homepage: https://broadinstitute.github.io/picard/ | ||
documentation: https://broadinstitute.github.io/picard/ | ||
tool_dev_url: https://github.com/broadinstitute/picard/ | ||
licence: ["MIT"] | ||
input: | ||
- meta: | ||
type: file | ||
description: | | ||
Input SAM/BAM/CRAM file | ||
- reference: | ||
type: file | ||
description: | | ||
Reference sequence file | ||
- haplotype_map: | ||
type: file | ||
description: | | ||
A file of haplotype information. The file lists a set of SNPs, optionally arranged in high-LD blocks, to be used for fingerprinting. | ||
See https://software.broadinstitute.org/gatk/documentation/article?id=9526 for details. | ||
pattern: "*.{txt,vcf,vcf.gz}" | ||
output: | ||
- fingerprint: | ||
type: file | ||
description: | | ||
Output fingerprint file (VCF) | ||
- versions: | ||
type: file | ||
description: File containing software versions | ||
pattern: "versions.yml" | ||
authors: | ||
- "@adamrtalbot" | ||
- "@mauro-saporita" | ||
maintainers: | ||
- "@adamrtalbot" | ||
- "@mauro-saporita" |
47 changes: 47 additions & 0 deletions
47
modules/nf-core/picard/extractfingerprint/tests/main.nf.test
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,47 @@ | ||
nextflow_process { | ||
|
||
name "Test Process PICARD_EXTRACTFINGERPRINT" | ||
script "../main.nf" | ||
process "PICARD_EXTRACTFINGERPRINT" | ||
tag "modules" | ||
tag "modules_nfcore" | ||
tag "picard" | ||
tag "picard/extractfingerprint" | ||
|
||
test("extract_fingerprint") { | ||
when { | ||
params { | ||
outdir = "$outputDir" | ||
} | ||
process { | ||
""" | ||
bam = [ | ||
[ id:'test', single_end:false ], // meta map | ||
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true), | ||
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true) | ||
] | ||
fasta = [file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true)] | ||
fai = [file(params.test_data['homo_sapiens']['genome']['genome_fasta_fai'], checkIfExists: true)] | ||
dict = [file(params.test_data['homo_sapiens']['genome']['genome_dict'], checkIfExists: true)] | ||
haplotype_map = [file(params.test_data['homo_sapiens']['genome']['haplotype_map'], checkIfExists: true)] | ||
input[0] = bam | ||
input[1] = haplotype_map | ||
input[2] = fasta | ||
input[3] = fai | ||
input[4] = dict | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll ( | ||
{ assert process.success }, | ||
{ assert process.out.vcf.get(0).get(1) ==~ ".*.vcf.gz" }, | ||
{ assert process.out.tbi.get(0).get(1) ==~ ".*.vcf.gz.tbi" }, | ||
{ assert snapshot(process.out.versions).match("versions") }, | ||
{ assert snapshot(path(process.out.vcf.get(0).get(1)).linesGzip[0]).match() } | ||
) | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
modules/nf-core/picard/extractfingerprint/tests/main.nf.test.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,2 @@ | ||
picard/extractfingerprint: | ||
- modules/nf-core/picard/extractfingerprint/** |