Component clone = new Component(); clone.setInteractor(clone(component.getInteractor())); clone.setInteraction(clone(component.getInteraction())); clone.setCvBiologicalRole(clone(component.getCvBiologicalRole())); clone.setStoichiometry(component.getStoichiometry()); clone.setExpressedIn(clone(component.getExpressedIn())); if (isCollectionClonable(component.getParameters())) { Collection<ComponentParameter> parameters = IntactCore.ensureInitializedComponentParameters(component); clone.addParameter(clone(componentParameter)); if (isCollectionClonable(component.getFeatures())) { Collection<Feature> features = IntactCore.ensureInitializedFeatures(component); clone.addFeature(clone(feature)); if (isCollectionClonable(component.getExperimentalPreparations())) { Collection<CvExperimentalPreparation> expPreps = IntactCore.ensureInitializedExperimentalPreparations(component); clone.getExperimentalPreparations().add(clone(preparation)); if (isCollectionClonable(component.getParticipantDetectionMethods())) { Collection<CvIdentification> partDet = IntactCore.ensureInitializedParticipantIdentificationMethods(component); clone.getParticipantDetectionMethods().add(clone(method));
/*******************************/ public TreeNode( Component component_param, ComplexSolrEnricher enricher) { component = component_param ; this.enricher = enricher; if ( component.getInteractor() instanceof InteractionImpl ) { sons = new ArrayList(); for ( Component comp : ((InteractionImpl) component.getInteractor()).getComponents() ) { TreeComponents tree = null ; if ( ! map.containsKey ( comp.getAc() ) ) { tree = new TreeComponents ( comp, enricher ) ; map.put ( comp.getAc(), tree ) ; } else { tree = map.get ( comp.getAc() ) ; } sons.add ( tree ) ; } } else { sons = null ; } }
protected void traverseComponent(Component component, IntactVisitor ... visitors) { if (component == null) return; for (IntactVisitor visitor : visitors) { visitor.visitComponent(component); } // check if this element has been traversed already, to avoid cyclic recursion if (recursionChecker.isAlreadyTraversed(component)) { return; } traverse(component.getInteraction(), visitors); traverse(component.getInteractor(), visitors); traverse(component.getCvBiologicalRole(), visitors); traverse(component.getExpressedIn(), visitors); traverse(component.getParameters(), visitors); traverse(component.getParticipantDetectionMethods(), visitors); traverse(component.getExperimentalPreparations(), visitors); traverse(component.getBindingDomains(), visitors); traverse(component.getExperimentalRoles(), visitors); }
/** * Equality for Components is currently based on <b>object identity</b> (i.e. the references point to the same * objects) for Interactors, Interactions and CvComponentRoles. * * @param o The object to check * * @return true if the parameter equals this object, false otherwise */ @Override public boolean equals( Object o ) { /* TODO: Take features into account when they are implemented. */ if ( this == o ) { return true; } if ( !( o instanceof Component ) ) { return false; } // don't call super because that's a BasicObject ! final Component component = ( Component ) o; // Compare if the component links the same objects. // This comparision can be based on reference equality, // so "==" can be used instead of "equals". return this.interactor == component.getInteractor() && this.interaction == component.getInteraction() && this.experimentalRole == component.experimentalRole && this.biologicalRole == component.biologicalRole; }
public Component createComponent(Interaction interaction, Interactor interactor, CvExperimentalRole expRole, CvBiologicalRole bioRole) { Component component = new Component(getInstitution(), interaction, interactor, expRole, bioRole); CvIdentification cvParticipantDetMethod = createCvObject(CvIdentification.class, CvIdentification.PREDETERMINED_MI_REF, CvIdentification.PREDETERMINED); component.getParticipantDetectionMethods().add(cvParticipantDetMethod); CvExperimentalPreparation cvExperimentalPreparation = createCvObject(CvExperimentalPreparation.class, CvExperimentalPreparation.PURIFIED_REF, CvExperimentalPreparation.PURIFIED); component.getExperimentalPreparations().add(cvExperimentalPreparation); return component; }
if (IntactCore.isInitializedAndDirty(component.getFeatures())) { Collection<Feature> features = synchronizeCollection(component.getFeatures()); component.getFeatures().clear(); component.getFeatures().addAll(features); component.setCvBiologicalRole( synchronize( component.getCvBiologicalRole() ) ); if (IntactCore.isInitializedAndDirty(component.getExperimentalRoles())) { Collection<CvExperimentalRole> roles = synchronizeCollection( component.getExperimentalRoles() ); component.getExperimentalRoles().clear(); component.getExperimentalRoles().addAll(roles); component.setExpressedIn( synchronize( component.getExpressedIn() ) ); component.setInteraction( synchronize( component.getInteraction() ) ); component.setInteractor( synchronize( component.getInteractor() ) ); if (IntactCore.isInitializedAndDirty(component.getParticipantDetectionMethods())) { Collection<CvIdentification> partDet = synchronizeCollection( component.getParticipantDetectionMethods()); component.getParticipantDetectionMethods().clear(); component.getParticipantDetectionMethods().addAll(partDet); if (IntactCore.isInitializedAndDirty(component.getExperimentalPreparations())) { Collection<CvExperimentalPreparation> expPrep = synchronizeCollection( component.getExperimentalPreparations() ); component.getExperimentalPreparations().clear(); component.getExperimentalPreparations().addAll(expPrep); if (IntactCore.isInitializedAndDirty(component.getParameters())) { Collection<ComponentParameter> componentParameters = synchronizeComponentParameters(component.getParameters(), component); component.getParameters().clear();
@Override protected Component syncAttributes(Component intactObject) { if (intactObject.getExpressedIn() != null) { BioSource bioSource = BioSourcePersister.getInstance().syncIfTransient(intactObject.getExpressedIn()); intactObject.setExpressedIn(bioSource); intactObject.setCvBiologicalRole((CvBiologicalRole) cvPersister.syncIfTransient(intactObject.getCvBiologicalRole())); intactObject.setCvExperimentalRole((CvExperimentalRole) cvPersister.syncIfTransient(intactObject.getCvExperimentalRole())); Collection<CvIdentification> syncedParticipantDetectionMethods = new ArrayList<CvIdentification>(intactObject.getParticipantDetectionMethods().size()); for (CvIdentification participantDetection : intactObject.getParticipantDetectionMethods()) { CvIdentification detMethod = (CvIdentification) cvPersister.syncIfTransient(participantDetection); syncedParticipantDetectionMethods.add(detMethod); intactObject.setParticipantDetectionMethods(syncedParticipantDetectionMethods); Collection<CvExperimentalPreparation> syncedExperimentalPreparations = new ArrayList<CvExperimentalPreparation>(intactObject.getExperimentalPreparations().size()); for (CvExperimentalPreparation experimentalPreparation : intactObject.getExperimentalPreparations()) { syncedExperimentalPreparations.add((CvExperimentalPreparation) cvPersister.syncIfTransient(experimentalPreparation)); intactObject.setExperimentalPreparations(syncedExperimentalPreparations); intactObject.setInteractor((Interactor) InteractorPersister.getInstance().syncIfTransient(intactObject.getInteractor())); Collection<Feature> features = new ArrayList<Feature>( intactObject.getBindingDomains().size() ); for ( Feature feature : intactObject.getBindingDomains() ) { features.add( FeaturePersister.getInstance().syncIfTransient( feature ) ); intactObject.setBindingDomains( features );
sb.append(createUniquenessString(component.getInteractor())); sb.append(component.getStoichiometry()); sb.append(createUniquenessString(component.getCvBiologicalRole())); List<CvExperimentalRole> expRoles = new ArrayList<CvExperimentalRole>(component.getExperimentalRoles()); Collections.sort(expRoles, new CvObjectComparator()); List<Feature> features = new ArrayList<Feature>(component.getBindingDomains()); Collections.sort(features, new FeatureComparator()); List<CvIdentification> participantDetMethods = new ArrayList<CvIdentification>(component.getParticipantDetectionMethods()); Collections.sort(participantDetMethods, new CvObjectComparator()); List<CvExperimentalPreparation> experimentalPreparations = new ArrayList<CvExperimentalPreparation>(component.getExperimentalPreparations()); Collections.sort(experimentalPreparations, new CvObjectComparator()); annotations.addAll(component.getAnnotations()); sb.append(createUniquenessString(component.getExpressedIn()));
experimentalRoles = intactObject.getExperimentalRoles(); partIdentMethods = intactObject.getParticipantDetectionMethods(); expPreparations = intactObject.getExperimentalPreparations(); features = intactObject.getFeatures(); confs = intactObject.getConfidences(); params = intactObject.getParameters(); log.error("Component without experimental roles : " + intactObject.getShortLabel()); log.error("Component with "+experimentalRoles.size()+" experimental roles : " + intactObject.getShortLabel()); if (intactObject.getCvBiologicalRole() == null) { throw new IllegalStateException("Found component without biological role: "+intactObject.getAc()); BiologicalRole bioRole = this.biologicalRoleConverter.intactToPsi(intactObject.getCvBiologicalRole()); participant.setBiologicalRole(bioRole); if (intactObject.getInteractor() != null && intactObject.getInteractor() instanceof InteractionImpl){ psidev.psi.mi.xml.model.Interaction interactor = interactionConverter.intactToPsi((InteractionImpl) intactObject.getInteractor()); if( ConverterContext.getInstance().isGenerateExpandedXml() ) { participant.setInteraction(interactor); else if (intactObject.getInteractor() != null){ psidev.psi.mi.xml.model.Interactor interactor = interactorConverter.intactToPsi(intactObject.getInteractor()); if( ConverterContext.getInstance().isGenerateExpandedXml() ) { participant.setInteractor(interactor); log.error("Component without interactor " + intactObject.getShortLabel());
@Override protected void saveOrUpdateAttributes(Component intactObject) throws PersisterException { super.saveOrUpdateAttributes(intactObject); if (intactObject.getExpressedIn() != null) { BioSourcePersister bioSourcePersister = BioSourcePersister.getInstance(); bioSourcePersister.saveOrUpdate(intactObject.getExpressedIn()); } CvObjectPersister cvPersister = CvObjectPersister.getInstance(); cvPersister.saveOrUpdate(intactObject.getCvBiologicalRole()); cvPersister.saveOrUpdate(intactObject.getCvExperimentalRole()); for (CvIdentification participantDetection : intactObject.getParticipantDetectionMethods()) { cvPersister.saveOrUpdate(participantDetection); } for (CvExperimentalPreparation experimentalPreparation : intactObject.getExperimentalPreparations()) { cvPersister.saveOrUpdate(experimentalPreparation); } InteractionPersister.getInstance().saveOrUpdate(intactObject.getInteraction()); InteractorPersister.getInstance().saveOrUpdate(intactObject.getInteractor()); for (Feature feature : intactObject.getBindingDomains()) { FeaturePersister.getInstance().saveOrUpdate(feature); } }
private static String getLabel(Component comp1) { String name = ProteinUtils.getGeneName(comp1.getInteractor()); if (name == null) name = "null"; name = name.toLowerCase(); return name; } }
Component component = new Component(); component.setOwner(getInstitution()); log.error("Participant without interactor : " + component.getShortLabel()); component.setInteractor(interactor); component.setCvBiologicalRole(biologicalRole); component.getExperimentalRoles().add(experimentalRole); component.addFeature(feature); component.getParticipantDetectionMethods().add(cvIdentification); component.getExperimentalPreparations().add(cvExpPrep); component.setExpressedIn(bioSource); component.addConfidence( confidence); component.addParameter(parameter); log.warn("Participant with " + participant.getExperimentalInteractors().size() + " experimental interactors : " + component.getShortLabel() + ". We do not export them in Intact"); try { float stoichio = Float.parseFloat(a.getValue().substring(a.getValue().indexOf(STOICHIOMETRY_PREFIX) + STOICHIOMETRY_PREFIX.length())); component.setStoichiometry(stoichio);
Interactor interactor = component.getInteractor(); if ( component.getCvBiologicalRole() != null ) { CvObject2xmlFactory.getInstance( session ).create( session, element, component.getCvBiologicalRole() ); if ( component.getCvExperimentalRole() != null ) { Element experimentalRoleList = session.createElement( "experimentalRoleList" ); element.appendChild( experimentalRoleList ); component.getCvExperimentalRole() ); if ( ! component.getBindingDomains().isEmpty() ) { Element featureListElement = session.createElement( "featureList" ); for ( Iterator iterator = component.getBindingDomains().iterator(); iterator.hasNext(); ) { Feature feature = (Feature) iterator.next(); if ( component.getExpressedIn() != null && component.getInteractor().getBioSource() != null) { Element hostOrganismList = session.createElement( "hostOrganismList" ); element.appendChild( hostOrganismList );
Interactor interactor = component.getInteractor(); if ( component.getCvComponentRole() != null ) { CvObject2xmlPSI2 cv2xml = (CvObject2xmlPSI2) CvObject2xmlFactory.getInstance( session ); cv2xml.createBiologicalRole( session, element, component.getCvComponentRole() ); if ( component.getCvComponentRole() != null ) { CvObject2xmlPSI2 cv2xml = (CvObject2xmlPSI2) CvObject2xmlFactory.getInstance( session ); Element experimentalRoleList = session.createElement( "experimentalRoleList" ); element.appendChild( experimentalRoleList ); cv2xml.createExperimentalRole( session, experimentalRoleList, component.getCvComponentRole() ); if ( ! component.getBindingDomains().isEmpty() ) { Element featureListElement = session.createElement( "featureList" ); for ( Iterator iterator = component.getBindingDomains().iterator(); iterator.hasNext(); ) { Feature feature = (Feature) iterator.next(); if ( component.getExpressedIn() != null ) { Element hostOrganismList = session.createElement( "hostOrganismList" ); element.appendChild( hostOrganismList );
Component component = new Component(institution, interaction, interactor, intactExpRoles.iterator().next(), biologicalRole); IntactConverterUtils.populateAnnotations(attributesToConvert, component, institution); component.setExperimentalRoles(intactExpRoles); component.getBindingDomains().add(feature); feature.setComponent(component); ParticipantIdentificationMethodConverter pimConverter = new ParticipantIdentificationMethodConverter(institution); CvIdentification cvIdentification = pimConverter.psiToIntact(pim); component.getParticipantDetectionMethods().add(cvIdentification); new CvObjectConverter<CvExperimentalPreparation, ExperimentalPreparation>(institution, CvExperimentalPreparation.class, ExperimentalPreparation.class); CvExperimentalPreparation cvExpPrep = epConverter.psiToIntact(expPrep); component.getExperimentalPreparations().add(cvExpPrep); component.setExpressedIn(bioSource); for (psidev.psi.mi.xml.model.Confidence psiConfidence : participant.getConfidenceList()){ ComponentConfidence confidence = confConverter.psiToIntact( psiConfidence ); component.addConfidence( confidence); component.addConfidence( confidence); for (psidev.psi.mi.xml.model.Parameter psiParameter : participant.getParameters()){ ComponentParameter parameter = paramConverter.psiToIntact( psiParameter ); component.addParameter(parameter);
CvExperimentalRole exp = component.getCvExperimentalRole(); CvBiologicalRole bio = component.getCvBiologicalRole(); "(Component: " + component.getAc() + " - " + "Interaction: " + component.getInteraction().getAc() + ")" ); "(Component: " + component.getAc() + " - " + "Interaction: " + component.getInteraction().getAc() + ")" ); "CvBiologicalRole( '" + ( bio == null ? "null" : bio.getShortLabel() ) + "' ). " + "Role was set to default '" + DEFAULT_ROLE + "'. " + "(Component: " + component.getAc() + " - Interaction: " + component.getInteraction().getAc() + ")" ); role = DEFAULT_ROLE;
Protein protein = (Protein) component.getInteractor(); if ( ! session.isAlreadyDefined( protein ) ) { if ( ! component.getBindingDomains().isEmpty() ) { Element featureListElement = session.createElement( "featureList" ); for ( Iterator iterator = component.getBindingDomains().iterator(); iterator.hasNext(); ) { Feature feature = (Feature) iterator.next(); if ( component.getCvBiologicalRole() != null ) { CvObject2xmlFactory.getInstance( session ).create( session, element, component.getCvBiologicalRole() );
protected void syncComponents(Interaction intactObject) { ComponentPersister compPersister = ComponentPersister.getInstance(); List<Component> components = new ArrayList<Component>(intactObject.getComponents().size()); for (Component component : intactObject.getComponents()) { Component c = compPersister.syncIfTransient(component); c.setInteraction(intactObject); c.setInteractor( component.getInteractor() ); components.add(c); } // for (Component c : components) { // c.setInteraction(intactObject); // } intactObject.setComponents(components); }
protected void copyComponent( Component source, Component target ) { copyProperty(source, "stoichiometry", target); copyProperty(source, "interaction", target); copyProperty(source, "interactor", target); copyProperty(source, "cvBiologicalRole", target); copyProperty(source, "cvExperimentalRole", target); copyProperty(source, "expressedIn", target); copyCollection( source.getBindingDomains(), target.getBindingDomains() ); for (Feature bindingDomain : target.getBindingDomains()) { bindingDomain.setComponent(target); } copyCollection( source.getExperimentalPreparations(), target.getExperimentalPreparations() ); copyCollection( source.getParticipantDetectionMethods(), target.getParticipantDetectionMethods() ); copyCollection( source.getParameters(), target.getParameters() ); }
public Component createComponent(Interaction interaction, Interactor interactor, CvExperimentalRole expRole, CvBiologicalRole bioRole) { Component component = new Component(getInstitution(), interaction, interactor, expRole, bioRole); CvIdentification cvParticipantDetMethod = createCvObject(CvIdentification.class, CvIdentification.PREDETERMINED_MI_REF, CvIdentification.PREDETERMINED); component.getParticipantDetectionMethods().add(cvParticipantDetMethod); CvExperimentalPreparation cvExperimentalPreparation = createCvObject(CvExperimentalPreparation.class, CvExperimentalPreparation.PURIFIED_REF, CvExperimentalPreparation.PURIFIED); component.getExperimentalPreparations().add(cvExperimentalPreparation); ComponentParameter componentParameter = createDeterministicComponentParameter(); component.addParameter(componentParameter); interactor.addActiveInstance( component ); interaction.addComponent( component ); return component; }