Skip to content

Instantly share code, notes, and snippets.

@pontikos
Created January 7, 2015 14:52
Show Gist options
  • Select an option

  • Save pontikos/20da3519f79523c2cdcb to your computer and use it in GitHub Desktop.

Select an option

Save pontikos/20da3519f79523c2cdcb to your computer and use it in GitHub Desktop.
Takes vcf file and writes to vcf.gz OR takes gz filename as arguments and reads from stdin.
#!/bin/bash
f=$1
extension=${f##*.}
if [[ "$extension" == 'vcf' ]]
then
in=$f
out=${in}.gz
bgzip $in > $out
tabix -f -p vcf $out
elif [[ "$extension" == 'gz' ]]
then
out=$f
#read from standard input
bgzip > $out
tabix -f -p vcf $out
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment