File: sqt-bambai

package info (click to toggle)
python-sqt 0.8.0-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 824 kB
  • sloc: python: 5,964; sh: 38; makefile: 10
file content (23 lines) | stat: -rwxr-xr-x 604 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash
set -euo pipefail
#set -x
if [ $# -ne 1 -o x$1 == x-h -o x$1 == x--help ]; then
	echo -e \
"Usage:

    samtools sort -O bam -T prefix ... | bambai BAMPATH

Read a sorted BAM file from standard input, write it to BAMPATH and
index it at the same time (creating BAMPATH.bai)."
exit 2
fi
if [ -t 0 ]; then
	echo "Reading input from terminal - this is probably not what you want. Use Ctrl+C to cancel."
fi
BAM="$1"
WORKDIR=$(mktemp -d) || exit 1
trap "rm -rf ${WORKDIR}" exit
FIFO=${WORKDIR}/fifo.bam
mkfifo ${FIFO}
samtools index ${FIFO} && mv ${FIFO}.bai "${BAM}.bai" &
tee ${FIFO} > "${BAM}"