/** * @param interactions * @return */ private String toPigeon(Set<Interaction> interactions) { StringBuilder sb = new StringBuilder(); sb.append("# Arcs").append("\r\n"); if (null != interactions && !(interactions.isEmpty())) { Iterator<Interaction> it = interactions.iterator(); while (it.hasNext()) { Interaction ia = it.next(); if (InteractionType.REPRESSES == ia.getType()) { sb.append(toPigeonRep(ia)); } else if (InteractionType.INDUCES == ia.getType()) { sb.append(toPigeonInd(ia)); } sb.append("\r\n"); } } return sb.toString(); }
/* * REPRESSES -> REP */ private String toPigeonInd(Interaction induces) { StringBuilder sb = new StringBuilder(); // get the individual roles String inducer = null; String inducee = null; for (Participation part : induces.getParticipations()) { if (Participation.Role.INDUCER == part.getRole()) { inducer = part.getParticipant().getName(); } else if (Participation.Role.INDUCEE == part.getRole()) { inducee = part.getParticipant().getName(); } } // finally, we build the Pigeon statement sb.append(inducer); sb.append(" ing "); sb.append(inducee); return sb.toString(); }
/* * REPRESSES -> REP */ private String toPigeonRep(Interaction represses) { StringBuilder sb = new StringBuilder(); // get the individual roles String repressor = null; String repressee = null; for (Participation part : represses.getParticipations()) { if (Participation.Role.REPRESSOR == part.getRole()) { repressor = part.getParticipant().getName(); } else if (Participation.Role.REPRESSEE == part.getRole()) { repressee = part.getParticipant().getName(); } } // finally, we build the Pigeon statement sb.append(repressor); sb.append(" rep "); sb.append(repressee); return sb.toString(); }