question: public static int [ ] splitGt ( String gt ) { final int gtlen = gt . length ( ) ; if ( gtlen == 1 ) { return new int [ ] { alleleId ( gt . charAt ( 0 ) ) } ; } else { int [ ] result = new int [ 2 ] ; int ploid = 0 ; int allelestart = 0 ; for ( int i = 0 ; i < gtlen ; i ++ ) { final char c = gt . charAt ( i ) ; if ( c == PHASED_SEPARATOR || c == UNPHASED_SEPARATOR ) { if ( ploid == result . length ) { result = Arrays . copyOf ( result , result . length + 1 ) ; } result [ ploid ++ ] = alleleId ( gt , allelestart , i - allelestart ) ; allelestart = i + 1 ; } } if ( allelestart < gtlen ) { if ( ploid == result . length ) { result = Arrays . copyOf ( result , result . length + 1 ) ; } result [ ploid ++ ] = alleleId ( gt , allelestart , gtlen - allelestart ) ; } if ( ploid < result . length ) { result = Arrays . copyOf ( result , ploid ) ; } if ( ploid == 0 ) { throw new NumberFormatException ( "Malformed GT '" + gt + "'" ) ; } return result ; } }
target:  Utility method for splitting a VCF genotype subfield into an array of numeric allele identifiers.