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

Make outdir great again #73

Merged
merged 1 commit into from
Jan 7, 2025
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
111 changes: 83 additions & 28 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ process {

withName: 'IDENTIFY_SEQ_ONLINE|WRITE_SEQINFO' {
publishDir = [
path: { "${params.outdir}/seqinfo" },
path: { "${params.outdir}/seqinfo/${meta.id}" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
enabled: params.output_intermediates
Expand All @@ -35,7 +35,7 @@ process {

withName: 'FETCH_OMA_GROUP_LOCAL|FETCH_OMA_GROUP_ONLINE' {
publishDir = [
path: { "${params.outdir}/orthologs/oma" },
path: { "${params.outdir}/orthologs/${meta.id}/oma" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
enabled: params.output_intermediates
Expand All @@ -46,7 +46,7 @@ process {

withName: 'FETCH_PANTHER_GROUP_LOCAL|FETCH_PANTHER_GROUP_ONLINE' {
publishDir = [
path: { "${params.outdir}/orthologs/panther" },
path: { "${params.outdir}/orthologs/${meta.id}/panther" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
enabled: params.output_intermediates
Expand All @@ -57,7 +57,7 @@ process {

withName: 'FETCH_INSPECTOR_GROUP_ONLINE' {
publishDir = [
path: { "${params.outdir}/orthologs/orthoinspector" },
path: { "${params.outdir}/orthologs/${meta.id}/orthoinspector" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
enabled: params.output_intermediates
Expand All @@ -68,7 +68,7 @@ process {

withName: 'FETCH_EGGNOG_GROUP_LOCAL|FETCH_EGGNOG_GROUP_ONLINE' {
publishDir = [
path: { "${params.outdir}/orthologs/eggnog" },
path: { "${params.outdir}/orthologs/${meta.id}/eggnog" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
enabled: params.output_intermediates
Expand All @@ -83,7 +83,7 @@ process {

withName: 'SPLIT_ID_FORMAT' {
publishDir = [
path: { "${params.outdir}/sequences" },
path: { "${params.outdir}/sequences/${meta.id}/" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
enabled: params.output_intermediates
Expand All @@ -92,7 +92,7 @@ process {

withName: 'FETCH_UNIPROT_SEQUENCES' {
publishDir = [
path: { "${params.outdir}/sequences" },
path: { "${params.outdir}/sequences/${meta.id}/uniprot" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
enabled: params.output_intermediates
Expand All @@ -110,7 +110,7 @@ process {

withName: 'FETCH_ENSEMBL_SEQUENCES' {
publishDir = [
path: { "${params.outdir}/sequences" },
path: { "${params.outdir}/sequences/${meta.id}/ensembl" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
enabled: params.output_intermediates
Expand All @@ -119,7 +119,7 @@ process {

withName: 'FETCH_REFSEQ_SEQUENCES' {
publishDir = [
path: { "${params.outdir}/sequences" },
path: { "${params.outdir}/sequences/${meta.id}/refseq" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
enabled: params.output_intermediates
Expand All @@ -128,16 +128,17 @@ process {

withName: 'FETCH_OMA_SEQUENCES' {
publishDir = [
path: { "${params.outdir}/sequences" },
path: { "${params.outdir}/sequences/${meta.id}/oma" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
enabled: params.output_intermediates
]
}

withName: 'CONCAT_FASTA' {
ext.prefix = { "${meta.id}_orthologs.txt" }
publishDir = [
path: { "${params.outdir}/sequences" },
path: { "${params.outdir}/sequences/${meta.id}" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
Expand All @@ -146,7 +147,7 @@ process {
withName: 'CONCAT_HITS' {
ext.prefix = {"${meta.id}_hits.txt"}
publishDir = [
path: { "${params.outdir}/sequences" },
path: { "${params.outdir}/sequences/${meta.id}" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
enabled: params.output_intermediates
Expand All @@ -156,7 +157,7 @@ process {
withName: 'CONCAT_MISSES' {
ext.prefix = {"${meta.id}_misses.txt"}
publishDir = [
path: { "${params.outdir}/sequences" },
path: { "${params.outdir}/sequences/${meta.id}" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
enabled: params.output_intermediates
Expand All @@ -168,7 +169,7 @@ process {
ext.prefix = {"${meta.id}_ids"}
ext.suffix = "txt"
publishDir = [
path: { "${params.outdir}/merge" },
path: { "${params.outdir}/merge/${meta.id}" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
enabled: params.output_intermediates
Expand All @@ -179,11 +180,40 @@ process {
// ID merging
// ----------------------

withName: 'SPLIT_TAXIDS' {
publishDir = [
path: { "${params.outdir}/merge/${meta.id}/taxids" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
enabled: params.output_intermediates
]
}

withName: 'MERGE_FASTA_IDS' {
ext.prefix = { "${meta.id}_ids_raw" }
publishDir = [
path: { "${params.outdir}/merge/${meta.id}/" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
enabled: params.output_intermediates
]
}

withName: 'DIAMOND_CLUSTER' {
ext.args = "--approx-id 90"
ext.prefix = { "${meta.id}_${db.toString().tokenize(".")[0].tokenize("_")[-1]}" }
ext.prefix = { "${meta.id}_${db.toString().tokenize(".")[0].tokenize("_")[-1]}_clusters" }
publishDir = [
path: { "${params.outdir}/merge" },
path: { "${params.outdir}/merge/${meta.id}/clusters" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
enabled: params.output_intermediates
]
}

withName: 'MERGE_DIAMOND' {
ext.prefix = { "${meta.id}_pairs_raw.txt" }
publishDir = [
path: { "${params.outdir}/merge/${meta.id}" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
enabled: params.output_intermediates
Expand All @@ -201,10 +231,10 @@ process {
print col1[1];
}
}\'"""
ext.prefix = { "${meta.id}_ids_diamond" }
ext.prefix = { "${meta.id}_pairs_clean" }
ext.suffix = "txt"
publishDir = [
path: { "${params.outdir}/merge" },
path: { "${params.outdir}/merge/${meta.id}" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
enabled: params.output_intermediates
Expand All @@ -216,7 +246,17 @@ process {
ext.prefix = { "${meta.id}_clusters" }
ext.suffix = "txt"
publishDir = [
path: { "${params.outdir}/merge" },
path: { "${params.outdir}/merge/${meta.id}" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
enabled: params.output_intermediates
]
}

withName: 'MERGE_ALL' {
ext.prefix = { "${meta.id}_idmap_raw.tsv" }
publishDir = [
path: { "${params.outdir}/merge/${meta.id}" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
enabled: params.output_intermediates
Expand All @@ -226,13 +266,19 @@ process {
withName: 'REDUCE_IDMAP' {
ext.args = "-F\'\t\'"
ext.args2 = "\'NF >= 2\'"
ext.prefix = { "${meta.id}_idmap" }
ext.prefix = { "${meta.id}_idmap.tsv" }
publishDir = [
path: { "${params.outdir}/merge/${meta.id}" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
enabled: params.output_intermediates
]
}

withName: 'MERGE_CSV' {
ext.args = '-f 1 --outer-join --na 0'
publishDir = [
path: { "${params.outdir}/orthologs/merge_csv" },
path: { "${params.outdir}/score/${meta.id}" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
enabled: params.output_intermediates
Expand All @@ -245,15 +291,15 @@ process {

withName: 'MAKE_SCORE_TABLE' {
publishDir = [
path: { "${params.outdir}/orthologs/score_table" },
path: { "${params.outdir}/score/${meta.id}" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}

withName: 'FILTER_HITS' {
publishDir = [
path: { "${params.outdir}/orthologs/filter_hits" },
path: { "${params.outdir}/score/${meta.id}" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
enabled: params.output_intermediates
Expand All @@ -262,15 +308,15 @@ process {

withName: 'PLOT_ORTHOLOGS' {
publishDir = [
path: { "${params.outdir}/orthologs/plots" },
path: { "${params.outdir}/score/${meta.id}/plots" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}

withName: 'MAKE_HITS_TABLE' {
publishDir = [
path: { "${params.outdir}/orthologs/stats" },
path: { "${params.outdir}/score/${meta.id}" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
enabled: params.output_intermediates
Expand All @@ -281,15 +327,24 @@ process {
ext.args = "-u 0 -k"
ext.prefix = "aggregated_hits"
publishDir = [
path: { "${params.outdir}/orthologs/stats" },
path: { "${params.outdir}/score" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}

withName: 'MAKE_STATS' {
publishDir = [
path: { "${params.outdir}/orthologs/stats" },
path: { "${params.outdir}/score/${meta.id}" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
enabled: params.output_intermediates
]
}

withName: 'STATS2CSV' {
publishDir = [
path: { "${params.outdir}/score/${meta.id}" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
enabled: params.output_intermediates
Expand All @@ -300,7 +355,7 @@ process {
ext.args = "-u NA"
ext.prefix = "aggregated_stats"
publishDir = [
path: { "${params.outdir}/orthologs/stats" },
path: { "${params.outdir}/score" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
Expand Down
15 changes: 7 additions & 8 deletions modules/local/make_report.nf
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ process MAKE_REPORT {
tuple val(meta), path(id), path(taxid), path(exact), path(score_table), path(filtered_hits), path(support_plot), path(venn_plot), path(jaccard_plot), path(orthostats), path(seq_hits), path(seq_misses), path(params_file)

output:
tuple val(meta), path("*dist/*"), emit: report_files
path "versions.yml" , emit: versions
tuple val(meta), path("${prefix}/*"), emit: report_files
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when
Expand All @@ -20,7 +20,7 @@ process MAKE_REPORT {
error("Local MAKE_REPORT module does not support Conda. Please use Docker / Singularity / Podman instead.")
}

def prefix = task.ext.prefix ?: meta.id
prefix = task.ext.prefix ?: meta.id
seqhits_cmd = seq_hits ? "cp $seq_hits public/seq_hits.txt" : ''
seqmisses_cmd = seq_misses ? "cp $seq_misses public/seq_misses.txt" : ''
"""
Expand Down Expand Up @@ -50,8 +50,8 @@ process MAKE_REPORT {
echo "python3 -m http.server 0" > dist/run.sh
chmod u+x dist/run.sh

# add prefix to directory name
mv dist ${prefix}_dist
# change output directory name
mv dist ${prefix}

cat <<- END_VERSIONS > versions.yml
"${task.process}":
Expand All @@ -62,10 +62,9 @@ process MAKE_REPORT {
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
mkdir ${prefix}_dist
touch ${prefix}_dist/${prefix}_run.sh
mkdir ${prefix}
touch ${prefix}/run.sh

cat <<- END_VERSIONS > versions.yml
${task.process}:
Expand Down
Loading