X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fanalysis%2FGeneticCodes.java;h=c91cfa2ed0149f84c64d09454b30340fb563f5ef;hb=85299bc2db43c8b108169661ebc1c4d9b2d3d2e5;hp=df1dd8255e97fe5fe18404efba3fb23f85127c4e;hpb=c7827c8c0d28158fcea4ebc132c7b457d60f557d;p=jalview.git diff --git a/src/jalview/analysis/GeneticCodes.java b/src/jalview/analysis/GeneticCodes.java index df1dd82..c91cfa2 100644 --- a/src/jalview/analysis/GeneticCodes.java +++ b/src/jalview/analysis/GeneticCodes.java @@ -20,8 +20,7 @@ */ package jalview.analysis; -import jalview.bin.Cache; - +import java.util.Locale; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; @@ -31,6 +30,8 @@ import java.util.LinkedHashMap; import java.util.Map; import java.util.StringTokenizer; +import jalview.bin.Console; + /** * A singleton that provides instances of genetic code translation tables * @@ -139,7 +140,8 @@ public final class GeneticCodes InputStream is = getClass().getResourceAsStream(fileName); if (is == null) { - System.err.println("Resource file not found: " + fileName); + jalview.bin.Console + .errPrintln("Resource file not found: " + fileName); return; } BufferedReader dataIn = new BufferedReader(new InputStreamReader(is)); @@ -160,13 +162,12 @@ public final class GeneticCodes } } catch (IOException | NullPointerException e) { - Cache.log.error( - "Error reading genetic codes data file " + fileName + ": " - + e.getMessage()); + Console.error("Error reading genetic codes data file " + fileName + + ": " + e.getMessage()); } if (codeTables.isEmpty()) { - System.err.println( + jalview.bin.Console.errPrintln( "No genetic code tables loaded, check format of file " + fileName); } @@ -190,7 +191,8 @@ public final class GeneticCodes InputStream is = getClass().getResourceAsStream(fileName); if (is == null) { - System.err.println("Resource file not found: " + fileName); + jalview.bin.Console + .errPrintln("Resource file not found: " + fileName); return; } BufferedReader dataIn = new BufferedReader(new InputStreamReader(is)); @@ -198,26 +200,25 @@ public final class GeneticCodes while (line != null) { line = readLine(dataIn); - if (line != null && !"DNA".equals(line.toUpperCase())) + if (line != null && !"DNA".equals(line.toUpperCase(Locale.ROOT))) { String[] tokens = line.split("\\t"); if (tokens.length == 2) { - ambiguityCodes.put(tokens[0].toUpperCase(), - tokens[1].toUpperCase()); + ambiguityCodes.put(tokens[0].toUpperCase(Locale.ROOT), + tokens[1].toUpperCase(Locale.ROOT)); } else { - System.err.println( + jalview.bin.Console.errPrintln( "Unexpected data in " + fileName + ": " + line); } } } } catch (IOException e) { - Cache.log.error( - "Error reading nucleotide ambiguity codes data file: " - + e.getMessage()); + Console.error("Error reading nucleotide ambiguity codes data file: " + + e.getMessage()); } } @@ -292,7 +293,7 @@ public final class GeneticCodes line.lastIndexOf(QUOTE)); if (aminos.length() != NUCS_COUNT_CUBED) // 4 * 4 * 4 combinations { - Cache.log.error("wrong data length in code table: " + line); + Console.error("wrong data length in code table: " + line); } else { @@ -341,13 +342,13 @@ public final class GeneticCodes @Override public String translateCanonical(String codon) { - return codons.get(codon.toUpperCase()); + return codons.get(codon.toUpperCase(Locale.ROOT)); } @Override public String translate(String codon) { - String upper = codon.toUpperCase(); + String upper = codon.toUpperCase(Locale.ROOT); String peptide = translateCanonical(upper); /*