Skip to content

Commit 8d40b36

Browse files
committed
[MODIF] add pairtools nf-core#162
1 parent 1ed8c3d commit 8d40b36

34 files changed

+1325
-42
lines changed

conf/modules.config

+33
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,39 @@ process {
174174
]
175175
}
176176

177+
//*******************************************
178+
// PAIRTOOLS
179+
180+
withName: 'BWA_MEM' {
181+
ext.args = '-5SP -T0'
182+
}
183+
184+
withName: 'PAIRTOOLS_PARSE' {
185+
ext.args = { "--min-mapq 40 --walks-policy 5unique --max-inter-align-gap 30 --output-stats ${meta.id}_parse.stats --add-columns mapq --drop-sam --drop-seq" }
186+
187+
}
188+
189+
withName: 'PAIRTOOLS_DEDUP' {
190+
ext.args = { "--mark-dups"} // --output-stats ${meta.id}_dedup.stats" }
191+
}
192+
193+
withName: 'PAIRTOOLS_SPLIT' {
194+
ext.args = params.save_interaction_bam ? "--output-sam ${prefix}.bam" : ''
195+
}
196+
197+
withName: 'PAIRTOOLS_SELECT' {
198+
ext.args = { [
199+
"(mapq1>${params.min_mapq} and mapq2>${params.min_mapq})",
200+
params.min_cis_dist > 0 ? " and (abs(pos1-pos2) < ${params.min_cis_dist})" : '',
201+
params.keep_multi ? " and ((pair_type=='UU') or (pair_type=='UR') or (pair_type=='RU') or (pair_type=='MM') or (pair_type=='MU'))" :
202+
" and ((pair_type=='UU') or (pair_type=='UR') or (pair_type=='RU'))",
203+
//params.min_insert_size > 0 ? " -s ${params.min_insert_size}" : '',
204+
//params.max_insert_size > 0 ? " -l ${params.max_insert_size}" : '',
205+
//params.min_restriction_fragment_size > 0 ? " -t ${params.min_restriction_fragment_size}" : '',
206+
//params.max_restriction_fragment_size > 0 ? " -m ${params.max_restriction_fragment_size}" : '',
207+
].join(' ').trim() }
208+
}
209+
177210
//*****************************************
178211
// QUALITY METRICS
179212

conf/test.config

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ params {
2424

2525
// Annotations
2626
fasta = 'https://github.com/nf-core/test-datasets/raw/hic/reference/W303_SGD_2015_JRIU00000000.fsa'
27+
//fasta = '/data/annotations/pipelines/Human/hg38/genome/hg38.fa'
28+
//bwa_index = '/data/annotations/pipelines/Human/hg38/indexes/bwamem2/'
2729
digestion = 'hindiii'
2830
min_mapq = 10
2931
min_restriction_fragment_size = 100

environment.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# You can use this file to create a conda environment for this pipeline:
2-
# conda env create -f environment.yml
2+
# conda env create2-f environment.yml
33
name: nf-core-hic-2.0.0
44
channels:
55
- conda-forge
@@ -16,7 +16,9 @@ dependencies:
1616
- bioconda::pysam=0.19.0=py39h5030a8b_0
1717
- conda-forge::pymdown-extensions=7.1=pyh9f0ad1d_0
1818
- bioconda::cooler=0.8.11=pyh5e36f6f_1
19-
- bioconda::cooltools=0.5.1=py39h5371cbf_1
19+
- bioconda::pairtools=1.0.2
20+
- bioconda::cooltools=0.5.1
21+
- bioconda::bwa-mem2=2.2.1
2022
- bioconda::bowtie2=2.4.5=py39hd2f7db1_2
2123
- bioconda::samtools=1.15.1=h1170115_0
2224
- bioconda::multiqc=1.12=pyhdfd78af_0

main.nf

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ nextflow.enable.dsl = 2
1919

2020
params.fasta = WorkflowMain.getGenomeAttribute(params, 'fasta')
2121
params.bwt2_index = WorkflowMain.getGenomeAttribute(params, 'bowtie2')
22+
params.bwa_index = WorkflowMain.getGenomeAttribute(params, 'bwamem2')
2223

2324
/*
2425
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

modules.json

+108-11
Original file line numberDiff line numberDiff line change
@@ -8,52 +8,149 @@
88
"bowtie2/align": {
99
"branch": "master",
1010
"git_sha": "603ecbd9f45300c9788f197d2a15a005685b4220",
11-
"installed_by": ["modules"]
11+
"installed_by": [
12+
"modules"
13+
]
1214
},
1315
"bowtie2/build": {
1416
"branch": "master",
1517
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
16-
"installed_by": ["modules"]
18+
"installed_by": [
19+
"modules"
20+
]
21+
},
22+
"bwa/index": {
23+
"branch": "master",
24+
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
25+
"installed_by": [
26+
"modules"
27+
]
28+
},
29+
"bwa/mem": {
30+
"branch": "master",
31+
"git_sha": "603ecbd9f45300c9788f197d2a15a005685b4220",
32+
"installed_by": [
33+
"modules"
34+
]
35+
},
36+
"bwamem2/index": {
37+
"branch": "master",
38+
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
39+
"installed_by": [
40+
"modules"
41+
]
42+
},
43+
"bwamem2/mem": {
44+
"branch": "master",
45+
"git_sha": "0460d316170f75f323111b4a2c0a2989f0c32013",
46+
"installed_by": [
47+
"modules"
48+
]
1749
},
1850
"cooler/balance": {
1951
"branch": "master",
2052
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
21-
"installed_by": ["modules"]
53+
"installed_by": [
54+
"modules"
55+
]
2256
},
2357
"cooler/cload": {
2458
"branch": "master",
2559
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
26-
"installed_by": ["modules"]
60+
"installed_by": [
61+
"modules"
62+
]
2763
},
2864
"cooler/dump": {
2965
"branch": "master",
3066
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
31-
"installed_by": ["modules"]
67+
"installed_by": [
68+
"modules"
69+
]
3270
},
3371
"cooler/makebins": {
3472
"branch": "master",
3573
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
36-
"installed_by": ["modules"]
74+
"installed_by": [
75+
"modules"
76+
]
3777
},
3878
"cooler/zoomify": {
3979
"branch": "master",
4080
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
41-
"installed_by": ["modules"]
81+
"installed_by": [
82+
"modules"
83+
]
4284
},
4385
"custom/dumpsoftwareversions": {
4486
"branch": "master",
4587
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
46-
"installed_by": ["modules"]
88+
"installed_by": [
89+
"modules"
90+
]
4791
},
4892
"custom/getchromsizes": {
4993
"branch": "master",
5094
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
51-
"installed_by": ["modules"]
95+
"installed_by": [
96+
"modules"
97+
]
5298
},
5399
"fastqc": {
54100
"branch": "master",
55101
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
56-
"installed_by": ["modules"]
102+
"installed_by": [
103+
"modules"
104+
]
105+
},
106+
"pairix": {
107+
"branch": "master",
108+
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
109+
"installed_by": [
110+
"modules"
111+
]
112+
},
113+
"pairtools/dedup": {
114+
"branch": "master",
115+
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
116+
"installed_by": [
117+
"modules"
118+
]
119+
},
120+
"pairtools/parse": {
121+
"branch": "master",
122+
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
123+
"installed_by": [
124+
"modules"
125+
]
126+
},
127+
"pairtools/restrict": {
128+
"branch": "master",
129+
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
130+
"installed_by": [
131+
"modules"
132+
]
133+
},
134+
"pairtools/select": {
135+
"branch": "master",
136+
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
137+
"installed_by": [
138+
"modules"
139+
]
140+
},
141+
"pairtools/sort": {
142+
"branch": "master",
143+
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
144+
"installed_by": [
145+
"modules"
146+
]
147+
},
148+
"samtools/index": {
149+
"branch": "master",
150+
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
151+
"installed_by": [
152+
"modules"
153+
]
57154
}
58155
}
59156
},
@@ -62,4 +159,4 @@
62159
}
63160
}
64161
}
65-
}
162+
}

modules/local/cooltools/insulation.nf

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ process COOLTOOLS_INSULATION {
2626
2727
cat <<-END_VERSIONS > versions.yml
2828
"${task.process}":
29-
cooltools: \$(cooltools --version 2>&1 | sed 's/cooltools, version //')
29+
cooltools: \$(cooltools --version 2>&1 | grep version | sed 's/cooltools, version //')
3030
END_VERSIONS
3131
"""
3232
}
+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Pairtools - merge
3+
* Merge multiple sorted pairs files
4+
*/
5+
6+
process PAIRTOOLS_MERGE {
7+
tag "${meta.id}"
8+
label 'process_medium'
9+
10+
11+
// Pinning numpy to 1.23 until https://github.com/open2c/pairtools/issues/170 is resolved
12+
// Not an issue with the biocontainers because they were built prior to numpy 1.24
13+
conda "bioconda::pairtools=1.0.2 conda-forge::numpy=1.23"
14+
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
15+
'https://depot.galaxyproject.org/singularity/pairtools:1.0.2--py39h2a9f597_0' :
16+
'biocontainers/pairtools:1.0.2--py39h2a9f597_0' }"
17+
18+
input:
19+
tuple val(meta), path(allpairs)
20+
21+
output:
22+
tuple val(meta), path("*pairs.gz"), emit:pairs
23+
path("versions.yml"), emit:versions
24+
25+
script:
26+
def args = task.ext.args ?: ''
27+
def prefix = task.ext.prefix ?: "${meta.id}_merged"
28+
"""
29+
pairtools merge \
30+
${args} \
31+
--nproc ${task.cpus} \
32+
-o ${prefix}.pairs.gz \
33+
${allpairs}
34+
35+
cat <<-END_VERSIONS > versions.yml
36+
"${task.process}":
37+
pairtools: \$(pairtools --version 2>&1 | sed 's/pairtools, version //')
38+
END_VERSIONS
39+
"""
40+
}
+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Pairtools - Split
3+
* Split a .pairsam file into .pairs and .sam
4+
*/
5+
6+
process PAIRTOOLS_SPLIT {
7+
tag "${meta.id}"
8+
label 'process_medium'
9+
10+
// Pinning numpy to 1.23 until https://github.com/open2c/pairtools/issues/170 is resolved
11+
// Not an issue with the biocontainers because they were built prior to numpy 1.24
12+
conda "bioconda::pairtools=1.0.2 conda-forge::numpy=1.23"
13+
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
14+
'https://depot.galaxyproject.org/singularity/pairtools:1.0.2--py39h2a9f597_0' :
15+
'biocontainers/pairtools:1.0.2--py39h2a9f597_0' }"
16+
17+
input:
18+
tuple val(meta), path(pairs)
19+
20+
output:
21+
tuple val(meta), path("*.split.pairs.gz"), emit:pairs
22+
tuple val(meta), path("*.bam"), optional:true, emit:bam
23+
tuple val(meta), path("*.txt"), optional: true, emit:stats
24+
path("versions.yml"), emit:versions
25+
26+
script:
27+
def args = task.ext.args ?: ''
28+
def prefix = task.ext.prefix ?: "${meta.id}"
29+
"""
30+
pairtools split \
31+
--nproc-in ${task.cpus} --nproc-out ${task.cpus} \
32+
--output-pairs ${prefix}.split.pairs.gz \
33+
${args} \
34+
${pairs}
35+
36+
cat <<-END_VERSIONS > versions.yml
37+
"${task.process}":
38+
pairtools: \$(pairtools --version 2>&1 | sed 's/pairtools, version //')
39+
END_VERSIONS
40+
"""
41+
}
+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Pairtools - Stats
3+
* Statistics on pairs file
4+
*/
5+
6+
process PAIRTOOLS_STATS {
7+
tag "${meta.id}"
8+
label 'process_low'
9+
10+
// Pinning numpy to 1.23 until https://github.com/open2c/pairtools/issues/170 is resolved
11+
// Not an issue with the biocontainers because they were built prior to numpy 1.24
12+
conda "bioconda::pairtools=1.0.2 conda-forge::numpy=1.23"
13+
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
14+
'https://depot.galaxyproject.org/singularity/pairtools:1.0.2--py39h2a9f597_0' :
15+
'biocontainers/pairtools:1.0.2--py39h2a9f597_0' }"
16+
17+
input:
18+
tuple val(meta), path(pairs)
19+
20+
output:
21+
tuple val(meta), path("*txt"), emit:stats
22+
path("versions.yml"), emit:versions
23+
24+
script:
25+
def args = task.ext.args ?: ''
26+
def prefix = task.ext.prefix ?: "${meta.id}_stats"
27+
"""
28+
pairtools stats \
29+
${args} \
30+
--nproc-in ${task.cpus} --nproc-out ${task.cpus} \
31+
-o ${prefix}.txt \
32+
${pairs}
33+
34+
cat <<-END_VERSIONS > versions.yml
35+
"${task.process}":
36+
pairtools: \$(pairtools --version 2>&1 | sed 's/pairtools, version //')
37+
END_VERSIONS
38+
"""
39+
}

0 commit comments

Comments
 (0)