- StringBuffer multiacc = new StringBuffer();
- ArrayList<String> tosend = new ArrayList<String>();
- while (en.hasNext())
- {
- String nel = en.next();
- tosend.add(nel);
- multiacc.append(nel);
- if (en.hasNext())
- {
- multiacc.append(proxy.getAccessionSeparator());
- }
- }
- try
- {
- AlignmentI rslt;
- SequenceI[] rs;
- List<String> nores = new ArrayList<String>();
- rslt = proxy.getSequenceRecords(multiacc.toString());
- if (rslt == null || rslt.getHeight() == 0)
- {
- // no results - pass on all queries to next source
- nextfetch.addAll(tosend);
- }
- else
- {
- aresultq.add(multiacc.toString());
- aresult.add(rslt);
-
- rs = rslt.getSequencesArray();
- // search for each query in the dbrefs associated with each
- // sequence
- // returned.
- // ones we do not find will be used to query next source (if any)
- for (String q : tosend)
- {
- DBRefEntry dbr = new DBRefEntry(), found[] = null;
- dbr.setSource(proxy.getDbSource());
- dbr.setVersion(null);
- if (proxy.getAccessionValidator() != null)
- {
- Regex vgr = proxy.getAccessionValidator();
- vgr.search(q);
- if (vgr.numSubs() > 0)
- {
- dbr.setAccessionId(vgr.stringMatched(1));
- }
- else
- {
- dbr.setAccessionId(vgr.stringMatched());
- }
- }
- else
- {
- dbr.setAccessionId(q);
- }
- boolean rfound = false;
- for (int r = 0; r < rs.length; r++)
- {
- if (rs[r] != null
- && (found = DBRefUtils.searchRefs(
- rs[r].getDBRef(), dbr)) != null
- && found.length > 0)
- {
- rfound = true;
- rs[r] = null;
- continue;
- }
- }
- if (!rfound)
- {
- nextfetch.add(q);
- }
- }
- }
- } catch (OutOfMemoryError oome)
- {
- new OOMWarning("fetching " + multiacc + " from "
- + database.getSelectedItem(), oome, this);
- }