Skip to content

Commit

Permalink
[MODIF] add pairtools nf-core#162
Browse files Browse the repository at this point in the history
  • Loading branch information
nservant committed Jun 15, 2023
1 parent 1ed8c3d commit 8d40b36
Show file tree
Hide file tree
Showing 34 changed files with 1,325 additions and 42 deletions.
33 changes: 33 additions & 0 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,39 @@ process {
]
}

//*******************************************
// PAIRTOOLS

withName: 'BWA_MEM' {
ext.args = '-5SP -T0'
}

withName: 'PAIRTOOLS_PARSE' {
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" }

}

withName: 'PAIRTOOLS_DEDUP' {
ext.args = { "--mark-dups"} // --output-stats ${meta.id}_dedup.stats" }
}

withName: 'PAIRTOOLS_SPLIT' {
ext.args = params.save_interaction_bam ? "--output-sam ${prefix}.bam" : ''
}

withName: 'PAIRTOOLS_SELECT' {
ext.args = { [
"(mapq1>${params.min_mapq} and mapq2>${params.min_mapq})",
params.min_cis_dist > 0 ? " and (abs(pos1-pos2) < ${params.min_cis_dist})" : '',
params.keep_multi ? " and ((pair_type=='UU') or (pair_type=='UR') or (pair_type=='RU') or (pair_type=='MM') or (pair_type=='MU'))" :
" and ((pair_type=='UU') or (pair_type=='UR') or (pair_type=='RU'))",
//params.min_insert_size > 0 ? " -s ${params.min_insert_size}" : '',
//params.max_insert_size > 0 ? " -l ${params.max_insert_size}" : '',
//params.min_restriction_fragment_size > 0 ? " -t ${params.min_restriction_fragment_size}" : '',
//params.max_restriction_fragment_size > 0 ? " -m ${params.max_restriction_fragment_size}" : '',
].join(' ').trim() }
}

//*****************************************
// QUALITY METRICS

Expand Down
2 changes: 2 additions & 0 deletions conf/test.config
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ params {

// Annotations
fasta = 'https://github.com/nf-core/test-datasets/raw/hic/reference/W303_SGD_2015_JRIU00000000.fsa'
//fasta = '/data/annotations/pipelines/Human/hg38/genome/hg38.fa'
//bwa_index = '/data/annotations/pipelines/Human/hg38/indexes/bwamem2/'
digestion = 'hindiii'
min_mapq = 10
min_restriction_fragment_size = 100
Expand Down
6 changes: 4 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# You can use this file to create a conda environment for this pipeline:
# conda env create -f environment.yml
# conda env create2-f environment.yml
name: nf-core-hic-2.0.0
channels:
- conda-forge
Expand All @@ -16,7 +16,9 @@ dependencies:
- bioconda::pysam=0.19.0=py39h5030a8b_0
- conda-forge::pymdown-extensions=7.1=pyh9f0ad1d_0
- bioconda::cooler=0.8.11=pyh5e36f6f_1
- bioconda::cooltools=0.5.1=py39h5371cbf_1
- bioconda::pairtools=1.0.2
- bioconda::cooltools=0.5.1
- bioconda::bwa-mem2=2.2.1
- bioconda::bowtie2=2.4.5=py39hd2f7db1_2
- bioconda::samtools=1.15.1=h1170115_0
- bioconda::multiqc=1.12=pyhdfd78af_0
Expand Down
1 change: 1 addition & 0 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ nextflow.enable.dsl = 2

params.fasta = WorkflowMain.getGenomeAttribute(params, 'fasta')
params.bwt2_index = WorkflowMain.getGenomeAttribute(params, 'bowtie2')
params.bwa_index = WorkflowMain.getGenomeAttribute(params, 'bwamem2')

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
119 changes: 108 additions & 11 deletions modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,52 +8,149 @@
"bowtie2/align": {
"branch": "master",
"git_sha": "603ecbd9f45300c9788f197d2a15a005685b4220",
"installed_by": ["modules"]
"installed_by": [
"modules"
]
},
"bowtie2/build": {
"branch": "master",
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
"installed_by": ["modules"]
"installed_by": [
"modules"
]
},
"bwa/index": {
"branch": "master",
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
"installed_by": [
"modules"
]
},
"bwa/mem": {
"branch": "master",
"git_sha": "603ecbd9f45300c9788f197d2a15a005685b4220",
"installed_by": [
"modules"
]
},
"bwamem2/index": {
"branch": "master",
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
"installed_by": [
"modules"
]
},
"bwamem2/mem": {
"branch": "master",
"git_sha": "0460d316170f75f323111b4a2c0a2989f0c32013",
"installed_by": [
"modules"
]
},
"cooler/balance": {
"branch": "master",
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
"installed_by": ["modules"]
"installed_by": [
"modules"
]
},
"cooler/cload": {
"branch": "master",
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
"installed_by": ["modules"]
"installed_by": [
"modules"
]
},
"cooler/dump": {
"branch": "master",
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
"installed_by": ["modules"]
"installed_by": [
"modules"
]
},
"cooler/makebins": {
"branch": "master",
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
"installed_by": ["modules"]
"installed_by": [
"modules"
]
},
"cooler/zoomify": {
"branch": "master",
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
"installed_by": ["modules"]
"installed_by": [
"modules"
]
},
"custom/dumpsoftwareversions": {
"branch": "master",
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
"installed_by": ["modules"]
"installed_by": [
"modules"
]
},
"custom/getchromsizes": {
"branch": "master",
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
"installed_by": ["modules"]
"installed_by": [
"modules"
]
},
"fastqc": {
"branch": "master",
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
"installed_by": ["modules"]
"installed_by": [
"modules"
]
},
"pairix": {
"branch": "master",
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
"installed_by": [
"modules"
]
},
"pairtools/dedup": {
"branch": "master",
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
"installed_by": [
"modules"
]
},
"pairtools/parse": {
"branch": "master",
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
"installed_by": [
"modules"
]
},
"pairtools/restrict": {
"branch": "master",
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
"installed_by": [
"modules"
]
},
"pairtools/select": {
"branch": "master",
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
"installed_by": [
"modules"
]
},
"pairtools/sort": {
"branch": "master",
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
"installed_by": [
"modules"
]
},
"samtools/index": {
"branch": "master",
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
"installed_by": [
"modules"
]
}
}
},
Expand All @@ -62,4 +159,4 @@
}
}
}
}
}
2 changes: 1 addition & 1 deletion modules/local/cooltools/insulation.nf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ process COOLTOOLS_INSULATION {
cat <<-END_VERSIONS > versions.yml
"${task.process}":
cooltools: \$(cooltools --version 2>&1 | sed 's/cooltools, version //')
cooltools: \$(cooltools --version 2>&1 | grep version | sed 's/cooltools, version //')
END_VERSIONS
"""
}
40 changes: 40 additions & 0 deletions modules/local/pairtools/pairtools_merge.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Pairtools - merge
* Merge multiple sorted pairs files
*/

process PAIRTOOLS_MERGE {
tag "${meta.id}"
label 'process_medium'


// Pinning numpy to 1.23 until https://github.com/open2c/pairtools/issues/170 is resolved
// Not an issue with the biocontainers because they were built prior to numpy 1.24
conda "bioconda::pairtools=1.0.2 conda-forge::numpy=1.23"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/pairtools:1.0.2--py39h2a9f597_0' :
'biocontainers/pairtools:1.0.2--py39h2a9f597_0' }"

input:
tuple val(meta), path(allpairs)

output:
tuple val(meta), path("*pairs.gz"), emit:pairs
path("versions.yml"), emit:versions

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}_merged"
"""
pairtools merge \
${args} \
--nproc ${task.cpus} \
-o ${prefix}.pairs.gz \
${allpairs}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
pairtools: \$(pairtools --version 2>&1 | sed 's/pairtools, version //')
END_VERSIONS
"""
}
41 changes: 41 additions & 0 deletions modules/local/pairtools/pairtools_split.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Pairtools - Split
* Split a .pairsam file into .pairs and .sam
*/

process PAIRTOOLS_SPLIT {
tag "${meta.id}"
label 'process_medium'

// Pinning numpy to 1.23 until https://github.com/open2c/pairtools/issues/170 is resolved
// Not an issue with the biocontainers because they were built prior to numpy 1.24
conda "bioconda::pairtools=1.0.2 conda-forge::numpy=1.23"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/pairtools:1.0.2--py39h2a9f597_0' :
'biocontainers/pairtools:1.0.2--py39h2a9f597_0' }"

input:
tuple val(meta), path(pairs)

output:
tuple val(meta), path("*.split.pairs.gz"), emit:pairs
tuple val(meta), path("*.bam"), optional:true, emit:bam
tuple val(meta), path("*.txt"), optional: true, emit:stats
path("versions.yml"), emit:versions

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
"""
pairtools split \
--nproc-in ${task.cpus} --nproc-out ${task.cpus} \
--output-pairs ${prefix}.split.pairs.gz \
${args} \
${pairs}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
pairtools: \$(pairtools --version 2>&1 | sed 's/pairtools, version //')
END_VERSIONS
"""
}
39 changes: 39 additions & 0 deletions modules/local/pairtools/pairtools_stats.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Pairtools - Stats
* Statistics on pairs file
*/

process PAIRTOOLS_STATS {
tag "${meta.id}"
label 'process_low'

// Pinning numpy to 1.23 until https://github.com/open2c/pairtools/issues/170 is resolved
// Not an issue with the biocontainers because they were built prior to numpy 1.24
conda "bioconda::pairtools=1.0.2 conda-forge::numpy=1.23"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/pairtools:1.0.2--py39h2a9f597_0' :
'biocontainers/pairtools:1.0.2--py39h2a9f597_0' }"

input:
tuple val(meta), path(pairs)

output:
tuple val(meta), path("*txt"), emit:stats
path("versions.yml"), emit:versions

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}_stats"
"""
pairtools stats \
${args} \
--nproc-in ${task.cpus} --nproc-out ${task.cpus} \
-o ${prefix}.txt \
${pairs}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
pairtools: \$(pairtools --version 2>&1 | sed 's/pairtools, version //')
END_VERSIONS
"""
}
Loading

0 comments on commit 8d40b36

Please sign in to comment.