package jalview.ws;
+import jalview.analysis.CrossRef;
import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.DBRefSource;
import jalview.ws.seqfetcher.ASequenceFetcher;
import jalview.ws.seqfetcher.DbSourceProxy;
-import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.Vector;
// assertions
AlignmentI ds = null;
- Vector noProds = new Vector();
+ Vector<Object[]> noProds = new Vector<Object[]>();
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"
{
boolean dna = sp.isDnaCoding();
// try and find products
- String types[] = jalview.analysis.CrossRef
- .findSequenceXrefTypes(dna, al.getSequencesArray());
+ CrossRef crossRef = new CrossRef(al.getSequencesArray(),
+ al);
+ List<String> types = crossRef.findXrefSourcesForSequences(dna);
if (types != null)
{
System.out.println("Xref Types for: "
+ (dna ? "dna" : "prot"));
- for (int t = 0; t < types.length; t++)
+ for (String source : types)
{
- System.out.println("Type: " + types[t]);
- SequenceI[] prod = jalview.analysis.CrossRef
- .findXrefSequences(al.getSequencesArray(), dna,
- types[t], null, new ArrayList<SequenceI>())
+ System.out.println("Type: " + source);
+ SequenceI[] prod = crossRef.findXrefSequences(source, dna)
.getSequencesArray();
System.out.println("Found "
+ ((prod == null) ? "no" : "" + prod.length)
}
if (noProds.size() > 0)
{
- Enumeration ts = noProds.elements();
+ Enumeration<Object[]> ts = noProds.elements();
while (ts.hasMoreElements())
{
- Object[] typeSq = (Object[]) ts.nextElement();
+ Object[] typeSq = ts.nextElement();
boolean dna = (typeSq.length > 1);
AlignmentI al = (AlignmentI) typeSq[0];
System.out.println("Trying getProducts for "
// have a bash at finding the products amongst all the retrieved
// sequences.
SequenceI[] seqs = al.getSequencesArray();
- Alignment prodal = jalview.analysis.CrossRef.findXrefSequences(
- seqs, dna, null, ds, new ArrayList<SequenceI>());
+ Alignment prodal = new CrossRef(seqs, ds).findXrefSequences(null,
+ dna);
System.out.println("Found "
+ ((prodal == null) ? "no" : "" + prodal.getHeight())
+ " products");