/** * Get the first interaction type only */ protected CvInteractionType getInteractionType(psidev.psi.mi.xml.model.Interaction psiInteraction) { final Collection<InteractionType> interactionTypes = psiInteraction.getInteractionTypes(); if (interactionTypes == null || interactionTypes.isEmpty()) { throw new PsiConversionException("Interaction without Interaction Type: "+psiInteraction); } if (interactionTypes.size() > 1) { throw new PsiConversionException("Interaction with more than one Interaction Type: "+psiInteraction); } InteractionType psiInteractionType = interactionTypes.iterator().next(); return this.interactionTypeConverter.psiToIntact(psiInteractionType); }
public static Interaction createInteraction(String name, ExperimentDescription experiment, InteractionType interactionType, Collection<Participant> participants) { Interaction interaction = new Interaction(); assignNextId(interaction); interaction.setNames(createNames(name, null)); for (Participant participant : participants) { interaction.getParticipants().add(participant); } interaction.getInteractionTypes().add(interactionType); interaction.getExperiments().add(experiment); return interaction; }
/** * Build a new Interaction with no participants but holding a copy of all other attributes of the given interaction. * <br/> WARNING: all attributes of the newly created interaction are the same as the source's (that is same object * instance). This is not an object clone. * * @param source the source interaction. * @return a target interaction which is a copy of the source interaction but the participants or * inferredInteractions. */ protected Interaction copyInteraction(Interaction source) { Interaction target = new Interaction(); // clone inner attributes target.setId(source.getId()); target.setImexId(source.getImexId()); // objects target.setNames(source.getNames()); target.setXref(source.getXref()); // collections target.getConfidences().addAll(source.getConfidences()); target.getExperiments().addAll(source.getExperiments()); target.getInteractionTypes().addAll(source.getInteractionTypes()); // added with mitab 27 target.setModelled(source.isModelled()); target.setIntraMolecular(source.isIntraMolecular()); target.setNegative(source.isNegative()); target.getParameters().addAll(source.getParameters()); target.getAttributes().addAll(source.getAttributes()); target.setAvailability(source.getAvailability()); return target; }
List<CrossReference> types = new ArrayList<CrossReference>(interaction.getInteractionTypes().size()); for (psidev.psi.mi.xml.model.InteractionType interactionType : interaction.getInteractionTypes()) {
interaction.getInteractionTypes().addAll(getInteractionTypes(binaryInteraction));
for(CvType interactionType : interaction.getInteractionTypes()) {
interaction.getInteractionTypes().add(interactionType);
private void processEdge(final Participant source, final Participant target, final Interaction interaction, final Collection<Participant> nodes, CyTable nodeTable, CyTable edgeTable) { Interactor sourceInteractor = source.getInteractor(); Interactor targetInteractor = target.getInteractor(); if (sourceInteractor == null || targetInteractor == null) { return; } final CyNode sourceCyNode = id2NodeMap.get(sourceInteractor.getId()); final CyNode targetCyNode = id2NodeMap.get(targetInteractor.getId()); // PPI does not have directinarity final CyEdge edge = network.addEdge(sourceCyNode, targetCyNode, false); // TODO: what's the best value for interaction? edgeTable.getRow(edge.getSUID()).set(CyEdge.INTERACTION, "pp"); final String sourceName = nodeTable.getRow(sourceCyNode.getSUID()).get(CyNetwork.NAME, String.class); final String targetName = nodeTable.getRow(targetCyNode.getSUID()).get(CyNetwork.NAME, String.class); edgeTable.getRow(edge.getSUID()).set(CyNetwork.NAME, sourceName + " (pp) " + targetName); mapNames(edgeTable, edge.getSUID(), interaction.getNames(), null); mapAttributes(interaction.getAttributes(), edgeTable, edge.getSUID()); final Collection<InteractionType> types = interaction.getInteractionTypes(); mapInteractionType(types, edgeTable, edge.getSUID()); }
mInteraction.getInteractionTypes().add( cvTypeConverter.fromJaxb( jIntereractionType, InteractionType.class ) );
mInteraction.getInteractionTypes().add( cvTypeConverter.fromJaxb( jIntereractionType, InteractionType.class ) );
for ( InteractionType mInteractionType : mInteraction.getInteractionTypes() ) { jInteraction.getInteractionTypes().add( cvTypeConverter.toJaxb( mInteractionType ) );
for ( InteractionType mInteractionType : mInteraction.getInteractionTypes() ) { jInteraction.getInteractionTypes().add( cvTypeConverter.toJaxb( mInteractionType ) );