JAL-2110 unused method removed
[jalview.git] / src / jalview / analysis / CrossRef.java
index 7dcaa17..e73912d 100644 (file)
@@ -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.
+   *          <ul>
+   *          <li>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).</li>
+   *          <li>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)</li>
+   *          </ul>
    * @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<DBRefEntry> 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))