// One Taxa represents one TAXA block in a Nexus file.
t = (Taxa) taxas.elementAt(i);
if (!t.isDoomed()) {
// a taxa is represented by a TaxonLabelSet
// name is important:
TaxonLabelSet labelSet = new TaxonLabelSet();
labelSet.setStudy(pStudy);
labelSet.setTitle(t.getName());
labelSet.setTaxa(true);
// TODO: make sure the name is not null
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("taxa(" + i + ") name=" + t.getName()); //$NON-NLS-1$
}
// FIXME: instead of using a loop, use one query!
long[] taxaIDs = t.getTaxaIDs();
for (int j = 0; j < taxaIDs.length; j++) {
Taxon taxon = t.getTaxon(j);
String aLabel = taxon.getName();
TaxonLabel taxonLabel = getTaxonLabelHome().getByDescriptionAndStudy(
aLabel,
pStudy);
labelSet.addPhyloTaxonLabel(taxonLabel);
}
pDataSet.addTaxonLabelSet(t, labelSet);
}
}
// matrix:
MesquiteMatrixConverter.convertMatrices(
project,
pDataSet,
pFile.getName(),
getMatrixDataTypeHome(),
getItemDefinitionHome());
// tree:
TreesManager treeManager = (TreesManager) project.ownerModule
.findElementManager(TreeVector.class);
ListableVector treeVectors = treeManager.getTreeBlockVector();
for (int i = 0; i < treeVectors.size(); i++) {
// One treeVector represents one tree block
TreeVector treeVector = (TreeVector) treeVectors.elementAt(i);
// System.out.println(" treeVector: " + i + " - " + treeVector.getName());
TreeBlock treeblock = new TreeBlock();
treeblock.setTitle(treeVector.getName());
// first get the taxon list for the trees:
Taxa treeTaxa = treeVector.getTaxa();
// String taxaName = treeTaxa.getName();
TaxonLabelSet tlSet = pDataSet.getTaxonLabelSet(treeTaxa);
treeblock.setTaxonLabelSet(tlSet);
List<TaxonLabel> treeTaxonLabels = null;
if (tlSet != null) {
treeTaxonLabels = tlSet.getTaxonLabelsReadOnly();
}
// To be used by the tree traversal methods.
setCurrentTaxaList(treeTaxonLabels);
setCurrentTreeTaxa(treeTaxa);