Skip to content

Commit

Permalink
refactor: Change how quast and recombination inputs work (#197)
Browse files Browse the repository at this point in the history
* refactor: Change way of handling IDs in organize_recomb_data

* fix: Remove relative paths from quast input
  • Loading branch information
jvfe authored Jun 8, 2024
1 parent a19a05e commit 146af3f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 21 deletions.
6 changes: 3 additions & 3 deletions bin/organize_recomb_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def remove_after_second_underscore(val):
parts = val.split('_')
if len(parts) > 2:
return '_'.join(parts[:2])
return val
return re.sub("\.(.*)|_T1|$", "", val)

def create_recomb_input(quast_report, poppunk_clusters, assembly_samplesheet, file_out):
# Parsing datasets
Expand All @@ -46,13 +46,13 @@ def create_recomb_input(quast_report, poppunk_clusters, assembly_samplesheet, fi
)

poppunk = read_csv(poppunk_clusters)
poppunk["Taxon"] = poppunk["Taxon"].str.replace("\.(.*)|_T1|$", "", regex=True)
poppunk["Taxon"] = poppunk["Taxon"].apply(remove_after_second_underscore)

assemblies = read_csv(assembly_samplesheet, names=["id", "assembly_path"])
assemblies["assembly_path"] = [
Path(path).name for path in assemblies["assembly_path"].to_list()
]
assemblies["id"] = assemblies["id"].str.replace("\.(.*)|_T1|$", "", regex=True)
assemblies["id"] = assemblies["id"].apply(remove_after_second_underscore)

# Merging datasets
merged = poppunk.merge(quast, right_on="Assembly", left_on="Taxon").loc[
Expand Down
3 changes: 2 additions & 1 deletion modules/nf-core/quast/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ process QUAST {
val use_fasta
val use_gff


output:
path "${prefix}" , emit: results
path "*.tsv" , emit: tsv
Expand All @@ -34,7 +35,7 @@ process QUAST {
$features \\
--threads $task.cpus \\
$args \\
\$(cat ${consensus.join(' ')})
${consensus.join(' ')}
ln -s ${prefix}/report.tsv
Expand Down
16 changes: 5 additions & 11 deletions modules/nf-core/quast/quast.diff
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ Changes in module 'nf-core/quast'
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/quast:5.2.0--py39pl5321h2add14b_1' :
'quay.io/biocontainers/quast:5.2.0--py39pl5321h2add14b_1' }"
@@ -15,7 +15,8 @@
@@ -13,9 +13,11 @@
val use_fasta
val use_gff

+
output:
path "${prefix}" , emit: results
- path '*.tsv' , emit: tsv
Expand All @@ -20,16 +23,7 @@ Changes in module 'nf-core/quast'
path "versions.yml" , emit: versions

when:
@@ -33,7 +34,7 @@
$features \\
--threads $task.cpus \\
$args \\
- ${consensus.join(' ')}
+ \$(cat ${consensus.join(' ')})

ln -s ${prefix}/report.tsv

@@ -42,4 +43,16 @@
@@ -42,4 +44,16 @@
quast: \$(quast.py --version 2>&1 | sed 's/^.*QUAST v//; s/ .*\$//')
END_VERSIONS
"""
Expand Down
7 changes: 1 addition & 6 deletions subworkflows/local/assemblyqc.nf
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,8 @@ workflow CHECK_ASSEMBLIES {
/*
* Module: QUAST quality check
*/
assemblies
.map { meta, fasta -> fasta.toString() }
.collectFile(name:'assemblies.txt', newLine: true)
.set { quast_input }

QUAST (
quast_input,
assemblies.collect { meta, fasta -> fasta },
reference_genome,
[],
use_reference_genome,
Expand Down

0 comments on commit 146af3f

Please sign in to comment.