flag for dasCoordSysFound added
authoramwaterhouse <Andrew Waterhouse>
Wed, 4 Apr 2007 13:10:57 +0000 (13:10 +0000)
committeramwaterhouse <Andrew Waterhouse>
Wed, 4 Apr 2007 13:10:57 +0000 (13:10 +0000)
src/jalview/io/DasSequenceFeatureFetcher.java

index a4dc777..33791ad 100755 (executable)
@@ -258,29 +258,42 @@ public class DasSequenceFeatureFetcher
         //  jalview.datamodel.DBRefSource.EMBL - not tested on any EMBL coord sys sources\r
       });\r
 // TODO: minimal list of DAS queries to make by querying with untyped ID if distinct from any typed IDs\r
-        if (uprefs != null)\r
+\r
+      boolean dasCoordSysFound = false;\r
+\r
+      if (uprefs != null)\r
         {\r
           // do any of these ids match the source's coordinate system ?\r
           for (int j = 0; j < uprefs.length; j++)\r
           {\r
             DasCoordinateSystem cs[] = dasSource.getCoordinateSystem();\r
-            \r
-            if(cs.length>0  && jalview.util.DBRefUtils\r
-                    .isDasCoordinateSystem(cs[0].getName(), uprefs[j]))\r
+\r
+            for(int csIndex=0; csIndex<cs.length; csIndex++)\r
             {\r
-              Cache.log.debug("Launched fetcher for coordinate system " +\r
-                  cs[0].getName());\r
-              //  Will have to pass any mapping information to the fetcher\r
-              //- the start/end for the DBRefEntry may not be the same as the sequence's start/end\r
-                  \r
-              createFeatureFetcher(seq,\r
-                                       dasSource,\r
-                                       uprefs[j]);\r
-              break; // only do this for one reference - assume same source will send same features for all IDs\r
+              if (cs.length > 0 && jalview.util.DBRefUtils\r
+                  .isDasCoordinateSystem(cs[csIndex].getName(), uprefs[j]))\r
+              {\r
+                Cache.log.debug("Launched fetcher for coordinate system " +\r
+                                cs[0].getName());\r
+                //  Will have to pass any mapping information to the fetcher\r
+                //- the start/end for the DBRefEntry may not be the same as the sequence's start/end\r
+\r
+                System.out.println(seq.getName() + " " + (seq.getDatasetSequence() == null)\r
+                                   + " " + dasSource.getUrl());\r
+\r
+                dasCoordSysFound = false;\r
+                createFeatureFetcher(seq,\r
+                                     dasSource,\r
+                                     uprefs[j]);\r
+                break; // only do this for one reference - assume same source will send same features for all IDs\r
+              }\r
+              else\r
+                System.out.println("IGNORE " + cs[csIndex].getName());\r
             }\r
           }\r
         }\r
-        else\r
+\r
+        if(!dasCoordSysFound)\r
         {\r
           String id = null;\r
           // try and use the name as the sequence id\r
@@ -312,16 +325,16 @@ public class DasSequenceFeatureFetcher
  * @param seq\r
  * @param SourceUrl\r
  * @param dbref\r
- */  \r
+ */\r
   protected void createFeatureFetcher(final SequenceI seq, final DasSource dasSource,\r
         final DBRefEntry dbref) {\r
-    \r
+\r
     //////////////\r
     /// fetch DAS features\r
     final Das1Source source = new Das1Source();\r
     source.setUrl(dasSource.getUrl());\r
     source.setNickname(dasSource.getNickname());\r
-    if (dbref==null || dbref.getAccessionId()==null || dbref.getAccessionId().length()<1) \r
+    if (dbref==null || dbref.getAccessionId()==null || dbref.getAccessionId().length()<1)\r
     {\r
       return;\r
     }\r
@@ -361,7 +374,7 @@ public class DasSequenceFeatureFetcher
                 Cache.log.debug("mapping from "+f.getBegin()+" - "+f.getEnd());\r
                 SequenceFeature vf[] = dbref.getMap().locateFeature(f);\r
                 if (vf!=null) {\r
-                  for (int v=0;v<vf.length;v++) \r
+                  for (int v=0;v<vf.length;v++)\r
                   {\r
                     Cache.log.debug("mapping to "+v+": "+vf[v].getBegin()+" - "+vf[v].getEnd());\r
                     seq.addSequenceFeature(vf[v]);\r