private static Mapping map;
/**
+ * configurable parameter controlling prefixing of entry names with accessions
+ */
+ private boolean includeAllIds = false;
+
+ /**
* Constructor
*/
public Uniprot()
*/
public SequenceI uniprotEntryToSequenceI(UniprotEntry entry)
{
- String id = getUniprotEntryId(entry);
+ String id = getUniprotEntryId(entry, includeAllIds);
SequenceI sequence = new Sequence(id,
entry.getUniprotSequence().getContent());
sequence.setDescription(getUniprotEntryDescription(entry));
* UniportEntry
* @return The accession id(s) and name(s) delimited by '|'.
*/
- public static String getUniprotEntryId(UniprotEntry entry)
+ public static String getUniprotEntryId(UniprotEntry entry,
+ boolean includeAllIds)
{
StringBuilder name = new StringBuilder(32);
- // name.append("UniProt/Swiss-Prot");
- // use 'canonicalised' name for optimal id matching
- name.append(DBRefSource.UNIPROT);
- for (String accessionId : entry.getAccession())
+ if (includeAllIds)
{
- name.append(BAR_DELIMITER);
- name.append(accessionId);
+ // // use 'canonicalised' name for optimal id matching
+ name.append(DBRefSource.UNIPROT);
+ for (String accessionId : entry.getAccession())
+ {
+ name.append(BAR_DELIMITER);
+ name.append(accessionId);
+ }
+
}
for (String n : entry.getName())
{
- name.append(BAR_DELIMITER);
+ if (name.length() > 0)
+ {
+ name.append(BAR_DELIMITER);
+ }
name.append(n);
}
return name.toString();
* source database converted to Jalview canonical name
*/
String expectedName = "UNIPROT|A9CKP4|A9CKP5|A9CKP4_AGRT5|A9CKP4_AGRT6";
- assertEquals(expectedName, Uniprot.getUniprotEntryId(entry));
+ assertEquals(expectedName, Uniprot.getUniprotEntryId(entry, true));
+ String expectedShortName = "A9CKP4_AGRT5|A9CKP4_AGRT6";
+ assertEquals(expectedShortName,
+ Uniprot.getUniprotEntryId(entry, false));
}
/**