public static Map < Integer , Integer > alignmentAsMap ( AFPChain afpChain ) throws StructureException { Map < Integer , Integer > map = new HashMap < Integer , Integer > ( ) ; if ( afpChain . getAlnLength ( ) < 1 ) { return map ; } int [ ] [ ] [ ] optAln = afpChain . getOptAln ( ) ; int [ ] optLen = afpChain . getOptLen ( ) ; for ( int block = 0 ; block < afpChain . getBlockNum ( ) ; block ++ ) { for ( int pos = 0 ; pos < optLen [ block ] ; pos ++ ) { int res1 = optAln [ block ] [ 0 ] [ pos ] ; int res2 = optAln [ block ] [ 1 ] [ pos ] ; if ( map . containsKey ( res1 ) ) { throw new StructureException ( String . format ( "Residue %d aligned to both %d and %d." , res1 , map . get ( res1 ) , res2 ) ) ; } map . put ( res1 , res2 ) ; } } return map ; }
Creates a Map specifying the alignment as a mapping between residue indices of protein 1 and residue indices of protein 2 .