public static void main( String[] args ) throws PsimiXmlReaderException { File file = new File( "path/to/intputfile.xml" ); PsimiXmlLightweightReader reader = new PsimiXmlLightweightReader( file ); final List<IndexedEntry> indexedEntries = reader.getIndexedEntries(); for ( IndexedEntry indexedEntry : indexedEntries ) { Iterator<Interaction> ii = indexedEntry.unmarshallInteractionIterator(); while ( ii.hasNext() ) { Interaction interaction = ii.next(); System.out.println( interaction.getId() ); } } } }
log.debug("interaction " + interaction.getId() + "/" + interaction.getImexId() + " was binary or intra molecular, no further processing involved."); interactions.add(interaction); log.debug("interaction " + interaction.getId() + "/" + interaction.getImexId() + " was inter molecular, reset stoichiometry of one of interactors"); interactions.add(interaction); } else {
log.debug("interaction " + interaction.getId() + "/" + interaction.getImexId() + " was binary or intra molecular, no further processing involved."); interactions.add(interaction); log.debug("interaction " + interaction.getId() + "/" + interaction.getImexId() + " was inter molecular, reset stoichiometry of one of interactors"); interactions.add(interaction); } else {
public static Collection<Object> nonRedundantInteractorsFromPsiEntry(Entry psiEntry) { Map<Integer, Object> nonRedundantInteractors = new HashMap<Integer, Object>(); if( ConverterContext.getInstance().isGenerateExpandedXml() ) { // iterate to get the unique experiments/interactors for (psidev.psi.mi.xml.model.Interaction interaction : psiEntry.getInteractions()) { for (Participant participant : interaction.getParticipants()) { if (participant.getInteractor() != null){ nonRedundantInteractors.put(participant.getInteractor().getId(), participant.getInteractor()); } else if (participant.getInteraction() != null){ nonRedundantInteractors.put(participant.getInteraction().getId(), participant.getInteraction()); } } } } else { for ( psidev.psi.mi.xml.model.Interactor interactor : psiEntry.getInteractors() ) { nonRedundantInteractors.put( interactor.getId(), interactor ); } } return nonRedundantInteractors.values(); }
psiIndex.addInteraction( interaction.getId(), isr );
psiIndex.addInteraction( interaction.getId(), isr );
LOG.warn("Interaction: " + interaction.getId() + ", name(s): " + shortName + " " + name + "; has both 'gene' and physical entity type participants: " + participantTypes + "; so we'll replace 'gene' with 'dna' (a quick fix)"); bpInteraction = createComplex(bpParticipants, interaction.getImexId(), interaction.getId()); } else if(isGeneticInteraction) { bpInteraction = createGeneticInteraction(bpParticipants, interactionVocabularies, interaction.getImexId(), interaction.getId() ); } else { bpInteraction = createMolecularInteraction(bpParticipants, interactionVocabularies, interaction.getImexId(), interaction.getId());
log.error("interaction (id:" + interaction.getId() + ") could not be converted to MITAB25 as it does not have exactly 1 or 2 participants."); return null;
throw new PsimiXmlReaderException("The interaction "+interaction.getId()+" refers to the experiment " + eref.getRef() + " but this experiment cannot be found by the parser." + " Please check that you are not mixing the expanded PSI xml schema and the compact PSI xml schema together. Either all the experiments are described at the beginning of the file and" + " all the interactions then use references to pre-declared experiments or all the experiments are only described at the level of the interactions and no experiment reference can be used."); }else { throw new PsimiXmlReaderException( "An interaction (id="+ interaction.getId()+") contains an inferredInteraction which refers to experiment ref "+ eref.getRef() +"," + "however, this experiment isn't defined in this interaction." + " This is not a supported use of the PSI-MI XML format." ); ExperimentDescription ed = getExperimentById( file, eref.getRef() ); if (ed == null){ throw new PsimiXmlReaderException("The interaction "+interaction.getId()+" has an inferred interaction which refers to the experiment " + eref.getRef() + " but this experiment cannot be found by the parser." + " Please check that you are not mixing the expanded PSI xml schema and the compact PSI xml schema together. Either all the experiments are described at the beginning of the file and" + " all the interactions and participants then use references to pre-declared experiments or all the experiments are only described at the level of the interactions and no experiment reference can be used."); throw new PsimiXmlReaderException("The interaction "+interaction.getId()+" has an inferred interaction participant which refers to the feature " + iip.getFeatureRef().getRef() + " but this feature cannot be found by the parser." + " Please check that you have described this feature previously in this interaction."); throw new PsimiXmlReaderException("The interaction "+interaction.getId()+" has an inferred interaction which refers to the participant " + iip.getParticipantRef().getRef() + " but this participant cannot be found by the parser." + " Please check that you have described the participant in this interaction."); interaction.getId()+") has a confidence which refers to experiment ref "+ eref.getRef() +"," + "however, this experiment isn't defined in this interaction." + " This is not a supported use of the PSI-MI XML format." ); throw new PsimiXmlReaderException("The interaction "+interaction.getId()+" has a confidence which refers to the experiment " + eref.getRef() + " but this experiment cannot be found by the parser." + " Please check that you are not mixing the expanded PSI xml schema and the compact PSI xml schema together. Either all the experiments are described at the beginning of the file and" + " all the interactions and participants then use references to pre-declared experiments or all the experiments are only described at the level of the interactions and no experiment reference can be used.");
/** * 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; }
participant.setInteraction(interactor); } else { participant.setInteractionRef(new InteractionRef(interactor.getId()));
interaction.getImexId(), interaction.getId(), experimentDescription.getId());
if (ref.getRef() == parentInteraction.getId()){ throw new PsimiXmlReaderException("The interaction " + ref.getRef() + " has a participant ("+participant.getId()+") which is an interaction and this interaction is referring to itself." + " It is not a valid participant."); parentInteraction.getId()+") has a participant identification method which refers to experiment ref "+ eref.getRef() +"," + "however, this experiment isn't defined in this interaction." + " This is not a supported use of the PSI-MI XML format." ); parentInteraction.getId()+") has an experimental role which refers to experiment ref "+ eref.getRef() +"," + "however, this experiment isn't defined in this interaction." + " This is not a supported use of the PSI-MI XML format." ); parentInteraction.getId()+") has an experimental preparation which refers to experiment ref "+ eref.getRef() +"," + "however, this experiment isn't defined in this interaction." + " This is not a supported use of the PSI-MI XML format." ); parentInteraction.getId()+") has an experimental interactor which refers to experiment ref "+ eref.getRef() +"," + "however, this experiment isn't defined in this interaction." + " This is not a supported use of the PSI-MI XML format." ); parentInteraction.getId()+") has an organism which refers to experiment ref "+ eref.getRef() +"," + "however, this experiment isn't defined in this interaction." + " This is not a supported use of the PSI-MI XML format." ); parentInteraction.getId()+") has a confidence which refers to experiment ref "+ eref.getRef() +"," + "however, this experiment isn't defined in this interaction." + " This is not a supported use of the PSI-MI XML format." ); parentInteraction.getId()+") has a parameter which refers to experiment ref "+ eref.getRef() +"," +
jInteraction.setId( mInteraction.getId() ); jInteraction.setImexId( mInteraction.getImexId() );
jInteraction.setId( mInteraction.getId() ); jInteraction.setImexId( mInteraction.getImexId() );
jParticipant.setInteractionRef( mParticipant.getInteraction().getId() ); } else { throw new ConverterException( "Neither an interactor or an interaction was present in participant " + mParticipant.getId() );
jParticipant.setInteractionRef( mParticipant.getInteraction().getId() ); } else { throw new ConverterException( "Neither an interactor or an interaction was present in participant " + mParticipant.getId() );