X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fschemes%2FResidueProperties.java;h=60fd25cbeb022e72c8500dcc38eaa3c29e5f6c63;hb=4306800413a28da102c15fe7301bcac7816445fe;hp=55df1d180bf46c70f89ed25f4babdc9109cddcd1;hpb=3d0101179759ef157b088ea135423cd909512d9f;p=jalview.git diff --git a/src/jalview/schemes/ResidueProperties.java b/src/jalview/schemes/ResidueProperties.java index 55df1d1..60fd25c 100755 --- a/src/jalview/schemes/ResidueProperties.java +++ b/src/jalview/schemes/ResidueProperties.java @@ -39,14 +39,17 @@ public class ResidueProperties public static final int[] purinepyrimidineIndex; - public static final Map aa3Hash = new HashMap(); + public static final Map aa3Hash = new HashMap<>(); - public static final Map aa2Triplet = new HashMap(); + public static final Map aa2Triplet = new HashMap<>(); - public static final Map nucleotideName = new HashMap(); + public static final Map nucleotideName = new HashMap<>(); // lookup from modified amino acid (e.g. MSE) to canonical form (e.g. MET) - public static final Map modifications = new HashMap(); + public static final Map modifications = new HashMap<>(); + + // residue background frequencies across different alphabets + public static final Map> backgroundFrequencies = new HashMap<>(); static { @@ -496,25 +499,27 @@ 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"; /** * Nucleotide Ambiguity Codes */ - public static final Map ambiguityCodes = new Hashtable(); + public static final Map ambiguityCodes = new Hashtable<>(); /** * Codon triplets with additional symbols for unambiguous codons that include * ambiguity codes */ - public static final Hashtable codonHash2 = new Hashtable(); + public static final Hashtable codonHash2 = new Hashtable<>(); /** * all ambiguity codes for a given base */ - public final static Hashtable> _ambiguityCodes = new Hashtable>(); + public final static Hashtable> _ambiguityCodes = new Hashtable<>(); static { @@ -638,7 +643,7 @@ public class ResidueProperties List codesfor = _ambiguityCodes.get(r); if (codesfor == null) { - _ambiguityCodes.put(r, codesfor = new ArrayList()); + _ambiguityCodes.put(r, codesfor = new ArrayList<>()); } if (!codesfor.contains(acode.getKey())) { @@ -755,27 +760,27 @@ public class ResidueProperties } // Stores residue codes/names and colours and other things - public static Map> propHash = new Hashtable>(); + public static Map> propHash = new Hashtable<>(); - public static Map hydrophobic = new Hashtable(); + public static Map hydrophobic = new Hashtable<>(); - public static Map polar = new Hashtable(); + public static Map polar = new Hashtable<>(); - public static Map small = new Hashtable(); + public static Map small = new Hashtable<>(); - public static Map positive = new Hashtable(); + public static Map positive = new Hashtable<>(); - public static Map negative = new Hashtable(); + public static Map negative = new Hashtable<>(); - public static Map charged = new Hashtable(); + public static Map charged = new Hashtable<>(); - public static Map aromatic = new Hashtable(); + public static Map aromatic = new Hashtable<>(); - public static Map aliphatic = new Hashtable(); + public static Map aliphatic = new Hashtable<>(); - public static Map tiny = new Hashtable(); + public static Map tiny = new Hashtable<>(); - public static Map proline = new Hashtable(); + public static Map proline = new Hashtable<>(); static { @@ -1149,7 +1154,7 @@ public class ResidueProperties String cdn = codonHash2.get(lccodon.toUpperCase()); if ("*".equals(cdn)) { - return "STOP"; + return STOP; } return cdn; } @@ -1157,7 +1162,7 @@ public class ResidueProperties public static Hashtable toDssp3State; static { - toDssp3State = new Hashtable(); + toDssp3State = new Hashtable<>(); toDssp3State.put("H", "H"); toDssp3State.put("E", "E"); toDssp3State.put("C", " "); @@ -2515,6 +2520,58 @@ public class ResidueProperties } + static + { + 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 + { + 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); + + } + public static String getCanonicalAminoAcid(String aA) { String canonical = modifications.get(aA); @@ -2525,7 +2582,7 @@ public class ResidueProperties // / cut here public static void main(String[] args) { - Hashtable> aaProps = new Hashtable>(); + Hashtable> aaProps = new Hashtable<>(); System.out.println("my %aa = {"); // invert property hashes for (String pname : propHash.keySet()) @@ -2536,7 +2593,7 @@ public class ResidueProperties Vector aprops = aaProps.get(rname); if (aprops == null) { - aprops = new Vector(); + aprops = new Vector<>(); aaProps.put(rname, aprops); } Integer hasprop = phash.get(rname); @@ -2578,7 +2635,7 @@ public class ResidueProperties public static List getResidues(boolean forNucleotide, boolean includeAmbiguous) { - List result = new ArrayList(); + List result = new ArrayList<>(); if (forNucleotide) { for (String nuc : nucleotideName.keySet())