Variants fix

This pull request includes an update to get this sample working again via the variants API and also some refactoring to make it more amenable to pulling the methods into other scripts.  (At a later date there will be an R package encapsulating access to the Genomics APIs.)