Skip to content
Merged
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: 1 addition & 1 deletion conf/real_data.config
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ params {
skip_mogonet = false
skip_mofa = false
// Run feature selection
select_feature = true
selectFeature = true
k_fold_number = 5
filter_low_var = "1" // This get casted as bool in both Python and R
// number of component
Expand Down
8 changes: 2 additions & 6 deletions modules/calculate_metrics/main.nf
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
process CALCULATE_METRICS {
def onSockeye = workflow.projectDir.toString().contains('/scratch')
debug true
label 'process_single'
container "${ onSockeye ?
'mogonet.sif' :
'tonyliang19/mogonet:latest' }"

label 'mogonet' // Should be a generic python container?
publishDir (
path: "${params.outdir}/${task.process.tokenize(':').join('/').toLowerCase()}",
mode: 'copy',
Expand All @@ -28,4 +24,4 @@ process CALCULATE_METRICS {
--threshold=${threshold} > \
${task.process.tokenize(':')[-1].toLowerCase()}.log
"""
}
}
32 changes: 19 additions & 13 deletions modules/calculate_metrics/resources/usr/bin/calculate_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,29 +42,35 @@ def calculate_metrics(group, threshold, average='binary', round_digit=3):
y_pred = np.where(phat >= threshold, 1, 0)
# Initialize dict for metrics
metrics = {
'auc': 0.0,
'roc_auc': 0.0,
'pr_auc': 0.0,
'f1_score': 0.0,
'log_loss': 0.0,
'matthews_corrcoef': 0.0,
'accuracy': 0.0,
'balanced_accuracy': 0.0,
'precision': 0.0,
'average_precision_score': 0.0,
'recall': 0.0,
'f1_score': 0.0,
'log_loss': 0.0,

}

try:
# Check if both classes are present in the current group
if len(set(y_true)) > 1: # More than one unique value in y_true
# AUC requires predicted probability (phat) not y_pred
metrics['auc'] = roc_auc_score(y_true, phat)
metrics['accuracy'] = accuracy_score(y_true, y_pred)
metrics['balanced_accuracy'] = balanced_accuracy_score(y_true, y_pred)
metrics['precision'] = precision_score(y_true, y_pred, average=average)
metrics['average_precision_score'] = average_precision_score(y_true, y_pred)
metrics['recall'] = recall_score(y_true, y_pred, average=average)
metrics['f1_score'] = f1_score(y_true, y_pred, average=average)
# For the losses as well
metrics['log_loss'] = log_loss(y_true, y_pred)
metrics['roc_auc'] = roc_auc_score(y_true, phat)
# Same thing with precision-recall auc
metrics['pr_auc'] = average_precision_score(y_true, phat)
# Rest could use the predicted class (y_pred) to calculate metrics
metrics['f1_score'] = f1_score(y_true, y_pred, average=average)
metrics['log_loss'] = log_loss(y_true, phat)
metrics['matthews_corrcoef'] = matthews_corrcoef(y_true, y_pred)
metrics['accuracy'] = accuracy_score(y_true, y_pred)
metrics['balanced_accuracy'] = balanced_accuracy_score(y_true, y_pred)
metrics['precision'] = precision_score(y_true, y_pred, average=average)
metrics['recall'] = recall_score(y_true, y_pred, average=average)


else:
raise ValueError("Only one class present")

Expand Down
5 changes: 1 addition & 4 deletions modules/caret_multimodal/predict/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@ include { getPublishPath } from "${modulesDir}/functions"

process CARET_MULTIMODAL_PREDICT {
// Vars stuff
def onSockeye = workflow.projectDir.toString().contains('/scratch')
tag "${dataset_name}-${fold_name}"
debug "${params.debug}"
container "${ onSockeye ?
'caret_multimodal.sif' :
'tonyliang19/caret_multimodal:latest' }"
label 'caret_multimodal'

publishDir (
path: "${params.outdir}/${getPublishPath(task.process)}/${dataset_name}/${fold_name}",
Expand Down
7 changes: 1 addition & 6 deletions modules/caret_multimodal/preprocess/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,12 @@ include { getPublishPath } from "${modulesDir}/functions"

// TODO: Replace name here
process CARET_MULTIMODAL_PREPROCESS {
// temp variables to use
def onSockeye = workflow.projectDir.toString().contains('/scratch')
// process level configuration
debug "${params.debug}" // debugs true or false by param in MESSI.config
tag "${dataset_name}" // identifier of process when ran in parallel
// By var before to determine what container to use
// Uses apptainer if true otherwise docker
container "${ onSockeye ?
'caret_multimodal.sif' :
'tonyliang19/caret_multimodal:latest' }"

label "caret_multimodal"
label "process_low"

/* outputs store to outdir for saving and inspecting purpose */
Expand Down
5 changes: 1 addition & 4 deletions modules/caret_multimodal/select_feature/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@ include { getPublishPath } from "${modulesDir}/functions"

process CARET_MULTIMODAL_SELECT_FEATURE {
// Vars stuff
def onSockeye = workflow.projectDir.toString().contains('/scratch')
tag "${dataset_name}"
debug true
label 'process_high'
container "${ onSockeye ?
'caret_multimodal.sif' :
'tonyliang19/caret_multimodal:latest' }"
label 'caret_multimodal'

publishDir (
path: "${params.outdir}/${task.process.tokenize(':').join('/').toLowerCase()}/${dataset_name}",
Expand Down
8 changes: 2 additions & 6 deletions modules/caret_multimodal/train/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,9 @@
include { getPublishPath } from "${modulesDir}/functions"

process CARET_MULTIMODAL_TRAIN {
// Vars stuff
def onSockeye = workflow.projectDir.toString().contains('/scratch')
// Identifier for each dataset and fold combination
tag "${dataset_name}-${fold_path.name}"
// TODO: rename to the actual image name used
container "${ onSockeye ?
'caret_multimodal.sif' :
'tonyliang19/caret_multimodal:latest' }"

// Parse the output directory to migrate results to
publishDir (
path: "${params.outdir}/${getPublishPath(task.process)}/${dataset_name}/${fold_path.name}",
Expand All @@ -34,6 +29,7 @@ process CARET_MULTIMODAL_TRAIN {
// TODO: add your custom labels to tell if process
// consumes large RAM/ROM and gpu access or not
label 'process_medium'
label 'caret_multimodal'


// TODO: Change arg name to mae_path or mu_path
Expand Down
5 changes: 1 addition & 4 deletions modules/cooperative_learning/predict/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@
include { getPublishPath } from "${modulesDir}/functions"
process COOPERATIVE_LEARNING_PREDICT {
// Vars stuff
def onSockeye = workflow.projectDir.toString().contains('/scratch')
tag "${dataset_name}-${fold_name}"
debug true
label 'process_single'
container "${ onSockeye ?
'codia.sif' :
'tonyliang19/codia:latest' }"
label 'codia'

publishDir (
path: "${params.outdir}/${getPublishPath(task.process)}/${dataset_name}/${fold_name}",
Expand Down
5 changes: 1 addition & 4 deletions modules/cooperative_learning/preprocess/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@ include { getPublishPath } from "${modulesDir}/functions"

process COOPERATIVE_LEARNING_PREPROCESS {
// Temp variables
def onSockeye = workflow.projectDir.toString().contains('/scratch')
/* Directives for process */
debug "${params.debug}" // default is true
tag "${dataset_name}"
label 'process_single'
container "${ onSockeye ?
'codia.sif' :
'tonyliang19/codia:latest'}"
label 'codia'

// More special publish dir by getting method/method_abc to method/abc
publishDir (
Expand Down
7 changes: 2 additions & 5 deletions modules/cooperative_learning/select_feature/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@ include { getPublishPath } from "${modulesDir}/functions"

process COOPERATIVE_LEARNING_SELECT_FEATURE {
// Vars stuff
def onSockeye = workflow.projectDir.toString().contains('/scratch')
tag "${dataset_name}"
debug true
label 'process_high'
container "${ onSockeye ?
'codia.sif' :
'tonyliang19/codia:latest' }"
label 'codia'

publishDir (
path: "${params.outdir}/${task.process.tokenize(':').join('/').toLowerCase()}/${dataset_name}",
Expand All @@ -21,7 +18,7 @@ process COOPERATIVE_LEARNING_SELECT_FEATURE {
// Labels
label 'low_mem'
label 'cpu'
label 'codia'
label 'codia'


/* Input and output blocks*/
Expand Down
5 changes: 1 addition & 4 deletions modules/cooperative_learning/train/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@
include { getPublishPath } from "${modulesDir}/functions"
process COOPERATIVE_LEARNING_TRAIN {
// Vars stuff
def onSockeye = workflow.projectDir.toString().contains('/scratch')
tag "${dataset_name}-${fold_path.name}"
debug "${params.debug}"
label 'process_high'
container "${ onSockeye ?
'codia.sif' :
'tonyliang19/codia:latest' }"
label 'codia'
// More special publish dir by getting method/method_abc to method/abc
publishDir (
path: "${params.outdir}/${getPublishPath(task.process)}/${dataset_name}/${fold_path.name}",
Expand Down
5 changes: 1 addition & 4 deletions modules/diablo/downstream/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,13 @@ include { getPublishPath } from "${modulesDir}/functions"
// TODO: Replace name here
process DIABLO_DOWNSTREAM {
// temp variables to use
def onSockeye = workflow.projectDir.toString().contains('/scratch')
// process level configuration
debug "${params.debug}" // debugs true or false by param in MESSI.config
label 'process_single'
tag "${dataset_name}" // identifier of process when ran in parallel
// By var before to determine what container to use
// Uses apptainer if true otherwise docker
container "${ onSockeye ?
'codia.sif' :
'tonyliang19/codia:latest'}"
label 'codia'

/* outputs store to outdir for saving and inspecting purpose */
publishDir (
Expand Down
5 changes: 1 addition & 4 deletions modules/diablo/predict/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@ include { getPublishPath } from "${modulesDir}/functions"

process DIABLO_PREDICT {
// Vars stuff
def onSockeye = workflow.projectDir.toString().contains('/scratch')
tag "${dataset_name}-${fold_name}-${method}"
debug true
label 'process_single'
container "${ onSockeye ?
'codia.sif' :
'tonyliang19/codia:latest' }"
label 'codia'

publishDir (
//path: "${params.outdir}/${task.process.tokenize(':')[-1].toLowerCase()}/${dataset_name}/${fold_name}",
Expand Down
5 changes: 1 addition & 4 deletions modules/diablo/preprocess/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,13 @@ include { getPublishPath } from "${modulesDir}/functions"

process DIABLO_PREPROCESS {
// temp variables to use
def onSockeye = workflow.projectDir.toString().contains('/scratch')
// process level configuration
debug "${params.debug}" // debugs true or false by param in MESSI.config
label 'process_single'
tag "${dataset_name}" // identifier of process when ran in parallel
// By var before to determine what container to use
// Uses apptainer if true otherwise docker
container "${ onSockeye ?
'codia.sif' :
'tonyliang19/codia:latest'}"
label 'codia'

/* outputs store to outdir for saving and inspecting purpose */
publishDir (
Expand Down
5 changes: 1 addition & 4 deletions modules/diablo/select_feature/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@ include { getPublishPath } from "${modulesDir}/functions"

process DIABLO_SELECT_FEATURE {
// Vars stuff
def onSockeye = workflow.projectDir.toString().contains('/scratch')
tag "${dataset_name}-design_${design}-ncomp_${ncomp}"
debug true
label 'process_high'
container "${ onSockeye ?
'codia.sif' :
'tonyliang19/codia:latest' }"
label 'codia'

publishDir (
path: "${params.outdir}/${task.process.tokenize(':').join('/').toLowerCase()}/${dataset_name}",
Expand Down
5 changes: 1 addition & 4 deletions modules/diablo/train/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,12 @@
include { getPublishPath } from "${modulesDir}/functions"
process DIABLO_TRAIN {
// Vars stuff
def onSockeye = workflow.projectDir.toString().contains('/scratch')
def method_name = "diablo"
tag "${dataset_name}-${fold_path.name}-design_${design}-ncomp_${ncomp}"
//debug "${params.debug}"
debug true
label 'process_medium'
container "${ onSockeye ?
'codia.sif' :
'tonyliang19/codia:latest' }"
label 'codia'
// Parse this path
publishDir (
//path: "${params.outdir}/${task.process.tokenize(':')[-1].toLowerCase()}/${dataset_name}/${fold_path.name}",
Expand Down
38 changes: 0 additions & 38 deletions modules/goat/main.nf

This file was deleted.

Empty file.
5 changes: 1 addition & 4 deletions modules/integrao/predict/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@ include { getPublishPath } from "${modulesDir}/functions"

process INTEGRAO_PREDICT {
// Vars stuff
def onSockeye = workflow.projectDir.toString().contains('/scratch')
tag "${dataset_name}-${fold_name}"
debug "${params.debug}"
container "${ onSockeye ?
'integrao.sif' :
'tonyliang19/integrao:latest' }"
label 'integrao'

publishDir (
path: "${params.outdir}/${getPublishPath(task.process)}/${dataset_name}/${fold_name}",
Expand Down
5 changes: 1 addition & 4 deletions modules/integrao/preprocess/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,12 @@ include { getPublishPath } from "${modulesDir}/functions"
// TODO: Replace name here
process INTEGRAO_PREPROCESS {
// temp variables to use
def onSockeye = workflow.projectDir.toString().contains('/scratch')
// process level configuration
debug "${params.debug}" // debugs true or false by param in MESSI.config
tag "${dataset_name}" // identifier of process when ran in parallel
// By var before to determine what container to use
// Uses apptainer if true otherwise docker
container "${ onSockeye ?
'integrao.sif' :
'tonyliang19/integrao:latest' }"
label 'integrao'

label "process_low"

Expand Down
5 changes: 1 addition & 4 deletions modules/integrao/select_feature/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@ include { getPublishPath } from "${modulesDir}/functions"

process INTEGRAO_SELECT_FEATURE {
// Vars stuff
def onSockeye = workflow.projectDir.toString().contains('/scratch')
tag "${dataset_name}"
debug true
label 'process_high'
label 'gpu'
container "${ onSockeye ?
'integrao.sif' :
'tonyliang19/integrao:latest' }"
label 'integrao'

publishDir (
path: "${params.outdir}/${task.process.tokenize(':').join('/').toLowerCase()}/${dataset_name}",
Expand Down
Loading
Loading