package org.broadinstitute.sting.gatk.refdata;

import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.GenomeLocParser;

import java.util.*;

public class SimpleIndelROD extends TabularROD implements Genotype {

    public SimpleIndelROD(String name) {
        super(name);
    }

    public GenomeLoc getLocation() {
        return GenomeLocParser.createGenomeLoc(this.get("0"), Long.parseLong(this.get("1")));
    }

    public List<String> getFWDAlleles() {
        String str = this.get("3");
        return Arrays.asList(str.substring(0, str.indexOf(":")));    
    }

    public String getFWDRefBases() { return ""; }
    public char getRef() { return 'N'; }
    public boolean isPointGenotype() { return false; }
    public boolean isIndelGenotype() { return true; }
    public boolean isSNP() { return false; }
    public boolean isReference() { return false; }
    public boolean isInsertion() { return this.get("3").charAt(0) == '+'; }
    public boolean isDeletion() { return this.get("3").charAt(0) == '-'; }
    public boolean isIndel() { return false; }
    public double getVariantConfidence() { return 0.0; }
    public double getConsensusConfidence() { return 0.0; }
    public boolean isBiallelic() { return true; }
    public boolean isHom() { return false; }
    public boolean isHet() { return false; }

    public String toString() {
        StringBuffer sb = new StringBuffer();
        sb.append(getLocation() + "\t" + getFWDAlleles().get(0));
        return sb.toString();
    }
 }
@@ -1497,16 +1497,28 @@
 cation()
+.getContig()
  + %22%5Ct%22 
@@ -1526,26 +1526,188 @@
  get
-FWDAlleles().get(0
+Location().getStart() + %22%5Ct%22);%0D%0A        String indel = getFWDAlleles().get(0);%0D%0A        sb.append((indel.length()-1) + %22%5Ct%22 + (isInsertion() ? %22I%22 : %22D%22) + %22%5Ct%22 + indel.substring(1
 ));%0D

print indels in the format required for 1KG submissions