if (nestCompartments) nm = CompartmentManager.getUnifiedName(nm);
compart = getCompartment(nm, map, root);
}
}
NodeModel nd;
if (cmp.getComponent().isEmpty())
{
nd = new Actor(compart, cmp, null);
}
else
{
ChbComplex c = new ChbComplex(compart, cmp);
createComplexContent(c, cmp, cmp, map);
nd = c;
}
map.put(cmp.getRDFId(), nd);
}
}
// Create events
for (Conversion conv : model.getObjects(Conversion.class))
{
String compName = ChbConversion.getPossibleCompartmentName(conv);
if (compName != null && nestCompartments)
compName = CompartmentManager.getUnifiedName(compName);
CompoundModel compart = compName == null ? root : (CompoundModel) map.get(compName);
// if (compart == null)
// {
// System.out.println("");
// }
assert compart != null;
ChbConversion forwd = null, rever = null;
if (evidenceExists(conv, ChbConversion.LEFT_TO_RIGHT))
{
forwd = new ChbConversion(compart, conv, ChbConversion.LEFT_TO_RIGHT, map);
forwd.selectBestCompartment();
}
if (evidenceExists(conv, ChbConversion.RIGHT_TO_LEFT))
{
rever = new ChbConversion(compart, conv, ChbConversion.RIGHT_TO_LEFT, map);
rever.selectBestCompartment();
}
if (forwd == null && rever == null)
{
forwd = new ChbConversion(compart, conv, ChbConversion.LEFT_TO_RIGHT, map);
forwd.selectBestCompartment();
}
}
// for (TemplateReaction reac : model.getObjects(TemplateReaction.class))
// {
// String compName = ChbConversion.getPossibleCompartmentName(reac);
//
// if (compName != null && nestCompartments)
// compName = CompartmentManager.getUnifiedName(compName);
//
// CompoundModel compart = compName == null ? root : (CompoundModel) map.get(compName);
//
// }
for (Interaction inter : model.getObjects(Interaction.class))
{
boolean drawPPI = true;
if (!drawPPI) break;
if (!(inter instanceof Conversion) && !(inter instanceof Control))
{
// We constraint the participant list to Physical Entities only
Set<Entity> interPartic = inter.getParticipant();
Set<PhysicalEntity> pes = new HashSet<PhysicalEntity>();
for (Entity e : interPartic)
{
if (e instanceof PhysicalEntity) pes.add((PhysicalEntity) e);
}
if (pes.isEmpty()) continue;
boolean hasControl = !inter.getControlledOf().isEmpty();
if (hasControl || pes.size() != 2)
{
String compName = Hub.getPossibleCompartmentName(pes);
if (nestCompartments) compName = CompartmentManager.getUnifiedName(compName);
CompoundModel compart = compName == null ? root :
(CompoundModel) map.get(compName);
Hub hub = new Hub(compart, inter, map);
for (PhysicalEntity pe : pes)
{
NodeModel node = map.get(pe.getRDFId());
assert node != null;
new MultiTouch(node, hub);
}