From 6c28874716c83a6337411de97c02a5a087c03123 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Wed, 11 Mar 2015 10:54:30 +0000 Subject: [PATCH] JAL-1421 changed Vector to List for protein-to-codon mappings --- src/jalview/schemes/ResidueProperties.java | 191 ++++++++++++++-------------- 1 file changed, 93 insertions(+), 98 deletions(-) diff --git a/src/jalview/schemes/ResidueProperties.java b/src/jalview/schemes/ResidueProperties.java index c11423c..6cea8f0 100755 --- a/src/jalview/schemes/ResidueProperties.java +++ b/src/jalview/schemes/ResidueProperties.java @@ -633,47 +633,47 @@ public class ResidueProperties public static final float[] pidThresholds = { 80, 60, 40, }; - public static Hashtable codonHash = new Hashtable(); + public static Map> codonHash = new HashMap>(); - public static Vector Lys = new Vector(); + private static List Lys = new ArrayList(); - public static Vector Asn = new Vector(); + private static List Asn = new ArrayList(); - public static Vector Gln = new Vector(); + private static List Gln = new ArrayList(); - public static Vector His = new Vector(); + private static List His = new ArrayList(); - public static Vector Glu = new Vector(); + private static List Glu = new ArrayList(); - public static Vector Asp = new Vector(); + private static List Asp = new ArrayList(); - public static Vector Tyr = new Vector(); + private static List Tyr = new ArrayList(); - public static Vector Thr = new Vector(); + private static List Thr = new ArrayList(); - public static Vector Pro = new Vector(); + private static List Pro = new ArrayList(); - public static Vector Ala = new Vector(); + private static List Ala = new ArrayList(); - public static Vector Ser = new Vector(); + private static List Ser = new ArrayList(); - public static Vector Arg = new Vector(); + private static List Arg = new ArrayList(); - public static Vector Gly = new Vector(); + private static List Gly = new ArrayList(); - public static Vector Trp = new Vector(); + private static List Trp = new ArrayList(); - public static Vector Cys = new Vector(); + private static List Cys = new ArrayList(); - public static Vector Ile = new Vector(); + private static List Ile = new ArrayList(); - public static Vector Met = new Vector(); + private static List Met = new ArrayList(); - public static Vector Leu = new Vector(); + private static List Leu = new ArrayList(); - public static Vector Val = new Vector(); + private static List Val = new ArrayList(); - public static Vector Phe = new Vector(); + private static List Phe = new ArrayList(); public static List STOP = new ArrayList(); @@ -1047,87 +1047,87 @@ public class ResidueProperties static { - Lys.addElement("AAA"); - Lys.addElement("AAG"); - Asn.addElement("AAC"); - Asn.addElement("AAT"); - - Gln.addElement("CAA"); - Gln.addElement("CAG"); - His.addElement("CAC"); - His.addElement("CAT"); - - Glu.addElement("GAA"); - Glu.addElement("GAG"); - Asp.addElement("GAC"); - Asp.addElement("GAT"); - - Tyr.addElement("TAC"); - Tyr.addElement("TAT"); - - Thr.addElement("ACA"); - Thr.addElement("ACG"); - Thr.addElement("ACC"); - Thr.addElement("ACT"); - - Pro.addElement("CCA"); - Pro.addElement("CCG"); - Pro.addElement("CCC"); - Pro.addElement("CCT"); - - Ala.addElement("GCA"); - Ala.addElement("GCG"); - Ala.addElement("GCC"); - Ala.addElement("GCT"); - - Ser.addElement("TCA"); - Ser.addElement("TCG"); - Ser.addElement("TCC"); - Ser.addElement("TCT"); - Ser.addElement("AGC"); - Ser.addElement("AGT"); - - Arg.addElement("AGA"); - Arg.addElement("AGG"); - Arg.addElement("CGA"); - Arg.addElement("CGG"); - Arg.addElement("CGC"); - Arg.addElement("CGT"); - - Gly.addElement("GGA"); - Gly.addElement("GGG"); - Gly.addElement("GGC"); - Gly.addElement("GGT"); + Lys.add("AAA"); + Lys.add("AAG"); + Asn.add("AAC"); + Asn.add("AAT"); + + Gln.add("CAA"); + Gln.add("CAG"); + His.add("CAC"); + His.add("CAT"); + + Glu.add("GAA"); + Glu.add("GAG"); + Asp.add("GAC"); + Asp.add("GAT"); + + Tyr.add("TAC"); + Tyr.add("TAT"); + + Thr.add("ACA"); + Thr.add("ACG"); + Thr.add("ACC"); + Thr.add("ACT"); + + Pro.add("CCA"); + Pro.add("CCG"); + Pro.add("CCC"); + Pro.add("CCT"); + + Ala.add("GCA"); + Ala.add("GCG"); + Ala.add("GCC"); + Ala.add("GCT"); + + Ser.add("TCA"); + Ser.add("TCG"); + Ser.add("TCC"); + Ser.add("TCT"); + Ser.add("AGC"); + Ser.add("AGT"); + + Arg.add("AGA"); + Arg.add("AGG"); + Arg.add("CGA"); + Arg.add("CGG"); + Arg.add("CGC"); + Arg.add("CGT"); + + Gly.add("GGA"); + Gly.add("GGG"); + Gly.add("GGC"); + Gly.add("GGT"); STOP.add("TGA"); STOP.add("TAA"); STOP.add("TAG"); - Trp.addElement("TGG"); + Trp.add("TGG"); - Cys.addElement("TGC"); - Cys.addElement("TGT"); + Cys.add("TGC"); + Cys.add("TGT"); - Ile.addElement("ATA"); - Ile.addElement("ATC"); - Ile.addElement("ATT"); + Ile.add("ATA"); + Ile.add("ATC"); + Ile.add("ATT"); - Met.addElement("ATG"); + Met.add("ATG"); - Leu.addElement("CTA"); - Leu.addElement("CTG"); - Leu.addElement("CTC"); - Leu.addElement("CTT"); - Leu.addElement("TTA"); - Leu.addElement("TTG"); + Leu.add("CTA"); + Leu.add("CTG"); + Leu.add("CTC"); + Leu.add("CTT"); + Leu.add("TTA"); + Leu.add("TTG"); - Val.addElement("GTA"); - Val.addElement("GTG"); - Val.addElement("GTC"); - Val.addElement("GTT"); + Val.add("GTA"); + Val.add("GTG"); + Val.add("GTC"); + Val.add("GTT"); - Phe.addElement("TTC"); - Phe.addElement("TTT"); + Phe.add("TTC"); + Phe.add("TTT"); } // Stores residue codes/names and colours and other things @@ -1594,14 +1594,9 @@ public class ResidueProperties { return "X"; } - Enumeration e = codonHash.keys(); - - while (e.hasMoreElements()) + for (String key : codonHash.keySet()) { - String key = (String) e.nextElement(); - Vector tmp = (Vector) codonHash.get(key); - - if (tmp.contains(codon)) + if (codonHash.get(key).contains(codon)) { return key; } -- 1.7.10.2