General university rankings are practically worthless. Subject rankings are more helpful, but still relatively useless, particularly when you are comparing universities like Saint Andrews and UCL.
If you are coming to the UK from the US you may as well try and get as unique and different an experience as you can get. Saint Andrews is a small university in a village, and its close-knit and ancient environment is quite unlike what you will find in London. It's true that UCL has a history of excellence in research, but if I were you I would do my undergrad at Saint Andrews and then opt for a research-strong university for a post-grad. If your heart is set in London, why not Imperial or King's? Imperial has a remarkably strong position in science, which seems to be your area of interest. But bear in mind that (and I know Londoners here will strongly disagree) Scottish people tend to be more friendly than people in London.