protected Collection<Experiment> getExperiments(psidev.psi.mi.xml.model.Interaction psiInteraction) { Collection<ExperimentDescription> expDescriptions = psiInteraction.getExperiments(); List<Experiment> experiments = new ArrayList<Experiment>(expDescriptions.size()); for (ExperimentDescription expDesc : expDescriptions) { Experiment experiment = experimentConverter.psiToIntact(expDesc); experiments.add(experiment); } if (expDescriptions.size() > 1){ log.error("Interaction having more than one experiment not valid in IntAct : " + psiInteraction); } else if (expDescriptions.isEmpty()){ log.error("Interaction without experiments not valid in IntAct : " + psiInteraction); } return experiments; }
/** * Retrieve an experiment description in an interaction using an experiment ref * @param eref : the experiment reference * @param i : the interaction to look into * @return the experiment which has been found */ private ExperimentDescription findExperimentDescriptionInInteraction(ExperimentRef eref, Interaction i){ for ( ExperimentDescription ed : i.getExperiments() ) { if( ed.getId() == eref.getRef() ) { return ed; } } return null; }
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; }
public static Collection<ExperimentDescription> nonRedundantExperimentsFromPsiEntry(Entry psiEntry) { Map<Integer,ExperimentDescription> nonRedundantExps = new HashMap<Integer,ExperimentDescription>(); if( ConverterContext.getInstance().isGenerateCompactXml() ) { for (ExperimentDescription expDesc : psiEntry.getExperiments()) { nonRedundantExps.put(expDesc.getId(), expDesc); } } else { for (psidev.psi.mi.xml.model.Interaction interaction : psiEntry.getInteractions()) { for (ExperimentDescription exp : interaction.getExperiments()) { nonRedundantExps.put(exp.getId(), exp); } } } return nonRedundantExps.values(); }
public static Entry createEntry(Source source, Collection<Interaction> interactions) { Entry entry = new Entry(); entry.setSource(source); for (Interaction interaction : interactions) { entry.getInteractions().add(interaction); for (ExperimentDescription expDesc : interaction.getExperiments()) { entry.getExperiments().add(expDesc); } for (Participant part : interaction.getParticipants()) { entry.getInteractors().add(part.getInteractor()); } } return entry; }
private void normalizeEntry(Entry entry) { if (entry.getExperiments().isEmpty()) { for (Interaction interaction : entry.getInteractions()) { interaction.getExperimentRefs().clear(); for (ExperimentDescription exp : interaction.getExperiments()) { entry.getExperiments().add(exp); interaction.getExperimentRefs().add(new ExperimentRef(exp.getId())); } } } if (entry.getInteractors().isEmpty()) { for (Interaction interaction : entry.getInteractions()) { for(Participant participant : interaction.getParticipants()) { entry.getInteractors().add(participant.getInteractor()); } } } }
protected void failIfInconsistentConversion(Interaction intact, psidev.psi.mi.xml.model.Interaction psi, int numberOfAuthorConfAttributes) { Collection<Experiment> experiments; Collection<Component> participants; Collection<Confidence> confidences; if (isCheckInitializedCollections()){ experiments = IntactCore.ensureInitializedExperiments(intact); participants = IntactCore.ensureInitializedParticipants(intact); confidences = IntactCore.ensureInitializedConfidences(intact); } else { experiments = intact.getExperiments(); participants = intact.getComponents(); confidences = intact.getConfidences(); } failIfInconsistentCollectionSize("experiment", experiments, psi.getExperiments()); failIfInconsistentCollectionSize("participant", participants, psi.getParticipants()); Collection<Confidence> confs = confidences; if (confs.size() > 0 && psi.getConfidences().size() + numberOfAuthorConfAttributes > 0 && confs.size() != (psi.getConfidences().size() + numberOfAuthorConfAttributes)) { throw new InconsistentConversionException("Confidence", confs.size(), psi.getConfidences().size() + numberOfAuthorConfAttributes); } }
protected void failIfInconsistentPsiConversion(Interaction intact, psidev.psi.mi.xml.model.Interaction psi) { Collection<Experiment> experiments; Collection<Component> participants; Collection<Confidence> confidences; if (isCheckInitializedCollections()){ experiments = IntactCore.ensureInitializedExperiments(intact); participants = IntactCore.ensureInitializedParticipants(intact); confidences = IntactCore.ensureInitializedConfidences(intact); } else { experiments = intact.getExperiments(); participants = intact.getComponents(); confidences = intact.getConfidences(); } failIfInconsistentCollectionSize("experiment", experiments, psi.getExperiments()); failIfInconsistentCollectionSize("participant", participants, psi.getParticipants()); Collection<Confidence> confs = confidences; if (confs.size() > 0 && psi.getConfidences().size() > 0 && (confs.size()) != psi.getConfidences().size()) { throw new InconsistentConversionException("Confidence", confs.size(), psi.getConfidences().size()); } }
/** * 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; }
for (psidev.psi.mi.xml.model.ExperimentDescription jExperiment : mInteraction.getExperiments()) { if (!experimentIds.contains(jExperiment.getId())) { mEntry.getExperiments().add(jExperiment);
mEntry.getExperiments().addAll(mInteraction.getExperiments());
protected void failIfInconsistentConversion(Interaction intact, psidev.psi.mi.xml.model.Interaction psi) { Collection<Experiment> experiments; Collection<Component> participants; Collection<Confidence> confidences; if (isCheckInitializedCollections()){ experiments = IntactCore.ensureInitializedExperiments(intact); participants = IntactCore.ensureInitializedParticipants(intact); confidences = IntactCore.ensureInitializedConfidences(intact); } else { experiments = intact.getExperiments(); participants = intact.getComponents(); confidences = intact.getConfidences(); } failIfInconsistentCollectionSize("experiment", experiments, psi.getExperiments()); failIfInconsistentCollectionSize("participant", participants, psi.getParticipants()); failIfInconsistentCollectionSize( "confidence", confidences, psi.getConfidences()); }
for (psidev.psi.mi.xml.model.ExperimentDescription jExperiment : jInteraction.getExperiments()) { if (!experimentIds.contains(jExperiment.getId())) { jEntry.getExperimentList().getExperimentDescriptions().add(experimentDescriptionConverter.toJaxb(jExperiment));
for (psidev.psi.mi.xml.model.ExperimentDescription jExperiment : jInteraction.getExperiments()) { if (!experimentIds.contains(jExperiment.getId())) { jEntry.getExperimentList().getExperimentDescriptions().add( experimentDescriptionConverter.toJaxb(jExperiment));
interaction.getExperiments().add( ed ); for ( Iterator<ExperimentRef> itex = ii.getExperimentRefs().iterator(); itex.hasNext(); ) { ExperimentRef eref = itex.next(); if( ! interaction.getExperiments().isEmpty() ) { ExperimentDescription ed = findExperimentDescriptionInInteraction(eref, interaction); if (conf.hasExperimentRefs()){ for (ExperimentRef eref : conf.getExperimentRefs()){ if( !interaction.getExperiments().isEmpty() ) { ExperimentDescription ed = findExperimentDescriptionInInteraction(eref, interaction); ExperimentRef eref = pm.getExperimentRef(); if( ! interaction.getExperiments().isEmpty() ) { ExperimentDescription ed = findExperimentDescriptionInInteraction(eref, interaction);
mInteraction.getExperiments().add( mExperiment );
mInteraction.getExperiments().add( mExperiment );
private Set<Evidence> createBiopaxEvidences(Interaction interaction) { Set<Evidence> evidences = new HashSet<Evidence>(); for (ExperimentDescription experimentDescription : interaction.getExperiments()) {
for ( ExperimentDescription mExperiment : mInteraction.getExperiments() ) { final psidev.psi.mi.xml254.jaxb.ExperimentDescription exp = experimentDescriptionConverter.toJaxb( mExperiment );
for ( ExperimentDescription mExperiment : mInteraction.getExperiments() ) { final ExperimentType exp = experimentDescriptionConverter.toJaxb( mExperiment );