Skip to content

Instantly share code, notes, and snippets.

@genomewalker
Last active August 29, 2015 14:26
Show Gist options
  • Save genomewalker/089690cc59795ae73125 to your computer and use it in GitHub Desktop.
Save genomewalker/089690cc59795ae73125 to your computer and use it in GitHub Desktop.
#Read a hist file from bedtools coverage -hist and create a coverage per orf file.
#Coverage per each gene is calculated as: coverage_orfA = sum(depth_of_coverage * fraction_covered)
{
if ($0 i ~ /^all/){
next;
}else{
split($4,a,"_");
b=$1"_"$6"_"$2+1"_"$3"_orf-"a[2]"\t"$13;
c[b]=c[b] + ($11*$14)
}
}END{
for (var in c){
print var"\t"c[var]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment