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

IGV Snapshot module #125

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,8 @@ jobs:
tags: salmon/quant
- profile: "conda"
tags: rediscoverte
- profile: "conda"
tags: igv/snapshot

env:
NXF_ANSI_LOG: false
Expand Down
9 changes: 9 additions & 0 deletions modules/msk/igv/snapshot/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
name: "igv_snapshot"
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- "bioconda::igv=2.17.4"
57 changes: 57 additions & 0 deletions modules/msk/igv/snapshot/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
process IGV_SNAPSHOT {
tag "$meta.id"
label 'process_single'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'ghcr.io/msk-access/igv_snapshot:0.0.1':
'ghcr.io/msk-access/igv_snapshot:0.0.1' }"

input:
tuple val(meta), path(bam), path(bai), path(variant_file)

output:

tuple val(meta), path("**igv_output/*"), emit: igv_screenshots
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 bed_name = prefix ? "${prefix}.bed": "variant.bed"
def out = prefix ? "${prefix}_igv_output": "igv_output"
def genome = task.ext.genome ? "-g ${task.ext.genome}" : ""
"""
igv run_screenshot \\
--input-files $bam \\
--annotated-variant-file $variant_file \\
-t $prefix \\
-o $out \\
-r $bed_name \\
$genome

cat <<-END_VERSIONS > versions.yml
"${task.process}":
igv: \$(igv --version)
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ""
def prefix = task.ext.prefix ?: "${meta.id}"
def bed_name = prefix ? "${prefix}.bed": "variant.bed"
def out = prefix ? "${prefix}_igv_output": "igv_output"
"""
mkdir $out
touch $out/test.png
touch $out/test.bat

cat <<-END_VERSIONS > versions.yml
"${task.process}":
igv: \$(igv --version)
END_VERSIONS
"""
}
62 changes: 62 additions & 0 deletions modules/msk/igv/snapshot/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "igv_snapshot"
description: a module to run IGV screenshot
keywords:
- sort
- example
- genomics
tools:
- "igv":
description: "Integrative Genomics Viewer. Fast, efficient, scalable visualization tool for genomics data and annotations."
homepage: "https://igv.org/"
documentation: "https://igv.org/doc/desktop/#QuickStart/"
tool_dev_url: "https://github.com/igvteam/igv"
licence: ["MIT"]
- "igv snapshot":
description: "A python package to generate and execute IGV screenshot script."
documentation: "https://github.com/msk-access/igv_snapshot/blob/main/README.md"
tool_dev_url: "https://github.com/msk-access/igv_snapshot"
licence: ["MIT"]

input:
# Only when we have meta
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- bam:
type: file
description: BAM file with index.
pattern: "*.{bam,cram,sam}"
- bai:
type: file
description: BAM file index
pattern: "*.{bai}"
- variant_file:
type: file
description: Variant file of input BAM.
pattern: "*.{maf,vcf}"

output:
#Only when we have meta
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`

- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
- igv_screenshots:
type: directory
description: directory containing IGV screenshot for provided sample, and the bat script used to generate the screenshots.
pattern: "**igv_output/*"

authors:
- "@buehlere"
maintainers:
- "@buehlere"
64 changes: 64 additions & 0 deletions modules/msk/igv/snapshot/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
nextflow_process {

name "Test Process IGV_SNAPSHOT"
script "../main.nf"
process "IGV_SNAPSHOT"

tag "modules"
tag "modules_nfcore"
tag "modules_msk"
tag "igv"
tag "igv/snapshot"

test("chr22 - bam, vcf") {

when {
process {
"""
input[0] = [
[ id:'C-9M47TU-L001-d'], // meta map
file(params.test_data_mskcc['chr22']['chr22bam'], checkIfExists: true),
file(params.test_data_mskcc['chr22']['chr22bam_bai'], checkIfExists: true),
file(params.test_data_mskcc['chr22']['chr22vcf'], checkIfExists: true)

]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}

}

test("chr22 - bam, vcf - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id:'C-9M47TU-L001-d'], // meta map
file(params.test_data_mskcc['chr22']['chr22bam'], checkIfExists: true),
file(params.test_data_mskcc['chr22']['chr22bam_bai'], checkIfExists: true),
file(params.test_data_mskcc['chr22']['chr22vcf'], checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}

}

}
82 changes: 82 additions & 0 deletions modules/msk/igv/snapshot/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"chr22 - bam, vcf - stub": {
"content": [
{
"0": [
[
{
"id": "C-9M47TU-L001-d"
},
[
"test.bat:md5,d41d8cd98f00b204e9800998ecf8427e",
"test.png:md5,d41d8cd98f00b204e9800998ecf8427e"
]
]
],
"1": [
"versions.yml:md5,870a90d9f64f5a5f5ec4cd474d69027c"
],
"igv_screenshots": [
[
{
"id": "C-9M47TU-L001-d"
},
[
"test.bat:md5,d41d8cd98f00b204e9800998ecf8427e",
"test.png:md5,d41d8cd98f00b204e9800998ecf8427e"
]
]
],
"versions": [
"versions.yml:md5,870a90d9f64f5a5f5ec4cd474d69027c"
]
}
],
"timestamp": "2024-08-06T17:08:44.477177"
},
"chr22 - bam, vcf": {
"content": [
{
"0": [
[
{
"id": "C-9M47TU-L001-d"
},
[
"22_22127176_22127176.png:md5,fd9de31a371db4523f8a0982df749a09",
"22_41565827_41565827.png:md5,1904ecf0b28baeee6e14e78543052a17",
"22_41566406_41566406.png:md5,c77c48716ed2272f45b49c7852a74705",
"22_41566413_41566413.png:md5,bfaf4189292aa0495e51c26ea33f64f7",
"22_41566595_41566595.png:md5,2fca6b6e75fd4c533fb512d0cd11941b",
"22_41566657_41566657.png:md5,fd49c1c6439206da9c15595921392d29",
"IGV_snapshots.bat:md5,d2eaf7a013f62e5fe07f8a0ddf459ace"
]
]
],
"1": [
"versions.yml:md5,870a90d9f64f5a5f5ec4cd474d69027c"
],
"igv_screenshots": [
[
{
"id": "C-9M47TU-L001-d"
},
[
"22_22127176_22127176.png:md5,fd9de31a371db4523f8a0982df749a09",
"22_41565827_41565827.png:md5,1904ecf0b28baeee6e14e78543052a17",
"22_41566406_41566406.png:md5,c77c48716ed2272f45b49c7852a74705",
"22_41566413_41566413.png:md5,bfaf4189292aa0495e51c26ea33f64f7",
"22_41566595_41566595.png:md5,2fca6b6e75fd4c533fb512d0cd11941b",
"22_41566657_41566657.png:md5,fd49c1c6439206da9c15595921392d29",
"IGV_snapshots.bat:md5,d2eaf7a013f62e5fe07f8a0ddf459ace"
]
]
],
"versions": [
"versions.yml:md5,870a90d9f64f5a5f5ec4cd474d69027c"
]
}
],
"timestamp": "2024-08-06T17:08:31.32318"
}
}
2 changes: 2 additions & 0 deletions modules/msk/igv/snapshot/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
igv/snapshot:
- "modules/msk/igv/snapshot/**"
3 changes: 3 additions & 0 deletions tests/config/test_data.config
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,9 @@ params {
dbsnp_138_b37_chr17_vcf_gz_tbi = "${params.test_data_base_msk}/hg37/genomic_reference/GRCH37/vcf/dbsnp_138.b37.chr17.vcf.gz.tbi"
}
'chr22' {
chr22bam = "${params.test_data_base_msk}/chr22/chr22/chr22.bam"
chr22bam_bai = "${params.test_data_base_msk}/chr22/chr22/chr22.bam.bai"
chr22vcf = "${params.test_data_base_msk}/chr22/chr22/chr22.vcf"
chr22maf = "${params.test_data_base_msk}/chr22/chr22/chr22.maf"
chr22mafstandard = "${params.test_data_base_msk}/chr22/chr22/chr22_standard.maf"
}
Expand Down
Loading