Skip to content

Instantly share code, notes, and snippets.

@brianjmpark
Created February 13, 2020 20:08
Show Gist options
  • Save brianjmpark/43f3a77b5ab0a7844e10fcfdc5a0c7e1 to your computer and use it in GitHub Desktop.
Save brianjmpark/43f3a77b5ab0a7844e10fcfdc5a0c7e1 to your computer and use it in GitHub Desktop.
##takes output from bedtools intersect output tab delimted file containing all instances at which two annotations intersect
##bedtools intersect input of alignment.bed file and gff/gtf3 annotation
##script output count table of unique gene ID and number of intersect counts (collapsed under one gene id)
function count_intersect() {
echo "using file name $1.tsv"
cut -f15 $1_intersect_final.tsv |
tail -n +2 |
awk -F '[;]' '{print $2}' |
awk -F '["]' '{print $2}' |
sed 's.\\..g' |
sort -n |
uniq -c > $1_bedtools_count_new.txt
echo "done"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment