X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fschemes%2FResidueProperties.java;h=7ad35c3200b2d6d9ef4aa21c90004e2797107de1;hb=7bb1887834cefc1a39ffd5b034b77c7984a13009;hp=bf30ed6175223d7488e179d476817cd35a1070a6;hpb=a97dbd3e6e9707de13f47c66beaa15df8ea24d0e;p=jalview.git diff --git a/src/jalview/schemes/ResidueProperties.java b/src/jalview/schemes/ResidueProperties.java index bf30ed6..7ad35c3 100755 --- a/src/jalview/schemes/ResidueProperties.java +++ b/src/jalview/schemes/ResidueProperties.java @@ -20,6 +20,8 @@ */ package jalview.schemes; +import java.util.Locale; + import jalview.analysis.GeneticCodes; import java.awt.Color; @@ -405,6 +407,125 @@ public class ResidueProperties Color.white // ' ' }; + /* + * flower, blossom, sunset, ocean colour schemes from geocos. + * See https://gecos.biotite-python.org/ + * https://raw.githubusercontent.com/biotite-dev/biotite/master/src/biotite/sequence/graphics/color_schemes/flower.json + * and https://bmcbioinformatics.biomedcentral.com/articles/10.1186/s12859-020-3526-6 + * (https://doi.org/10.1186/s12859-020-3526-6) + */ + public static final Color[] flower = { new Color(177, 138, 81), // A + new Color(131, 191, 241), // R + new Color(11, 206, 198), // N + new Color(1, 165, 120), // D + new Color(255, 87, 1), // C + new Color(114, 149, 174), // Q + new Color(45, 160, 161), // E + new Color(177, 194, 60), // G + new Color(1, 148, 249), // H + new Color(242, 118, 99), // I + new Color(223, 110, 117), // L + new Color(127, 195, 215), // K + new Color(254, 157, 175), // M + new Color(250, 85, 157), // F + new Color(79, 163, 42), // P + new Color(180, 189, 155), // S + new Color(210, 181, 118), // T + new Color(255, 45, 237), // W + new Color(201, 110, 207), // Y + new Color(253, 153, 123), // V + Color.white, // B + Color.white, // Z + Color.white, // X + Color.white, // - + Color.white, // * + Color.white // . + }; + + public static final Color[] blossom = { new Color(139, 196, 180), // A + new Color(252, 149, 2), // R + new Color(181, 194, 6), // N + new Color(95, 165, 5), // D + new Color(8, 147, 254), // C + new Color(191, 133, 39), // Q + new Color(219, 181, 1), // E + new Color(0, 211, 130), // G + new Color(255, 87, 1), // H + new Color(154, 186, 243), // I + new Color(205, 165, 220), // L + new Color(254, 165, 39), // K + new Color(245, 161, 184), // M + new Color(247, 79, 168), // F + new Color(16, 214, 49), // P + new Color(126, 157, 89), // S + new Color(0, 162, 156), // T + new Color(254, 8, 251), // W + new Color(255, 78, 122), // Y + new Color(135, 192, 228), // V + Color.white, // B + Color.white, // Z + Color.white, // X + Color.white, // - + Color.white, // * + Color.white // . + }; + + public static final Color[] sunset = { new Color(254, 160, 253), // A + new Color(133, 116, 106), // R + new Color(171, 200, 245), // N + new Color(46, 123, 190), // D + new Color(252, 12, 254), // C + new Color(140, 110, 129), // Q + new Color(103, 120, 146), // E + new Color(39, 153, 255), // G + new Color(219, 197, 142), // H + new Color(250, 33, 161), // I + new Color(224, 30, 130), // L + new Color(222, 190, 204), // K + new Color(209, 62, 123), // M + new Color(255, 56, 93), // F + new Color(87, 102, 249), // P + new Color(231, 180, 253), // S + new Color(166, 88, 183), // T + new Color(255, 55, 1), // W + new Color(203, 83, 57), // Y + new Color(254, 81, 184), // V + Color.white, // B + Color.white, // Z + Color.white, // X + Color.white, // - + Color.white, // * + Color.white // . + }; + + public static final Color[] ocean = { new Color(198, 202, 155), // A + new Color(12, 160, 168), // R + new Color(10, 223, 195), // N + new Color(76, 223, 161), // D + new Color(198, 129, 54), // C + new Color(139, 211, 209), // Q + new Color(96, 218, 201), // E + new Color(51, 165, 81), // G + new Color(0, 207, 254), // H + new Color(242, 186, 170), // I + new Color(187, 138, 131), // L + new Color(64, 160, 144), // K + new Color(164, 139, 136), // M + new Color(171, 136, 174), // F + new Color(175, 211, 101), // P + new Color(109, 155, 116), // S + new Color(141, 149, 102), // T + new Color(117, 138, 238), // W + new Color(186, 195, 252), // Y + new Color(233, 190, 164), // V + Color.white, // B + Color.white, // Z + Color.white, // X + Color.white, // - + Color.white, // * + Color.white // . + }; + // Dunno where I got these numbers from public static final double[] hyd2 = { 0.62, // A 0.29, // R @@ -500,7 +621,8 @@ public class ResidueProperties public static String STOP = "STOP"; - public static List STOP_CODONS = Arrays.asList("TGA", "TAA", "TAG"); + public static List STOP_CODONS = Arrays.asList("TGA", "TAA", + "TAG"); public static String START = "ATG"; @@ -905,47 +1027,51 @@ public class ResidueProperties return peptide; } - public static Hashtable toDssp3State; + /* + * lookup of (A-Z) alternative secondary structure symbols' + * equivalents in DSSP3 notation + */ + private static char[] toDssp3State; static { - toDssp3State = new Hashtable<>(); - toDssp3State.put("H", "H"); - toDssp3State.put("E", "E"); - toDssp3State.put("C", " "); - toDssp3State.put(" ", " "); - toDssp3State.put("T", " "); - toDssp3State.put("B", "E"); - toDssp3State.put("G", "H"); - toDssp3State.put("I", "H"); - toDssp3State.put("X", " "); + toDssp3State = new char[9]; // for 'A'-'I'; extend if needed + Arrays.fill(toDssp3State, ' '); + toDssp3State['B' - 'A'] = 'E'; + toDssp3State['E' - 'A'] = 'E'; + toDssp3State['G' - 'A'] = 'H'; + toDssp3State['H' - 'A'] = 'H'; + toDssp3State['I' - 'A'] = 'H'; } /** * translate from other dssp secondary structure alphabets to 3-state * - * @param ssstring - * @return ssstring as a three-state secondary structure assignment. + * @param ssString + * @return ssstring */ - public static String getDssp3state(String ssstring) + public static String getDssp3state(String ssString) { - if (ssstring == null) + if (ssString == null) { return null; } - StringBuffer ss = new StringBuffer(); - for (int i = 0; i < ssstring.length(); i++) + int lookupSize = toDssp3State.length; + int len = ssString.length(); + char[] trans = new char[len]; + for (int i = 0; i < len; i++) { - String ssc = ssstring.substring(i, i + 1); - if (toDssp3State.containsKey(ssc)) + char c = ssString.charAt(i); + int index = c - 'A'; + if (index < 0 || index >= lookupSize) { - ss.append(toDssp3State.get(ssc)); + trans[i] = ' '; } else { - ss.append(" "); + trans[i] = toDssp3State[index]; } } - return ss.toString(); + return new String(trans); } static @@ -2274,6 +2400,10 @@ public class ResidueProperties // main method generates perl representation of residue property hash // / cut here + /** + * @j2sIgnore + * @param args + */ public static void main(String[] args) { Hashtable> aaProps = new Hashtable<>(); @@ -2339,7 +2469,7 @@ public class ResidueProperties { continue; } - nuc = nuc.toUpperCase(); + nuc = nuc.toUpperCase(Locale.ROOT); if (!result.contains(nuc)) { result.add(nuc); @@ -2358,7 +2488,7 @@ public class ResidueProperties { continue; } - res = res.toUpperCase(); + res = res.toUpperCase(Locale.ROOT); if (!result.contains(res)) { result.add(res); @@ -2383,7 +2513,7 @@ public class ResidueProperties return '0'; } Integer index = ResidueProperties.aa3Hash - .get(threeLetterCode.toUpperCase()); + .get(threeLetterCode.toUpperCase(Locale.ROOT)); return index == null ? '0' : aa[index].charAt(0); } }