*/
package jalview.datamodel.xdb.uniprot;
+import java.util.Vector;
+
/**
* A data model class for binding from Uniprot XML via uniprot_mapping.xml
*/
private String original = null;
- private String variation = null;
+ private Vector<String> variation = null;
private String status;
{
return null;
}
- return (description == null ? "" : description)
- + (variation != null
- ? (description != null ? " " : "") + "Variation: '"
- + variation + "'"
- : "")
- + (original != null
- ? ((description != null || variation != null) ? " "
- : "") + "Original: '" + original + "'"
- : "");
+ 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();
}
public void setDescription(String d)
this.original = original;
}
- public String getVariation()
+ public Vector<String> getVariation()
{
return variation;
}
- public void setVariation(String variant)
+ public void setVariation(Vector<String> variant)
{
this.variation = variant;
}
+ "<feature type=\"sequence variant\"><original>M</original><variation>L</variation><location><position position=\"41\"/></location></feature>"
+ "<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>"
+ "<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(6, features.size());
+ assertEquals(7, features.size());
UniprotFeature sf = features.get(0);
assertEquals("signal peptide", sf.getType());
assertNull(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'",
+ sf.getDescription());
+ assertEquals(42, sf.getPosition());
+ assertEquals(42, sf.getBegin());
+ assertEquals(42, sf.getEnd());
/*
* Check cross-references
*/