X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fschemes%2FResidueProperties.java;h=60fd25cbeb022e72c8500dcc38eaa3c29e5f6c63;hb=4306800413a28da102c15fe7301bcac7816445fe;hp=4a56fbc507717d84d44e16d60cb852a6c45b90bd;hpb=56c4fb001c142a23664c2b595b8d3967e69f0fa6;p=jalview.git diff --git a/src/jalview/schemes/ResidueProperties.java b/src/jalview/schemes/ResidueProperties.java index 4a56fbc..60fd25c 100755 --- a/src/jalview/schemes/ResidueProperties.java +++ b/src/jalview/schemes/ResidueProperties.java @@ -48,11 +48,8 @@ public class ResidueProperties // lookup from modified amino acid (e.g. MSE) to canonical form (e.g. MET) public static final Map modifications = new HashMap<>(); - // amino acid background Frequencies - public static final Map aminoBackgroundFrequencies = new HashMap<>(); - - // nucleotide background Frequencies - public static final Map nucleotideBackgroundFrequencies = new HashMap<>(); + // residue background frequencies across different alphabets + public static final Map> backgroundFrequencies = new HashMap<>(); static { @@ -369,8 +366,11 @@ public class ResidueProperties }; // Added for PurinePyrimidineColourScheme - public static final Color[] purinepyrimidine = { - new Color(255, 131, 250), // A, G, R purines purplish/orchid + public static final Color[] purinepyrimidine = { new Color(255, 131, 250), // A, + // G, + // R + // purines + // purplish/orchid new Color(64, 224, 208), // C,U, T, Y pyrimidines turquoise Color.white, // all other nucleotides Color.white // Gap @@ -385,7 +385,7 @@ public class ResidueProperties Color.green, // Q Color.red, // E Color.magenta, // G - midBlue,// Color.red, // H + midBlue, // Color.red, // H Color.pink, // I Color.pink, // L midBlue, // K @@ -432,9 +432,9 @@ public class ResidueProperties 0.0 // X }; - public static final double[] helix = { 1.42, 0.98, 0.67, 1.01, 0.70, - 1.11, 1.51, 0.57, 1.00, 1.08, 1.21, 1.16, 1.45, 1.13, 0.57, 0.77, - 0.83, 1.08, 0.69, 1.06, 0.84, 1.31, 1.00, 0.0 }; + public static final double[] helix = { 1.42, 0.98, 0.67, 1.01, 0.70, 1.11, + 1.51, 0.57, 1.00, 1.08, 1.21, 1.16, 1.45, 1.13, 0.57, 0.77, 0.83, + 1.08, 0.69, 1.06, 0.84, 1.31, 1.00, 0.0 }; public static final double helixmin = 0.57; @@ -456,9 +456,9 @@ public class ResidueProperties public static final double turnmax = 1.56; - public static final double[] buried = { 1.7, 0.1, 0.4, 0.4, 4.6, 0.3, - 0.3, 1.8, 0.8, 3.1, 2.4, 0.05, 1.9, 2.2, 0.6, 0.8, 0.7, 1.6, 0.5, - 2.9, 0.4, 0.3, 1.358, 0.00 }; + public static final double[] buried = { 1.7, 0.1, 0.4, 0.4, 4.6, 0.3, 0.3, + 1.8, 0.8, 3.1, 2.4, 0.05, 1.9, 2.2, 0.6, 0.8, 0.7, 1.6, 0.5, 2.9, 0.4, + 0.3, 1.358, 0.00 }; public static final double buriedmin = 0.05; @@ -499,7 +499,9 @@ public class ResidueProperties * Color.white, // R Color.white, // Y Color.white, // N Color.white, // Gap */ - public static List STOP = Arrays.asList("TGA", "TAA", "TAG"); + public static String STOP = "STOP"; + + public static List STOP_CODONS = Arrays.asList("TGA", "TAA", "TAG"); public static String START = "ATG"; @@ -649,16 +651,16 @@ public class ResidueProperties } else { - System.err - .println("Inconsistency in the IUBMB ambiguity code nomenclature table: collision for " + System.err.println( + "Inconsistency in the IUBMB ambiguity code nomenclature table: collision for " + acode.getKey() + " in residue " + r); } } } // and programmatically add in the ambiguity codes that yield the same amino // acid - String[] unambcodons = codonHash2.keySet().toArray( - new String[codonHash2.size()]); + String[] unambcodons = codonHash2.keySet() + .toArray(new String[codonHash2.size()]); for (String codon : unambcodons) { String residue = codonHash2.get(codon); @@ -677,7 +679,8 @@ public class ResidueProperties } } // enumerate all combinations and test for veracity of translation - int tpos[] = new int[codon.length()], cpos[] = new int[codon.length()]; + int tpos[] = new int[codon.length()], + cpos[] = new int[codon.length()]; for (int i = 0; i < tpos.length; i++) { tpos[i] = -1; @@ -930,7 +933,7 @@ public class ResidueProperties charged.put("Q", ZERO); charged.put("D", ONE); charged.put("N", ZERO); // Asparagine is polar but not - // charged. + // charged. // Alternative would be charged and // negative (in basic form)? charged.put("S", ZERO); @@ -1059,7 +1062,9 @@ public class ResidueProperties } static { - int[][] propMatrixF = new int[maxProteinIndex][maxProteinIndex], propMatrixPos = new int[maxProteinIndex][maxProteinIndex], propMatrixEpos = new int[maxProteinIndex][maxProteinIndex]; + int[][] propMatrixF = new int[maxProteinIndex][maxProteinIndex], + propMatrixPos = new int[maxProteinIndex][maxProteinIndex], + propMatrixEpos = new int[maxProteinIndex][maxProteinIndex]; for (int i = 0; i < maxProteinIndex; i++) { int maxF = 0, maxP = 0, maxEP = 0; @@ -1149,7 +1154,7 @@ public class ResidueProperties String cdn = codonHash2.get(lccodon.toUpperCase()); if ("*".equals(cdn)) { - return "STOP"; + return STOP; } return cdn; } @@ -2517,35 +2522,53 @@ public class ResidueProperties static { - aminoBackgroundFrequencies.put('A', 0.0826f); - aminoBackgroundFrequencies.put('Q', 0.0393f); - aminoBackgroundFrequencies.put('L', 0.0965f); - aminoBackgroundFrequencies.put('S', 0.0661f); - aminoBackgroundFrequencies.put('R', 0.0553f); - aminoBackgroundFrequencies.put('E', 0.0674f); - aminoBackgroundFrequencies.put('K', 0.0582f); - aminoBackgroundFrequencies.put('T', 0.0535f); - aminoBackgroundFrequencies.put('N', 0.0406f); - aminoBackgroundFrequencies.put('G', 0.0708f); - aminoBackgroundFrequencies.put('M', 0.0241f); - aminoBackgroundFrequencies.put('W', 0.0109f); - aminoBackgroundFrequencies.put('D', 0.0546f); - aminoBackgroundFrequencies.put('H', 0.0227f); - aminoBackgroundFrequencies.put('F', 0.0386f); - aminoBackgroundFrequencies.put('Y', 0.0292f); - aminoBackgroundFrequencies.put('C', 0.0137f); - aminoBackgroundFrequencies.put('I', 0.0593f); - aminoBackgroundFrequencies.put('P', 0.0472f); - aminoBackgroundFrequencies.put('V', 0.0686f); + Map amino = new HashMap<>(); + amino.put('A', 0.0826f); + amino.put('Q', 0.0393f); + amino.put('L', 0.0965f); + amino.put('S', 0.0661f); + amino.put('R', 0.0553f); + amino.put('E', 0.0674f); + amino.put('K', 0.0582f); + amino.put('T', 0.0535f); + amino.put('N', 0.0406f); + amino.put('G', 0.0708f); + amino.put('M', 0.0241f); + amino.put('W', 0.0109f); + amino.put('D', 0.0546f); + amino.put('H', 0.0227f); + amino.put('F', 0.0386f); + amino.put('Y', 0.0292f); + amino.put('C', 0.0137f); + amino.put('I', 0.0593f); + amino.put('P', 0.0472f); + amino.put('V', 0.0686f); + backgroundFrequencies.put("amino", amino); + // todo: these don't match https://www.ebi.ac.uk/uniprot/TrEMBLstats - what + // are they? + } + + // TODO get correct frequencies + + static + { + Map dna = new HashMap<>(); + dna.put('A', 0.25f); + dna.put('C', 0.25f); + dna.put('T', 0.25f); + dna.put('G', 0.25f); + backgroundFrequencies.put("DNA", dna); } static { - nucleotideBackgroundFrequencies.put('A', 0.25f); - nucleotideBackgroundFrequencies.put('C', 0.25f); - nucleotideBackgroundFrequencies.put('T', 0.25f); - nucleotideBackgroundFrequencies.put('G', 0.25f); + Map rna = new HashMap<>(); + rna.put('A', 0.25f); + rna.put('C', 0.25f); + rna.put('T', 0.25f); + rna.put('G', 0.25f); + backgroundFrequencies.put("RNA", rna); } @@ -2665,8 +2688,8 @@ public class ResidueProperties { return '0'; } - Integer index = ResidueProperties.aa3Hash.get(threeLetterCode - .toUpperCase()); + Integer index = ResidueProperties.aa3Hash + .get(threeLetterCode.toUpperCase()); return index == null ? '0' : aa[index].charAt(0); } }