From: tcofoegbu Date: Thu, 3 Sep 2015 10:33:47 +0000 (+0100) Subject: merge X-Git-Tag: Release_2_10_0~507 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=ac16d57bd5c4a52189a1487f64422091b91ba935;hp=02d6b4895305788dbf460a6e0334dba93b0b3423;p=jalview.git merge --- diff --git a/src/MCview/Atom.java b/src/MCview/Atom.java index 894984a..68a7c21 100755 --- a/src/MCview/Atom.java +++ b/src/MCview/Atom.java @@ -20,6 +20,8 @@ */ package MCview; +import jalview.schemes.ResidueProperties; + import java.awt.Color; public class Atom @@ -73,6 +75,8 @@ public class Atom name = str.substring(12, 15).trim(); resName = str.substring(17, 20); + // JAL-1828 treat MSE Selenomethionine as MET (etc) + resName = ResidueProperties.getCanonicalAminoAcid(resName); chain = str.substring(21, 22); diff --git a/src/jalview/ext/jmol/PDBFileWithJmol.java b/src/jalview/ext/jmol/PDBFileWithJmol.java index 240ea7b..cb19769 100644 --- a/src/jalview/ext/jmol/PDBFileWithJmol.java +++ b/src/jalview/ext/jmol/PDBFileWithJmol.java @@ -242,6 +242,19 @@ public class PDBFileWithJmol extends AlignFile implements lastrnum = group.getResno(); } seq[len] = group.getGroup1(); + + /* + * JAL-1828 replace a modified amino acid with its standard + * equivalent (e.g. MSE with MET->M) to maximise sequence matching + */ + String threeLetterCode = group.getGroup3(); + String canonical = ResidueProperties.getCanonicalAminoAcid(threeLetterCode); + if (canonical != null + && !canonical.equalsIgnoreCase(threeLetterCode)) + { + seq[len] = ResidueProperties + .getSingleCharacterCode(canonical); + } switch (group.getProteinStructureSubType()) { case HELIX310: diff --git a/src/jalview/io/FileLoader.java b/src/jalview/io/FileLoader.java index 870d438..e2e7d19 100755 --- a/src/jalview/io/FileLoader.java +++ b/src/jalview/io/FileLoader.java @@ -429,8 +429,11 @@ public class FileLoader implements Runnable Desktop.instance.stopLoading(); } - final String errorMessage = "Couldn't load file " + title + "\n" - + error; + final String errorMessage = MessageManager + .getString("label.couldnt_load_file") + + " " + + title + + "\n" + error; // TODO: refactor FileLoader to be independent of Desktop / Applet GUI // bits ? if (raiseGUI && Desktop.desktop != null) diff --git a/src/jalview/io/FileParse.java b/src/jalview/io/FileParse.java index 9228257..1ab99db 100755 --- a/src/jalview/io/FileParse.java +++ b/src/jalview/io/FileParse.java @@ -98,7 +98,7 @@ public class FileParse protected BufferedReader dataIn = null; - protected String errormessage = "UNITIALISED SOURCE"; + protected String errormessage = "UNINITIALISED SOURCE"; protected boolean error = true; diff --git a/src/jalview/schemes/ResidueProperties.java b/src/jalview/schemes/ResidueProperties.java index 662a77e..209fe12 100755 --- a/src/jalview/schemes/ResidueProperties.java +++ b/src/jalview/schemes/ResidueProperties.java @@ -20,6 +20,10 @@ */ package jalview.schemes; +import jalview.analysis.scoremodels.FeatureScoreModel; +import jalview.analysis.scoremodels.PIDScoreModel; +import jalview.api.analysis.ScoreModelI; + import java.awt.Color; import java.util.ArrayList; import java.util.Enumeration; @@ -29,10 +33,6 @@ import java.util.List; import java.util.Map; import java.util.Vector; -import jalview.analysis.scoremodels.FeatureScoreModel; -import jalview.analysis.scoremodels.PIDScoreModel; -import jalview.api.analysis.ScoreModelI; - public class ResidueProperties { public static Hashtable scoreMatrices = new Hashtable(); @@ -50,6 +50,9 @@ public class ResidueProperties 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(); + static { aaIndex = new int[255]; @@ -1703,6 +1706,26 @@ public class ResidueProperties } } + static + { + modifications.put("MSE", "MET"); // Selenomethionine + // the rest tbc; from + // http://sourceforge.net/p/jmol/mailman/message/12833570/ + // modifications.put("CSE", "CYS"); // Selenocysteine + // modifications.put("PTR", "TYR"); // Phosphotyrosine + // modifications.put("SEP", "SER"); // Phosphoserine + // modifications.put("HYP", "PRO"); // 4-hydroxyproline + // modifications.put("5HP", "GLU"); // Pyroglutamic acid; 5-hydroxyproline + // modifications.put("PCA", "GLU"); // Pyroglutamic acid + // modifications.put("LYZ", "LYS"); // 5-hydroxylysine + } + + public static String getCanonicalAminoAcid(String aa) + { + String canonical = modifications.get(aa); + return canonical == null ? aa : canonical; + } + /** * translate to RNA secondary structure representation * @@ -1835,4 +1858,21 @@ public class ResidueProperties return result; } + /** + * Returns the single letter code for a three letter code, or '0' if not known + * + * @param threeLetterCode + * not case sensitive + * @return + */ + public static char getSingleCharacterCode(String threeLetterCode) + { + if (threeLetterCode == null) + { + return '0'; + } + Integer index = ResidueProperties.aa3Hash.get(threeLetterCode + .toUpperCase()); + return index == null ? '0' : aa[index].charAt(0); + } } diff --git a/test/jalview/schemes/ResiduePropertiesTest.java b/test/jalview/schemes/ResiduePropertiesTest.java index eb2ad45..b1d860e 100644 --- a/test/jalview/schemes/ResiduePropertiesTest.java +++ b/test/jalview/schemes/ResiduePropertiesTest.java @@ -216,4 +216,23 @@ public class ResiduePropertiesTest "[ALA, ARG, ASN, ASP, ASX, CYS, GLN, GLU, GLX, GLY, HIS, ILE, LEU, LYS, MET, PHE, PRO, SER, THR, TRP, TYR, VAL, XAA]", residues.toString()); } + + @Test(groups = { "Functional" }) + public void testGetCanonicalAminoAcid() + { + assertEquals("MET", ResidueProperties.getCanonicalAminoAcid("MET")); + assertEquals("MET", ResidueProperties.getCanonicalAminoAcid("MSE")); + assertEquals(null, ResidueProperties.getCanonicalAminoAcid(null)); + } + + @Test(groups = { "Functional" }) + public void testGetSingleCharacterCode() + { + assertEquals('0', ResidueProperties.getSingleCharacterCode(null)); + assertEquals('0', ResidueProperties.getSingleCharacterCode(null)); + assertEquals('0', ResidueProperties.getSingleCharacterCode("")); + assertEquals('Q', ResidueProperties.getSingleCharacterCode("GLN")); + assertEquals('Q', ResidueProperties.getSingleCharacterCode("Gln")); + assertEquals('Q', ResidueProperties.getSingleCharacterCode("gln")); + } }