Skip to content

Commit

Permalink
shinyngs feature/observation matrix validation module (#2392)
Browse files Browse the repository at this point in the history
* Starting component set for FOM validation module

* Add test yaml

* Remove trailing whitespace, bump version for bug

* Cheeky symlink for testing install

* [automated] Fix linting with Prettier

* Revert "Cheeky symlink for testing install"

This reverts commit c797d7a.

* appease eclint

* Fix linting issues

* double quote variable in tag

* Fix contrasts channel

* Bump container

Co-authored-by: nf-core-bot <[email protected]>
Co-authored-by: Simon Pearce <[email protected]>
  • Loading branch information
3 people authored Oct 31, 2022
1 parent 6d26aab commit 72695ee
Show file tree
Hide file tree
Showing 6 changed files with 155 additions and 0 deletions.
43 changes: 43 additions & 0 deletions modules/nf-core/shinyngs/validatefomcomponents/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
process SHINYNGS_VALIDATEFOMCOMPONENTS {
tag "$sample"
label 'process_single'

conda (params.enable_conda ? "bioconda::r-shinyngs=1.4.2" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/r-shinyngs:1.4.2--r41hdfd78af_0':
'quay.io/biocontainers/r-shinyngs:1.4.2--r41hdfd78af_0' }"

input:
tuple val(meta), path(sample), path(feature_meta), path(assay_files)
tuple val(meta2), path(contrasts)

output:
tuple val(meta), path("*/*.sample_metadata.tsv"), path("*/*.feature_metadata.tsv"), path("*/*.assay.tsv") , emit: fom
tuple val(meta2), path("*/*.contrasts_file.tsv") , emit: contrasts
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when

script:
// For full list of available args see
// https://github.com/pinin4fjords/shinyngs/blob/develop/exec/validate_fom_components.R
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: meta.id

"""
validate_fom_components.R \\
--sample_metadata $sample \\
--feature_metadata $feature_meta \\
--assay_files ${assay_files.join(',')} \\
--contrasts_file $contrasts \\
--output_directory $prefix \\
$args
cat <<-END_VERSIONS > versions.yml
"${task.process}":
r-base: \$(echo \$(R --version 2>&1) | sed 's/^.*R version //; s/ .*\$//')
r-shinyngs: \$(Rscript -e "library(shinyngs); cat(as.character(packageVersion('shinyngs')))")
END_VERSIONS
"""
}
71 changes: 71 additions & 0 deletions modules/nf-core/shinyngs/validatefomcomponents/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: "shinyngs_validatefomcomponents"
description: validate consistency of feature and sample annotations with matrices and contrasts

keywords:
- expression

tools:
- "shinyngs":
description: "Provides Shiny applications for various array and NGS applications. Currently very RNA-seq centric, with plans for expansion."
homepage: "https://github.com/pinin4fjords/shinyngs"
documentation: "https://rawgit.com/pinin4fjords/shinyngs/master/vignettes/shinyngs.html"
tool_dev_url: "https://github.com/pinin4fjords/shinyngs"
licence: "['AGPL v3']"

input:
- meta:
type: map
description: |
Groovy Map containing information on experiment, at a minimum an id.
e.g. [ id:'test' ]
- meta2:
type: map
description: |
Groovy Map containing information on experiment, at a minimum an id. To match meta.
e.g. [ id:'test' ]
- sample:
type: file
description: |
CSV-format sample sheet with sample metadata
- feature_meta:
type: file
description: |
TSV-format feature (e.g. gene) metadata
- assay_files:
type: list
description: |
List of TSV-format matrix files representing different measures for the same samples (e.g. raw and normalised).
- contrasts:
type: file
description: |
CSV-format file with four columns identifying the sample sheet variable, reference level, treatment level, and optionally a comma-separated list of covariates used as blocking factors.
output:
- meta:
type: map
description: |
Groovy Map containing information on experiment.
e.g. [ id:'test' ]
- sample_meta:
type: file
description: File containing validated sample metadata
pattern: "/*.sample_metadata.tsv"
- sample_meta:
type: file
description: File containing validated feature metadata
pattern: "/*.feature_metadata.tsv"
- asays:
type: file
description: Files containing validated matrices
pattern: "/*.assay.tsv"
- contrast:
type: file
description: Files containing validated matrices
pattern: "/*.contrasts_file.tsv"
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"

authors:
- "@pinin4fjords"
4 changes: 4 additions & 0 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2463,6 +2463,10 @@ shinyngs/staticexploratory:
- modules/nf-core/shinyngs/staticexploratory/**
- tests/modules/nf-core/shinyngs/staticexploratory/**

shinyngs/validatefomcomponents:
- modules/nf-core/shinyngs/validatefomcomponents/**
- tests/modules/nf-core/shinyngs/validatefomcomponents/**

shovill:
- modules/nf-core/shovill/**
- tests/modules/nf-core/shovill/**
Expand Down
18 changes: 18 additions & 0 deletions tests/modules/nf-core/shinyngs/validatefomcomponents/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env nextflow

nextflow.enable.dsl = 2

include { SHINYNGS_VALIDATEFOMCOMPONENTS } from '../../../../../modules/nf-core/shinyngs/validatefomcomponents/main.nf'

workflow test_shinyngs_validatefomcomponents {

expression_sample_sheet = file(params.test_data['mus_musculus']['genome']['rnaseq_samplesheet'], checkIfExists: true)
expression_feature_meta = file(params.test_data['mus_musculus']['genome']['rnaseq_genemeta'], checkIfExists: true)
expression_matrix_file = file(params.test_data['mus_musculus']['genome']['rnaseq_matrix'], checkIfExists: true)
expression_contrasts = file(params.test_data['mus_musculus']['genome']['rnaseq_contrasts'], checkIfExists: true)

SHINYNGS_VALIDATEFOMCOMPONENTS (
[ [ "id":"SRP254919" ], expression_sample_sheet, expression_feature_meta, [ expression_matrix_file ] ],
[ [ "id":"SRP254919" ], expression_contrasts ]
)
}
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()}" }

}
14 changes: 14 additions & 0 deletions tests/modules/nf-core/shinyngs/validatefomcomponents/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
- name: shinyngs validatefomcomponents test_shinyngs_validatefomcomponents
command: nextflow run ./tests/modules/nf-core/shinyngs/validatefomcomponents -entry test_shinyngs_validatefomcomponents -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/shinyngs/validatefomcomponents/nextflow.config
tags:
- shinyngs/validatefomcomponents
- shinyngs
files:
- path: output/shinyngs/SRP254919/SRP254919.contrasts.contrasts_file.tsv
md5sum: e0980240404f48216aedb63b5094029f
- path: output/shinyngs/SRP254919/SRP254919.gene_meta.feature_metadata.tsv
md5sum: 9307606b9a78af90f85b06531d190b55
- path: output/shinyngs/SRP254919/SRP254919.salmon.merged.gene_counts.top1000cov.assay.tsv
md5sum: 0c2224f6c33af1fe93c3b1382b3e05ce
- path: output/shinyngs/SRP254919/SRP254919.samplesheet.sample_metadata.tsv
md5sum: 7c5233cf34fd8eaf7071f21f6fcac7d8

0 comments on commit 72695ee

Please sign in to comment.