-
Notifications
You must be signed in to change notification settings - Fork 1k
Expand file tree
/
Copy pathcluster_viz.nf
More file actions
47 lines (41 loc) · 1.56 KB
/
cluster_viz.nf
File metadata and controls
47 lines (41 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
process CLUSTER_VIZ {
tag "${meta.id}"
label 'process_medium'
container "${params.python_container ?: params.container_py ?: 'snpclustering-py:latest'}"
publishDir "${params.outdir}/viz", mode: 'copy'
input:
tuple val(meta), path(pca_scores), path(pca_info), path(clusters)
path cluster_viz_script
output:
tuple val(meta), path("${meta.id}_umap.png"),
path("${meta.id}_tsne.png"),
path("${meta.id}_pca.png"), emit: plots
tuple val(meta), path("${meta.id}_umap.tsv"), emit: umap_tsv
tuple val(meta), path("${meta.id}_tsne.tsv"), emit: tsne_tsv
path "versions.yml", emit: versions
script:
def umap_n = params.viz_umap_neighbors ?: 15
def umap_d = params.viz_umap_min_dist ?: 0.1
def tsne_p = params.viz_perplexity ?: 30
def tsne_i = params.viz_tsne_iter ?: 1000
"""
export NUMBA_DISABLE_JIT=1
python3 ${cluster_viz_script} \\
--features ${pca_scores} \\
--clusters ${clusters} \\
--pca-scores ${pca_scores} \\
--umap-neighbors ${umap_n} \\
--umap-min-dist ${umap_d} \\
--tsne-perplexity ${tsne_p} \\
--tsne-iter ${tsne_i} \\
--out-umap-tsv ${meta.id}_umap.tsv \\
--out-tsne-tsv ${meta.id}_tsne.tsv \\
--out-umap-png ${meta.id}_umap.png \\
--out-tsne-png ${meta.id}_tsne.png \\
--out-pca-png ${meta.id}_pca.png
cat <<-END_VERSIONS > versions.yml
"${task.process}":
scikit-learn: \$(python3 -c "import sklearn; print(sklearn.__version__)")
END_VERSIONS
"""
}