Program: 80621
Project: 80621
Buggy source:
/** 
 * takes a line from a VCF file, parse it, return a Variant object right now the meta-info lines (beginning with ##) are not tied with data line parsing. This will be corrected in the future (perhaps with help of HTSJDK).
 * @param line
 * @return
 */
public Variant processLine(String line) throws UnexpectedException {
  StringTokenizer toks=new StringTokenizer(line);
  if (line.startsWith("String_Node_Str")) {
    if (sampleId != null && line.startsWith("String_Node_Str")) {
      chromLineSeen=true;
      int index=0;
      while (toks.hasMoreTokens()) {
        index++;
        String tok=toks.nextToken();
        if (tok.equals(sampleId))         sampleIndex=index;
      }
    }
 else     if (sampleId == null) {
      sampleIndex=10;
    }
    return null;
  }
  if (sampleIndex < 0 && !chromLineSeen) {
    sampleIndex=10;
  }
 else   if (sampleIndex < 0) {
    sampleIndex=10;
    log.warn("String_Node_Str" + sampleId + "String_Node_Str");
  }
  int index=0, genotypeIndex=-1, copyNumberIndex=-1;
  int pos=-1;
  ChrString chr=null;
  String REF="String_Node_Str", FILTER="String_Node_Str", ALT="String_Node_Str", variantId="String_Node_Str";
  String phase="String_Node_Str", copyNumber="String_Node_Str", infoString="String_Node_Str", FORMAT;
  String[] sampleInfo;
  while (toks.hasMoreTokens()) {
    index++;
    if (index == 1) {
      chr=new ChrString(toks.nextToken());
    }
 else     if (index == 2)     pos=Integer.parseInt(toks.nextToken());
 else     if (index == 3)     variantId=toks.nextToken();
 else     if (index == 4)     REF=toks.nextToken();
 else     if (index == 5)     ALT=toks.nextToken();
 else     if (index == 7)     FILTER=toks.nextToken();
 else     if (index == 8)     infoString=toks.nextToken();
 else     if (index == 9) {
      FORMAT=toks.nextToken();
      genotypeIndex=getFormatKeyIndex(FORMAT,"String_Node_Str");
      copyNumberIndex=getFormatKeyIndex(FORMAT,"String_Node_Str");
    }
 else     if (index == sampleIndex) {
      sampleInfo=(toks.nextToken()).split("String_Node_Str");
      if (genotypeIndex >= 0) {
        phase=sampleInfo[genotypeIndex];
      }
      if (copyNumberIndex >= 0) {
        copyNumber=sampleInfo[copyNumberIndex];
      }
      break;
    }
 else {
      toks.nextToken();
    }
  }
  if (chr == null) {
    log.warn("String_Node_Str" + line);
    return null;
  }
  if (isPassFilterRequired && !(FILTER.contains("String_Node_Str") || FILTER.equals(DEFAULT_FILTER))) {
    return null;
  }
  byte[] genotypeArray=new byte[2];
  boolean isGenotypePhased=isPhased(phase,genotypeArray,chr);
  if (genotypeIndex >= 0 && genotypeArray[0] == 0 && genotypeArray[1] == 0) {
  }
  byte[] copyNumberArray=new byte[2];
  boolean isCopyNumberPhased;
  if (copyNumberIndex >= 0) {
    isCopyNumberPhased=isPhased(copyNumber,copyNumberArray,chr);
    if (isCopyNumberPhased != isGenotypePhased) {
      log.error("String_Node_Str");
      log.error(line);
      return null;
    }
  }
  REF=REF.toUpperCase();
  ALT=ALT.toUpperCase();
  String deletedReference="String_Node_Str";
  VCFInfo info=new VCFInfo(infoString);
  if (ALT.indexOf('<') != -1) {
    String[] alternativeAlleles=ALT.split("String_Node_Str");
    int[] svlen=info.getValue("String_Node_Str",int[].class);
    if (alternativeAlleles.length != svlen.length) {
      throw new IllegalArgumentException("String_Node_Str" + line);
    }
    for (int i=0; i < alternativeAlleles.length; i++) {
      if (!alternativeAlleles[i].startsWith("String_Node_Str")) {
        throw new IllegalArgumentException("String_Node_Str" + line);
      }
    }
  }
  Alt[] alts=string2Alt(ALT);
  if (alts[0].getSymbolicAllele() != null) {
    int[] end=info.getValue("String_Node_Str",int[].class);
    int[] svlen=info.getValue("String_Node_Str",int[].class);
    int[] end2=info.getValue("String_Node_Str",int[].class);
    int[] pos2=info.getValue("String_Node_Str",int[].class);
    Boolean isinv=info.getValue("String_Node_Str",Boolean.class);
    String[] traid=info.getValue("String_Node_Str",String[].class);
    String[] chr2=info.getValue("String_Node_Str",String[].class);
    deletedReference=REF;
    byte[] refs=new byte[0];
    pos++;
    if (Alt.SVType.SVSubtype.TRA.equals(alts[0].getSymbolicAllele().getMinor())) {
      if (traid == null || traid.length == 0) {
        throw new IllegalArgumentException("String_Node_Str" + line);
      }
    }
    if (alts[0].getSymbolicAllele().getMajor() == Alt.SVType.INV) {
      if (svlen.length > 0) {
        for (int i=0; i < svlen.length; i++) {
          int alternativeAlleleLength=Math.max(Math.abs(svlen[i]),1);
          alts[i].setSeq(new FlexSeq(FlexSeq.Type.INV,alternativeAlleleLength));
        }
        return new Variant.Builder().chr(chr).pos(pos).referenceAlleleLength(Math.abs(svlen[0])).ref(refs).alts(alts).phase(genotypeArray).isPhased(isGenotypePhased).varId(variantId).filter(FILTER).refDeleted(deletedReference).randomNumberGenerator(random).build();
      }
 else       if (end != null && end.length > 0 && end[0] > 0) {
        int alternativeAlleleLength=Math.max(Math.abs(end[0] - pos + 1),1);
        alts[0].setSeq(new FlexSeq(FlexSeq.Type.INV,alternativeAlleleLength));
        return new Variant.Builder().chr(chr).pos(pos).referenceAlleleLength(alternativeAlleleLength).ref(refs).alts(alts).phase(genotypeArray).isPhased(isGenotypePhased).varId(variantId).filter(FILTER).refDeleted(deletedReference).randomNumberGenerator(random).build();
      }
 else {
        log.error("String_Node_Str");
        log.error(line);
        log.error("String_Node_Str");
        return null;
      }
    }
 else     if (alts[0].getSymbolicAllele().getMajor() == Alt.SVType.DUP && ((alts[0].getSymbolicAllele().getMinor() != Alt.SVType.SVSubtype.TRA && alts[0].getSymbolicAllele().getMinor() != Alt.SVType.SVSubtype.ISP && info.getValue("String_Node_Str",getType("String_Node_Str")) == null) || alts[0].getSymbolicAllele().getMinor() == Alt.SVType.SVSubtype.TANDEM)) {
      if (svlen.length > 0) {
        for (int i=0; i < svlen.length; i++) {
          int currentCopyNumber=1;
          for (int j=0; j < 2; j++) {
            if ((i + 1) == genotypeArray[j]) {
              if (copyNumberArray[j] > 0) {
                currentCopyNumber=copyNumberArray[j];
              }
            }
          }
          int alternativeAlleleLength=Math.max(Math.abs(svlen[i]),1);
          alts[i].setSeq(new FlexSeq(FlexSeq.Type.TANDEM_DUP,alternativeAlleleLength,currentCopyNumber));
        }
        return new Variant.Builder().chr(chr).pos(pos).referenceAlleleLength(Math.abs(svlen[0])).ref(refs).alts(alts).phase(genotypeArray).isPhased(isGenotypePhased).varId(variantId).filter(FILTER).refDeleted(deletedReference).randomNumberGenerator(random).build();
      }
 else       if (end != null && end.length > 0 && end[0] > 0) {
        int alternativeAlleleLength=Math.max(Math.abs(end[0] - pos + 1),1);
        alts[0].setSeq(new FlexSeq(FlexSeq.Type.TANDEM_DUP,alternativeAlleleLength,Math.max(copyNumberArray[0],copyNumberArray[1])));
        return new Variant.Builder().chr(chr).pos(pos).referenceAlleleLength(alternativeAlleleLength).ref(refs).alts(alts).phase(genotypeArray).isPhased(isGenotypePhased).varId(variantId).filter(FILTER).refDeleted(deletedReference).randomNumberGenerator(random).build();
      }
 else {
        log.error("String_Node_Str");
        log.error(line);
        log.error("String_Node_Str");
        return null;
      }
    }
 else     if (alts[0].getSymbolicAllele().getMajor() == Alt.SVType.INS) {
      if (svlen.length > 0) {
        for (int i=0; i < svlen.length; i++) {
          int alternativeAlleleLength=svlen[i] == 0 ? Integer.MAX_VALUE : Math.max(Math.abs(svlen[i]),1);
          alts[i].setSeq(new FlexSeq(FlexSeq.Type.INS,alternativeAlleleLength));
        }
        return new Variant.Builder().chr(chr).pos(pos).referenceAlleleLength(0).ref(refs).alts(alts).phase(genotypeArray).isPhased(isGenotypePhased).varId(variantId).filter(FILTER).refDeleted(deletedReference).randomNumberGenerator(random).build();
      }
 else       if (end != null && end.length > 0 && end[0] > 0) {
        int alternativeAlleleLength=Math.max(Math.abs(end[0] - pos),1);
        alts[0].setSeq(new FlexSeq(FlexSeq.Type.INS,alternativeAlleleLength));
        return new Variant.Builder().chr(chr).pos(pos).referenceAlleleLength(0).ref(refs).alts(alts).phase(genotypeArray).isPhased(isGenotypePhased).varId(variantId).filter(FILTER).refDeleted(deletedReference).randomNumberGenerator(random).build();
      }
 else {
        log.error("String_Node_Str");
        log.error(line);
        log.error("String_Node_Str");
        return null;
      }
    }
 else     if (alts[0].getSymbolicAllele().getMajor() == Alt.SVType.DEL) {
      Variant.Builder template=new Variant.Builder().chr(chr).pos(pos).ref(refs).phase(genotypeArray).isPhased(isGenotypePhased).varId(variantId).filter(FILTER).refDeleted(deletedReference).randomNumberGenerator(random).traid(traid == null ? null : traid[0]);
      if (svlen.length > 0) {
        for (int i=0; i < svlen.length; i++) {
          if (Alt.SVType.SVSubtype.TRA == alts[i].getSymbolicAllele().getMinor()) {
            alts[i].setSeq(new FlexSeq(FlexSeq.Type.TRA_DEL,svlen[i]));
          }
 else {
            alts[i].setSeq(new FlexSeq(FlexSeq.Type.DEL,0));
          }
        }
        return template.alts(alts).referenceAlleleLength(Math.abs(svlen[0])).build();
      }
 else       if (end != null && end.length > 0 && end[0] > 0) {
        int alternativeAlleleLength=end[0] - pos + 1;
        if (Alt.SVType.SVSubtype.TRA == alts[0].getSymbolicAllele().getMinor()) {
          alts[0].setSeq(new FlexSeq(FlexSeq.Type.TRA_DEL,-alternativeAlleleLength));
        }
 else {
          alts[0].setSeq(new FlexSeq(FlexSeq.Type.DEL,0));
        }
        return template.alts(alts).referenceAlleleLength(alternativeAlleleLength).build();
      }
 else {
        log.error("String_Node_Str");
        log.error(line);
        log.error("String_Node_Str");
        return null;
      }
    }
 else     if (alts[0].getSymbolicAllele().getMajor() == Alt.SVType.DUP && (alts[0].getSymbolicAllele().getMinor() == Alt.SVType.SVSubtype.TRA || alts[0].getSymbolicAllele().getMinor() == Alt.SVType.SVSubtype.ISP || info.getValue("String_Node_Str",getType("String_Node_Str")) != null)) {
      if (svlen.length > 0) {
        for (int altAlleleIndex=1; altAlleleIndex <= svlen.length; altAlleleIndex++) {
          int currentCopyNumber=1;
          if (altAlleleIndex == genotypeArray[0]) {
            currentCopyNumber=copyNumberArray[0];
          }
          if (altAlleleIndex == genotypeArray[1]) {
            currentCopyNumber=copyNumberArray[1];
          }
          currentCopyNumber=Math.max(1,currentCopyNumber);
          int altAllelelength=Math.max(Math.abs(svlen[altAlleleIndex - 1]),1);
          alts[altAlleleIndex - 1].setSeq(new FlexSeq(alts[altAlleleIndex - 1].getSymbolicAllele().getMinor() == Alt.SVType.SVSubtype.TRA ? FlexSeq.Type.TRA_DUP : FlexSeq.Type.ISP_DUP,altAllelelength,currentCopyNumber));
        }
        for (int i=1; i < svlen.length; i++) {
          if (svlen[i] != svlen[0]) {
            throw new IllegalArgumentException("String_Node_Str" + line);
          }
        }
        return new Variant.Builder().chr(chr).pos(pos).referenceAlleleLength(Math.abs(0)).ref(refs).alts(alts).phase(genotypeArray).isPhased(isGenotypePhased).varId(variantId).filter(FILTER).refDeleted(deletedReference).randomNumberGenerator(random).chr2(ChrString.string2ChrString(chr2)).pos2(pos2).end2(end2).isinv(isinv).traid(traid == null ? null : traid[0]).build();
      }
 else {
        log.error("String_Node_Str");
        log.error(line);
        log.error("String_Node_Str");
        return null;
      }
    }
 else {
      log.warn("String_Node_Str" + line);
      return null;
    }
  }
 else   if (alts[0].getSeq() != null) {
    for (int i=0; i < alts.length; i++) {
      if (REF.length() == 1 && alts[i].length() == 1) {
      }
 else       if (REF.length() == 0 || alts[i].length() == 0) {
        log.warn("String_Node_Str");
        log.warn(line);
        return null;
      }
    }
    while (REF.length() > 0) {
      boolean same=true;
      for (int i=0; i < alts.length; i++) {
        if (alts[i].length() == 0 || REF.charAt(0) != alts[i].byteAt(0)) {
          same=false;
          break;
        }
      }
      if (same) {
        pos++;
        deletedReference=String.valueOf(REF.charAt(0));
        REF=REF.substring(1);
        for (int i=0; i < alts.length; i++) {
          alts[i].setSeq(new FlexSeq(alts[i].getSeq().substring(1)));
        }
      }
 else {
        break;
      }
    }
    if (REF.length() > 0) {
      int referenceAlleleLength=REF.length();
      int minClipLength=Integer.MAX_VALUE;
      for (int i=0; i < alts.length; i++) {
        int alternativeAlleleLength=alts[i].length();
        int clipLength=0;
        for (int j=0; j < alternativeAlleleLength; j++) {
          if (referenceAlleleLength <= j) {
            clipLength=j;
            break;
          }
          if (REF.charAt(referenceAlleleLength - j - 1) != alts[i].byteAt(alternativeAlleleLength - j - 1)) {
            clipLength=j;
            break;
          }
          clipLength=j + 1;
        }
        if (minClipLength > clipLength) {
          minClipLength=clipLength;
        }
      }
      if (minClipLength > 0) {
        REF=REF.substring(0,Math.max(0,referenceAlleleLength - minClipLength));
        for (int i=0; i < alts.length; i++) {
          alts[i].setSeq(new FlexSeq(alts[i].getSeq().substring(0,Math.max(0,alts[i].length() - minClipLength))));
        }
      }
    }
    byte[] refs=new byte[REF.length()];
    for (int i=0; i < REF.length(); i++) {
      refs[i]=(byte)REF.charAt(i);
    }
    return new Variant.Builder().chr(chr).pos(pos).referenceAlleleLength(refs.length).ref(refs).alts(alts).phase(genotypeArray).isPhased(isGenotypePhased).varId(variantId).filter(FILTER).refDeleted(deletedReference).randomNumberGenerator(random).build();
  }
 else {
    log.warn("String_Node_Str" + line);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * takes a line from a VCF file, parse it, return a Variant object right now the meta-info lines (beginning with ##) are not tied with data line parsing. This will be corrected in the future (perhaps with help of HTSJDK).
 * @param line
 * @return
 */
public Variant processLine(String line) throws UnexpectedException {
  Iterable<String> toks=Splitter.on('\t').split(line);
  if (line.startsWith("String_Node_Str")) {
    if (sampleId != null && line.startsWith("String_Node_Str")) {
      chromLineSeen=true;
      int index=0;
      for (      String tok : toks) {
        index++;
        if (tok.equals(sampleId))         sampleIndex=index;
      }
    }
 else     if (sampleId == null) {
      sampleIndex=10;
    }
    return null;
  }
  if (sampleIndex < 0 && !chromLineSeen) {
    sampleIndex=10;
  }
 else   if (sampleIndex < 0) {
    sampleIndex=10;
    log.warn("String_Node_Str" + sampleId + "String_Node_Str");
  }
  int index=0, genotypeIndex=-1, copyNumberIndex=-1;
  int pos=-1;
  ChrString chr=null;
  String REF="String_Node_Str", FILTER="String_Node_Str", ALT="String_Node_Str", variantId="String_Node_Str";
  String phase="String_Node_Str", copyNumber="String_Node_Str", infoString="String_Node_Str", FORMAT;
  String[] sampleInfo;
  for (  String tok : toks) {
    index++;
    if (index == 1) {
      chr=new ChrString(tok);
    }
 else     if (index == 2)     pos=Integer.parseInt(tok);
 else     if (index == 3)     variantId=tok;
 else     if (index == 4)     REF=tok;
 else     if (index == 5)     ALT=tok;
 else     if (index == 7)     FILTER=tok;
 else     if (index == 8)     infoString=tok;
 else     if (index == 9) {
      FORMAT=tok;
      genotypeIndex=getFormatKeyIndex(FORMAT,"String_Node_Str");
      copyNumberIndex=getFormatKeyIndex(FORMAT,"String_Node_Str");
    }
 else     if (index == sampleIndex) {
      sampleInfo=tok.split("String_Node_Str");
      if (genotypeIndex >= 0) {
        phase=sampleInfo[genotypeIndex];
      }
      if (copyNumberIndex >= 0) {
        copyNumber=sampleInfo[copyNumberIndex];
      }
      break;
    }
  }
  if (chr == null) {
    log.warn("String_Node_Str" + line);
    return null;
  }
  if (isPassFilterRequired && !(FILTER.contains("String_Node_Str") || FILTER.equals(DEFAULT_FILTER))) {
    return null;
  }
  byte[] genotypeArray=new byte[2];
  boolean isGenotypePhased=isPhased(phase,genotypeArray,chr);
  if (genotypeIndex >= 0 && genotypeArray[0] == 0 && genotypeArray[1] == 0) {
  }
  byte[] copyNumberArray=new byte[2];
  boolean isCopyNumberPhased;
  if (copyNumberIndex >= 0) {
    isCopyNumberPhased=isPhased(copyNumber,copyNumberArray,chr);
    if (isCopyNumberPhased != isGenotypePhased) {
      log.error("String_Node_Str");
      log.error(line);
      return null;
    }
  }
  REF=REF.toUpperCase();
  ALT=ALT.toUpperCase();
  String deletedReference="String_Node_Str";
  VCFInfo info=new VCFInfo(infoString);
  if (ALT.indexOf('<') != -1) {
    String[] alternativeAlleles=ALT.split("String_Node_Str");
    int[] svlen=info.getValue("String_Node_Str",int[].class);
    if (alternativeAlleles.length != svlen.length) {
      throw new IllegalArgumentException("String_Node_Str" + line);
    }
    for (int i=0; i < alternativeAlleles.length; i++) {
      if (!alternativeAlleles[i].startsWith("String_Node_Str")) {
        throw new IllegalArgumentException("String_Node_Str" + line);
      }
    }
  }
  Alt[] alts=string2Alt(ALT);
  if (alts[0].getSymbolicAllele() != null) {
    int[] end=info.getValue("String_Node_Str",int[].class);
    int[] svlen=info.getValue("String_Node_Str",int[].class);
    int[] end2=info.getValue("String_Node_Str",int[].class);
    int[] pos2=info.getValue("String_Node_Str",int[].class);
    Boolean isinv=info.getValue("String_Node_Str",Boolean.class);
    String[] traid=info.getValue("String_Node_Str",String[].class);
    String[] chr2=info.getValue("String_Node_Str",String[].class);
    deletedReference=REF;
    byte[] refs=new byte[0];
    pos++;
    if (Alt.SVType.SVSubtype.TRA.equals(alts[0].getSymbolicAllele().getMinor())) {
      if (traid == null || traid.length == 0) {
        throw new IllegalArgumentException("String_Node_Str" + line);
      }
    }
    if (alts[0].getSymbolicAllele().getMajor() == Alt.SVType.INV) {
      if (svlen.length > 0) {
        for (int i=0; i < svlen.length; i++) {
          int alternativeAlleleLength=Math.max(Math.abs(svlen[i]),1);
          alts[i].setSeq(new FlexSeq(FlexSeq.Type.INV,alternativeAlleleLength));
        }
        return new Variant.Builder().chr(chr).pos(pos).referenceAlleleLength(Math.abs(svlen[0])).ref(refs).alts(alts).phase(genotypeArray).isPhased(isGenotypePhased).varId(variantId).filter(FILTER).refDeleted(deletedReference).randomNumberGenerator(random).build();
      }
 else       if (end != null && end.length > 0 && end[0] > 0) {
        int alternativeAlleleLength=Math.max(Math.abs(end[0] - pos + 1),1);
        alts[0].setSeq(new FlexSeq(FlexSeq.Type.INV,alternativeAlleleLength));
        return new Variant.Builder().chr(chr).pos(pos).referenceAlleleLength(alternativeAlleleLength).ref(refs).alts(alts).phase(genotypeArray).isPhased(isGenotypePhased).varId(variantId).filter(FILTER).refDeleted(deletedReference).randomNumberGenerator(random).build();
      }
 else {
        log.error("String_Node_Str");
        log.error(line);
        log.error("String_Node_Str");
        return null;
      }
    }
 else     if (alts[0].getSymbolicAllele().getMajor() == Alt.SVType.DUP && ((alts[0].getSymbolicAllele().getMinor() != Alt.SVType.SVSubtype.TRA && alts[0].getSymbolicAllele().getMinor() != Alt.SVType.SVSubtype.ISP && info.getValue("String_Node_Str",getType("String_Node_Str")) == null) || alts[0].getSymbolicAllele().getMinor() == Alt.SVType.SVSubtype.TANDEM)) {
      if (svlen.length > 0) {
        for (int i=0; i < svlen.length; i++) {
          int currentCopyNumber=1;
          for (int j=0; j < 2; j++) {
            if ((i + 1) == genotypeArray[j]) {
              if (copyNumberArray[j] > 0) {
                currentCopyNumber=copyNumberArray[j];
              }
            }
          }
          int alternativeAlleleLength=Math.max(Math.abs(svlen[i]),1);
          alts[i].setSeq(new FlexSeq(FlexSeq.Type.TANDEM_DUP,alternativeAlleleLength,currentCopyNumber));
        }
        return new Variant.Builder().chr(chr).pos(pos).referenceAlleleLength(Math.abs(svlen[0])).ref(refs).alts(alts).phase(genotypeArray).isPhased(isGenotypePhased).varId(variantId).filter(FILTER).refDeleted(deletedReference).randomNumberGenerator(random).build();
      }
 else       if (end != null && end.length > 0 && end[0] > 0) {
        int alternativeAlleleLength=Math.max(Math.abs(end[0] - pos + 1),1);
        alts[0].setSeq(new FlexSeq(FlexSeq.Type.TANDEM_DUP,alternativeAlleleLength,Math.max(copyNumberArray[0],copyNumberArray[1])));
        return new Variant.Builder().chr(chr).pos(pos).referenceAlleleLength(alternativeAlleleLength).ref(refs).alts(alts).phase(genotypeArray).isPhased(isGenotypePhased).varId(variantId).filter(FILTER).refDeleted(deletedReference).randomNumberGenerator(random).build();
      }
 else {
        log.error("String_Node_Str");
        log.error(line);
        log.error("String_Node_Str");
        return null;
      }
    }
 else     if (alts[0].getSymbolicAllele().getMajor() == Alt.SVType.INS) {
      if (svlen.length > 0) {
        for (int i=0; i < svlen.length; i++) {
          int alternativeAlleleLength=svlen[i] == 0 ? Integer.MAX_VALUE : Math.max(Math.abs(svlen[i]),1);
          alts[i].setSeq(new FlexSeq(FlexSeq.Type.INS,alternativeAlleleLength));
        }
        return new Variant.Builder().chr(chr).pos(pos).referenceAlleleLength(0).ref(refs).alts(alts).phase(genotypeArray).isPhased(isGenotypePhased).varId(variantId).filter(FILTER).refDeleted(deletedReference).randomNumberGenerator(random).build();
      }
 else       if (end != null && end.length > 0 && end[0] > 0) {
        int alternativeAlleleLength=Math.max(Math.abs(end[0] - pos),1);
        alts[0].setSeq(new FlexSeq(FlexSeq.Type.INS,alternativeAlleleLength));
        return new Variant.Builder().chr(chr).pos(pos).referenceAlleleLength(0).ref(refs).alts(alts).phase(genotypeArray).isPhased(isGenotypePhased).varId(variantId).filter(FILTER).refDeleted(deletedReference).randomNumberGenerator(random).build();
      }
 else {
        log.error("String_Node_Str");
        log.error(line);
        log.error("String_Node_Str");
        return null;
      }
    }
 else     if (alts[0].getSymbolicAllele().getMajor() == Alt.SVType.DEL) {
      Variant.Builder template=new Variant.Builder().chr(chr).pos(pos).ref(refs).phase(genotypeArray).isPhased(isGenotypePhased).varId(variantId).filter(FILTER).refDeleted(deletedReference).randomNumberGenerator(random).traid(traid == null ? null : traid[0]);
      if (svlen.length > 0) {
        for (int i=0; i < svlen.length; i++) {
          if (Alt.SVType.SVSubtype.TRA == alts[i].getSymbolicAllele().getMinor()) {
            alts[i].setSeq(new FlexSeq(FlexSeq.Type.TRA_DEL,svlen[i]));
          }
 else {
            alts[i].setSeq(new FlexSeq(FlexSeq.Type.DEL,0));
          }
        }
        return template.alts(alts).referenceAlleleLength(Math.abs(svlen[0])).build();
      }
 else       if (end != null && end.length > 0 && end[0] > 0) {
        int alternativeAlleleLength=end[0] - pos + 1;
        if (Alt.SVType.SVSubtype.TRA == alts[0].getSymbolicAllele().getMinor()) {
          alts[0].setSeq(new FlexSeq(FlexSeq.Type.TRA_DEL,-alternativeAlleleLength));
        }
 else {
          alts[0].setSeq(new FlexSeq(FlexSeq.Type.DEL,0));
        }
        return template.alts(alts).referenceAlleleLength(alternativeAlleleLength).build();
      }
 else {
        log.error("String_Node_Str");
        log.error(line);
        log.error("String_Node_Str");
        return null;
      }
    }
 else     if (alts[0].getSymbolicAllele().getMajor() == Alt.SVType.DUP && (alts[0].getSymbolicAllele().getMinor() == Alt.SVType.SVSubtype.TRA || alts[0].getSymbolicAllele().getMinor() == Alt.SVType.SVSubtype.ISP || info.getValue("String_Node_Str",getType("String_Node_Str")) != null)) {
      if (svlen.length > 0) {
        for (int altAlleleIndex=1; altAlleleIndex <= svlen.length; altAlleleIndex++) {
          int currentCopyNumber=1;
          if (altAlleleIndex == genotypeArray[0]) {
            currentCopyNumber=copyNumberArray[0];
          }
          if (altAlleleIndex == genotypeArray[1]) {
            currentCopyNumber=copyNumberArray[1];
          }
          currentCopyNumber=Math.max(1,currentCopyNumber);
          int altAllelelength=Math.max(Math.abs(svlen[altAlleleIndex - 1]),1);
          alts[altAlleleIndex - 1].setSeq(new FlexSeq(alts[altAlleleIndex - 1].getSymbolicAllele().getMinor() == Alt.SVType.SVSubtype.TRA ? FlexSeq.Type.TRA_DUP : FlexSeq.Type.ISP_DUP,altAllelelength,currentCopyNumber));
        }
        for (int i=1; i < svlen.length; i++) {
          if (svlen[i] != svlen[0]) {
            throw new IllegalArgumentException("String_Node_Str" + line);
          }
        }
        return new Variant.Builder().chr(chr).pos(pos).referenceAlleleLength(Math.abs(0)).ref(refs).alts(alts).phase(genotypeArray).isPhased(isGenotypePhased).varId(variantId).filter(FILTER).refDeleted(deletedReference).randomNumberGenerator(random).chr2(ChrString.string2ChrString(chr2)).pos2(pos2).end2(end2).isinv(isinv).traid(traid == null ? null : traid[0]).build();
      }
 else {
        log.error("String_Node_Str");
        log.error(line);
        log.error("String_Node_Str");
        return null;
      }
    }
 else {
      log.warn("String_Node_Str" + line);
      return null;
    }
  }
 else   if (alts[0].getSeq() != null) {
    for (int i=0; i < alts.length; i++) {
      if (REF.length() == 1 && alts[i].length() == 1) {
      }
 else       if (REF.length() == 0 || alts[i].length() == 0) {
        log.warn("String_Node_Str");
        log.warn(line);
        return null;
      }
    }
    while (REF.length() > 0) {
      boolean same=true;
      for (int i=0; i < alts.length; i++) {
        if (alts[i].length() == 0 || REF.charAt(0) != alts[i].byteAt(0)) {
          same=false;
          break;
        }
      }
      if (same) {
        pos++;
        deletedReference=String.valueOf(REF.charAt(0));
        REF=REF.substring(1);
        for (int i=0; i < alts.length; i++) {
          alts[i].setSeq(new FlexSeq(alts[i].getSeq().substring(1)));
        }
      }
 else {
        break;
      }
    }
    if (REF.length() > 0) {
      int referenceAlleleLength=REF.length();
      int minClipLength=Integer.MAX_VALUE;
      for (int i=0; i < alts.length; i++) {
        int alternativeAlleleLength=alts[i].length();
        int clipLength=0;
        for (int j=0; j < alternativeAlleleLength; j++) {
          if (referenceAlleleLength <= j) {
            clipLength=j;
            break;
          }
          if (REF.charAt(referenceAlleleLength - j - 1) != alts[i].byteAt(alternativeAlleleLength - j - 1)) {
            clipLength=j;
            break;
          }
          clipLength=j + 1;
        }
        if (minClipLength > clipLength) {
          minClipLength=clipLength;
        }
      }
      if (minClipLength > 0) {
        REF=REF.substring(0,Math.max(0,referenceAlleleLength - minClipLength));
        for (int i=0; i < alts.length; i++) {
          alts[i].setSeq(new FlexSeq(alts[i].getSeq().substring(0,Math.max(0,alts[i].length() - minClipLength))));
        }
      }
    }
    byte[] refs=new byte[REF.length()];
    for (int i=0; i < REF.length(); i++) {
      refs[i]=(byte)REF.charAt(i);
    }
    return new Variant.Builder().chr(chr).pos(pos).referenceAlleleLength(refs.length).ref(refs).alts(alts).phase(genotypeArray).isPhased(isGenotypePhased).varId(variantId).filter(FILTER).refDeleted(deletedReference).randomNumberGenerator(random).build();
  }
 else {
    log.warn("String_Node_Str" + line);
  }
  return null;
}