public static String reverseComplement(final String seq){
  final StringBuilder sb=new StringBuilder();
  for (int i=seq.length() - 1; i >= 0; i--) {
    final char c=seq.charAt(i);
switch (c) {
case 'a':
      sb.append('t');
    break;
case 'A':
  sb.append('T');
break;
case 'c':
sb.append('g');
break;
case 'C':
sb.append('G');
break;
case 'g':
sb.append('c');
break;
case 'G':
sb.append('C');
break;
case 't':
sb.append('a');
break;
case 'T':
sb.append('A');
break;
case '-':
break;
default :
sb.append(c);
break;
}
}
return sb.toString();
}

public static String reverseComplement ( final String seq ) { final StringBuilder sb = new StringBuilder ( ) ; for ( int i = seq . length ( ) - 1 ; i >= 0 ; i -- ) { final char c = seq . charAt ( i ) ; switch ( c ) { case 'a' : sb . append ( 't' ) ; break ; case 'A' : sb . append ( 'T' ) ; break ; case 'c' : sb . append ( 'g' ) ; break ; case 'C' : sb . append ( 'G' ) ; break ; case 'g' : sb . append ( 'c' ) ; break ; case 'G' : sb . append ( 'C' ) ; break ; case 't' : sb . append ( 'a' ) ; break ; case 'T' : sb . append ( 'A' ) ; break ; case '-' : break ; default : sb . append ( c ) ; break ; } } return sb . toString ( ) ; }
take reverse complement of a string .
