- replaceMatchingSeqsWith(rna, al, AlignSeq.DNA);
- }
- } catch (ClassNotFoundException x)
- {
- // ignore classnotfounds - occurs in applet
- }
- ;
- }
-
- /**
- * matches ochains against al and populates seqs with the best match between
- * each ochain and the set in al
- *
- * @param ochains
- * @param al
- * @param dnaOrProtein
- */
- private void replaceMatchingSeqsWith(ArrayList<SequenceI> ochains,
- AlignmentI al, String dnaOrProtein)
- {
- if (al != null && al.getHeight() > 0)
- {
- ArrayList<SequenceI> matches = new ArrayList<SequenceI>();
- ArrayList<AlignSeq> aligns = new ArrayList<AlignSeq>();
-
- for (SequenceI sq : ochains)
- {
- SequenceI bestm = null;
- AlignSeq bestaseq = null;
- int bestscore = 0;
- for (SequenceI msq : al.getSequences())
- {
- AlignSeq aseq = AlignSeq.doGlobalNWAlignment(msq, sq,
- dnaOrProtein);
- if (bestm == null || aseq.getMaxScore() > bestscore)
- {
- bestscore = aseq.getMaxScore();
- bestaseq = aseq;
- bestm = msq;
- }
- }
- System.out.println("Best Score for " + (matches.size() + 1) + " :"
- + bestscore);
- matches.add(bestm);
- aligns.add(bestaseq);
- al.deleteSequence(bestm);
- }
- for (int p = 0, pSize = seqs.size(); p < pSize; p++)
- {
- SequenceI sq, sp = seqs.get(p);
- int q;
- if ((q = ochains.indexOf(sp)) > -1)