X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fws%2Fdbsources%2FEmblXmlSource.java;h=0236d441e5ca38fd16ed17bd492cfbb84131a370;hb=db93a1adcbe0a4eaaf06e0a70ade0d6c5c1961c3;hp=73e67aa2ea377c7a912ee4885174cf685cea5ac6;hpb=30b2b47cbdfa35b127b0fb09e911815cddd9ed7b;p=jalview.git diff --git a/src/jalview/ws/dbsources/EmblXmlSource.java b/src/jalview/ws/dbsources/EmblXmlSource.java index 73e67aa..0236d44 100644 --- a/src/jalview/ws/dbsources/EmblXmlSource.java +++ b/src/jalview/ws/dbsources/EmblXmlSource.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) - * Copyright (C) $$Year-Rel$$ The Jalview Authors + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9.0b2) + * Copyright (C) 2015 The Jalview Authors * * This file is part of Jalview. * @@ -72,7 +72,7 @@ public abstract class EmblXmlSource extends EbiFileRetrievedProxy "exception.ebiembl_retrieval_failed_on", new String[] { emprefx.toLowerCase(), query.trim() }), e); } - return getEmblSequenceRecords(emprefx, reply); + return getEmblSequenceRecords(emprefx, query, reply); } /** @@ -81,38 +81,46 @@ public abstract class EmblXmlSource extends EbiFileRetrievedProxy * @param emprefx * either EMBL or EMBLCDS strings are allowed - anything else will * not retrieve emblxml + * @param query * @param file * the EMBL XML file containing the results of a query * @return * @throws Exception */ - public AlignmentI getEmblSequenceRecords(String emprefx, File reply) - throws Exception + public AlignmentI getEmblSequenceRecords(String emprefx, String query, + File reply) throws Exception { - EmblEntry entry = null; + EmblFile efile = null; + List seqs = new ArrayList(); if (reply != null && reply.exists()) { file = reply.getAbsolutePath(); if (reply.length() > EMBL_NOT_FOUND_REPLY.length()) { - entry = EmblFile.getEmblEntry(reply); + efile = EmblFile.getEmblFile(reply); } } - // TODO don't need peptides any more? List peptides = new ArrayList(); - AlignmentI al = null; - if (entry != null) + if (efile != null) { - SequenceI seq = entry.getSequence(emprefx, peptides); - if (seq != null) + for (EmblEntry entry : efile.getEntries()) { - seq.deriveSequence(); - // place DBReferences on dataset and refer - al = new Alignment(new SequenceI[] { seq }); + SequenceI seq = entry.getSequence(emprefx, peptides); + if (seq != null) + { + seqs.add(seq.deriveSequence()); + // place DBReferences on dataset and refer + } } } + + AlignmentI al = null; + if (!seqs.isEmpty()) + { + al = new Alignment(seqs.toArray(new SequenceI[seqs.size()])); + } stopQuery(); return al; }