Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add bedops/gtf2bed #4476

Merged
merged 22 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions modules/nf-core/bedops/gtf2bed/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

davidecarlson marked this conversation as resolved.
Show resolved Hide resolved
process BEDOPS_GTF2BED {
tag "$gtf"
label 'process_low'

conda "bioconda::bedops=2.4.41"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/bedops:2.4.41--h9f5acd7_0':
'biocontainers/bedops:2.4.41--h9f5acd7_0' }"

input:
path gtf

output:
path '*.bed' , emit: bed
path "versions.yml", emit: versions

when:
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${gtf.baseName}"

"""
cat \\
$gtf \\
| gtf2bed \\
$args \\
--attribute-key=exon_id \\
> ${prefix}.bed

cat <<-END_VERSIONS > versions.yml
"${task.process}":
gtf2bed: \$(bedops --version | grep version | awk ' { print \$2 } ')
END_VERSIONS
"""
}
32 changes: 32 additions & 0 deletions modules/nf-core/bedops/gtf2bed/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: "bedops_gtf2bed"
description: Convert gtf format to bed format
keywords:
- gtf
- bed
- conversion
tools:
- gtf2bed:
description: The gtf2bed script converts 1-based, closed [start, end] Gene Transfer Format v2.2 (GTF2.2) to sorted, 0-based, half-open [start-1, end) extended BED-formatted data.
homepage: https://bedops.readthedocs.io/en/latest/content/reference/file-management/conversion/gtf2bed.html
documentation: https://bedops.readthedocs.io/en/latest/content/reference/file-management/conversion/gtf2bed.html
tool_dev_url: https://github.com/bedops/bedops
doi: 10.1093/bioinformatics/bts277
licence: ["GPL v2"]

input:
- gtf:
type: file
description: A reference file in GTF format
pattern: "*.{gtf,gtf.gz}"

output:
- bed:
type: file
description: A reference file in BED format
pattern: "*.{bed}"
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
authors:
- "@davidecarlson"
3 changes: 3 additions & 0 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ bcftools/stats:
beagle5/beagle:
- modules/nf-core/beagle5/beagle/**
- tests/modules/nf-core/beagle5/beagle/**
bedops/gtf2bed:
- modules/nf-core/bedops/gtf2bed/**
- tests/modules/nf-core/bedops/gtf2bed/**
bedtools/getfasta:
- modules/nf-core/bedtools/getfasta/**
- tests/modules/nf-core/bedtools/getfasta/**
Expand Down
14 changes: 14 additions & 0 deletions tests/modules/nf-core/bedops/gtf2bed/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env nextflow

nextflow.enable.dsl = 2

include { BEDOPS_GTF2BED } from '../../../../../modules/nf-core/bedops/gtf2bed/main.nf'

workflow test_bedops_gtf2bed {

input = [
//[ id:'test' ], // meta map
file('https://raw.githubusercontent.com/nf-core/test-datasets/rnaseq/reference/genes.gtf', checkIfExists: true)]

BEDOPS_GTF2BED ( input )
}
6 changes: 6 additions & 0 deletions tests/modules/nf-core/bedops/gtf2bed/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
process {

publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }


}
9 changes: 9 additions & 0 deletions tests/modules/nf-core/bedops/gtf2bed/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- name: bedops gtf2bed test_bedops_gtf2bed
command: nextflow run ./tests/modules/nf-core/bedops/gtf2bed -entry test_bedops_gtf2bed -c ./tests/config/nextflow.config
tags:
- bedops
- bedops/gtf2bed
files:
- path: output/bedops/genes.bed
md5sum: b783320a6ebde0b139f8e0a821b76240
- path: output/bedops/versions.yml
Loading