From: jprocter Date: Thu, 31 Jul 2008 10:09:55 +0000 (+0000) Subject: added specific retrieval arguments to SequneceFetcher's main method. X-Git-Tag: Release_2_4~77 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=b7885c2f1d36f515354ede5793f5b3cddbc9db04;p=jalview.git added specific retrieval arguments to SequneceFetcher's main method. --- diff --git a/src/jalview/ws/SequenceFetcher.java b/src/jalview/ws/SequenceFetcher.java index 208eb88..da2dab6 100644 --- a/src/jalview/ws/SequenceFetcher.java +++ b/src/jalview/ws/SequenceFetcher.java @@ -33,15 +33,46 @@ public class SequenceFetcher extends ASequenceFetcher addDBRefSourceImpl(jalview.ws.dbsources.Pdb.class); addDBRefSourceImpl(jalview.ws.dbsources.Pfam.class); }; - + /** + * 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 [ ]\n" + +"With no arguments, all DbSources will be queried with their test Accession number.\n" + +"If given two arguments, SequenceFetcher will try to find the DbFetcher corresponding to and retrieve from it."; if (argv != null && argv.length > 0) { + DbSourceProxy sp = new SequenceFetcher().getSourceProxy(argv[0]); + if (sp!=null) + { + AlignmentI al = null; + try + { + al = sp.getSequenceRecords(argv[1]); + } catch (Exception e) + { + e.printStackTrace(); + System.err.println("Error when retrieving "+argv[1]+" from "+argv[0]+"\nUsage: "+usage); + } + SequenceI[] prod = al.getSequencesArray(); + if (al!=null) + { + for (int p = 0; p < prod.length; p++) + { + System.out.println("Prod " + p + ": " + + prod[p].getDisplayId(true) + " : "+prod[p].getDescription()); + } + } + return; + } else { + System.err.println("Can't resolve "+argv[0]+" as a database name. Allowed values are :\n"+new SequenceFetcher().getSupportedDb()); + } System.out - .println("Ignoring arguments. Future Usage = dbname:query1;query2;..."); + .println(usage); } ASequenceFetcher sfetcher = new SequenceFetcher(); String[] dbSources = sfetcher.getSupportedDb();