*/
package jalview.util;
-import java.util.Locale;
-
import java.util.ArrayList;
import java.util.BitSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import com.stevesoft.pat.Regex;
}
// and promote - not that version must be non-null here,
// as p must have passed isPrimaryCandidate()
- cand.setVersion(p.getVersion() + " (promoted)");
+ cand.setVersion(cand.getVersion() + " (promoted)");
bsSelect.clear(ic);
// selfs.remove(cand);
// toPromote.add(cand);
SequenceI sequence = new Sequence(id, seqString);
sequence.setDescription(getUniprotEntryDescription(entry));
-
+ final String uniprotRecordVersion = "" + entry.getVersion();
/*
* add a 'self' DBRefEntry for each accession
*/
boolean canonical = true;
for (String accessionId : entry.getAccession())
{
- DBRefEntry dbRef = new DBRefEntry(DBRefSource.UNIPROT, dbVersion,
- accessionId, null, canonical);
+ DBRefEntry dbRef = new DBRefEntry(DBRefSource.UNIPROT,
+ uniprotRecordVersion, accessionId, null, canonical);
canonical = false;
dbRefs.add(dbRef);
}
// remove version
String[] vrs = cdsId.split("\\.");
String version = vrs.length > 1 ? vrs[1]
- : DBRefSource.UNIPROT + ":" + dbVersion;
+ : DBRefSource.UNIPROT + ":" + uniprotRecordVersion;
dbr = new DBRefEntry(DBRefSource.EMBLCDS, version, vrs[0]);
+ // TODO: process VARIANT features to allow EMBLCDS record's product to
+ // match Uniprot
+ dbr.setCanonical(true);
dbRefs.add(dbr);
}
}
// remove version
String[] vrs = dbref.getId().split("\\.");
String version = vrs.length > 1 ? vrs[1]
- : DBRefSource.UNIPROT + ":" + dbVersion;
+ : DBRefSource.UNIPROT + ":" + uniprotRecordVersion;
dbr.setAccessionId(vrs[0]);
dbr.setVersion(version);
/*
// remove version
String[] cdsVrs = cdsId.split("\\.");
String cdsVersion = cdsVrs.length > 1 ? cdsVrs[1]
- : DBRefSource.UNIPROT + ":" + dbVersion;
+ : DBRefSource.UNIPROT + ":" + uniprotRecordVersion;
dbr = new DBRefEntry(DBRefSource.ENSEMBL,
DBRefSource.UNIPROT + ":" + cdsVersion, cdsVrs[0]);
dbRefs.add(dbr);
res = DBRefUtils.searchRefsForSource(seq.getDBRefs(),
DBRefSource.UNIPROT);
assertEquals(2, res.size());
- res = DBRefUtils.searchRefs(seq.getDBRefs(), "AAK85932");
- assertEquals(1, res.size());
- assertTrue("1".equals(res.get(0).getVersion()));
/*
* NB this test fragile - relies on ordering being preserved
*/
assertTrue(res.get(0).isCanonical());
assertFalse(res.get(1).isCanonical());
+
+ // check version is preserved for EMBLCDS
+ res = DBRefUtils.searchRefs(seq.getDBRefs(), "AAK85932");
+ assertEquals(1, res.size());
+ // Ideally we would expect AAK85932.1 -> AAK85932
+ // assertTrue("1".equals(res.get(0).getVersion()));
+ // but it also passes through DBrefUtils.ensurePrimaries which adds
+ // (promoted) to the version string
+ // FIXME: Jim needs to specify what (promoted) means !! - or perhaps we just
+ // ignore it !
+ assertEquals("1 (promoted)", (res.get(0).getVersion()));
}
/**