* @param al
* alignment to search for cross-referenced sequences (and possibly
* add to)
- * @param addedPeers
- * a list of sequences to add to if 'peers' to the original sequences
- * are found e.g. alternative protein products for a protein's gene
* @return products (as dataset sequences)
*/
public static Alignment findXrefSequences(SequenceI[] seqs,
- final boolean dna, final String source, AlignmentI al,
- List<SequenceI> addedPeers)
+ final boolean dna, final String source, AlignmentI al)
{
AlignmentI dataset = al.getDataset() == null ? al : al.getDataset();
List<SequenceI> rseqs = new ArrayList<SequenceI>();
{
found |= searchDataset(dss, xref, dataset, rseqs, cf, false,
!dna);
- // ,false,!dna);
if (found)
{
xrfs[r] = null; // we've recovered seqs for this one.
}
if (l > 0)
{
- System.out
- .println("Attempting to retrieve cross referenced sequences.");
+ // System.out
+ // .println("Attempting to retrieve cross referenced sequences.");
DBRefEntry[] t = new DBRefEntry[l];
l = 0;
for (int r = 0; r < xrfs.length; r++)
SequenceIdMatcher matcher = new SequenceIdMatcher(
dataset.getSequences());
- matcher.addAll(addedPeers);
List<SequenceFeature> copiedFeatures = new ArrayList<SequenceFeature>();
CrossRef me = new CrossRef();
for (int rs = 0; rs < retrieved.length; rs++)
.findIdMatch(map.getTo());
if (matched != null)
{
+ /*
+ * already got an xref to this sequence; update this
+ * map to point to the same sequence, and add
+ * any new dbrefs to it
+ */
+ for (DBRefEntry ref : map.getTo().getDBRefs())
+ {
+ matched.addDBRef(ref); // add or update mapping
+ }
map.setTo(matched);
}
else
map.setTo(dss);
/*
* copy sequence features as well, avoiding
- * duplication (e.g. from 2 transcripts)
+ * duplication (e.g. same variation from 2
+ * transcripts)
*/
SequenceFeature[] sfs = ms
.getSequenceFeatures();
}
else
{
- if (!addedPeers.contains(map.getTo()))
- {
- addedPeers.add(map.getTo());
- }
cf.addMap(retrieved[rs].getDatasetSequence(),
map.getTo(), map.getMap());
}