-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.nf
More file actions
83 lines (70 loc) · 2.48 KB
/
Copy pathmain.nf
File metadata and controls
83 lines (70 loc) · 2.48 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
process NOVEL_PEPTIDES {
tag "$meta.id"
label 'process_medium'
conda "${moduleDir}/environment.yml"
container "docker://docker.io/jtllab/lrp2-lite:latest"
input:
tuple val(meta), val(fragpipe_results_dir)
path novel_peptides_script
path lr_cds_gtf
path lr_orf_fasta
val gencode_version
output:
tuple val(meta), path("*_novel_peptides.tsv"), emit: novel_peptides
path "versions.yml", emit: versions
when:
task.ext.when == null || task.ext.when
script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def ms_search_software = meta.protein_search ?: 'fragpipe'
def acquisition_type = meta.mass_spec_type ?: 'DDA'
"""
echo "NOVEL PEPTIDES CLASSIFICATION: ${meta.id}"
echo "Sample: ${prefix}"
echo "Search software: ${ms_search_software}"
echo "Acquisition type: ${acquisition_type}"
echo "LR CDS GTF: ${lr_cds_gtf}"
echo "LR ORF FASTA: ${lr_orf_fasta}"
echo "FragPipe results directory: ${fragpipe_results_dir}"
echo ""
if [ ! -d "${fragpipe_results_dir}" ]; then
echo "ERROR: FragPipe results directory not found: ${fragpipe_results_dir}"
echo "Please check that FragPipe completed successfully."
exit 1
fi
Rscript ${novel_peptides_script} \\
--sample_name ${prefix} \\
--ms_search_software ${ms_search_software} \\
--acquisition_type ${acquisition_type} \\
--fragpipe_results_dir ${fragpipe_results_dir} \\
--lr_cds_gtf ${lr_cds_gtf} \\
--lr_orf_fasta ${lr_orf_fasta} \\
--gencode_version ${gencode_version} \\
--outdir . \\
$args
if [ ! -f "${prefix}_novel_peptides.tsv" ]; then
echo "ERROR: Novel peptides output file not created"
exit 1
fi
echo ""
echo "Novel peptides classification completed successfully!"
echo "Output: ${prefix}_novel_peptides.tsv"
echo ""
cat <<-END_VERSIONS > versions.yml
"${task.process}":
r-base: \$(R --version 2>/dev/null | grep "R version" | sed 's/.*R version //g' | sed 's/ .*//g' || echo "unknown")
r-tidyverse: \$(Rscript -e "cat(as.character(packageVersion('tidyverse')))" 2>/dev/null || echo "unknown")
END_VERSIONS
"""
stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}_novel_peptides.tsv
cat <<-END_VERSIONS > versions.yml
"${task.process}":
r-base: 4.5.0
r-tidyverse: 2.0.0
END_VERSIONS
"""
}