jParticipant.setId( mParticipant.getId() ); if ( mParticipant.hasInteractor() || mParticipant.hasInteractorRef() ) { if ( mParticipant.hasInteractorRef() ) jParticipant.setInteractorRef( mParticipant.getInteractorRef().getRef() ); else jParticipant.setInteractorRef( mParticipant.getInteractor().getId() ); jParticipant.setInteractor( interactorConverter.toJaxb( mParticipant.getInteractor() ) ); } else if ( mParticipant.hasInteraction() ) { jParticipant.setInteractionRef( mParticipant.getInteraction().getId() ); } else { throw new ConverterException( "Neither an interactor or an interaction was present in participant " + mParticipant.getId() ); if ( mParticipant.hasBiologicalRole() ) { jParticipant.setBiologicalRole( cvTypeConverter.toJaxb( mParticipant.getBiologicalRole() ) ); if ( mParticipant.hasNames() ) { jParticipant.setNames( namesConverter.toJaxb( mParticipant.getNames() ) ); if ( mParticipant.hasXref() ) { jParticipant.setXref( xrefConverter.toJaxb( mParticipant.getXref() ) ); if ( mParticipant.hasConfidences() ) { if ( jParticipant.getConfidenceList() == null ) { jParticipant.setConfidenceList( new ConfidenceListType() );
public static Participant createParticipant(Interactor interactor, BiologicalRole biologicalRole, ExperimentalRole experimentalRole) { Participant participant = new Participant(); assignNextId(participant); participant.setInteractor(interactor); participant.setBiologicalRole(biologicalRole); participant.getExperimentalRoles().add(experimentalRole); return participant; }
protected boolean isBait(Participant participant) { if (participant == null) { throw new IllegalArgumentException("Participant must not be null."); } if (participant.hasExperimentalRoles()) { for (ExperimentalRole role : participant.getExperimentalRoles()) { // search for bait log.debug("Checking if participant (id:" + participant.getId() + ") is a bait."); if (XrefUtils.hasPsiId(role.getXref(), BAIT_MI_REF)) { log.debug("Yes it is."); return true; } log.debug("No it is not."); } } return false; }
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(); }
IntactConverterUtils.populateNames(participant.getNames(), component); IntactConverterUtils.populateXref(participant.getXref(), component, new XrefConverter<ComponentXref>(getInstitution(), ComponentXref.class)); IntactConverterUtils.populateAnnotations(participant.getAttributes(), component, getInstitution()); if (participant.getInteractor() != null){ interactor = this.interactorConverter.psiToIntact(participant.getInteractor()); else if (participant.getInteraction() != null){ interactor = this.interactionConverter.psiToIntact(participant.getInteraction()); BiologicalRole psiBioRole = participant.getBiologicalRole(); if (psiBioRole == null) { psiBioRole = PsiConverterUtils.createUnspecifiedBiologicalRole(); if (participant.getExperimentalRoles().size() > 1) { throw new UnsupportedConversionException("Cannot convert participants with more than one experimental role: "+participant); if (participant.getExperimentalRoles().isEmpty()) { if (log.isWarnEnabled()) log.warn("Participant without experimental roles: " + participant); roles = participant.getExperimentalRoles(); for (psidev.psi.mi.xml.model.Feature psiFeature : participant.getFeatures()) { Feature feature = featureConverter.psiToIntact(psiFeature); component.addFeature(feature); for (ParticipantIdentificationMethod pim : participant.getParticipantIdentificationMethods()) { CvIdentification cvIdentification = pimConverter.psiToIntact(pim); component.getParticipantDetectionMethods().add(cvIdentification);
Participant mParticipant = new Participant(); mParticipant.setId( jParticipant.getId() ); mInteractor = factory.getInteractorDAO().retreive( jParticipant.getInteractorRef() ); if ( mInteractor == null ) { mParticipant.setInteractorRef( new InteractorRef( jParticipant.getInteractorRef() ) ); } else { mParticipant.setInteractor( mInteractor ); mParticipant.setInteractor( mInteractor ); mInteraction = factory.getInteractionDAO().retreive( jParticipant.getInteractionRef() ); if ( mInteraction == null ) { mParticipant.setInteractionRef( new InteractionRef( jParticipant.getInteractionRef() ) ); mParticipant.setInteraction( mInteraction); mParticipant.setBiologicalRole( cvTypeConverter.fromJaxb( jParticipant.getBiologicalRole(), BiologicalRole.class ) ); mParticipant.setNames( namesConverter.fromJaxb( jParticipant.getNames() ) ); mParticipant.setXref( xrefConverter.fromJaxb( jParticipant.getXref() ) ); mParticipant.getConfidenceList().add( confidenceConverter.fromJaxb( jConfidence ) ); for ( psidev.psi.mi.xml254.jaxb.ExperimentalInteractor jExperimentalInteractor : jParticipant.getExperimentalInteractorList().getExperimentalInteractors() ) { mParticipant.getExperimentalInteractors().add( experimentalInteractorConverter.fromJaxb( jExperimentalInteractor ) );
if ( participant.hasInteractionRef() ) { InteractionRef ref = participant.getInteractionRef(); participant.setInteractionRef( null ); 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."); throw new PsimiXmlReaderException("The participant "+participant.getId()+" refers to the interaction " + ref.getRef() + " but this interaction cannot be found by the parser. Please check that this interaction is described somewhere in the list of interactions."); participant.setInteraction(i); // recursive call !! throw new PsimiXmlReaderException("The participant ("+participant.getId()+") doesn't have any interactions attached to it."); if ( participant.hasInteractorRef() ) { InteractorRef ref = participant.getInteractorRef(); InputStreamRange irange = index.getInteractorPosition( ref.getRef() ); InputStream iis = null; throw new PsimiXmlReaderException("The participant "+participant.getId()+" refers to the interactor " + ref.getRef() + " but this interactior 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 interactors are described at the beginning of the file and" + " all the participants then use references to pre-declared interactors or all the interactors are only described at the level of the participants and no interactor reference can be used."); participant.setInteractorRef( null ); participant.setInteractor( interactor ); if ( participant.hasParticipantIdentificationMethods() ) { for ( ParticipantIdentificationMethod pim : participant.getParticipantIdentificationMethods() ) { if ( pim.hasExperimentRefs() ) {
participant.getExperimentalRoles().add( expRole ); participant.setBiologicalRole(bioRole); psidev.psi.mi.xml.model.Interaction interactor = interactionConverter.intactToPsi((InteractionImpl) intactObject.getInteractor()); if( ConverterContext.getInstance().isGenerateExpandedXml() ) { participant.setInteraction(interactor); } else { participant.setInteractionRef(new InteractionRef(interactor.getId())); psidev.psi.mi.xml.model.Interactor interactor = interactorConverter.intactToPsi(intactObject.getInteractor()); if( ConverterContext.getInstance().isGenerateExpandedXml() ) { participant.setInteractor(interactor); } else { participant.setInteractorRef(new InteractorRef(interactor.getId())); participant.getParticipantIdentificationMethods().add(participantIdentificationMethod); participant.getExperimentalPreparations().add(expPrep); participant.getFeatures().add(psiFeature); participant.getHostOrganisms().add(hostOrganism); participant.getConfidenceList().add( confidence); if (!participant.getAttributes().contains(authConf)){ participant.getAttributes().add(authConf);
Interactor xmlInteractor = xmlParticipant.getInteractor(); if (xmlParticipant.hasBiologicalRole()) { BiologicalRole xmlBioRole = xmlParticipant.getBiologicalRole(); CrossReference cr = cvConverter.toMitab(xmlBioRole); if (xmlParticipant.hasExperimentalRoles()) { Collection<ExperimentalRole> xmlExpRoles = xmlParticipant.getExperimentalRoles(); if (xmlParticipant.getAttributes() != null) { Collection<Attribute> xmlParticipantAttributes = xmlParticipant.getAttributes(); for (Attribute xmlParticipantAttribute : xmlParticipantAttributes) { String name = xmlParticipantAttribute.getName(); if (xmlParticipant.getFeatures() != null) { Collection<Feature> xmlFeatures = xmlParticipant.getFeatures(); List<psidev.psi.mi.tab.model.Feature> tabFeatures = new ArrayList<psidev.psi.mi.tab.model.Feature>(); if (xmlParticipant.getAttributes() != null) { Collection<Attribute> attributes = xmlParticipant.getAttributes(); if (xmlParticipant.getParticipantIdentificationMethods() != null) { Collection<ParticipantIdentificationMethod> xmlPartIdentMethodsRoles = xmlParticipant.getParticipantIdentificationMethods();
private Entity createBiopaxEntity(Participant participant, Set<String> avail, Provenance pro) LOG.debug("createBiopaxEntity, processing participant: " + participant.getId()); if (participant.hasInteractor()) { entity = createParticipant(participant, participant.getInteractor(), avail, pro, false); } else if(participant.hasInteraction()) { entity = (Complex) processInteraction(participant.getInteraction(), avail, pro, true); .create(Evidence.class, genUri(Evidence.class, "p",participant.getId())); if(participant.hasExperimentalRoles() || participant.hasExperimentalInteractors() || participant.hasFeatures()) if(participant.hasExperimentalInteractors()) { for(ExperimentalInteractor experimentalInteractor : participant.getExperimentalInteractors()) { Interactor interactor = experimentalInteractor.getInteractor(); LOG.debug("createBiopaxEntity, participant: " + participant.getId() + ", exp. interactor: " + interactor.getId()); Entity expEntity = createParticipant(participant, interactor, avail, pro, true); LOG.debug("createBiopaxEntity, participant: " + participant.getId() + " doesn't have any exp. interactors"); createAddExperimentalForm(participant, participantEvidence, null, null);
participant = new Participant(); participant.setId(IdentifierGenerator.getInstance().nextId()); participant.setInteractor(interactor); participant.setBiologicalRole(biologicalRole); participant.getExperimentalRoles().add(experimentalRole); xmlfeature.getAttributes().add(attribute); participant.getFeatures().add(xmlfeature); if (!participant.getAttributes().contains(attribute)) { participant.getAttributes().add(attribute); participant.getParticipantIdentificationMethods().add(xmlParticipantIdMethod);
for (psidev.psi.mi.xml.model.Participant mParticipant : mInteraction.getParticipants()) { if (!participantIds.contains(mParticipant.getId())) { mEntry.getInteractors().add(mParticipant.getInteractor()); participantIds.add(mParticipant.getInteractor().getId());
public int compare(Participant p1, Participant p2) { Interactor i1 = p1.getInteractor(); if( i1 == null ) { throw new IllegalArgumentException( "Both participant should hold a valid interactor." ); } Interactor i2 = p2.getInteractor(); if( i2 == null ) { throw new IllegalArgumentException( "Both participant should hold a valid interactor." ); } String name1 = getName( i1 ); String name2 = getName( i2 ); int result; if ( name1 == null ) { result = -1; } else if ( name2 == null ) { result = 1; } else { result = name1.compareTo( name2 ); } return result; } } );
protected String displayParticipant(Participant p) { // fetch role String role = ""; for (ExperimentalRole aRole : p.getExperimentalRoles()) { if (role.length() > 0) { role += "&"; } if (aRole.hasNames()) { role += aRole.getNames().getShortLabel(); } else { role += "?"; } } // fetch interactor String interactor = p.getInteractor().getNames().getShortLabel(); return interactor + ":" + role; }
for(Feature f : participant.getFeatures()) { if(exp==null || f.getExperiments().contains(exp) || f.getExperiments().isEmpty()) { EntityFeature feature = getFeature(ModificationFeature.class, f); if (participant.hasExperimentalRoles()) { for (ExperimentalRole role : participant.getExperimentalRoles()) { if(exp==null || role.getExperiments().contains(exp) || role.getExperiments().isEmpty()) {
Interactor interactor = participant.getInteractor(); String name = interactor.getNames().getShortLabel(); String type = interactor.getInteractorType().getNames().getShortLabel(); if ( participant.hasBiologicalRole() ) { role = participant.getBiologicalRole().getNames().getShortLabel();
if(p.hasInteractor()) { String type = getName(p.getInteractor().getInteractorType().getNames()); if(type==null) type = "protein"; //default type (if unspecified) participantTypes.add(type.toLowerCase()); } else if (p.hasInteraction()) { participantTypes.add("complex"); //hierarchical complex build up + "; so we'll replace 'gene' with 'dna' (a quick fix)"); for(Participant p : interaction.getParticipants()) { if(p.hasInteractor() && p.getInteractor().getInteractorType().hasNames()) { String type = getName(p.getInteractor().getInteractorType().getNames()); if("gene".equalsIgnoreCase(type)) { p.getInteractor().getInteractorType().getNames().setShortLabel("dna");
private void removeInteractorRedundancy( EntrySet mEntrySet ) { if( ConverterContext.getInstance().getConverterConfig().getXmlForm() == PsimiXmlForm.FORM_COMPACT ) { for ( Entry entry : mEntrySet.getEntries() ) { Map<Interactor, Interactor> uniqueInteractors = new HashMap<Interactor, Interactor>(); for ( Interaction interaction : entry.getInteractions() ) { for ( Participant participant : interaction.getParticipants() ) { if( participant.getInteractor() != null ) { final Interactor myInteractor = participant.getInteractor(); if( uniqueInteractors.containsKey( myInteractor ) ) { final Interactor uniq = uniqueInteractors.get( myInteractor ); participant.setInteractor( uniq ); } else { uniqueInteractors.put( myInteractor, myInteractor ); } } } // participants } // interactions // if we had a compact format, we cannot remove interactor redundancy without changing the interactions // and update the interactor xref if (!uniqueInteractors.isEmpty()){ entry.getInteractors().clear(); entry.getInteractors().addAll( uniqueInteractors.keySet() ); } } // entries } // model is compact }
psiIndex.addParticipant( participant.getId(), isr );
if(participant.hasInteraction()) { participantInteractions.add(participant.getInteraction());