File: vcfsort.sh

package info (click to toggle)
bedtools 2.31.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 57,304 kB
  • sloc: ansic: 38,507; cpp: 29,721; sh: 8,001; makefile: 663; python: 240; javascript: 16
file content (13 lines) | stat: -rwxr-xr-x 484 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/bash

[ $# -eq 0 ] && { echo "Sorts a VCF file in natural chromosome order";\
                  echo "Usage: $0 [my.vcf | my.vcf.gz]"; exit 1;
                 }
if LC_ALL=C (zless $1 | grep ^#; zless $1 | grep -v ^# | sort -k1,1V -k2,2n);
then
    exit 0
else
    printf 'sort failed. Does your version of sort support the -V option?\n'
    printf 'If not, you should update sort with the latest from GNU coreutils:\n'
    printf 'git clone git://git.sv.gnu.org/coreutils'
fi