X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fanalysis%2FCrossRef.java;h=e73912d0c788599022feeb0e0b7f6a19f3be9d0d;hb=df705d500ff5e5d167d1516e73169df9fde3d56e;hp=7dcaa17d9e6b1509f6a29e8fedc79536d63437d2;hpb=dfa980fc8e8dd186278e5aa1fcf356964afdf61a;p=jalview.git
diff --git a/src/jalview/analysis/CrossRef.java b/src/jalview/analysis/CrossRef.java
index 7dcaa17..e73912d 100644
--- a/src/jalview/analysis/CrossRef.java
+++ b/src/jalview/analysis/CrossRef.java
@@ -125,6 +125,9 @@ public class CrossRef
*
* @param seq
* the sequence whose dbrefs we are searching against
+ * @param fromDna
+ * when true, context is DNA - so sources identifying protein
+ * products will be returned.
* @param sources
* a list of sources to add matches to
*/
@@ -354,7 +357,8 @@ public class CrossRef
{
ASequenceFetcher sftch = SequenceFetcherFactory.getSequenceFetcher();
SequenceI[] retrieved = null;
- SequenceI dss = null;
+ SequenceI dss = seq.getDatasetSequence() == null ? seq : seq
+ .getDatasetSequence();
try
{
retrieved = sftch.getSequences(sourceRefs, !fromDna);
@@ -762,7 +766,16 @@ public class CrossRef
* @param cf
* a set of sequence mappings to add to
* @param direct
- * - search all references or only subset
+ * - indicates the type of relationship between returned sequences,
+ * xrf, and sequenceI that is required.
+ *
+ * - direct implies xrf is a primary reference for sequenceI AND
+ * the sequences to be located (eg a uniprot ID for a protein
+ * sequence, and a uniprot ref on a transcript sequence).
+ * - indirect means xrf is a cross reference with respect to
+ * sequenceI or all the returned sequences (eg a genomic reference
+ * associated with a locus and one or more transcripts)
+ *
* @return true if relationship found and sequence added.
*/
boolean searchDataset(boolean fromDna, SequenceI sequenceI,
@@ -789,7 +802,11 @@ public class CrossRef
if (nxt.getDatasetSequence() != null)
{
System.err
- .println("Implementation warning: getProducts passed a dataset alignment without dataset sequences in it!");
+ .println("Implementation warning: CrossRef initialised with a dataset alignment with non-dataset sequences in it! ("
+ + nxt.getDisplayId(true)
+ + " has ds reference "
+ + nxt.getDatasetSequence().getDisplayId(true)
+ + ")");
}
if (nxt == sequenceI || nxt == sequenceI.getDatasetSequence())
{
@@ -811,21 +828,16 @@ public class CrossRef
// look for direct or indirect references in common
DBRefEntry[] poss = nxt.getDBRefs();
List cands = null;
- /*
- * TODO does this make any sense?
- * if 'direct', search the dbrefs for xrf
- * else, filter the dbrefs by type and then search for xrf
- * - the result is the same isn't it?
- */
- if (direct)
- {
- cands = DBRefUtils.searchRefs(poss, xrf);
- }
- else
- {
- poss = DBRefUtils.selectDbRefs(!fromDna, poss);
- cands = DBRefUtils.searchRefs(poss, xrf);
- }
+
+ // todo: indirect specifies we select either direct references to nxt
+ // that match xrf which is indirect to sequenceI, or indirect
+ // references to nxt that match xrf which is direct to sequenceI
+ cands = DBRefUtils.searchRefs(poss, xrf);
+ // else
+ // {
+ // poss = DBRefUtils.selectDbRefs(nxt.isProtein()!fromDna, poss);
+ // cands = DBRefUtils.searchRefs(poss, xrf);
+ // }
if (!cands.isEmpty())
{
if (!rseqs.contains(nxt))