+/*\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.ws.dbsources;\r
\r
import jalview.datamodel.Alignment;\r
import jalview.datamodel.AlignmentI;\r
import jalview.datamodel.SequenceI;\r
import jalview.datamodel.xdb.embl.EmblEntry;\r
-import jalview.ws.EBIFetchClient;\r
+import jalview.ws.ebi.EBIFetchClient;\r
\r
import java.io.File;\r
import java.util.Iterator;\r
super();\r
}\r
/**\r
- * set this to false to *not* add protein products to alignment dataset.\r
- */\r
- public boolean getProteinProducts=false;\r
- /**\r
* retrieve and parse an emblxml file\r
* @param emprefx either EMBL or EMBLCDS strings are allowed - anything else will not retrieve emblxml\r
* @param query\r
public AlignmentI getEmblSequenceRecords(String emprefx, String query) throws Exception\r
{\r
startQuery();\r
- SequenceI seqs[] = null;\r
- Vector alseq = new Vector(); // the sequences that will actually be presented in the alignment\r
- StringBuffer result = new StringBuffer();\r
EBIFetchClient dbFetch = new EBIFetchClient();\r
File reply; \r
try {\r
stopQuery();\r
throw new Exception("EBI EMBL XML retrieval failed on "+emprefx.toLowerCase()+":"+query.trim(),e);\r
}\r
+ return getEmblSequenceRecords(emprefx, query, reply);\r
+ }\r
+ /**\r
+ * parse an emblxml file stored locally\r
+ * @param emprefx either EMBL or EMBLCDS strings are allowed - anything else will not retrieve emblxml\r
+ * @param query\r
+ * @param file the EMBL XML file containing the results of a query\r
+ * @return\r
+ * @throws Exception\r
+ */\r
+ public AlignmentI getEmblSequenceRecords(String emprefx, String query, File reply) throws Exception\r
+ {\r
+ SequenceI seqs[] = null;\r
+ StringBuffer result = new StringBuffer();\r
if (reply != null && reply.exists())\r
{\r
+ efile=null;\r
file = reply.getAbsolutePath();\r
- efile = jalview.datamodel.xdb.embl.EmblFile.getEmblFile(reply);\r
+ if (reply.length()>25)\r
+ {\r
+ efile = jalview.datamodel.xdb.embl.EmblFile.getEmblFile(reply);\r
+ } else {\r
+ result.append("# No EMBL record retrieved for "+emprefx.toLowerCase()+":"+query.trim());\r
+ }\r
}\r
if (efile!=null) {\r
for (Iterator i=efile.getEntries().iterator(); i.hasNext(); ) {\r
EmblEntry entry = (EmblEntry) i.next();\r
- SequenceI[] seqparts = entry.getSequences(false,!getProteinProducts, emprefx);\r
+ SequenceI[] seqparts = entry.getSequences(false, true, emprefx); // TODO: use !fetchNa,!fetchPeptide here instead - see todo in emblEntry\r
if (seqparts!=null) {\r
SequenceI[] newseqs = null;\r
int si=0;\r
return al;\r
}\r
\r
-}
\ No newline at end of file
+}\r