{
String first = did[0] + " " + did[1];
AlignFrame af = null;
+ boolean dna;
+ AlignmentI retral;
+ AlignmentI dataset;
+ SequenceI[] seqs;
+ List<String> ptypes = null;
if (pass1 == 0)
{
// retrieve dbref
AlignmentTest.assertAlignmentDatasetRefs(af.getViewport()
.getAlignment(), "Pass (" + pass1 + "," + pass2 + ","
+ pass3 + "): Fetch " + first + ":");
+ dna = af.getViewport().getAlignment().isNucleotide();
+ retral = af.getViewport().getAlignment();
+ dataset = retral.getDataset();
+ seqs = retral.getSequencesArray();
- // store project to recover on next pass
- stringify(dbtoviewBit, savedProjects, first, af.alignPanel);
}
else
{
// recover stored project
af = new FileLoader(false).LoadFileWaitTillLoaded(savedProjects
.get(first).toString(), FormatAdapter.FILE);
+ System.out.println("Recovered view for '" + first + "' from '"
+ + savedProjects.get(first).toString() + "'");
+ dna = af.getViewport().getAlignment().isNucleotide();
+ retral = af.getViewport().getAlignment();
+ dataset = retral.getDataset();
+ seqs = retral.getSequencesArray();
// verify references for recovered data
AlignmentTest.assertAlignmentDatasetRefs(af.getViewport()
}
- boolean dna = af.getViewport().getAlignment().isNucleotide();
- AlignmentI retral = af.getViewport().getAlignment();
- AlignmentI dataset = retral.getDataset();
- SequenceI[] seqs = retral.getSequencesArray();
- List<String> ptypes = (seqs == null || seqs.length == 0) ? null
- : new CrossRef(seqs, dataset)
- .findXrefSourcesForSequences(dna);
+ // store project on first pass, compare next pass
+ stringify(dbtoviewBit, savedProjects, first, af.alignPanel);
+ ptypes = (seqs == null || seqs.length == 0) ? null : new CrossRef(
+ seqs, dataset).findXrefSourcesForSequences(dna);
+
+ // start of pass2: retrieve each cross-ref for fetched or restored
+ // project.
pass2 = 0;
do // second cross ref and recover crossref loop
{
- for (String db : ptypes)
- {
+
+ for (String db : ptypes)
+ {
// counter for splitframe views retrieved via crossref
- int p = 0;
+ int firstcr_ap = 0;
// build next key so we an retrieve all views
- String nextxref = first + " -> " + db + "{" + p + "}";
+ String nextxref = first + " -> " + db + "{" + firstcr_ap + "}";
// perform crossref action, or retrieve stored project
List<AlignmentViewPanel> cra_views = new ArrayList<AlignmentViewPanel>();
CrossRefAction cra = null;
AlignFrame af2 = new FileLoader(false)
.LoadFileWaitTillLoaded(savedProjects.get(nextxref)
.toString(), FormatAdapter.FILE);
+ System.out.println("Recovered view for '" + nextxref
+ + "' from '" + savedProjects.get(nextxref).toString()
+ + "'");
// gymnastics to recover the alignPanel/Complementary alignPanel
if (af2.getViewport().isNucleotide())
{
}
}
+ HashMap<String, List<String>> xrptypes = new HashMap<String, List<String>>();
+ // first save/verify views.
for (AlignmentViewPanel avp : cra_views)
{
- nextxref = first + " -> " + db + "{" + p++ + "}";
-
+ nextxref = first + " -> " + db + "{" + firstcr_ap++ + "}";
// verify references for this panel
AlignmentTest.assertAlignmentDatasetRefs(avp.getAlignment(),
- "" + "Pass (" + pass1 + "," + pass2 + "): For "
- + nextxref + ":");
+ "Pass (" + pass1 + "," + pass2 + "," + pass3
+ + "): before start of pass3: " + nextxref
+ + ":");
SequenceI[] xrseqs = avp.getAlignment().getSequencesArray();
- stringify(dbtoviewBit, savedProjects, nextxref, avp);
- keyseq.add(nextxref);
-
- List<String> xrptypes = (seqs == null || seqs.length == 0) ? null
+ List<String> _xrptypes = (seqs == null || seqs.length == 0) ? null
: new CrossRef(xrseqs, dataset)
.findXrefSourcesForSequences(avp
.getAlignViewport().isNucleotide());
- pass3 = 0;
- do // 3rd cross ref and recover crossref loop
+
+ stringify(dbtoviewBit, savedProjects, nextxref, avp);
+ xrptypes.put(nextxref, _xrptypes);
+
+ }
+ // now do the next xref pass starting from either saved or just
+ // recovered split pane, in sequence
+ pass3 = 0;
+ do // 3rd cross ref and recover crossref loop, for each view from
+ // second xref view set or recover viewset
+ {
+ firstcr_ap = 0;
+ for (AlignmentViewPanel avp : cra_views)
{
- for (String xrefdb : xrptypes)
+ nextxref = first + " -> " + db + "{" + firstcr_ap++ + "}";
+ for (String xrefdb : xrptypes.get(nextxref))
{
List<AlignmentViewPanel> cra_views2 = new ArrayList<AlignmentViewPanel>();
int q = 0;
- String nextnextxref = "{" + p + "}" + nextxref + " -> "
- + xrefdb + "{" + q + "}";
+ String nextnextxref = nextxref
+ + " -> " + xrefdb + "{" + q + "}";
if (pass3 == 0)
{
+ SequenceI[] xrseqs = avp.getAlignment()
+ .getSequencesArray();
AlignFrame nextaf = Desktop.getAlignFrameFor(avp
.getAlignViewport());
cra = new CrossRefAction(nextaf, xrseqs, avp
.getAlignViewport().isNucleotide(), xrefdb);
cra.run();
- Assert.assertTrue(cra.getXrefViews().size() > 0,
- "No crossrefs found for '" + nextxref + "' to "
- + xrefdb + " via '" + nextaf.getTitle()
- + "'");
+ Assert.assertTrue(
+ cra.getXrefViews().size() > 0,
+ "No crossrefs found for '" + nextnextxref
+ + "' to " + xrefdb + " via '"
+ + nextaf.getTitle() + "'");
cra_views2 = cra.getXrefViews();
}
else
.LoadFileWaitTillLoaded(
savedProjects.get(nextnextxref)
.toString(), FormatAdapter.FILE);
+ System.out.println("Recovered view for '"
+ + nextnextxref + "' from '"
+ + savedProjects.get(nextnextxref).toString()
+ + "'");
// gymnastics to recover the alignPanel/Complementary
// alignPanel
if (af2.getViewport().isNucleotide())
for (AlignmentViewPanel nextavp : cra_views2)
{
- nextnextxref = "{" + p + "}" + nextxref + " -> "
- + xrefdb + "{" + q++ + "}";
+ nextnextxref = nextxref
+ + " -> " + xrefdb + "{" + q++ + "}";
// verify references for this panel
AlignmentTest.assertAlignmentDatasetRefs(
keyseq.add(nextnextxref);
}
} // end of loop around showing all xrefdb for crossrf2
- // fetchdb->crossref1->crossref-2->verify for xrefs we
- // either loop twice when pass2=0, or just once when pass2=1
- // (recovered project from previous crossref)
- } while (pass3++ < 2 && pass2 < 1);
- }
- }
+
+ } // end of loop around all viewpanels from crossrf1
+ } while (pass3++ < 2 && pass2 < 1);
+ // fetchdb->crossref1->crossref-2->verify for xrefs we
+ // either loop twice when pass2=0, or just once when pass2=1
+ // (recovered project from previous crossref)
+
+ }
// fetchdb-->crossref1
// for each xref we try to retrieve xref, store and verify when
// pass1=0, or just retrieve and verify when pass1=1
// fetchdb
// for each ref we
// loop twice: first, do the retrieve, second recover from saved project
- } while (++pass1 < 2);
+ } while (pass1++ < 2);
}
}