<td width="60" nowrap>
<div align="center">
<strong><a name="Jalview.2.10.4b1">2.10.4b1</a><br />
- <em>5/06/2018</em></strong>
+ <em>7/06/2018</em></strong>
</div>
</td>
<td><div align="left">
<em></em>
<ul>
<li>
+ <!-- JAL-2920 -->Use HGVS nomenclature for variant
+ annotation retrieved from Uniprot
+ </li>
+ <li>
<!-- JAL-1460 -->Windows File Shortcuts can be dragged
onto the Jalview Desktop
</li>
<ul>
<li>
<!-- JAL-3017 -->Cannot import features with multiple
- variant elements
+ variant elements (blocks import of some Uniprot records)
</li>
<li>
<!-- JAL-2997 -->Clustal files with sequence positions in
not alignment area in exported graphic
</li>
<li>
- <!-- JAL-2992 -->Annotation panel set too high when
- annotation added to view
- </li>
- <li>
<!-- JAL-2993 -->F2/Keyboard mode edits work when Overview
window has input focus
</li>
<li>
+ <!-- JAL-2992 -->Annotation panel set too high when
+ annotation added to view (Windows)
+ </li>
+ <li>
<!-- JAL-1460 -->Drag URL from chrome, firefox, IE to
Jalview desktop on Windows doesn't open file<br /> <em>Dragging
the currently open URL and links from a page viewed in
</head>
<body>
<p>
- <strong>What's new in Jalview 2.10.4 ?</strong>
- </p>
- <p>
- This is the May 2018 release of Jalview, and the last in the 2.10.x series. Jalview 2.10.4 includes:
+ <strong>What's new in Jalview 2.10.4b1 ?</strong>
</p>
+ <p>This is the first patch release for Jalview 2.10.4. It includes
+ the following new patches:</p>
+ <ul>
+ <li>HGVS nomenclature used for variant annotation retrieved
+ from Uniprot</li>
+ <li>Uniprot import fails for some sequences (Cannot import
+ features with multiple variant elements)</li>
+ <li>Clustal files with sequence positions in right-hand column
+ are now parsed correctly</li>
+ <li>Wrap view - export to SVG - IDs shown but not alignment
+ area in exported graphic</li>
+ <li>F2/Keyboard mode edits work when Overview window has input
+ focus</li>
+ <li>Windows specific fixes:
+ <ul>
+ <li>Annotation panel set too high when annotation added to
+ view</li>
+ <li>Updated search paths for Chimera default installation</li>
+ <li>Windows File Shortcuts can be dragged onto the Jalview
+ Desktop</li>
+ <li>Drag URL from Chrome, Firefox, IE to Jalview desktop on
+ Windows doesn't open file:<br /> Dragging the currently open
+ URL and links from a page viewed in Firefox or Chrome on
+ Windows is now fully supported.<br />
+ <strong>If you are using Edge</strong>, only links in the page
+ can be dragged.<br />
+ <strong>With Internet Explorer</strong>, only the currently open
+ URL in the browser can be dropped onto Jalview.
+ </li>
+ </ul>
+ </li>
+ </ul>
+ <p>Highlights in the 2.10.4 series include:</p>
<ul>
<li>Numerous efficiency improvements in the renderer and overview when working with large alignments with lots of hidden columns</li>
<li>Use of HTTPS when connecting to Uniprot, Ensembl and other EBI web services</li>
* The Jalview Authors are detailed in the 'AUTHORS' file.
-->
<mapping>
+ <!-- see https://www.uniprot.org/docs/uniprot.xsd for latest Uniprot XML schema -->
<class name="jalview.datamodel.xdb.uniprot.UniprotFile">
<map-to xml="uniprot"/>
<field name="UniprotEntries" type="jalview.datamodel.xdb.uniprot.UniprotEntry" collection="vector">
public String getDescription()
{
- if (description == null && variation == null && original == null)
- {
- return null;
- }
- StringBuilder sb = new StringBuilder();
- if (description != null)
- {
- sb.append(description);
- }
- if (variation != null && variation.size() > 0)
- {
- int i = 0;
- for (String var : variation)
- {
- if (i++ > 0)
- {
- sb.append(",");
- }
- if (sb.length() > 0)
- {
- sb.append(" ");
- }
- sb.append("Variation: '" + var + "'");
- }
- }
- if (original != null)
- {
- if (sb.length() > 0)
- {
- sb.append(" ");
- }
- sb.append("Original: '" + original + "'");
- }
- return sb.toString();
+ return description;
}
public void setDescription(String d)
import jalview.datamodel.xdb.uniprot.UniprotEntry;
import jalview.datamodel.xdb.uniprot.UniprotFeature;
import jalview.datamodel.xdb.uniprot.UniprotFile;
+import jalview.schemes.ResidueProperties;
+import jalview.util.StringUtils;
import jalview.ws.seqfetcher.DbSourceProxyImpl;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
+import java.util.List;
import java.util.Vector;
import org.exolab.castor.mapping.Mapping;
for (UniprotFeature uf : entry.getFeature())
{
SequenceFeature copy = new SequenceFeature(uf.getType(),
- uf.getDescription(), uf.getBegin(), uf.getEnd(), "Uniprot");
+ getDescription(uf), uf.getBegin(), uf.getEnd(), "Uniprot");
copy.setStatus(uf.getStatus());
sequence.addSequenceFeature(copy);
}
}
/**
+ * Constructs a feature description from the description and (optionally)
+ * original and variant fields of the Uniprot XML feature
+ *
+ * @param uf
+ * @return
+ */
+ protected static String getDescription(UniprotFeature uf)
+ {
+ String orig = uf.getOriginal();
+ List<String> variants = uf.getVariation();
+ StringBuilder sb = new StringBuilder();
+
+ /*
+ * append variant in standard format if present
+ * e.g. p.Arg59Lys
+ * multiple variants are split over lines using <br>
+ */
+ boolean asHtml = false;
+ if (orig != null && !orig.isEmpty() && variants != null
+ && !variants.isEmpty())
+ {
+ int p = 0;
+ for (String var : variants)
+ {
+ // TODO proper HGVS nomenclature for delins structural variations
+ // http://varnomen.hgvs.org/recommendations/protein/variant/delins/
+ // for now we are pragmatic - any orig/variant sequence longer than
+ // three characters is shown with single-character notation rather than
+ // three-letter notation
+ sb.append("p.");
+ if (orig.length() < 4)
+ {
+ 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));
+ }
+ }
+ else
+ {
+ sb.append(orig);
+ }
+
+ sb.append(Integer.toString(uf.getPosition()));
+
+ if (var.length() < 4)
+ {
+ for (int c = 0, clen = var.length(); c < clen; c++)
+ {
+ char varchar = var.charAt(c);
+ String var3 = ResidueProperties.aa2Triplet.get("" + varchar);
+
+ sb.append(var3 != null ? StringUtils.toSentenceCase(var3)
+ : "" + varchar);
+ }
+ }
+ else
+ {
+ sb.append(var);
+ }
+ if (++p != variants.size())
+ {
+ sb.append("<br/> ");
+ asHtml = true;
+ }
+ else
+ {
+ sb.append(" ");
+ }
+ }
+ }
+ String description = uf.getDescription();
+ if (description != null)
+ {
+ sb.append(description);
+ }
+ if (asHtml)
+ {
+ sb.insert(0, "<html>");
+ sb.append("</html>");
+ }
+
+ return sb.toString();
+ }
+
+ /**
*
* @param entry
* UniportEntry
import java.io.StringReader;
import java.util.Vector;
+import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
+ "<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>"
+ + "<feature type=\"sequence variant\" description=\"Foo Too\"><variation>LL</variation><variation>LMVK</variation><original>MLML</original><location><begin position=\"42\"/><end position=\"45\"/></location></feature>"
+ "<sequence length=\"10\" mass=\"27410\" checksum=\"8CB760AACF88FE6C\" modified=\"2008-01-15\" version=\"1\">MHAPL VSKDL</sequence></entry>"
+ "</uniprot>";
* Check sequence features
*/
Vector<UniprotFeature> features = entry.getFeature();
- assertEquals(7, features.size());
+ assertEquals(9, features.size());
UniprotFeature sf = features.get(0);
assertEquals("signal peptide", sf.getType());
assertNull(sf.getDescription());
sf = features.get(3);
assertEquals("sequence variant", sf.getType());
- assertEquals("Variation: 'L' Original: 'M'", sf.getDescription());
+ assertNull(sf.getDescription());
assertEquals(41, sf.getPosition());
assertEquals(41, sf.getBegin());
assertEquals(41, sf.getEnd());
sf = features.get(4);
assertEquals("sequence variant", sf.getType());
- assertEquals("Pathogenic Variation: 'L' Original: 'M'",
- sf.getDescription());
+ assertEquals("Pathogenic", sf.getDescription());
assertEquals(41, sf.getPosition());
assertEquals(41, sf.getBegin());
assertEquals(41, sf.getEnd());
sf = features.get(5);
assertEquals("sequence variant", sf.getType());
- assertEquals("Pathogenic Original: 'M'", sf.getDescription());
+ assertEquals("Pathogenic", sf.getDescription());
assertEquals(41, sf.getPosition());
assertEquals(41, sf.getBegin());
assertEquals(41, sf.getEnd());
sf = features.get(6);
assertEquals("sequence variant", sf.getType());
- assertEquals("Foo Variation: 'L', Variation: 'LMV' Original: 'M'",
+ assertEquals("Foo",
sf.getDescription());
assertEquals(42, sf.getPosition());
assertEquals(42, sf.getBegin());
assertEquals(42, sf.getEnd());
+ Assert.assertEquals(Uniprot.getDescription(sf),
+ "<html>p.Met42Leu" + "<br/> "
+ + "p.Met42LeuMetVal Foo</html>");
+
+ sf = features.get(7);
+ assertEquals(42, sf.getBegin());
+ assertEquals(43, sf.getEnd());
+ Assert.assertEquals(Uniprot.getDescription(sf),
+ "<html>p.MetLeu42LeuLeu" + "<br/> "
+ + "p.MetLeu42LeuMetVal Foo</html>");
+
+ sf = features.get(8);
+ assertEquals(42, sf.getBegin());
+ assertEquals(45, sf.getEnd());
+ Assert.assertEquals(Uniprot.getDescription(sf),
+ "<html>p.MLML42LeuLeu" + "<br/> "
+ + "p.MLML42LMVK Foo Too</html>");
+
/*
* Check cross-references
*/
assertEquals(expectedDescription,
Uniprot.getUniprotEntryDescription(entry));
}
+
+ @Test(groups = { "Functional" })
+ public void testGetDescription()
+ {
+ UniprotFeature uf = new UniprotFeature();
+ assertEquals("", Uniprot.getDescription(uf));
+
+ uf.setDescription("Hello");
+ assertEquals("Hello", Uniprot.getDescription(uf));
+
+ uf.setPosition(23);
+ uf.setOriginal("K");
+ Vector<String> vars = new Vector<>();
+ vars.add("y");
+ uf.setVariation(vars);
+ assertEquals("p.Lys23Tyr Hello", Uniprot.getDescription(uf));
+
+ // multiple variants generate an html description over more than one line
+ vars.add("W");
+ assertEquals("<html>p.Lys23Tyr<br/> p.Lys23Trp Hello</html>",
+ Uniprot.getDescription(uf));
+
+ /*
+ * indel cases
+ * up to 3 bases (original or variant) are shown using 3 letter code
+ */
+ vars.clear();
+ vars.add("KWE");
+ uf.setOriginal("KLS");
+ assertEquals("p.LysLeuSer23LysTrpGlu Hello",
+ Uniprot.getDescription(uf));
+
+ // adding a fourth original base switches to single letter code
+ uf.setOriginal("KLST");
+ assertEquals("p.KLST23LysTrpGlu Hello", Uniprot.getDescription(uf));
+
+ // adding a fourth variant switches to single letter code
+ vars.clear();
+ vars.add("KWES");
+ assertEquals("p.KLST23KWES Hello", Uniprot.getDescription(uf));
+
+ vars.clear();
+ vars.add("z"); // unknown variant - fails gracefully
+ uf.setOriginal("K");
+ assertEquals("p.Lys23z Hello", Uniprot.getDescription(uf));
+
+ uf.setVariation(null); // variant missing - is ignored
+ assertEquals("Hello", Uniprot.getDescription(uf));
+ }
}