int sourceKey = Integer.MIN_VALUE;
String canonicalSourceName;
+
+ boolean isCanonicalAccession;
/*
* maps from associated sequence to the database sequence's coordinate system
*/
public DBRefEntry(String source, String version, String accessionId)
{
- this(source, version, accessionId, null);
+ this(source, version, accessionId, null,false);
}
/**
*
* @param source
+ * may not be null
+ * @param version
+ * may be null
+ * @param accessionId
+ * may be null
+ */
+ public DBRefEntry(String source, String version, String accessionId, Mapping map)
+ {
+ this(source, version, accessionId, map,false);
+ }
+ /**
+ *
+ * @param source
* canonical source (turned to uppercase; cannot be null)
* @param version
* (source dependent version string or null)
* numbering or null)
*/
public DBRefEntry(String source, String version, String accessionId,
- Mapping map)
+ Mapping map,boolean isCanonical)
{
this.source = source.toUpperCase();
setVersion(version);
this.accessionId = accessionId;
this.map = map;
+ this.isCanonicalAccession=isCanonical;
}
/**
public String getCanonicalSourceName() {
return (canonicalSourceName == null ? (canonicalSourceName = DBRefUtils.getCanonicalName(this.source)) : canonicalSourceName);
}
+
+ /**
+ *
+ * @param canonical
+ */
+ public void setCanonical(boolean canonical)
+ {
+ isCanonicalAccession = canonical;
+ }
+ /**
+ *
+ * @return true if this is the primary canonical accession for the database source
+ */
+ public boolean isCanonical()
+ {
+ // TODO Auto-generated method stub
+ return isCanonicalAccession;
+ }
}
*/
final String dbVersion = getDbVersion();
List<DBRefEntry> dbRefs = new ArrayList<>();
+ boolean canonical=true;
for (String accessionId : entry.getAccession())
{
DBRefEntry dbRef = new DBRefEntry(DBRefSource.UNIPROT, dbVersion,
- accessionId);
+ accessionId,null,canonical);
+ canonical=false;
dbRefs.add(dbRef);
}
*/
package jalview.ws.dbsources;
+import static org.testng.Assert.assertFalse;
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertNotNull;
import static org.testng.AssertJUnit.assertNull;
import static org.testng.AssertJUnit.assertTrue;
+import jalview.datamodel.DBRefEntry;
import jalview.datamodel.SequenceI;
import jalview.gui.JvOptionPane;
+import jalview.util.DBRefUtils;
import jalview.xml.binding.uniprot.DbReferenceType;
import jalview.xml.binding.uniprot.Entry;
import jalview.xml.binding.uniprot.FeatureType;
assertEquals(6, seq.getDBRefs().size()); // 2*Uniprot, PDB, PDBsum, 2*EMBL
assertEquals(seq.getSequenceAsString(),
seq.createDatasetSequence().getSequenceAsString());
+ assertEquals(2,seq.getPrimaryDBRefs().size());
+ List<DBRefEntry> res = DBRefUtils.searchRefs(seq.getPrimaryDBRefs(), "A9CKP4");
+ assertEquals(1,res.size());
+ assertTrue(res.get(0).isCanonical());
+ assertFalse(res.get(1).isCanonical());
}
/**