Build branch main with version main (1e1ffb3)
Build pipeline: vsh-ci-dev-jsbwk
Source commit: 1e1ffb315f
Source message: Merge pull request #17 from viash-hub/add_biobox_modules
- Migrate a number of components to biobox
- Fix tests
- Reduce size of test resources
- Prepare for Viash Hub
This commit is contained in:
156
target/executable/gtf2bed/.config.vsh.yaml
Normal file
156
target/executable/gtf2bed/.config.vsh.yaml
Normal file
@@ -0,0 +1,156 @@
|
||||
name: "gtf2bed"
|
||||
version: "main"
|
||||
argument_groups:
|
||||
- name: "Input"
|
||||
arguments:
|
||||
- type: "file"
|
||||
name: "--gtf"
|
||||
description: "A reference file in GTF format."
|
||||
info: null
|
||||
must_exist: true
|
||||
create_parent: true
|
||||
required: true
|
||||
direction: "input"
|
||||
multiple: false
|
||||
multiple_sep: ";"
|
||||
- name: " Output"
|
||||
arguments:
|
||||
- type: "file"
|
||||
name: "--bed_output"
|
||||
description: "BED file resulting from the conversion of the GTF input file."
|
||||
info: null
|
||||
must_exist: true
|
||||
create_parent: true
|
||||
required: true
|
||||
direction: "output"
|
||||
multiple: false
|
||||
multiple_sep: ";"
|
||||
resources:
|
||||
- type: "bash_script"
|
||||
path: "script.sh"
|
||||
is_executable: true
|
||||
- type: "file"
|
||||
path: "gtf2bed.pl"
|
||||
description: "Create BED annotation file from GTF.\n"
|
||||
test_resources:
|
||||
- type: "bash_script"
|
||||
path: "test.sh"
|
||||
is_executable: true
|
||||
- type: "file"
|
||||
path: "genes.gtf.gz"
|
||||
info:
|
||||
migration_info:
|
||||
git_repo: "https://github.com/nf-core/rnaseq.git"
|
||||
paths:
|
||||
- "modules/local/gtf2bed.nf"
|
||||
last_sha: "0a1bdcfbb498987643b74e9fccab85ccd9f2a17d"
|
||||
status: "enabled"
|
||||
requirements:
|
||||
commands:
|
||||
- "ps"
|
||||
runners:
|
||||
- type: "executable"
|
||||
id: "executable"
|
||||
docker_setup_strategy: "ifneedbepullelsecachedbuild"
|
||||
- type: "nextflow"
|
||||
id: "nextflow"
|
||||
directives:
|
||||
tag: "$id"
|
||||
auto:
|
||||
simplifyInput: true
|
||||
simplifyOutput: false
|
||||
transcript: false
|
||||
publish: false
|
||||
config:
|
||||
labels:
|
||||
mem1gb: "memory = 1000000000.B"
|
||||
mem2gb: "memory = 2000000000.B"
|
||||
mem5gb: "memory = 5000000000.B"
|
||||
mem10gb: "memory = 10000000000.B"
|
||||
mem20gb: "memory = 20000000000.B"
|
||||
mem50gb: "memory = 50000000000.B"
|
||||
mem100gb: "memory = 100000000000.B"
|
||||
mem200gb: "memory = 200000000000.B"
|
||||
mem500gb: "memory = 500000000000.B"
|
||||
mem1tb: "memory = 1000000000000.B"
|
||||
mem2tb: "memory = 2000000000000.B"
|
||||
mem5tb: "memory = 5000000000000.B"
|
||||
mem10tb: "memory = 10000000000000.B"
|
||||
mem20tb: "memory = 20000000000000.B"
|
||||
mem50tb: "memory = 50000000000000.B"
|
||||
mem100tb: "memory = 100000000000000.B"
|
||||
mem200tb: "memory = 200000000000000.B"
|
||||
mem500tb: "memory = 500000000000000.B"
|
||||
mem1gib: "memory = 1073741824.B"
|
||||
mem2gib: "memory = 2147483648.B"
|
||||
mem4gib: "memory = 4294967296.B"
|
||||
mem8gib: "memory = 8589934592.B"
|
||||
mem16gib: "memory = 17179869184.B"
|
||||
mem32gib: "memory = 34359738368.B"
|
||||
mem64gib: "memory = 68719476736.B"
|
||||
mem128gib: "memory = 137438953472.B"
|
||||
mem256gib: "memory = 274877906944.B"
|
||||
mem512gib: "memory = 549755813888.B"
|
||||
mem1tib: "memory = 1099511627776.B"
|
||||
mem2tib: "memory = 2199023255552.B"
|
||||
mem4tib: "memory = 4398046511104.B"
|
||||
mem8tib: "memory = 8796093022208.B"
|
||||
mem16tib: "memory = 17592186044416.B"
|
||||
mem32tib: "memory = 35184372088832.B"
|
||||
mem64tib: "memory = 70368744177664.B"
|
||||
mem128tib: "memory = 140737488355328.B"
|
||||
mem256tib: "memory = 281474976710656.B"
|
||||
mem512tib: "memory = 562949953421312.B"
|
||||
cpu1: "cpus = 1"
|
||||
cpu2: "cpus = 2"
|
||||
cpu5: "cpus = 5"
|
||||
cpu10: "cpus = 10"
|
||||
cpu20: "cpus = 20"
|
||||
cpu50: "cpus = 50"
|
||||
cpu100: "cpus = 100"
|
||||
cpu200: "cpus = 200"
|
||||
cpu500: "cpus = 500"
|
||||
cpu1000: "cpus = 1000"
|
||||
debug: false
|
||||
container: "docker"
|
||||
engines:
|
||||
- type: "docker"
|
||||
id: "docker"
|
||||
image: "ubuntu:22.04"
|
||||
target_registry: "images.viash-hub.com"
|
||||
target_tag: "main"
|
||||
namespace_separator: "/"
|
||||
setup:
|
||||
- type: "apt"
|
||||
packages:
|
||||
- "perl"
|
||||
interactive: false
|
||||
entrypoint: []
|
||||
cmd: null
|
||||
- type: "native"
|
||||
id: "native"
|
||||
build_info:
|
||||
config: "src/gtf2bed/config.vsh.yaml"
|
||||
runner: "executable"
|
||||
engine: "docker|native"
|
||||
output: "target/executable/gtf2bed"
|
||||
executable: "target/executable/gtf2bed/gtf2bed"
|
||||
viash_version: "0.9.0"
|
||||
git_commit: "1e1ffb315fefec05db2ee0c62e1c98ce4b49929c"
|
||||
git_remote: "https://github.com/viash-hub/rnaseq"
|
||||
package_config:
|
||||
version: "main"
|
||||
info:
|
||||
test_resources:
|
||||
- path: "gs://viash-hub-test-data/rnaseq/v1"
|
||||
dest: "testData"
|
||||
viash_version: "0.9.0"
|
||||
source: "src"
|
||||
target: "target"
|
||||
config_mods:
|
||||
- ".requirements.commands := ['ps']\n.runners[.type == 'nextflow'].directives.tag\
|
||||
\ := '$id'\n"
|
||||
- ".engines += { type: \"native\" }"
|
||||
- ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'"
|
||||
- ".engines[.type == 'docker'].target_tag := 'main'"
|
||||
organization: "vsh"
|
||||
1078
target/executable/gtf2bed/gtf2bed
Executable file
1078
target/executable/gtf2bed/gtf2bed
Executable file
File diff suppressed because it is too large
Load Diff
122
target/executable/gtf2bed/gtf2bed.pl
Executable file
122
target/executable/gtf2bed/gtf2bed.pl
Executable file
@@ -0,0 +1,122 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
# Copyright (c) 2011 Erik Aronesty (erik@q32.com)
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
# ALSO, IT WOULD BE NICE IF YOU LET ME KNOW YOU USED IT.
|
||||
|
||||
use Getopt::Long;
|
||||
|
||||
my $extended;
|
||||
GetOptions("x"=>\$extended);
|
||||
|
||||
$in = shift @ARGV;
|
||||
|
||||
my $in_cmd =($in =~ /\.gz$/ ? "gunzip -c $in|" : $in =~ /\.zip$/ ? "unzip -p $in|" : "$in") || die "Can't open $in: $!\n";
|
||||
open IN, $in_cmd;
|
||||
|
||||
while (<IN>) {
|
||||
$gff = 2 if /^##gff-version 2/;
|
||||
$gff = 3 if /^##gff-version 3/;
|
||||
next if /^#/ && $gff;
|
||||
|
||||
s/\s+$//;
|
||||
# 0-chr 1-src 2-feat 3-beg 4-end 5-scor 6-dir 7-fram 8-attr
|
||||
my @f = split /\t/;
|
||||
if ($gff) {
|
||||
# most ver 2's stick gene names in the id field
|
||||
($id) = $f[8]=~ /\bID="([^"]+)"/;
|
||||
# most ver 3's stick unquoted names in the name field
|
||||
($id) = $f[8]=~ /\bName=([^";]+)/ if !$id && $gff == 3;
|
||||
} else {
|
||||
($id) = $f[8]=~ /transcript_id "([^"]+)"/;
|
||||
}
|
||||
|
||||
next unless $id && $f[0];
|
||||
|
||||
if ($f[2] eq 'exon') {
|
||||
die "no position at exon on line $." if ! $f[3];
|
||||
# gff3 puts :\d in exons sometimes
|
||||
$id =~ s/:\d+$// if $gff == 3;
|
||||
push @{$exons{$id}}, \@f;
|
||||
# save lowest start
|
||||
$trans{$id} = \@f if !$trans{$id};
|
||||
} elsif ($f[2] eq 'start_codon') {
|
||||
#optional, output codon start/stop as "thick" region in bed
|
||||
$sc{$id}->[0] = $f[3];
|
||||
} elsif ($f[2] eq 'stop_codon') {
|
||||
$sc{$id}->[1] = $f[4];
|
||||
} elsif ($f[2] eq 'miRNA' ) {
|
||||
$trans{$id} = \@f if !$trans{$id};
|
||||
push @{$exons{$id}}, \@f;
|
||||
}
|
||||
}
|
||||
|
||||
for $id (
|
||||
# sort by chr then pos
|
||||
sort {
|
||||
$trans{$a}->[0] eq $trans{$b}->[0] ?
|
||||
$trans{$a}->[3] <=> $trans{$b}->[3] :
|
||||
$trans{$a}->[0] cmp $trans{$b}->[0]
|
||||
} (keys(%trans)) ) {
|
||||
my ($chr, undef, undef, undef, undef, undef, $dir, undef, $attr, undef, $cds, $cde) = @{$trans{$id}};
|
||||
my ($cds, $cde);
|
||||
($cds, $cde) = @{$sc{$id}} if $sc{$id};
|
||||
|
||||
# sort by pos
|
||||
my @ex = sort {
|
||||
$a->[3] <=> $b->[3]
|
||||
} @{$exons{$id}};
|
||||
|
||||
my $beg = $ex[0][3];
|
||||
my $end = $ex[-1][4];
|
||||
|
||||
if ($dir eq '-') {
|
||||
# swap
|
||||
$tmp=$cds;
|
||||
$cds=$cde;
|
||||
$cde=$tmp;
|
||||
$cds -= 2 if $cds;
|
||||
$cde += 2 if $cde;
|
||||
}
|
||||
|
||||
# not specified, just use exons
|
||||
$cds = $beg if !$cds;
|
||||
$cde = $end if !$cde;
|
||||
|
||||
# adjust start for bed
|
||||
--$beg; --$cds;
|
||||
|
||||
my $exn = @ex; # exon count
|
||||
my $exst = join ",", map {$_->[3]-$beg-1} @ex; # exon start
|
||||
my $exsz = join ",", map {$_->[4]-$_->[3]+1} @ex; # exon size
|
||||
|
||||
my $gene_id;
|
||||
my $extend = "";
|
||||
if ($extended) {
|
||||
($gene_id) = $attr =~ /gene_name "([^"]+)"/;
|
||||
($gene_id) = $attr =~ /gene_id "([^"]+)"/ unless $gene_id;
|
||||
$extend="\t$gene_id";
|
||||
}
|
||||
# added an extra comma to make it look exactly like ucsc's beds
|
||||
print "$chr\t$beg\t$end\t$id\t0\t$dir\t$cds\t$cde\t0\t$exn\t$exsz,\t$exst,$extend\n";
|
||||
}
|
||||
|
||||
close IN;
|
||||
Reference in New Issue
Block a user