uf.setPosition(23);
uf.setOriginal("K");
- Vector<String> vars = new Vector();
+ Vector<String> vars = new Vector<>();
vars.add("y");
uf.setVariation(vars);
assertEquals("p.Lys23Tyr Hello", Uniprot.getDescription(uf));
+ vars.add("W");
+ assertEquals("p.Lys23Tyr\np.Lys23Trp Hello",
+ 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 a condensed representation
+ vars.clear();
+ vars.add("KWES");
+ assertEquals("p.KLST23KWES Hello", Uniprot.getDescription(uf));
+
vars.clear();
vars.add("z"); // unknown variant - fails gracefully
- uf.setVariation(vars);
+ uf.setOriginal("K");
assertEquals("p.Lys23z Hello", Uniprot.getDescription(uf));
uf.setVariation(null); // variant missing - is ignored