-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from charles-plessy/compareMasks
Compare and combine masked regions
- Loading branch information
Showing
4 changed files
with
152 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
process BEDTOOLS_CUSTOM { | ||
tag "$meta.id" | ||
label 'process_single' | ||
|
||
conda "${moduleDir}/environment.yml" | ||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? | ||
'https://depot.galaxyproject.org/singularity/bedtools:2.31.1--hf5e1c6e_0' : | ||
'biocontainers/bedtools:2.31.1--hf5e1c6e_0' }" | ||
|
||
input: | ||
tuple val(meta), path(genome), path(tantan), path(windowmasker), path(repeatmasker) | ||
|
||
output: | ||
tuple val(meta), path("*.fasta.gz") , emit: fasta | ||
tuple val(meta), path("*_jaccard.txt") , emit: txt | ||
tuple val(meta), path("*.bed.gz") , emit: bed_gz | ||
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}" | ||
""" | ||
bedtools jaccard -nonamecheck -a $tantan -b $windowmasker > ${prefix}_tantan_windowmasker_jaccard.txt | ||
bedtools jaccard -nonamecheck -a $tantan -b $repeatmasker > ${prefix}_tantan_repeatmasker_jaccard.txt | ||
bedtools jaccard -nonamecheck -a $repeatmasker -b $windowmasker > ${prefix}_repeatmasker_windowmasker_jaccard.txt | ||
zcat $tantan $windowmasker | sort -k1,1 -k2,2n | bedtools merge | gzip --best > ${prefix}_tantan_windowmasker.bed.gz | ||
zcat $tantan $repeatmasker | sort -k1,1 -k2,2n | bedtools merge | gzip --best > ${prefix}_tantan_repeatmasker.bed.gz | ||
zcat $windowmasker $repeatmasker | sort -k1,1 -k2,2n | bedtools merge | gzip --best > ${prefix}_windowmasker_repeatmasker.bed.gz | ||
zcat $tantan $windowmasker $repeatmasker | sort -k1,1 -k2,2n | bedtools merge | gzip --best > ${prefix}_allmaskers.bed.gz | ||
bedtools \\ | ||
maskfasta \\ | ||
-soft \\ | ||
-fi $genome \\ | ||
-bed ${prefix}_allmaskers.bed.gz \\ | ||
-fo /dev/stdout | | ||
gzip --best > ${prefix}_allmaskers.fasta.gz | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
bedtools: \$(bedtools --version | sed -e "s/bedtools v//g") | ||
END_VERSIONS | ||
""" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
process SEQTK_CUTN { | ||
tag "$meta.id" | ||
label 'process_low' | ||
|
||
conda "${moduleDir}/environment.yml" | ||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? | ||
'https://depot.galaxyproject.org/singularity/seqtk:1.4--he4a0461_1' : | ||
'biocontainers/seqtk:1.4--he4a0461_1' }" | ||
|
||
input: | ||
tuple val(meta), path(fasta) | ||
|
||
output: | ||
tuple val(meta), path("*.bed.gz") , emit: bed_gz | ||
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}" | ||
|
||
""" | ||
# Produces a compressed BED-3 file with the coordinates of soft-masked regions. | ||
awk '/^>/ {print; next} {gsub(/[acgt]/, "N"); print}' $fasta | | ||
seqtk cutN -gn 1 - | | ||
sort -k1,1 -k2,2n | gzip --best > ${prefix}.mask.bed.gz | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
seqtk: \$(echo \$(seqtk 2>&1) | sed 's/^.*Version: //; s/ .*\$//') | ||
END_VERSIONS | ||
""" | ||
|
||
stub: | ||
def prefix = task.ext.prefix ?: "${meta.id}" | ||
|
||
""" | ||
touch ${prefix}.mask.bed | ||
gzip --best ${prefix}.mask.bed | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
seqtk: \$(echo \$(seqtk 2>&1) | sed 's/^.*Version: //; s/ .*\$//') | ||
END_VERSIONS | ||
""" | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters