-
Notifications
You must be signed in to change notification settings - Fork 7
/
prepare_genome.nf
executable file
·92 lines (71 loc) · 1.81 KB
/
prepare_genome.nf
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
84
85
86
87
88
89
90
91
92
#!/usr/bin/env nextflow
// Enable syntax extension
// See https://www.nextflow.io/docs/latest/dsl2.html
nextflow.enable.dsl=2
/*
* Index the new reference genome using bowtie_build
*/
process bowtieGenomeIndex {
label 'med_time'
// Memory required is 10 times the size of the fasta in Bytes or at least 1GB
// Overwrite base_memory so that the standard retry strategy is used
ext base_memory: { Math.max(file(params.newgenome).size() * 10, 1073741824) }
input:
path "genome_fasta"
output:
path "bowtie_index.*.bt2", emit: bowtie_indexes
"""
bowtie2-build genome_fasta bowtie_index
"""
}
process samtoolsFaidx {
label 'med_time', 'med_mem'
input:
path "genome_basename"
output:
path "genome_basename.fai", emit: genome_fai
"""
samtools faidx genome_basename
"""
}
/*
* Extract chomosome/contig sizes
*/
process chromSizes {
label 'short_time', 'small_mem'
input:
path "genome.fa.fai"
output:
path "genome.fa.chrom.sizes", emit: genome_chrom_sizes
"""
cut -f1,2 genome.fa.fai > genome.fa.chrom.sizes
"""
}
workflow prepare_old_genome {
take:
genome
main:
samtoolsFaidx(genome)
chromSizes(samtoolsFaidx.out.genome_fai)
emit:
genome_fai = samtoolsFaidx.out.genome_fai
genome_chrom_sizes = chromSizes.out.genome_chrom_sizes
}
workflow prepare_new_genome {
take:
genome
main:
samtoolsFaidx(genome)
emit:
genome_fai = samtoolsFaidx.out.genome_fai
}
workflow prepare_new_genome_bowtie {
take:
genome
main:
samtoolsFaidx(genome)
bowtieGenomeIndex(genome)
emit:
genome_fai = samtoolsFaidx.out.genome_fai
bowtie_indexes = bowtieGenomeIndex.out.bowtie_indexes
}