*/
public SequenceI[] getSequences(List<DBRefEntry> refs, boolean dna)
{
- Vector<SequenceI> rseqs = new Vector<SequenceI>();
- Hashtable<String, List<String>> queries = new Hashtable<String, List<String>>();
+ Vector<SequenceI> rseqs = new Vector<>();
+ Hashtable<String, List<String>> queries = new Hashtable<>();
for (DBRefEntry ref : refs)
{
- if (!queries.containsKey(ref.getSource()))
+ String canonical = DBRefUtils.getCanonicalName(ref.getSource());
+ if (!queries.containsKey(canonical))
{
- queries.put(ref.getSource(), new ArrayList<String>());
+ queries.put(canonical, new ArrayList<String>());
}
- List<String> qset = queries.get(ref.getSource());
+ List<String> qset = queries.get(canonical);
if (!qset.contains(ref.getAccessionId()))
{
qset.add(ref.getAccessionId());
continue;
}
- Stack<String> queriesLeft = new Stack<String>();
+ Stack<String> queriesLeft = new Stack<>();
queriesLeft.addAll(query);
List<DbSourceProxy> proxies = getSourceProxy(db);
for (DbSourceProxy fetcher : proxies)
{
- List<String> queriesMade = new ArrayList<String>();
- HashSet<String> queriesFound = new HashSet<String>();
+ List<String> queriesMade = new ArrayList<>();
+ HashSet<String> queriesFound = new HashSet<>();
try
{
if (fetcher.isDnaCoding() != dna)
for (int is = 0; is < seqs.length; is++)
{
rseqs.addElement(seqs[is]);
+ // BH 2015.01.25 check about version/accessid being null here
List<DBRefEntry> frefs = DBRefUtils.searchRefs(
seqs[is].getDBRefs(),
- new DBRefEntry(db, null, null));
+ new DBRefEntry(db, null, null), DBRefUtils.SEARCH_MODE_FULL);
for (DBRefEntry dbr : frefs)
{
queriesFound.add(dbr.getAccessionId());
Map<String, DbSourceProxy> dblist = fetchableDbs.get(db);
if (dblist == null)
{
- return new ArrayList<DbSourceProxy>();
+ return new ArrayList<>();
}
/*
* sort so that primary sources precede secondary
*/
- List<DbSourceProxy> dbs = new ArrayList<DbSourceProxy>(dblist.values());
+ List<DbSourceProxy> dbs = new ArrayList<>(dblist.values());
Collections.sort(dbs, proxyComparator);
return dbs;
}
{
if (fetchableDbs == null)
{
- fetchableDbs = new Hashtable<String, Map<String, DbSourceProxy>>();
+ fetchableDbs = new Hashtable<>();
}
Map<String, DbSourceProxy> slist = fetchableDbs
.get(proxy.getDbSource());
if (slist == null)
{
fetchableDbs.put(proxy.getDbSource(),
- slist = new Hashtable<String, DbSourceProxy>());
+ slist = new Hashtable<>());
}
slist.put(proxy.getDbName(), proxy);
}
return null;
}
String[] sources = null;
- Vector<String> src = new Vector<String>();
+ Vector<String> src = new Vector<>();
Enumeration<String> dbs = fetchableDbs.keys();
while (dbs.hasMoreElements())
{
public DbSourceProxy[] getDbSourceProxyInstances(Class class1)
{
- List<DbSourceProxy> prlist = new ArrayList<DbSourceProxy>();
+ List<DbSourceProxy> prlist = new ArrayList<>();
for (String fetchable : getSupportedDb())
{
for (DbSourceProxy pr : getSourceProxy(fetchable))