+ return counts;
+ }
+
+ final private static HashMap<Character, Integer> calcResidueDistribution21( final Msa msa, final int col ) {
+ final HashMap<Character, Integer> counts = new HashMap<Character, Integer>();
+ for( int row = 0; row < msa.getNumberOfSequences(); ++row ) {
+ final char c = msa.getResidueAt( row, col );
+ if ( !counts.containsKey( c ) ) {
+ counts.put( c, 1 );
+ }
+ else {
+ counts.put( c, 1 + counts.get( c ) );
+ }
+ }
+ return counts;
+ }
+
+ final private static HashMap<Character, Integer> calcResidueDistribution6( final Msa msa, final int col ) {
+ // Residues are classified into one of tex2html_wrap199 types:
+ // aliphatic [AVLIMC], aromatic [FWYH], polar [STNQ], positive [KR], negative [DE],
+ // special conformations [GP] and gaps. This convention follows that
+ // of Mirny & Shakhnovich (1999, J Mol Biol 291:177-196).
+ final HashMap<Character, Integer> counts = new HashMap<Character, Integer>();
+ for( int row = 0; row < msa.getNumberOfSequences(); ++row ) {
+ final char c = msa.getResidueAt( row, col );
+ char x;
+ if ( ( c == 'A' ) || ( c == 'V' ) || ( c == 'L' ) || ( c == 'I' ) || ( c == 'M' ) || ( c == 'C' ) ) {
+ // aliphatic
+ x = 'a';
+ }
+ else if ( ( c == 'F' ) || ( c == 'W' ) || ( c == 'Y' ) || ( c == 'H' ) ) {
+ // aromatic
+ x = 'r';
+ }
+ else if ( ( c == 'S' ) || ( c == 'T' ) || ( c == 'N' ) || ( c == 'Q' ) ) {
+ // polar
+ x = 'p';
+ }
+ else if ( ( c == 'K' ) || ( c == 'R' ) ) {
+ // positive
+ x = 'o';
+ }
+ else if ( ( c == 'D' ) || ( c == 'E' ) ) {
+ // negative
+ x = 'e';
+ }
+ else if ( ( c == 'G' ) || ( c == 'P' ) ) {
+ // aliphatic - special conformation
+ x = 's';
+ }
+ else {
+ continue;
+ }
+ if ( !counts.containsKey( x ) ) {
+ counts.put( x, 1 );
+ }
+ else {
+ counts.put( x, 1 + counts.get( x ) );
+ }
+ }
+ return counts;
+ }
+
+ final private static HashMap<Character, Integer> calcResidueDistribution7( final Msa msa, final int col ) {
+ // Residues are classified into one of tex2html_wrap199 types:
+ // aliphatic [AVLIMC], aromatic [FWYH], polar [STNQ], positive [KR], negative [DE],
+ // special conformations [GP] and gaps. This convention follows that
+ // of Mirny & Shakhnovich (1999, J Mol Biol 291:177-196).
+ final HashMap<Character, Integer> counts = new HashMap<Character, Integer>();
+ for( int row = 0; row < msa.getNumberOfSequences(); ++row ) {
+ final char c = msa.getResidueAt( row, col );
+ char x = '-';
+ if ( ( c == 'A' ) || ( c == 'V' ) || ( c == 'L' ) || ( c == 'I' ) || ( c == 'M' ) || ( c == 'C' ) ) {
+ // aliphatic
+ x = 'a';
+ }
+ else if ( ( c == 'F' ) || ( c == 'W' ) || ( c == 'Y' ) || ( c == 'H' ) ) {
+ // aromatic
+ x = 'r';
+ }
+ else if ( ( c == 'S' ) || ( c == 'T' ) || ( c == 'N' ) || ( c == 'Q' ) ) {
+ // polar
+ x = 'p';
+ }
+ else if ( ( c == 'K' ) || ( c == 'R' ) ) {
+ // positive
+ x = 'o';
+ }
+ else if ( ( c == 'D' ) || ( c == 'E' ) ) {
+ // negative
+ x = 'e';
+ }
+ else if ( ( c == 'G' ) || ( c == 'P' ) ) {
+ // aliphatic - special conformation
+ x = 's';
+ }
+ if ( !counts.containsKey( x ) ) {
+ counts.put( x, 1 );
+ }
+ else {
+ counts.put( x, 1 + counts.get( x ) );
+ }
+ }
+ return counts;