Last active
July 31, 2024 01:51
-
-
Save mfansler/b82d5e00f8399bfbf6809e037f8647d6 to your computer and use it in GitHub Desktop.
GTF file compressed indexing for IGV compatibility
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$#" -ne 1 ]; then | |
echo -e "Incorrect number of parameters! Usage:\n index-gtf.sh <file.gtf(.gz)>" >&2 | |
exit 1 | |
fi | |
gtf="$1" | |
if [[ $gtf =~ \.gz$ ]]; then | |
output=${gtf%.gtf.gz}.sorted.gtf.gz | |
zcat $gtf | awk '!( $0 ~ /^#/ )' | sort --parallel=4 -S4G -k1,1 -k4,4n | bgzip -c > $output | |
else | |
output=${gtf%.gtf}.sorted.gtf.gz | |
cat $gtf | awk '!( $0 ~ /^#/ )' | sort --parallel=4 -S4G -k1,1 -k4,4n | bgzip -c > $output | |
fi | |
tabix $output | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment