JAL-1920 JAL-3017 use newline not <br/> in description and update test to cover multi...
authorJim Procter <jprocter@issues.jalview.org>
Wed, 6 Jun 2018 14:22:53 +0000 (15:22 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Wed, 6 Jun 2018 14:32:56 +0000 (15:32 +0100)
src/jalview/ws/dbsources/Uniprot.java
test/jalview/ws/dbsources/UniprotTest.java

index fc4f318..274ad32 100644 (file)
@@ -316,10 +316,18 @@ public class Uniprot extends DbSourceProxyImpl
       int p = 0;
       for (String var : variants)
       {
+        // TODO proper HGVC nomenclature for delins structural variations
         sb.append("p.");
-        String orig3 = ResidueProperties.aa2Triplet.get(orig);
-        sb.append(orig3 == null ? orig : StringUtils.toSentenceCase(orig3));
+        for (int c = 0, clen = orig.length(); c < clen; c++)
+        {
+          char origchar = orig.charAt(c);
+          String orig3 = ResidueProperties.aa2Triplet.get("" + origchar);
+          sb.append(orig3 == null ? origchar
+                  : StringUtils.toSentenceCase(orig3));
+        }
+
         sb.append(Integer.toString(uf.getPosition()));
+
         for (int c = 0, clen = var.length(); c < clen; c++)
         {
           char varchar = var.charAt(c);
@@ -330,7 +338,7 @@ public class Uniprot extends DbSourceProxyImpl
         }
         if (++p != variants.size())
         {
-          sb.append("<br/>");
+          sb.append("\n");
         }
         else
         {
index b187b67..c7f216e 100644 (file)
@@ -68,6 +68,7 @@ public class UniprotTest
           + "<feature type=\"sequence variant\" description=\"Pathogenic\"><original>M</original><variation>L</variation><location><position position=\"41\"/></location></feature>"
           + "<feature type=\"sequence variant\" description=\"Pathogenic\"><original>M</original><location><position position=\"41\"/></location></feature>"
           + "<feature type=\"sequence variant\" description=\"Foo\"><variation>L</variation><variation>LMV</variation><original>M</original><location><position position=\"42\"/></location></feature>"
+          + "<feature type=\"sequence variant\" description=\"Foo\"><variation>LL</variation><variation>LMV</variation><original>ML</original><location><begin position=\"42\"/><end position=\"43\"/></location></feature>"
           + "<sequence length=\"10\" mass=\"27410\" checksum=\"8CB760AACF88FE6C\" modified=\"2008-01-15\" version=\"1\">MHAPL VSKDL</sequence></entry>"
           + "</uniprot>";
 
@@ -103,7 +104,7 @@ public class UniprotTest
      * Check sequence features
      */
     Vector<UniprotFeature> features = entry.getFeature();
-    assertEquals(7, features.size());
+    assertEquals(8, features.size());
     UniprotFeature sf = features.get(0);
     assertEquals("signal peptide", sf.getType());
     assertNull(sf.getDescription());
@@ -152,10 +153,15 @@ public class UniprotTest
     assertEquals(42, sf.getBegin());
     assertEquals(42, sf.getEnd());
     Assert.assertEquals(Uniprot.getDescription(sf),
-            "p.Met42Leu<br/>p.Met42LeuMetVal Foo");
-    /*
-     * Check cross-references
-     */
+            "p.Met42Leu" + "\n" + "p.Met42LeuMetVal Foo");
+
+    sf = features.get(7);
+    assertEquals(42, sf.getBegin());
+    assertEquals(43, sf.getEnd());
+    Assert.assertEquals(Uniprot.getDescription(sf),
+            "p.MetLeu42LeuLeu" + "\n" + "p.MetLeu42LeuMetVal Foo"); /*
+                                                                    * Check cross-references
+                                                                    */
     Vector<PDBEntry> xrefs = entry.getDbReference();
     assertEquals(3, xrefs.size());