I am using the below command to calculate the average of a target bed file:
I added the text in bold as I am hoping that will only calculate the targets listed in that file.
So, the original command calculate all 4500 targets, but the I use 70 targets in list.txt as a filter to only calculate those. Is this right? Thank you .
Code:
awk '{if(len==0){last=$4;total=$6;len=1;getline}if($4!=last){printf("%s\t%f\n", last, total/len);last=$4;total=$6;len=1}else{total+=$6;len+=1}}END{printf("%s\t%f\n", last, total/len)}' output.bam.hist.txt [B]< list.txt[/B] > average.txt
So, the original command calculate all 4500 targets, but the I use 70 targets in list.txt as a filter to only calculate those. Is this right? Thank you .