for (String var : variants)
{
// TODO proper HGVC nomenclature for delins structural variations
+ // 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.");
- for (int c = 0, clen = orig.length(); c < clen; c++)
+ if (orig.length() < 4)
{
- char origchar = orig.charAt(c);
- String orig3 = ResidueProperties.aa2Triplet.get("" + origchar);
- sb.append(orig3 == null ? origchar
- : 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));
+ }
+ }
+ else
+ {
+ sb.append(orig);
}
sb.append(Integer.toString(uf.getPosition()));
- for (int c = 0, clen = var.length(); c < clen; c++)
+ if (var.length() < 4)
{
- char varchar = var.charAt(c);
- String var3 = ResidueProperties.aa2Triplet.get("" + varchar);
-
- sb.append(var3 != null ? StringUtils.toSentenceCase(var3)
- : "" + varchar);
+ 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())
{
+ "<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(8, features.size());
+ assertEquals(9, features.size());
UniprotFeature sf = features.get(0);
assertEquals("signal peptide", sf.getType());
assertNull(sf.getDescription());
assertEquals(42, sf.getBegin());
assertEquals(43, sf.getEnd());
Assert.assertEquals(Uniprot.getDescription(sf),
- "p.MetLeu42LeuLeu" + "\n" + "p.MetLeu42LeuMetVal Foo"); /*
- * Check cross-references
- */
+ "p.MetLeu42LeuLeu" + "\n" + "p.MetLeu42LeuMetVal Foo");
+
+ sf = features.get(8);
+ assertEquals(42, sf.getBegin());
+ assertEquals(45, sf.getEnd());
+ Assert.assertEquals(Uniprot.getDescription(sf),
+ "p.MLML42LeuLeu" + "\n" + "p.MLML42LMVK Foo Too");
+
+ /*
+ * Check cross-references
+ */
Vector<PDBEntry> xrefs = entry.getDbReference();
assertEquals(3, xrefs.size());