public static List < List < Integer > > buildSymmetryGraph ( List < AFPChain > afps , Atom [ ] atoms , boolean undirected ) { List < List < Integer >> graph = new ArrayList < List < Integer > > ( ) ; for ( int n = 0 ; n < atoms . length ; n ++ ) { graph . add ( new ArrayList < Integer > ( ) ) ; } for ( int k = 0 ; k < afps . size ( ) ; k ++ ) { for ( int i = 0 ; i < afps . get ( k ) . getOptAln ( ) . length ; i ++ ) { for ( int j = 0 ; j < afps . get ( k ) . getOptAln ( ) [ i ] [ 0 ] . length ; j ++ ) { Integer res1 = afps . get ( k ) . getOptAln ( ) [ i ] [ 0 ] [ j ] ; Integer res2 = afps . get ( k ) . getOptAln ( ) [ i ] [ 1 ] [ j ] ; graph . get ( res1 ) . add ( res2 ) ; if ( undirected ) graph . get ( res2 ) . add ( res1 ) ; } } } return graph ; }
Converts a set of AFP alignments into a Graph of aligned residues where each vertex is a residue and each edge means the connection between the two residues in one of the alignments .