private String placeBracketsAroundInsertionsInReadSequence(boolean dna2ProteinMode,String refSequence,String readSequence){
  StringBuilder buf=new StringBuilder();
  int readPos=0;
  boolean inInsertion=false;
  for (int i=0; i < refSequence.length() && readPos < readSequence.length(); i++) {
    final boolean isInsertion=(refSequence.charAt(i) == '-' && readSequence.charAt(readPos) != '-');
    if (!inInsertion && isInsertion) {
      buf.append("[");
      inInsertion=true;
    }
    if (inInsertion && !isInsertion) {
      buf.append("]");
      inInsertion=false;
    }
    if (dna2ProteinMode) {
      buf.append(readSequence.charAt(readPos++));
      buf.append(readSequence.charAt(readPos++));
      buf.append(readSequence.charAt(readPos++));
    }
 else     buf.append(readSequence.charAt(readPos++));
  }
  if (inInsertion) {
    buf.append("]");
  }
  return buf.toString();
}

private String placeBracketsAroundInsertionsInReadSequence ( boolean dna2ProteinMode , String refSequence , String readSequence ) { StringBuilder buf = new StringBuilder ( ) ; int readPos = 0 ; boolean inInsertion = false ; for ( int i = 0 ; i < refSequence . length ( ) && readPos < readSequence . length ( ) ; i ++ ) { final boolean isInsertion = ( refSequence . charAt ( i ) == '-' && readSequence . charAt ( readPos ) != '-' ) ; if ( ! inInsertion && isInsertion ) { buf . append ( "[" ) ; inInsertion = true ; } if ( inInsertion && ! isInsertion ) { buf . append ( "]" ) ; inInsertion = false ; } if ( dna2ProteinMode ) { buf . append ( readSequence . charAt ( readPos ++ ) ) ; buf . append ( readSequence . charAt ( readPos ++ ) ) ; buf . append ( readSequence . charAt ( readPos ++ ) ) ; } else buf . append ( readSequence . charAt ( readPos ++ ) ) ; } if ( inInsertion ) { buf . append ( "]" ) ; } return buf . toString ( ) ; }
put brackets around all inserts in the read sequence
