Skip to content

Commit

Permalink
moved validation parameter section from logratioanalysis.nf to mainwo…
Browse files Browse the repository at this point in the history
…rkflow.nf
  • Loading branch information
suzannejin committed Oct 17, 2023
1 parent 1bd95cf commit c205add
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 50 deletions.
21 changes: 15 additions & 6 deletions conf/test.config
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ params {
max_time = '6.h'

// Input data

input = 'https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/mus_musculus/rnaseq_expression/SRP254919.samplesheet.csv'
matrix = 'https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/mus_musculus/rnaseq_expression/SRP254919.salmon.merged.gene_counts.top1000cov.tsv'
contrasts = 'https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/mus_musculus/rnaseq_expression/SRP254919.contrasts.csv'
Expand All @@ -32,19 +31,29 @@ params {
gtf = 'https://ftp.ensembl.org/pub/release-81/gtf/mus_musculus/Mus_musculus.GRCm38.81.gtf.gz'

// Observations
observations_id_col = 'sample'
observations_name_col = 'sample'
observations_id_col = 'sample'
observations_name_col = 'sample'

// Apply a higher filter to check that the filtering works
filtering_min_abundance=10
filtering_min_abundance = 10

/*
differential abundance specific parameters
*/

// Exploratory
exploratory_main_variable = 'contrasts'
exploratory_main_variable = 'contrasts'

// Test dataset is too small for the nsub default value
deseq2_vst_nsub = 500
deseq2_vst_nsub = 500

// Activate GSEA
gsea_run = true
gsea_gene_sets = 'https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/mus_musculus/gene_set_analysis/mh.all.v2022.1.Mm.symbols.gmt'

/*
logratio analysis specific parameters
*/

// TODO add parameters
}
10 changes: 10 additions & 0 deletions conf/test_affy.config
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ params {
// Exploratory
exploratory_main_variable = 'contrasts'

/*
differential abundance specific parameters
*/

// Differential
differential_max_pval = 0.05
differential_max_qval = 0.05
Expand All @@ -43,4 +47,10 @@ params {
// Activate GSEA
gsea_run = true
gsea_gene_sets = 'https://raw.githubusercontent.com/nf-core/test-datasets/differentialabundance/testdata/h.all.v2022.1.Hs.symbols.gmt'

/*
logratio analysis specific parameters
*/

// TODO add parameters
}
2 changes: 2 additions & 0 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ if (params.help) {
}

// Validate input parameters
// this will check that the given parameters met the ones declared in json files
// it will also check all the required inputs are fullfilled
if (params.validate_params) {
validateParameters()
}
Expand Down
49 changes: 8 additions & 41 deletions subworkflows/logratioanalysis.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,6 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

include { paramsSummaryLog; paramsSummaryMap } from 'plugin/nf-validation'

def logo = NfcoreTemplate.logo(workflow, params.monochrome_logs)
def citation = '\n' + WorkflowMain.citation(workflow) + '\n'
def summary_params = paramsSummaryMap(workflow)

// Print parameter summary log to screen
log.info logo + paramsSummaryLog(workflow) + citation

// Validate input parameters
// TODO make it specific for logratioanalysis || or maybe it common for the whole workflow
WorkflowDifferentialabundance.initialise(params,log)

// Check input path parameters to see if they exist
def checkPathParamList = [
params.input,
params.matrix,
params.gtf
]
for (param in checkPathParamList) { if (param) { file(param, checkIfExists: true) } }

// Define meta
def exp_meta = [ "id": params.study_name ]

// Check input samplesheet
if (params.input) {
input_file = file(params.input, checkIfExists: true)
ch_input = Channel.of([ exp_meta, input_file ])
} else {
exit 1, 'Input samplesheet not specified!'
}
// Check input matrix
if (params.matrix) {
matrix_file = file(params.matrix, checkIfExists: true)
ch_in_raw = Channel.of([ exp_meta, matrix_file])
} else {
error("Input matrix not specified!")
}

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -75,11 +37,14 @@ include { PROPR_PROPD as PROPR_DIFFERENTIALPROPORTIONALITY } from '../modules/n
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

// Info required for completion email and summary
def multiqc_report = []

workflow LOGRATIOANALYSIS {

take:
ch_input
ch_in_raw


main:

/*
* DATA HANDLING
Expand All @@ -103,6 +68,8 @@ workflow LOGRATIOANALYSIS {

// TODO need to handle different data structures here (eg. affy, etc)

// TODO use contrast

// TODO currently the zeros can be directly handled in the downstream analysis by replacing them with the min value
// TODO add zero imputation methods

Expand Down
63 changes: 60 additions & 3 deletions workflows/mainworkflow.nf
Original file line number Diff line number Diff line change
@@ -1,17 +1,72 @@
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PRINT PARAMS SUMMARY
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

include { paramsSummaryLog; paramsSummaryMap } from 'plugin/nf-validation'

def logo = NfcoreTemplate.logo(workflow, params.monochrome_logs)
def citation = '\n' + WorkflowMain.citation(workflow) + '\n'
def summary_params = paramsSummaryMap(workflow)

log.info logo + paramsSummaryLog(workflow) + citation

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
VALIDATE INPUTS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

// TODO move the validation block from the subworkflows to here
// Validate input parameters
WorkflowDifferentialabundance.initialise(params, log)

// Check input path parameters to see if they exist
def checkPathParamList = [ params.input ]
for (param in checkPathParamList) { if (param) { file(param, checkIfExists: true) } }

// Check mandatory parameters
def exp_meta = [ "id": params.study_name ]
if (params.input) {
ch_input = Channel.of([ exp_meta, file(params.input, checkIfExists: true) ])
} else {
exit 1, 'Input samplesheet not specified!'
}

// handle different data formats
if (params.study_type == 'affy_array'){

if (params.affy_cel_files_archive) {
ch_celfiles = Channel.of([ exp_meta, file(params.affy_cel_files_archive, checkIfExists: true) ])
} else {
error("CEL files archive not specified!")
}

} else {
// If this is not microarray data or maxquant output, and this an RNA-seq dataset,
// then assume we're reading from a matrix

if (params.study_type == "rnaseq" && params.matrix) {
matrix_file = file(params.matrix, checkIfExists: true)
ch_in_raw = Channel.of([ exp_meta, matrix_file])
} else {
error("Input matrix not specified!")
}

}

report_file = file(params.report_file, checkIfExists: true)
logo_file = file(params.logo_file, checkIfExists: true)
css_file = file(params.css_file, checkIfExists: true)
citations_file = file(params.citations_file, checkIfExists: true)

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CONFIG FILES
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

// TODO maybe create two config files depending on running logratioanalysis or differentialabundance

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -33,7 +88,6 @@ if (params.run_partial_correlation || params.run_proportionality || params.run_d
*/



/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
RUN MAIN WORKFLOW
Expand All @@ -47,7 +101,10 @@ workflow MAINWORKFLOW {
}

if (params.run_partial_correlation || params.run_proportionality || params.run_differential_proportionality){
LOGRATIOANALYSIS()
LOGRATIOANALYSIS(
ch_input,
ch_in_raw
)
}

}

0 comments on commit c205add

Please sign in to comment.