import jalview.datamodel.AlignmentI;
import jalview.datamodel.DBRefEntry;
import jalview.datamodel.DBRefSource;
+import jalview.datamodel.Mapping;
import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceI;
import jalview.util.DBRefUtils;
{
String[] dbrefs = null;
List<String> refs = new ArrayList<String>();
- for (int s = 0; s < seqs.length; s++)
+ for (SequenceI seq : seqs)
{
- if (seqs[s] != null)
+ if (seq != null)
{
- SequenceI dss = seqs[s];
+ SequenceI dss = seq;
while (dss.getDatasetSequence() != null)
{
dss = dss.getDatasetSequence();
}
DBRefEntry[] rfs = findXDbRefs(dna, dss.getDBRef());
- for (int r = 0; rfs != null && r < rfs.length; r++)
+ if (rfs != null)
{
- if (!refs.contains(rfs[r].getSource()))
+ for (DBRefEntry ref : rfs)
{
- refs.add(rfs[r].getSource());
+ if (!refs.contains(ref.getSource()))
+ {
+ refs.add(ref.getSource());
+ }
}
}
if (dataset != null)
{
// search for references to this sequence's direct references.
- DBRefEntry[] lrfs = CrossRef
- .findXDbRefs(!dna, seqs[s].getDBRef());
+ DBRefEntry[] lrfs = CrossRef.findXDbRefs(!dna, seq.getDBRef());
List<SequenceI> rseqs = new ArrayList<SequenceI>();
- CrossRef.searchDatasetXrefs(seqs[s], !dna, lrfs, dataset, rseqs,
+ CrossRef.searchDatasetXrefs(seq, !dna, lrfs, dataset, rseqs,
null); // don't need to specify codon frame for mapping here
for (SequenceI rs : rseqs)
{
- DBRefEntry[] xrs = findXDbRefs(dna, rs.getDBRef()); // not used??
- for (int r = 0; rfs != null && r < rfs.length; r++)
+ DBRefEntry[] xrs = findXDbRefs(dna, rs.getDBRef());
+ if (xrs != null)
{
- if (!refs.contains(rfs[r].getSource()))
+ for (DBRefEntry ref : xrs)
{
- refs.add(rfs[r].getSource());
+ if (!refs.contains(ref.getSource()))
+ {
+ refs.add(ref.getSource());
+ }
}
}
+ // looks like copy and paste - change rfs to xrs?
+ // for (int r = 0; rfs != null && r < rfs.length; r++)
+ // {
+ // if (!refs.contains(rfs[r].getSource()))
+ // {
+ // refs.add(rfs[r].getSource());
+ // }
+ // }
}
}
}
return dbrefs;
}
- /*
- * if (dna) { if (rfs[r].hasMap()) { // most likely this is a protein cross
- * reference if (!refs.contains(rfs[r].getSource())) {
- * refs.addElement(rfs[r].getSource()); } } }
- */
public static boolean hasCdnaMap(SequenceI[] seqs)
{
+ // TODO unused - remove?
String[] reftypes = findSequenceXrefTypes(false, seqs);
for (int s = 0; s < reftypes.length; s++)
{
public static SequenceI[] getCdnaMap(SequenceI[] seqs)
{
+ // TODO unused - remove?
Vector cseqs = new Vector();
for (int s = 0; s < seqs.length; s++)
{
/**
*
* @param seqs
+ * sequences whose xrefs are being retrieved
* @param dna
+ * true if sequences are nucleotide
* @param source
* @param dataset
* alignment to search for product sequences.
String source, AlignmentI dataset)
{
List<SequenceI> rseqs = new ArrayList<SequenceI>();
- Alignment ral = null;
- AlignedCodonFrame cf = new AlignedCodonFrame(); // nominal width
- for (int s = 0; s < seqs.length; s++)
+ AlignedCodonFrame cf = new AlignedCodonFrame();
+ for (SequenceI seq : seqs)
{
- SequenceI dss = seqs[s];
+ SequenceI dss = seq;
while (dss.getDatasetSequence() != null)
{
dss = dss.getDatasetSequence();
if ((xrfs == null || xrfs.length == 0) && dataset != null)
{
System.out.println("Attempting to find ds Xrefs refs.");
- DBRefEntry[] lrfs = CrossRef.findXDbRefs(!dna, seqs[s].getDBRef());
+ // FIXME should be dss not seq here?
+ DBRefEntry[] lrfs = CrossRef.findXDbRefs(!dna, seq.getDBRef());
// less ambiguous would be a 'find primary dbRefEntry' method.
// filter for desired source xref here
found = CrossRef.searchDatasetXrefs(dss, !dna, lrfs, dataset,
{
System.err
.println("Problem whilst retrieving cross references for Sequence : "
- + seqs[s].getName());
+ + seq.getName());
e.printStackTrace();
}
if (retrieved != null)
for (int rs = 0; rs < retrieved.length; rs++)
{
// TODO: examine each sequence for 'redundancy'
- jalview.datamodel.DBRefEntry[] dbr = retrieved[rs]
- .getDBRef();
+ DBRefEntry[] dbr = retrieved[rs].getDBRef();
if (dbr != null && dbr.length > 0)
{
for (int di = 0; di < dbr.length; di++)
{
// find any entry where we should put in the sequence being
// cross-referenced into the map
- jalview.datamodel.Mapping map = dbr[di].getMap();
+ Mapping map = dbr[di].getMap();
if (map != null)
{
if (map.getTo() != null && map.getMap() != null)
}
}
}
+
+ Alignment ral = null;
if (rseqs.size() > 0)
{
SequenceI[] rsqs = new SequenceI[rseqs.size()];