I am trying to replicate a command line script in galaxy where I have used awk to calculate the average read depth across a BAM file where depth at each position (including zero bases) has been calculated using samtools depth. My awk output is always empty but it works perfectly when performed in the command line. I have 2 questions:
- is there another way to calculate the average of column 3 from a samtools depth output in galaxy
OR
- Can anyone explain why I get no output from awk for this command when running it on the samtools depth output file or could anyone make any suggestions for how to fix it?
β{sum+=$3; sumsq+=$3*$3} END { print "Average = ",sum/NR; print "Stdev = ",sqrt(sumsq/NR - (sum/NR)**2)}β
Thanks