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

Polish STATS subworkflow #75

Merged
merged 20 commits into from
Dec 12, 2023
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Initial release of nf-core/multiplesequencealign, created with the [nf-core](htt
[#66](https://github.com/nf-core/multiplesequencealign/issues/66) - README: add new metromap and available tool list.
[#54](https://github.com/nf-core/multiplesequencealign/issues/54) - Update modules versions from nf-core tools.
[#80](https://github.com/nf-core/multiplesequencealign/pull/80) - Update modules versions from nf-core tools with nf-test.
[#32](https://github.com/nf-core/multiplesequencealign/issues/32) - Update Stats workflow with nf-core modules for merging.

### `Dependencies`

Expand Down
1 change: 0 additions & 1 deletion assets/samplesheet.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
id,fasta,reference,structures,template
seatoxin-ref,test-dataset/setoxin-ref.fa,test-dataset/setoxin.ref,https://raw.githubusercontent.com/nf-core/test-datasets/multiplesequencealign/testdata/structures/seatoxin-ref.tar.gz,
toxin-ref,test-dataset/toxin-ref.fa,test-dataset/toxin.ref,
6 changes: 1 addition & 5 deletions assets/toolsheet.csv
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
tree,args_tree,aligner,args_aligner
FAMSA,"-gt upgma -parttree",FAMSA,""
"","",MAFFT,"--anysymbol --quiet --dpparttree"
"","","KALIGN",""
CLUSTALO,"--force",3DCOFFEE,"-method TMalign_pair"
CLUSTALO,"--force",TCOFFEE,"-reg -reg_method famsa_msa -reg_nseq 100"
"","",FAMSA,""
FAMSA,"",TCOFFEE,"-reg -reg_method famsa_msa -reg_nseq 100"

1 change: 0 additions & 1 deletion bin/calc_seqstats.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env python3
from Bio import SeqIO
import pandas as pd
import time
import sys

fam_name = sys.argv[1]
Expand Down
52 changes: 49 additions & 3 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,31 @@ process {
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]

withName: TCOFFEE_SEQREFORMAT_SIM{
ext.args = "-output=sim_idscore"
publishDir = [
path: { "${params.outdir}/stats/${task.process.tokenize(':')[-1].toLowerCase()}" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}

withName: PARSE_SIM{
publishDir = [
path: { "${params.outdir}/stats/${task.process.tokenize(':')[-1].toLowerCase()}" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}

withName: "CALCULATE_SEQSTATS"{
publishDir = [
path: { "${params.outdir}/stats/${task.process.tokenize(':')[-1].toLowerCase()}" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}

withName: "FAMSA_GUIDETREE"{
ext.prefix = { "${meta.id}_${meta.tree}-args-${meta.argstree_clean}" }
ext.args = { "${meta.args_tree}" == "null" ? '' : "${meta.args_tree}" }
Expand All @@ -38,6 +63,15 @@ process {
]
}

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

withName: ".*ALIGN"{
ext.prefix = { "${meta.id}_${meta.tree}-args-${meta.argstree_clean}_${meta.aligner}-args-${meta.argsaligner_clean}" }
ext.args = { "${meta.args_aligner}" == "null" ? '' : "${meta.args_aligner}" }
Expand Down Expand Up @@ -70,17 +104,29 @@ process {
]
}

withName: "MERGE_STATS"{

withName: "CONCAT_SEQSTATS"{
ext.prefix = { "summary_seqstats" }
publishDir = [
path: { "${params.outdir}/stats/" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}

withName: "TCOFFEE_SEQREFORMAT_SIM|CALCULATE_SEQSTATS"{
withName: "CONCAT_SIMSTATS"{
ext.prefix = { "summary_simstats" }
publishDir = [
path: { "${params.outdir}/stats/${task.process.tokenize(':')[-1].toLowerCase()}" },
path: { "${params.outdir}/stats/" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}

withName: "MERGE_STATS"{
ext.prefix = { "complete_summary_stats" }
publishDir = [
path: { "${params.outdir}/stats/" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
Expand Down
2 changes: 1 addition & 1 deletion conf/test.config
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ params {
max_time = '6.h'

// Stats
skip_stats = true
skip_stats = false
skip_eval = true

// Input data
Expand Down
15 changes: 15 additions & 0 deletions modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@
"git_sha": "1f253ec05723293df7757af8769f8389b7a1884e",
"installed_by": ["modules"]
},
"csvtk/concat": {
"branch": "master",
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
"installed_by": ["modules"]
},
"csvtk/join": {
"branch": "master",
"git_sha": "b2420a8bbd8af137380aa0a0c2e9a92456e5bb21",
"installed_by": ["modules"]
},
"custom/dumpsoftwareversions": {
"branch": "master",
"git_sha": "bba7e362e4afead70653f84d8700588ea28d0f9e",
Expand Down Expand Up @@ -65,6 +75,11 @@
"git_sha": "c83c78835ca6d7a55b3f200718d887cbc7149d37",
"installed_by": ["modules"]
},
"tcoffee/seqreformat": {
"branch": "master",
"git_sha": "f759fd45ecabb40c761df1338a4bb3851171a7f7",
"installed_by": ["modules"]
},
"untar": {
"branch": "master",
"git_sha": "3f5420aa22e00bd030a2556dfdffc9e164ec0ec5",
Expand Down
5 changes: 4 additions & 1 deletion modules/local/calculate_seqstats.nf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ process CALCULATE_SEQSTATS {
tag "$meta.id"
label 'process_low'

container 'luisas/structural_regression:20'
conda "conda-forge::python=3.11.0 conda-forge::biopython=1.80 conda-forge::pandas=1.5.2"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/mulled-v2-27978155697a3671f3ef9aead4b5c823a02cc0b7:548df772fe13c0232a7eab1bc1deb98b495a05ab-0' :
'biocontainers/mulled-v2-27978155697a3671f3ef9aead4b5c823a02cc0b7:548df772fe13c0232a7eab1bc1deb98b495a05ab-0' }"

input:
tuple val(meta), path(fasta)
Expand Down
30 changes: 0 additions & 30 deletions modules/local/merge_stats.nf

This file was deleted.

30 changes: 30 additions & 0 deletions modules/local/parse_sim.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
process PARSE_SIM {
tag "$meta.id"
label 'process_low'

input:
tuple val(meta), path(infile)

output:
tuple val (meta), path("${prefix}.sim_tot"), emit: sim_tot

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

script:
def args = task.ext.args ?: ''
prefix = task.ext.prefix ?: "${meta.id}"
"""
echo "$prefix" > tmp
grep ^TOT $infile | cut -f4 >> tmp

echo "id,perc_sim" > ${prefix}.sim_tot
cat tmp | tr '\\n' ',' | awk 'gsub(/,\$/,x)' >> ${prefix}.sim_tot
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}.sim_tot
"""
}
42 changes: 0 additions & 42 deletions modules/local/tcoffee_seqreformat_sim.nf

This file was deleted.

43 changes: 43 additions & 0 deletions modules/nf-core/csvtk/concat/main.nf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 51 additions & 0 deletions modules/nf-core/csvtk/concat/meta.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading