applied copyright 2008
[jalview.git] / src / jalview / analysis / CrossRef.java
index f355d1f..2da8773 100644 (file)
@@ -1,3 +1,21 @@
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ * \r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ * \r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 package jalview.analysis;\r
 \r
 import java.util.Enumeration;\r
@@ -158,7 +176,8 @@ public class CrossRef
       {\r
         if (cdna[c].getSource().equals(DBRefSource.EMBLCDS))\r
         {\r
-          // retrieve CDS dataset sequences\r
+          System.err.println("TODO: unimplemented sequence retrieval for coding region sequence.");\r
+          // TODO: retrieve CDS dataset sequences\r
           // need global dataset sequence retriever/resolver to reuse refs\r
           // and construct Mapping entry.\r
           // insert gaps in CDS according to peptide gaps.\r
@@ -444,6 +463,7 @@ public class CrossRef
           boolean direct, boolean dna)\r
   {\r
     boolean found = false;\r
+    SequenceI[] typer=new SequenceI[1];\r
     if (dataset == null)\r
       return false;\r
     if (dataset.getSequences() == null)\r
@@ -464,6 +484,17 @@ public class CrossRef
         }\r
         if (nxt != sequenceI && nxt != sequenceI.getDatasetSequence())\r
         {\r
+          // check if this is the correct sequence type\r
+          {\r
+            typer[0] = nxt;\r
+            boolean isDna = jalview.util.Comparison.isNucleotide(typer);\r
+            if ((direct && isDna == dna) || (!direct && isDna!=dna))\r
+            {\r
+              // skip this sequence because it is same molecule type\r
+              continue;\r
+            }\r
+          }\r
+\r
           // look for direct or indirect references in common\r
           DBRefEntry[] poss = null, cands = null;\r
           if (direct)\r
@@ -549,4 +580,4 @@ public class CrossRef
    * System.out.println("Prod "+p+": "+prod[p].getDisplayId(true)); } }\r
    *  } }\r
    */\r
-}
\ No newline at end of file
+}\r