From: Jim Procter Date: Wed, 6 Jun 2018 14:22:53 +0000 (+0100) Subject: JAL-1920 JAL-3017 use newline not
in description and update test to cover multi... X-Git-Tag: Release_2_10_5~60^2~3 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=11f6e7a63cc627f5dffb0dd382343bd99d15121c;p=jalview.git JAL-1920 JAL-3017 use newline not
in description and update test to cover multi-position variants and newline code --- diff --git a/src/jalview/ws/dbsources/Uniprot.java b/src/jalview/ws/dbsources/Uniprot.java index fc4f318..274ad32 100644 --- a/src/jalview/ws/dbsources/Uniprot.java +++ b/src/jalview/ws/dbsources/Uniprot.java @@ -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("
"); + sb.append("\n"); } else { diff --git a/test/jalview/ws/dbsources/UniprotTest.java b/test/jalview/ws/dbsources/UniprotTest.java index b187b67..c7f216e 100644 --- a/test/jalview/ws/dbsources/UniprotTest.java +++ b/test/jalview/ws/dbsources/UniprotTest.java @@ -68,6 +68,7 @@ public class UniprotTest + "ML" + "M" + "LLMVM" + + "LLLMVML" + "MHAPL VSKDL" + ""; @@ -103,7 +104,7 @@ public class UniprotTest * Check sequence features */ Vector 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
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 xrefs = entry.getDbReference(); assertEquals(3, xrefs.size());