Skip to content

Commit

Permalink
added more metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
erinyoung committed Jul 12, 2023
1 parent 695f66a commit 1353ce0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion modules/snp-dists.nf
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ process snp_dists {
//#UPHLICA time '24h'

input:
file(contigs)
tuple file(contigs), val(num_samples), val(num_core_genes)

output:
path "snp-dists/snp_matrix.txt" , emit: snp_matrix
path "snp-dists/snp_matrix_with_qc.txt"
path "snp-dists/roary_metrics_mqc.csv" , emit: for_multiqc
path "logs/${task.process}/${task.process}.${workflow.sessionId}.log", emit: log_files

shell:
Expand All @@ -31,5 +33,12 @@ process snp_dists {
snp-dists !{params.snp_dists_options} \
!{contigs} \
> snp-dists/snp_matrix.txt
genome_length=$(cat !{contigs} | tr "\n" ";" | sed 's/>[^>]*//2g' | tr ";" "\n" | grep -v ">" | wc -c )
sed '0,/,/s/,/num_samples=!{num_samples};num_core_genes=!{num_core_genes};core_genome_length=$genome_length,/' snp-dists/snp_matrix.txt > snp-dists/snp_matrix_with_qc.txt
echo "num_samples,num_core_genes,core_genome_length" > snp-dists/roary_metrics_mqc.csv
echo "!{num_samples},!{num_core_genes},$genome_length" >> snp-dists/roary_metrics_mqc.csv
'''
}

0 comments on commit 1353ce0

Please sign in to comment.