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. + * * @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))