Stupid awk tricks

From Rizzo_Lab
Revision as of 13:27, 11 February 2009 by Sudipto (talk | contribs)
(diff) ←Older revision | view current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

Grep out the wallclock time from the namd out files, convert to hours and adds them together.

grep "WallClock:" *.out | awk '{sum+=$2/3600} END {print "Hours="sum}'

Same thing, but now also does mean and sd

awk '{sum+=$2/3600; n+=1; sumsq+=($2/3600)^2} END {print "SD="sqrt(sum^2-sumsq)/(n+1),"Mean="sum/n}'


awk -F, '{mean+=$94/5000; n+=1; meansq+=(($94^2)/5000)} END {print "SD="sqrt(meansq - mean^2),"Mean="mean}'

Theoretical success rate i.e. at least one pose in mol2 file with RMSD<=2

awk '/RMSD:/{if($3<=2.0)ths=1}END{print ths}' scored.mol2 

Return lowest EMSD in mol2 file

awk 'BEGIN{lrm=99}/RMSD:/{if($3<=lrm)lrm=$3}END{printf"%.2f",lrm}' mol2file

Lowest DOCK RMSD in MOL2 output

grep RMSD mol_scored.mol2 | awk '{print $3}' | sort -n | head 


awk Tutorial