- * Returns true if either sequence has a cross-reference to the other
- *
- * @param seq1
- * @param seq2
- * @return
- */
- public static boolean haveCrossRef(SequenceI seq1, SequenceI seq2)
- {
- return hasCrossRef(seq1, seq2) || hasCrossRef(seq2, seq1);
- }
-
- /**
- * Returns true if seq1 has a cross-reference to seq2. Currently this assumes
- * that sequence name is structured as Source|AccessId.
- *
- * @param seq1
- * @param seq2
- * @return
- */
- public static boolean hasCrossRef(SequenceI seq1, SequenceI seq2)
- {
- if (seq1 == null || seq2 == null)
- {
- return false;
- }
- String name = seq2.getName();
- final DBRefEntry[] xrefs = seq1.getDBRef();
- if (xrefs != null)
- {
- for (DBRefEntry xref : xrefs)
- {
- String xrefName = xref.getSource() + "|" + xref.getAccessionId();
- // case-insensitive test, consistent with DBRefEntry.equalRef()
- if (xrefName.equalsIgnoreCase(name))
- {
- return true;
- }
- }
- }
- return false;
- }
-
- /**