public Locus(String locusName, double position, String[] alleleNames,
            PopulationData popdata) {
        if (locusName==null || locusName.trim().isEmpty()) {
            DecimalFormat fix3 = new DecimalFormat("#0.000");
            locusName = fix3.format(position);
        } else {
            this.locusName = locusName;
        }
        this.position = position;
        this.chrom = null;
        alleleName = new String[popdata.founderAlleleCount];
        if (alleleNames==null) {
            for (int i=0; i<popdata.founderAlleleCount; i++) {
                alleleName[i] = ""+i;
            }
        } else { //copy the correct number of alleleNames
            int minn = Math.min(alleleNames.length, this.alleleName.length);
            System.arraycopy(alleleNames, 0, this.alleleName, 0, minn);
            //add extra alleleNames if list not long enough:
            for (int i=minn; i<this.alleleName.length; i++) {
                this.alleleName[i] = ""+i;
            }
        }
    }