Skip to content

Commit 4cf8376

Browse files
committed
Update Minor things
1 parent 115eb41 commit 4cf8376

File tree

2 files changed

+0
-257
lines changed
  • modules/local/pretext/graph
  • subworkflows/local/telo_finder

2 files changed

+0
-257
lines changed
Lines changed: 0 additions & 160 deletions
Original file line numberDiff line numberDiff line change
@@ -1,160 +0,0 @@
1-
process PRETEXT_GRAPH {
2-
tag "$meta.id"
3-
label 'process_single'
4-
5-
container "quay.io/sanger-tol/pretext:0.0.9-yy5-c2"
6-
7-
input:
8-
tuple val(meta), path(pretext_file)
9-
path(gap_file, stageAs: 'gap_file.bed')
10-
path(coverage, stageAs: 'coverage.bw')
11-
path(telomere_file, stageAs: 'telomere/*')
12-
path(repeat_density, stageAs: 'repeat_density.bw')
13-
val (split_telo_bool)
14-
15-
output:
16-
tuple val(meta), path("*.pretext") , emit: pretext
17-
path "versions.yml" , emit: versions
18-
19-
when:
20-
task.ext.when == null || task.ext.when
21-
22-
script:
23-
// Exit if running this module with -profile conda / -profile mamba
24-
if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) {
25-
error "PRETEXT GRAPH module does not _currently_ support Conda. Please use Docker / Singularity instead."
26-
}
27-
28-
def args = task.ext.args ?: ''
29-
def prefix = task.ext.prefix ?: "${meta.id}"
30-
def UCSC_VERSION = '447' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions.
31-
32-
// Using single [ ] as nextflow will use sh where possible not bash
33-
34-
// Duplicate the telo chunk for the 5' and 3' and then another telox
35-
"""
36-
shopt -s nullglob
37-
38-
echo "PROCESSING ESSENTIAL FILES"
39-
40-
if [ -s "${coverage}" ]; then
41-
echo "PROCESSING COVERAGE..."
42-
bigWigToBedGraph ${coverage} /dev/stdout | PretextGraph ${args} -i ${pretext_file} -n "coverage" -o coverage.pretext.part
43-
else
44-
echo "SKIPPING COVERAGE"
45-
mv ${pretext_file} coverage.pretext.part
46-
fi
47-
48-
if [ -s "${repeat_density}" ]; then
49-
echo "PROCESSING REPEAT_DENSITY..."
50-
bigWigToBedGraph ${repeat_density} /dev/stdout | PretextGraph ${args} -i coverage.pretext.part -n "repeat_density" -o repeat.pretext.part
51-
else
52-
echo "SKIPPING REPEAT_DENSITY"
53-
mv coverage.pretext.part repeat.pretext.part
54-
fi
55-
56-
echo "NOW PROCESSING NON-ESSENTIAL files"
57-
58-
input_file="repeat.pretext.part"
59-
60-
if [ -s "${gap_file}" ]; then
61-
echo "Processing GAP file..."
62-
cat "${gap_file}" | PretextGraph ${args} -i repeat.pretext.part -n "gap" -o gap.pretext.part
63-
input_file="gap.pretext.part"
64-
fi
65-
66-
mkdir -p telomere/
67-
if [ -n "\$(ls -A telomere/ 2>/dev/null)" ]; then
68-
FILES=(telomere/*.bedgraph);
69-
70-
echo "Found /telomere/ has contents:"
71-
72-
file_telox=""
73-
file_5p=""
74-
file_3p=""
75-
file_og=""
76-
77-
for file in telomere/*.bedgraph; do
78-
[ -e "\$file" ] || continue # skip if no match
79-
fname=\$(basename "\$file")
80-
81-
case "\$fname" in
82-
*telox*)
83-
echo "Found TELOX: \$file"
84-
file_telox="\$file"
85-
;;
86-
*5P*)
87-
echo "Found 5P: \$file"
88-
file_5p="\$file"
89-
;;
90-
*3P*)
91-
echo "Found 3P: \$file"
92-
file_3p="\$file"
93-
;;
94-
*)
95-
echo "Found OG: \$file"
96-
file_og="\$file"
97-
;;
98-
esac
99-
done
100-
101-
if [ -s "\$file_og" ]; then
102-
echo "Processing OG_TELOMERE file..."
103-
cat "\$file_og" | PretextGraph ${args} -i "\$input_file" -n "og_telomere" -o telo_0.pretext
104-
else
105-
mv "\$input_file" telo_0.pretext
106-
fi
107-
108-
if [ -s "\$file_telox" ]; then
109-
echo "Processing TELOX_TELOMERE file..."
110-
cat "\$file_telox}" | PretextGraph ${args} -i telo_0.pretext -n "telox_telomere" -o telo_1.pretext
111-
else
112-
mv telo_0.pretext telo_1.pretext
113-
fi
114-
115-
if [ -s "\$file_5p" ]; then
116-
echo "Processing 5 Prime TELOMERE file..."
117-
cat "\$file_5p" | PretextGraph ${args} -i telo_1.pretext -n "5p_telomere" -o telo_2.pretext
118-
else
119-
mv telo_1.pretext telo_2.pretext
120-
fi
121-
122-
if [ -s "\$file_3p" ]; then
123-
echo "Processing 3 Prime TELOMERE file..."
124-
cat "\$file_3p" | PretextGraph ${args} -i telo_2.pretext -n "3p_telomere" -o "${prefix}.pretext"
125-
else
126-
mv telo_2.pretext "${prefix}.pretext"
127-
fi
128-
129-
else
130-
mv "\$input_file" "${prefix}.pretext"
131-
fi
132-
133-
134-
cat <<-END_VERSIONS > versions.yml
135-
"${task.process}":
136-
PretextGraph: \$(PretextGraph | grep "Version" | sed 's/Pretext.* Version //;')
137-
PretextMap: \$(PretextMap | grep "Version" | sed 's/Pretext.* Version//;')
138-
bigWigToBedGraph: ${UCSC_VERSION}
139-
END_VERSIONS
140-
"""
141-
142-
stub:
143-
// Exit if running this module with -profile conda / -profile mamba
144-
if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) {
145-
error "PRETEXT GRAPH module does not _currently_ support Conda. Please use Docker / Singularity instead."
146-
}
147-
148-
def prefix = task.ext.prefix ?: "${meta.id}"
149-
def UCSC_VERSION = '448' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions.
150-
"""
151-
touch ${prefix}.pretext
152-
153-
cat <<-END_VERSIONS > versions.yml
154-
"${task.process}":
155-
PretextGraph: \$(PretextGraph | grep "Version" | sed 's/Pretext* Version //;')
156-
PretextMap: \$(PretextMap | grep "Version" | sed 's/PretextMap Version//;')
157-
bigWigToBedGraph: ${UCSC_VERSION}
158-
END_VERSIONS
159-
"""
160-
}
Lines changed: 0 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,97 +0,0 @@
1-
#!/usr/bin/env nextflow
2-
3-
//
4-
// MODULE IMPORT BLOCK
5-
//
6-
include { GAWK as GAWK_UPPER_SEQUENCE } from '../../../modules/nf-core/gawk/main'
7-
include { FIND_TELOMERE_REGIONS } from '../../../modules/local/find/telomere_regions/main'
8-
include { GAWK as GAWK_SPLIT_DIRECTIONS } from '../../../modules/local/gawk/main'
9-
10-
include { TELO_EXTRACTION } from '../../../subworkflows/local/telo_extraction/main'
11-
12-
workflow TELO_FINDER {
13-
14-
take:
15-
reference_tuple // Channel: tuple [ val(meta), path(fasta) ]
16-
teloseq
17-
18-
main:
19-
ch_versions = Channel.empty()
20-
21-
//
22-
// MODULE: UPPERCASE THE REFERENCE SEQUENCE
23-
//
24-
GAWK_UPPER_SEQUENCE(
25-
reference_tuple,
26-
[],
27-
false,
28-
)
29-
ch_versions = ch_versions.mix( GAWK_UPPER_SEQUENCE.out.versions )
30-
31-
//
32-
// MODULE: FINDS THE TELOMERIC SEQEUNCE IN REFERENCE
33-
//
34-
FIND_TELOMERE_REGIONS (
35-
GAWK_UPPER_SEQUENCE.out.output,
36-
teloseq
37-
)
38-
ch_versions = ch_versions.mix( FIND_TELOMERE_REGIONS.out.versions )
39-
40-
41-
//
42-
// MODULE: SPLIT THE TELOMERE FILE INTO 5' and 3' FILES
43-
// THIS IS RUNNING ON A LOCAL VERSION OF THE GAWK MODULE
44-
//
45-
if (params.split_telomere) {
46-
GAWK_SPLIT_DIRECTIONS (
47-
FIND_TELOMERE_REGIONS.out.telomere,
48-
file("${projectDir}/bin/gawk_split_directions.awk"),
49-
false
50-
)
51-
ch_versions = ch_versions.mix( GAWK_SPLIT_DIRECTIONS.out.versions )
52-
53-
GAWK_SPLIT_DIRECTIONS.out.prime5
54-
.map { meta, file ->
55-
tuple( [id: meta.id + "5P" + prime], file)
56-
}
57-
.set { prime5_telo }
58-
59-
GAWK_SPLIT_DIRECTIONS.out.prime3
60-
.map { meta, file ->
61-
tuple( [id: meta.id + "3P" + prime], file)
62-
}
63-
.set { prime3_telo }
64-
65-
prime5_telo
66-
.mix(prime3_telo)
67-
.mix(FIND_TELOMERE_REGIONS.out.telomere)
68-
.set { telo_for_extraction }
69-
70-
} else {
71-
telo_for_extraction = FIND_TELOMERE_REGIONS.out.telomere
72-
}
73-
74-
75-
//
76-
// SUBWORKFLOW: TELO_EXTRACTION
77-
// - The prime5.mix(prime3) creates a queue channel to execute
78-
// TELO_EXTRACTION per item in channel
79-
//
80-
TELO_EXTRACTION (
81-
telo_for_extraction
82-
)
83-
ch_versions = ch_versions.mix( TELO_EXTRACTION.out.versions )
84-
85-
TELO_EXTRACTION.out.bedgraph_file
86-
.map{ _meta, bedgraph ->
87-
bedgraph
88-
}
89-
.collect()
90-
.set { telo_bedgraphs }
91-
92-
emit:
93-
bed_file = TELO_EXTRACTION.out.bed_file.collect() // Not used anymore
94-
bed_gz_tbi = TELO_EXTRACTION.out.bed_gz_tbi.collect() // Not used anymore
95-
bedgraph_file = telo_bedgraphs // Used in pretext_graph
96-
versions = ch_versions
97-
}

0 commit comments

Comments
 (0)