Automated chemical analysis