git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JAL-2136 JAL-2137 Modified STRUCTMODEL annotation format and added implementation...
[jalview.git]
/
src
/
jalview
/
ws
/
dbsources
/
EmblXmlSource.java
diff --git
a/src/jalview/ws/dbsources/EmblXmlSource.java
b/src/jalview/ws/dbsources/EmblXmlSource.java
index
73e67aa
..
b2fb808
100644
(file)
--- a/
src/jalview/ws/dbsources/EmblXmlSource.java
+++ b/
src/jalview/ws/dbsources/EmblXmlSource.java
@@
-64,7
+64,7
@@
public abstract class EmblXmlSource extends EbiFileRetrievedProxy
{
reply = dbFetch.fetchDataAsFile(
emprefx.toLowerCase() + ":" + query.trim(), "display=xml",
{
reply = dbFetch.fetchDataAsFile(
emprefx.toLowerCase() + ":" + query.trim(), "display=xml",
- ".xml");
+ "xml");
} catch (Exception e)
{
stopQuery();
} catch (Exception e)
{
stopQuery();
@@
-72,7
+72,7
@@
public abstract class EmblXmlSource extends EbiFileRetrievedProxy
"exception.ebiembl_retrieval_failed_on", new String[] {
emprefx.toLowerCase(), query.trim() }), e);
}
"exception.ebiembl_retrieval_failed_on", new String[] {
emprefx.toLowerCase(), query.trim() }), e);
}
- return getEmblSequenceRecords(emprefx, reply);
+ return getEmblSequenceRecords(emprefx, query, reply);
}
/**
}
/**
@@
-81,38
+81,51
@@
public abstract class EmblXmlSource extends EbiFileRetrievedProxy
* @param emprefx
* either EMBL or EMBLCDS strings are allowed - anything else will
* not retrieve emblxml
* @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
*/
* @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<SequenceI> seqs = new ArrayList<SequenceI>();
if (reply != null && reply.exists())
{
file = reply.getAbsolutePath();
if (reply.length() > EMBL_NOT_FOUND_REPLY.length())
{
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?
+ /*
+ * invalid accession gets a reply with no <entry> elements, text content of
+ * EmbFile reads something like (e.g.) this ungrammatical phrase
+ * Entry: <acc> display type is either not supported or entry is not found.
+ */
List<SequenceI> peptides = new ArrayList<SequenceI>();
List<SequenceI> peptides = new ArrayList<SequenceI>();
- AlignmentI al = null;
- if (entry != null)
+ if (efile != null && efile.getEntries() != 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;
}
stopQuery();
return al;
}