public Collection<Field> fieldsForInteractor( Interactor interactor ) { Collection<Field> fields = new ArrayList<Field>(); Field primaryIdField = new Field(); primaryIdField.setName( "Interactor type" ); final String type = ( interactor.getCvInteractorType() == null ? "-" : interactor.getCvInteractorType().getShortLabel() ); primaryIdField.setValue( type ); return fields; }
public Collection<GeneralMessage> check( Interactor interactor ) throws SanityRuleException { Collection<GeneralMessage> messages = new ArrayList<GeneralMessage>(); if ( interactor.getCvInteractorType() == null ) { final CvObjectXref xref = CvObjectUtils.getPsiMiIdentityXref( interactor.getCvInteractorType() ); if ( xref == null ) {
/** * Answers the question: "Has the given interaction got only interactors of the given type ?". * <p/> * note: an interaction without interactor is not valid. * * @param interaction the interaction. * @param type the interactor type. * @return true if all interactor are of the given type, false otherwise. */ public static boolean hasOnlyInteractorOfType(Interaction interaction, CvInteractorType type) { if (type == null) { throw new IllegalArgumentException("You must give a non null CvInteractorType."); } if (interaction == null) { throw new IllegalArgumentException("You must give a non null Interaction."); } if (interaction.getComponents().isEmpty()) { return false; } for (Component component : interaction.getComponents()) { Interactor interactor = component.getInteractor(); if (!type.equals(interactor.getCvInteractorType())) { return false; } } return true; }
/** * Answers the question: "Has the given interaction got only interactors of the given type ?". * <p/> * note: an interaction without interactor is not valid. * * @param interaction the interaction. * @param type the interactor type. * @return true if all interactor are of the given type, false otherwise. */ public static boolean hasOnlyInteractorOfType(Interaction interaction, CvInteractorType type) { if (type == null) { throw new IllegalArgumentException("You must give a non null CvInteractorType."); } if (interaction == null) { throw new IllegalArgumentException("You must give a non null Interaction."); } if (interaction.getComponents().isEmpty()) { return false; } for (Component component : interaction.getComponents()) { Interactor interactor = component.getInteractor(); if (!type.equals(interactor.getCvInteractorType())) { return false; } } return true; }
/** * Answers the question: "Has the given interaction got only interactors of the given type ?". * <p/> * note: an interaction without interactor is not valid. * * @param interaction the interaction. * @param type the interactor type. * @return true if all interactor are of the given type, false otherwise. */ public static boolean hasOnlyInteractorOfType( Interaction interaction, CvInteractorType type ) { if ( type == null ) { throw new IllegalArgumentException( "You must give a non null CvInteractorType." ); } if ( interaction == null ) { throw new IllegalArgumentException( "You must give a non null Interaction." ); } if ( interaction.getComponents().isEmpty() ) { return false; } for ( Component component : interaction.getComponents() ) { Interactor interactor = component.getInteractor(); if ( !type.equals( interactor.getCvInteractorType() ) ) { return false; } } return true; }
/** * Checks if an interaction contain other interactor types than Protein * * @param interaction * @return */ public static boolean containsNonProteinInteractors(Interaction interaction) { for (Component component : interaction.getComponents()) { Interactor interactor = component.getInteractor(); final CvInteractorType type = interactor.getCvInteractorType(); if (!CvObjectUtils.isProteinType(type)) { return true; } } return false; }
/** * Checks if an interaction contain other interactor types than Protein * * @param interaction * @return */ public static boolean containsNonProteinInteractors(Interaction interaction) { for (Component component : interaction.getComponents()) { Interactor interactor = component.getInteractor(); final CvInteractorType type = interactor.getCvInteractorType(); if (!CvObjectUtils.isProteinType(type)) { return true; } } return false; }
private Collection<Field> fieldsForAnnotation( Interactor interactor ) { Collection<Field> fields = new ArrayList<Field>(); addField( "Interactor AC", ( range.isUndetermined() ? "Yes" : "No" ), fields ); final CvInteractorType type = interactor.getCvInteractorType(); if ( type != null ) { addField( "Type", type.getShortLabel(), fields ); } if ( interactor instanceof Polymer ) { Polymer polymer = ( Polymer ) interactor; final int length = ( polymer.getSequence() == null ? 0 : polymer.getSequence().length() ); addField( "Seq. length", String.valueOf( length ), fields ); } return fields; }
protected void traverseInteractor(Interactor interactor, IntactVisitor ... visitors) { if (interactor == null) return; for (IntactVisitor visitor : visitors) { visitor.visitInteractor(interactor); } // check if this element has been traversed already, to avoid cyclic recursion if (recursionChecker.isAlreadyTraversed(interactor)) { return; } traverse(interactor.getCvInteractorType(), visitors); traverse(interactor.getBioSource(), visitors); }
protected void traverseInteractor(Interactor interactor, IntactVisitor ... visitors) { if (interactor == null) return; for (IntactVisitor visitor : visitors) { visitor.visitInteractor(interactor); } // check if this element has been traversed already, to avoid cyclic recursion if (recursionChecker.isAlreadyTraversed(interactor)) { return; } traverse(interactor.getCvInteractorType(), visitors); traverse(interactor.getBioSource(), visitors); }
@Override protected void saveOrUpdateAttributes(T intactObject) throws PersisterException { super.saveOrUpdateAttributes(intactObject); if (intactObject.getBioSource() != null) { BioSourcePersister.getInstance().saveOrUpdate(intactObject.getBioSource()); } if (intactObject.getCvInteractorType() != null) { CvObjectPersister.getInstance().saveOrUpdate(intactObject.getCvInteractorType()); } if ( intactObject.getActiveInstances() != null ) { for ( Component c : intactObject.getActiveInstances() ) { ComponentPersister.getInstance().saveOrUpdate( c ); } } }
private void synchronizeInteractor( Interactor interactor, boolean synchronizeAnnotatedAtributes ) { if (IntactCore.isInitializedAndDirty(interactor.getActiveInstances())){ Collection<Component> activeInstances = synchronizeCollection(interactor.getActiveInstances()); interactor.getActiveInstances().clear(); interactor.getActiveInstances().addAll(activeInstances); } interactor.setBioSource( synchronize( interactor.getBioSource() ) ); interactor.setCvInteractorType( synchronize( interactor.getCvInteractorType() ) ); if (synchronizeAnnotatedAtributes){ synchronizeAnnotatedObjectCommons( interactor ); } }
private void synchronizeInteractor( Interactor interactor, boolean synchronizeAnnotatedAtributes ) { if (IntactCore.isInitializedAndDirty(interactor.getActiveInstances())){ Collection<Component> activeInstances = synchronizeCollection(interactor.getActiveInstances()); interactor.getActiveInstances().clear(); interactor.getActiveInstances().addAll(activeInstances); } interactor.setBioSource( synchronize( interactor.getBioSource() ) ); interactor.setCvInteractorType( synchronize( interactor.getCvInteractorType() ) ); if (synchronizeAnnotatedAtributes){ synchronizeAnnotatedObjectCommons( interactor ); } }
CvObject2xmlFactory.getInstance( session ).create( session, element, interactor.getCvInteractorType() );
CvObject2xmlFactory.getInstance( session ).create( session, element, interactor.getCvInteractorType() );
@Override protected T syncAttributes(T intactObject) { if (intactObject.getBioSource() != null) { BioSource syncedBioSource = BioSourcePersister.getInstance().syncIfTransient(intactObject.getBioSource()); intactObject.setBioSource(syncedBioSource); } if (intactObject.getCvInteractorType() != null) { CvInteractorType cvIntType = (CvInteractorType) CvObjectPersister.getInstance().syncIfTransient(intactObject.getCvInteractorType()); intactObject.setCvInteractorType(cvIntType); } if ( intactObject.getActiveInstances() != null ) { Collection<Component> components = new ArrayList<Component>( intactObject.getActiveInstances().size() ); for ( Component component : intactObject.getActiveInstances() ) { final Component c = ComponentPersister.getInstance().syncIfTransient( component ); c.setInteractor( intactObject ); c.setInteraction( component.getInteraction() ); components.add( c ); } intactObject.setActiveInstances( components ); } return super.syncAttributes(intactObject); }
clone.setCvInteractorType(clone(interactor.getCvInteractorType())); clone.setObjClass(interactor.getObjClass());
clone.setCvInteractorType(clone(interactor.getCvInteractorType())); clone.setObjClass(interactor.getObjClass());
if (intactObject.getCvInteractorType() != null){ InteractorType interactorType = this.interactorTypeConverter.intactToPsi(intactObject.getCvInteractorType()); interactor.setInteractorType( interactorType );
private void indexFields(SolrInputDocument solrDocument) throws SolrServerException { Interactor interactor = component.getInteractor(); if (interactor != null){ // index interactor ac indexInteractorAC(interactor, solrDocument); // index interactor names indexInteractorNames(interactor, solrDocument); // index interactor type enricher.enrichInteractorType(interactor.getCvInteractorType(), solrDocument); // index and enrich xrefs enricher.enrichInteractorXref(interactor.getXrefs(), solrDocument); } // index biological role if (component.getCvBiologicalRole() != null){ enricher.enrichBiologicalRole(component.getCvBiologicalRole(), solrDocument); } // index features indexfeatures(solrDocument); // enrich sons if necessary if (hasSons()){ for (TreeComponents t : sons){ t.indexFields(solrDocument); } } }