Prevent vector end values from getting transformed during Genotype encoding, and detect invalid values

Previously we were incorrectly encoding vector end values in Genotype::encode_genotype().
Now vector end values are skipped, and invalid values are detected (only allele indices
>= 0, -1 for missing genotypes, and vector end values are allowed).