- if (dbs.isA(DBRefSource.ALIGNMENTDB))
- {
- skip = true;
- }
- else
- {
- nm = dbs.getDbName();
- if (getSourceProxy(srcs[i]) instanceof jalview.ws.dbsources.das.datamodel.DasSequenceSource)
- {
- if (nm.startsWith("das:"))
- {
- nm = nm.substring(4);
- das = true;
- }
- break;
- }
- }
- }
- if (skip)
- {
- continue;
- }
- if (das)
- {
- dassrc.add(srcs[i]);
- }
- else
- {
- nondas.add(srcs[i]);
- }
- }
- String[] tosort = nondas.toArray(new String[0]), sorted = nondas
- .toArray(new String[0]);
- for (int j = 0, jSize = sorted.length; j < jSize; j++)
- {
- tosort[j] = tosort[j].toLowerCase();
- }
- jalview.util.QuickSort.sort(tosort, sorted);
- // construct array with all sources listed
-
- srcs = new String[sorted.length + dassrc.size()];
- int i = 0;
- for (int j = sorted.length - 1; j >= 0; j--, i++)
- {
- srcs[i] = sorted[j];
- sorted[j] = null;
- }
-
- sorted = dassrc.toArray(new String[0]);
- tosort = dassrc.toArray(new String[0]);
- for (int j = 0, jSize = sorted.length; j < jSize; j++)
- {
- tosort[j] = tosort[j].toLowerCase();
- }
- jalview.util.QuickSort.sort(tosort, sorted);
- for (int j = sorted.length - 1; j >= 0; j--, i++)
- {
- srcs[i] = sorted[j];
- }
- return srcs;
- }
-
- /**
- * return plaintext databse list suitable for using in a GUI element
- */
- public String[] _getOrderedSupportedSources()
- {
- String[] srcs = this.getSupportedDb();
- ArrayList dassrc = new ArrayList(), nondas = new ArrayList();
- for (int i = 0; i < srcs.length; i++)
- {
- for (DbSourceProxy dbs : getSourceProxy(srcs[i]))
- {
- String nm = dbs.getDbName();
- if (getSourceProxy(srcs[i]) instanceof jalview.ws.dbsources.das.datamodel.DasSequenceSource)
- {
- if (nm.startsWith("das:"))
- {
- nm = nm.substring(4);
- }
- dassrc.add(new String[]
- { srcs[i], nm.toUpperCase() });
- }
- else
- {
- nondas.add(new String[]
- { srcs[i], nm.toUpperCase() });
- }
- }
- }
- Object[] sorted = nondas.toArray();
- String[] tosort = new String[sorted.length];
- nondas.clear();
- for (int j = 0; j < sorted.length; j++)
- {
- tosort[j] = ((String[]) sorted[j])[1];
- }
- jalview.util.QuickSort.sort(tosort, sorted);
- int i = 0;
- // construct array with all sources listed
- srcs = new String[sorted.length + dassrc.size()];
- for (int j = sorted.length - 1; j >= 0; j--, i++)
- {
- srcs[i] = ((String[]) sorted[j])[0];
- sorted[j] = null;
- }
-
- sorted = dassrc.toArray();
- tosort = new String[sorted.length];
- dassrc.clear();
- for (int j = 0; j < sorted.length; j++)
- {
- tosort[j] = ((String[]) sorted[j])[1];
- }
- jalview.util.QuickSort.sort(tosort, sorted);
- for (int j = sorted.length - 1; j >= 0; j--, i++)
- {
- srcs[i] = ((String[]) sorted[j])[0];
- sorted[j] = null;
- }
- return srcs;
- }
-
- /**
- * simple run method to test dbsources.
- *
- * @param argv
- */
- public static void main(String[] argv)
- {
- AlignmentI ds = null;
- Vector noProds = new Vector();
- String usage = "SequenceFetcher.main [-nodas] [<DBNAME> [<ACCNO>]]\n"
- + "With no arguments, all DbSources will be queried with their test Accession number.\n"
- + "With one argument, the argument will be resolved to one or more db sources and each will be queried with their test accession only.\n"
- + "If given two arguments, SequenceFetcher will try to find the DbFetcher corresponding to <DBNAME> and retrieve <ACCNO> from it.\n"
- + "The -nodas option will exclude DAS sources from the database fetchers Jalview will try to use.";
- boolean withDas = true;
- if (argv != null && argv.length > 0
- && argv[0].toLowerCase().startsWith("-nodas"))
- {
- withDas = false;
- String targs[] = new String[argv.length - 1];
- System.arraycopy(argv, 1, targs, 0, targs.length);
- argv = targs;
- }
- if (argv != null && argv.length > 0)
- {
- List<DbSourceProxy> sps = new SequenceFetcher(withDas)
- .getSourceProxy(argv[0]);
-
- if (sps != null)
- {
- for (DbSourceProxy sp : sps)