An integrated model for signal transduction, motor control and pattern formation in E. coli