Skip to content

Commit

Permalink
feat: added bamtobed wrapper (#531)
Browse files Browse the repository at this point in the history
* Added bamtobed wrapper

* Updated version in other wrappers

* improve envs

Co-authored-by: Johannes Köster <johannes.koester@uni-due.de>
  • Loading branch information
fgvieira and johanneskoester committed Aug 16, 2022
1 parent 2eb3fdd commit 0486745
Show file tree
Hide file tree
Showing 20 changed files with 83 additions and 23 deletions.
6 changes: 6 additions & 0 deletions bio/bedtools/bamtobed/environment.yaml
@@ -0,0 +1,6 @@
channels:
- conda-forge
- bioconda
- nodefaults
dependencies:
- bedtools =2.30
12 changes: 12 additions & 0 deletions bio/bedtools/bamtobed/meta.yaml
@@ -0,0 +1,12 @@
name: bamToBed
description: >
Conversion utility that converts sequence alignments in BAM format into BED, BED12, and/or BEDPE records.
url: https://bedtools.readthedocs.io/en/latest/content/tools/bamtobed.html
authors:
- Filipe G. Vieira
input:
- BAM file
output:
- BED file
notes: |
* The `extra` param allows for additional program arguments.
11 changes: 11 additions & 0 deletions bio/bedtools/bamtobed/test/Snakefile
@@ -0,0 +1,11 @@
rule bamtobed:
input:
"{sample}.bam",
output:
"{sample}.bed",
log:
"logs/bamtobed/{sample}.log",
params:
extra="-bedpe", # optional parameters
wrapper:
"master/bio/bedtools/bamtobed"
Binary file added bio/bedtools/bamtobed/test/a.bam
Binary file not shown.
19 changes: 19 additions & 0 deletions bio/bedtools/bamtobed/wrapper.py
@@ -0,0 +1,19 @@
__author__ = "Filipe G. Vieira"
__copyright__ = "Copyright 2022, Filipe G. Vieira"
__license__ = "MIT"


from snakemake.shell import shell


log = snakemake.log_fmt_shell(stdout=False, stderr=True)
extra = snakemake.params.get("extra", "")


shell(
"(bamToBed"
" {extra}"
" -i {snakemake.input[0]}"
" > {snakemake.output[0]}"
") {log}"
)
2 changes: 1 addition & 1 deletion bio/bedtools/complement/environment.yaml
Expand Up @@ -3,4 +3,4 @@ channels:
- bioconda
- nodefaults
dependencies:
- bedtools =2.29
- bedtools =2.30
7 changes: 4 additions & 3 deletions bio/bedtools/complement/meta.yaml
@@ -1,10 +1,11 @@
name: bedtools complement
name: complementBed
description: >
`Bedtools complement <https://bedtools.readthedocs.io/en/latest/content/tools/complement.html>`_ maps all regions of the genome which are not covered by the input.
Maps all regions of the genome which are not covered by the input.
url: https://bedtools.readthedocs.io/en/latest/content/tools/complement.html
authors:
- Antonie Vietor
input:
- BED/GFF/VCF files
- genome file (`genome file format <https://bedtools.readthedocs.io/en/latest/content/general-usage.html#genome-file-format>`_)
- genome file
output:
- complemented BED/GFF/VCF file
2 changes: 1 addition & 1 deletion bio/bedtools/coveragebed/environment.yaml
Expand Up @@ -3,4 +3,4 @@ channels:
- bioconda
- nodefaults
dependencies:
- bedtools ==2.29.0
- bedtools =2.30
6 changes: 3 additions & 3 deletions bio/bedtools/coveragebed/meta.yaml
@@ -1,6 +1,6 @@
name: "coverageBed"
name: coverageBed
description:
Returns the depth and breadth of coverage of features from B
on the intervals in A.
Returns the depth and breadth of coverage of features from B on the intervals in A.
url: https://bedtools.readthedocs.io/en/latest/content/tools/coverage.html
authors:
- Patrik Smeds
2 changes: 1 addition & 1 deletion bio/bedtools/genomecov/environment.yaml
Expand Up @@ -3,4 +3,4 @@ channels:
- bioconda
- nodefaults
dependencies:
- bedtools ==2.29.2
- bedtools =2.30
7 changes: 3 additions & 4 deletions bio/bedtools/genomecov/meta.yaml
@@ -1,8 +1,7 @@
name: bedtools genomeCoverageBed
name: genomeCoverageBed
description: >
``bedtools``'s genomeCoverageBed computes the coverage of a feature file as histograms, per-base reports or BEDGRAPH summaries among a given genome.
For usage information about genomeCoverageBed, please see ``bedtools``'s `documentation <https://bedtools.readthedocs.io/en/latest/content/tools/genomecov.html>`_.
For more information about ``bedtools``, also see the `source code <https://github.com/arq5x/bedtools2>`_.
Computes the coverage of a feature file as histograms, per-base reports or BEDGRAPH summaries among a given genome.
url: https://bedtools.readthedocs.io/en/latest/content/tools/genomecov.html
authors:
- Antonie Vietor
input:
Expand Down
2 changes: 1 addition & 1 deletion bio/bedtools/intersect/environment.yaml
Expand Up @@ -3,4 +3,4 @@ channels:
- bioconda
- nodefaults
dependencies:
- bedtools =2.29.0
- bedtools =2.30
3 changes: 2 additions & 1 deletion bio/bedtools/intersect/meta.yaml
@@ -1,4 +1,5 @@
name: "bedtools intersect"
name: intersectBed
description: Intersect BED/BAM/VCF files with bedtools.
url: https://bedtools.readthedocs.io/en/latest/content/tools/intersect.html
authors:
- Jan Forster
2 changes: 1 addition & 1 deletion bio/bedtools/merge/environment.yaml
Expand Up @@ -3,4 +3,4 @@ channels:
- bioconda
- nodefaults
dependencies:
- bedtools =2.29.0
- bedtools =2.30
3 changes: 2 additions & 1 deletion bio/bedtools/merge/meta.yaml
@@ -1,4 +1,5 @@
name: "bedtools merge"
name: mergeBed
description: Merge entries in one or multiple BED/BAM/VCF/GFF files with bedtools.
url: https://bedtools.readthedocs.io/en/latest/content/tools/merge.html
authors:
- Jan Forster
2 changes: 1 addition & 1 deletion bio/bedtools/slop/environment.yaml
Expand Up @@ -3,4 +3,4 @@ channels:
- bioconda
- nodefaults
dependencies:
- bedtools =2.29.0
- bedtools =2.30
3 changes: 2 additions & 1 deletion bio/bedtools/slop/meta.yaml
@@ -1,4 +1,5 @@
name: "bedtools slop"
name: slopBed
description: Increase the size of each feature in a BED/BAM/VCF by a specified factor.
url: https://bedtools.readthedocs.io/en/latest/content/tools/slop.html
authors:
- Jan Forster
2 changes: 1 addition & 1 deletion bio/bedtools/sort/environment.yaml
Expand Up @@ -3,4 +3,4 @@ channels:
- bioconda
- nodefaults
dependencies:
- bedtools =2.29
- bedtools =2.30
7 changes: 4 additions & 3 deletions bio/bedtools/sort/meta.yaml
@@ -1,11 +1,12 @@
name: bedtools sort
name: sortBed
description: >
Sorts bed, vcf or gff files by chromosome and other criteria, for more information please see `bedtools sort documentation <https://bedtools.readthedocs.io/en/latest/content/tools/sort.html>`_.
Sorts bed, vcf or gff files by chromosome and other criteria.
url: https://bedtools.readthedocs.io/en/latest/content/tools/sort.html
authors:
- Antonie Vietor
input:
- BED/GFF/VCF files
- optional a tab separating file that determines the sorting order and contains the chromosome names in the first column
- optional a fasta index file
output:
- complemented BED/GFF/VCF file
- sorted BED/GFF/VCF file
8 changes: 8 additions & 0 deletions test.py
Expand Up @@ -1028,6 +1028,14 @@ def test_bcftools_view_uncompressed_bcf():
)


@skip_if_not_modified
def test_bedtools_bamtobed():
run(
"bio/bedtools/bamtobed",
["snakemake", "--cores", "1", "a.bed", "--use-conda", "-F"],
)


@skip_if_not_modified
def test_bedtools_genomecoveragebed():
run(
Expand Down

0 comments on commit 0486745

Please sign in to comment.