/*\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
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)\r
+ * Copyright (C) 2010 J Procter, AM Waterhouse, 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
+ * This file is part of Jalview.\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
+ * Jalview 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 3 of the License, or (at your option) any later version.\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
+ * Jalview is distributed in the hope that it will be useful, but \r
+ * WITHOUT ANY WARRANTY; without even the implied warranty \r
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
+ * PURPOSE. See the GNU General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
package jalview.ws;\r
\r
addDBRefSourceImpl(jalview.ws.dbsources.Pdb.class);\r
addDBRefSourceImpl(jalview.ws.dbsources.PfamFull.class);\r
addDBRefSourceImpl(jalview.ws.dbsources.PfamSeed.class); // ensures Seed\r
- // alignment is\r
- // 'default' for\r
- // PFAM\r
+ // alignment is\r
+ // 'default' for\r
+ // PFAM\r
registerDasSequenceSources();\r
}\r
\r
{\r
DasSource[] sources = jalview.ws.DasSequenceFeatureFetcher\r
.getDASSources();\r
- if (sources!=null)\r
+ if (sources != null)\r
{\r
- for (int s=0; sources!=null && s<sources.length; s++)\r
+ for (int s = 0; sources != null && s < sources.length; s++)\r
{\r
addDasSequenceSource(sources[s]);\r
}\r
}\r
- \r
+\r
Vector localsources = jalview.bin.Cache.getLocalDasSources();\r
- if (localsources!=null)\r
- { \r
- for (Enumeration ls = localsources.elements(); ls.hasMoreElements(); )\r
+ if (localsources != null)\r
+ {\r
+ for (Enumeration ls = localsources.elements(); ls.hasMoreElements();)\r
{\r
addDasSequenceSource((DasSource) ls.nextElement());\r
}\r
- } \r
+ }\r
}\r
+\r
/**\r
* Try to create and add a DasSequenceSource to the list of sources.\r
+ * \r
* @param source\r
* @return null if no source was added, or the new DasSequenceSource created\r
*/\r
- DasSequenceSource addDasSequenceSource(DasSource source) {\r
- DasSequenceSource ds=null;\r
+ DasSequenceSource addDasSequenceSource(DasSource source)\r
+ {\r
+ DasSequenceSource ds = null;\r
Das1Source d1s = null;\r
if (source.hasCapability("sequence"))\r
{\r
if (source instanceof Das2Source)\r
{\r
- if (((Das2Source) source).hasDas1Capabilities())\r
- {\r
- try\r
- {\r
- d1s = org.biojava.dasobert.das2.DasSourceConverter\r
- .toDas1Source((Das2Source) source);\r
- } catch (Exception e)\r
- {\r
- System.err.println("Ignoring DAS2 sequence source "\r
- + source.getNickname()\r
- + " - couldn't map to Das1Source.\n");\r
- e.printStackTrace();\r
- }\r
- }\r
- }\r
- else\r
+ if (((Das2Source) source).hasDas1Capabilities())\r
{\r
- if (source instanceof Das1Source)\r
+ try\r
+ {\r
+ d1s = org.biojava.dasobert.das2.DasSourceConverter\r
+ .toDas1Source((Das2Source) source);\r
+ } catch (Exception e)\r
{\r
- d1s = (Das1Source) source;\r
+ System.err.println("Ignoring DAS2 sequence source "\r
+ + source.getNickname()\r
+ + " - couldn't map to Das1Source.\n");\r
+ e.printStackTrace();\r
}\r
}\r
}\r
- if (d1s != null)\r
+ else\r
{\r
- DasCoordinateSystem[] css = d1s.getCoordinateSystem();\r
- if (css==null || css.length==0)\r
+ if (source instanceof Das1Source)\r
{\r
- // TODO: query das source directly to identify coordinate system... or\r
- // have to make up a coordinate system\r
- css = new DasCoordinateSystem[] { new DasCoordinateSystem()};\r
- css[0].setName(d1s.getNickname());\r
- css[0].setUniqueId(d1s.getNickname());\r
+ d1s = (Das1Source) source;\r
}\r
- for (int c = 0; c < css.length; c++)\r
+ }\r
+ }\r
+ if (d1s != null)\r
+ {\r
+ DasCoordinateSystem[] css = d1s.getCoordinateSystem();\r
+ if (css == null || css.length == 0)\r
+ {\r
+ // TODO: query das source directly to identify coordinate system... or\r
+ // have to make up a coordinate system\r
+ css = new DasCoordinateSystem[]\r
+ { new DasCoordinateSystem() };\r
+ css[0].setName(d1s.getNickname());\r
+ css[0].setUniqueId(d1s.getNickname());\r
+ }\r
+ for (int c = 0; c < css.length; c++)\r
+ {\r
+ try\r
{\r
- try\r
- {\r
- addDbRefSourceImpl(ds=new DasSequenceSource(\r
- "das:" + d1s.getNickname() + " (" + css[c].getName()\r
- + ")", css[c].getName(), d1s, css[c]));\r
- } catch (Exception e)\r
- {\r
- System.err.println("Ignoring sequence coord system " + c + " ("\r
- + css[c].getName() + ") for source "\r
- + d1s.getNickname()\r
- + "- threw exception when constructing fetcher.\n");\r
- e.printStackTrace();\r
- }\r
+ addDbRefSourceImpl(ds = new DasSequenceSource("das:"\r
+ + d1s.getNickname() + " (" + css[c].getName() + ")",\r
+ css[c].getName(), d1s, css[c]));\r
+ } catch (Exception e)\r
+ {\r
+ System.err.println("Ignoring sequence coord system " + c + " ("\r
+ + css[c].getName() + ") for source " + d1s.getNickname()\r
+ + "- threw exception when constructing fetcher.\n");\r
+ e.printStackTrace();\r
}\r
}\r
- return ds;\r
+ }\r
+ return ds;\r
}\r
}\r