+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
+ * \r
+ * This file is part of Jalview.\r
+ * \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
+ * 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.dbsources;\r
\r
import java.util.Hashtable;\r
import jalview.datamodel.AlignmentI;\r
\r
/**\r
- * an instance of this class is created for each unique DAS Sequence source (ie one capable of handling the 'sequence' for a particular MapMaster)\r
- * \r
+ * an instance of this class is created for each unique DAS Sequence source (ie\r
+ * one capable of handling the 'sequence' for a particular MapMaster)\r
+ * \r
* @author JimP\r
- *\r
+ * \r
*/\r
public class DasSequenceSource extends DbSourceProxyImpl implements\r
DbSourceProxy\r
{\r
- protected Das1Source source=null;\r
- protected String dbname="DASCS";\r
- protected String dbrefname="das:source";\r
+ protected Das1Source source = null;\r
+\r
+ protected String dbname = "DASCS";\r
+\r
+ protected String dbrefname = "das:source";\r
+\r
protected DasCoordinateSystem coordsys = null;\r
+\r
/**\r
* create a new DbSource proxy for a DAS 1 source\r
- * @param dbnbame Human Readable Name to use when fetching from this source\r
- * @param dbrefname DbRefName for DbRefs attached to sequences retrieved from this source\r
- * @param source Das1Source\r
- * @param coordsys specific coordinate system to use for this source\r
- * @throws Exception if source is not capable of the 'sequence' command\r
+ * \r
+ * @param dbnbame\r
+ * Human Readable Name to use when fetching from this source\r
+ * @param dbrefname\r
+ * DbRefName for DbRefs attached to sequences retrieved from this\r
+ * source\r
+ * @param source\r
+ * Das1Source\r
+ * @param coordsys\r
+ * specific coordinate system to use for this source\r
+ * @throws Exception\r
+ * if source is not capable of the 'sequence' command\r
*/\r
- public DasSequenceSource(String dbname, String dbrefname, Das1Source source,\r
- DasCoordinateSystem coordsys) throws Exception\r
+ public DasSequenceSource(String dbname, String dbrefname,\r
+ Das1Source source, DasCoordinateSystem coordsys) throws Exception\r
{\r
if (!source.hasCapability("sequence"))\r
{\r
- throw new Exception("Source "+source.getNickname()+" does not support the sequence command.");\r
+ throw new Exception("Source " + source.getNickname()\r
+ + " does not support the sequence command.");\r
}\r
this.source = source;\r
this.dbname = dbname;\r
- this.dbrefname=dbrefname;\r
+ this.dbrefname = dbrefname;\r
this.coordsys = coordsys;\r
}\r
+\r
public String getAccessionSeparator()\r
{\r
// cope with single sequences only\r
\r
public Regex getAccessionValidator()\r
{\r
- /** ? **/\r
+ /** ? * */\r
return Regex.perlCode("\\S+");\r
}\r
\r
public String getDbName()\r
{\r
// TODO: map to\r
- return dbname+" (DAS)";\r
+ return dbname + " (DAS)";\r
}\r
\r
public String getDbSource()\r
\r
public AlignmentI getSequenceRecords(String queries) throws Exception\r
{\r
- SequenceThread seqfetcher = new org.biojava.dasobert.das.SequenceThread(queries, source);\r
- DasSequenceSourceListener ourlistener = new DasSequenceSourceListener(this, queries);\r
+ SequenceThread seqfetcher = new org.biojava.dasobert.das.SequenceThread(\r
+ queries, source);\r
+ DasSequenceSourceListener ourlistener = new DasSequenceSourceListener(\r
+ this, queries);\r
seqfetcher.addSequenceListener(ourlistener);\r
seqfetcher.start();\r
- try { Thread.sleep(5); } catch (Exception e) {};\r
+ try\r
+ {\r
+ Thread.sleep(5);\r
+ } catch (Exception e)\r
+ {\r
+ }\r
+ ;\r
while (ourlistener.isNotCalled() && seqfetcher.isAlive())\r
{\r
- try { Thread.sleep(5); } catch (Exception e) { };\r
+ try\r
+ {\r
+ Thread.sleep(5);\r
+ } catch (Exception e)\r
+ {\r
+ }\r
+ ;\r
}\r
if (ourlistener.isNotCalled() || ourlistener.hasNoSequences())\r
{\r
- System.err.println("Sequence Query to "+source.getNickname()+" with '"+queries+"' returned no sequences.");\r
+ System.err.println("Sequence Query to " + source.getNickname()\r
+ + " with '" + queries + "' returned no sequences.");\r
return null;\r
- } else {\r
+ }\r
+ else\r
+ {\r
return ourlistener.getSequences();\r
}\r
}\r
{\r
return coordsys.getTestCode();\r
}\r
+\r
public boolean isValidReference(String accession)\r
{\r
// TODO try to validate an accession against source\r
// We don't really know how to do this without querying source\r
- \r
+\r
return true;\r
}\r
+\r
/**\r
* @return the source\r
*/\r
{\r
return source;\r
}\r
+\r
/**\r
* @return the coordsys\r
*/\r