/usr/bin/gff2starch is in bedops 2.4.26+dfsg-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | #!/bin/bash
#
# convert2bed
# Copyright (C) 2014-2016 Alex Reynolds
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
cmd="convert2bed"
input_format="gff"
output_format="starch"
# general
do_not_sort=false
max_mem_set=false
max_mem="2G"
sort_tmpdir_set=false
sort_tmpdir="/tmp"
starch_bzip2=false
starch_gzip=false
starch_note=""
starch_not_set=false
# format-specific
keep_header=false
help()
{
${cmd} --help-gff
exit $1
}
optspec=":e:zgr:m:dhk-:"
while getopts "$optspec" optchar; do
case "${optchar}" in
-)
case "${OPTARG}" in
starch-bzip2)
starch_bzip2=true
;;
starch-gzip)
starch_gzip=true
;;
sort-tmpdir)
val="${!OPTIND}"; OPTIND=$(( $OPTIND + 1 ))
sort_tmpdir=${val}
sort_tmpdir_set=true
;;
sort-tmpdir=*)
val=${OPTARG#*=}
sort_tmpdir=${val}
sort_tmpdir_set=true
;;
starch-note)
val="${!OPTIND}"; OPTIND=$(( $OPTIND + 1 ))
starch_note="\"${val}\""
starch_note_set=true
;;
starch-note=*)
val=${OPTARG#*=}
starch_note="\"${val}\""
starch_note_set=true
;;
max-mem)
val="${!OPTIND}"; OPTIND=$(( $OPTIND + 1 ))
max_mem=${val}
max_mem_set=true
;;
max-mem=*)
val=${OPTARG#*=}
max_mem=${val}
max_mem_set=true
;;
do-not-sort)
do_not_sort=true
;;
help)
val="${!OPTIND}"; OPTIND=$(( $OPTIND + 1 ))
#echo "Parsing option: '--${OPTARG}', value: '${val}'" >&2;
help 0
;;
help=*)
val=${OPTARG#*=}
opt=${OPTARG%=$val}
#echo "Parsing option: '--${opt}', value: '${val}'" >&2
help 0
;;
help-gff)
help 0
;;
keep-header)
keep_header=true
;;
*)
help 1
#if [ "$OPTERR" = 1 ] && [ "${optspec:0:1}" != ":" ]; then echo "Unknown option --${OPTARG}" >&2; fi
;;
esac;;
e)
starch_note="\"${OPTARG}\""
starch_note_set=true
;;
z)
starch_bzip2=true
;;
g)
starch_gzip=true
;;
r)
sort_tmpdir=${OPTARG}
sort_tmpdir_set=true
;;
m)
max_mem=${OPTARG}
max_mem_set=true
;;
d)
do_not_sort=true
;;
h)
help 0
;;
k)
keep_header=true
;;
*)
help 1
#if [ "$OPTERR" != 1 ] || [ "${optspec:0:1}" = ":" ]; then echo "Non-option argument: '-${OPTARG}'" >&2; fi
;;
esac
done
# base options
options="--input=${input_format} --output=${output_format}"
# general
if [ "${max_mem_set}" = true ]; then options="${options} --max-mem=${max_mem}"; fi
if [ "${sort_tmpdir_set}" = true ]; then options="${options} --sort-tmpdir=\"${sort_tmpdir}\""; fi
if [ "${do_not_sort}" = true ]; then options="${options} --do-not-sort"; fi
if [ "${starch_gzip}" = false ]; then starch_bzip2=true; else options="${options} --starch-gzip"; fi
if [ "${starch_bzip2}" = true ]; then options="${options} --starch-bzip2"; fi
if [ "${starch_note_set}" = true ]; then options="${options} --starch-note=\"${starch_note}\""; fi
# format-specific
if [ "${keep_header}" = true ]; then options="${options} --keep-header"; fi
${cmd} ${options} - <&0
|