@Override public boolean equals( Object o ) { if ( !super.equals( o ) ) { return false; } if ( this == o ) { return true; } if ( o == null || getClass() != o.getClass() ) { return false; } final InteractorImpl that = ( InteractorImpl ) o; if ( activeInstances != null ? !activeInstances.equals( that.activeInstances ) : that.activeInstances != null ) { return false; } if ( bioSource != null ? !bioSource.equals( that.bioSource ) : that.bioSource != null ) { return false; } if ( interactorType != null ? !interactorType.equals( that.interactorType ) : that.interactorType != null ) { return false; } return true; }
@Override public int hashCode() { int result = super.hashCode(); result = 29 * result + ( bioSource != null ? bioSource.hashCode() : 0 ); result = 29 * result + ( interactorType != null ? interactorType.hashCode() : 0 ); // next line is commented because is making hibernate (cglib) fail from time to time //result = 29 * result + ( activeInstances != null ? activeInstances.size() : 0 ); return result; }
CvInteractorType proteinType = IntactContext.getCurrentInstance().getCvContext().getByMiRef(CvInteractorType.class, CvInteractorType.getProteinMI()); String message = "Could not find a CvInteractorType by MI reference: " + CvInteractorType.getProteinMI(); ControlledVocabularyRepository.getNoUniprotUpdateTopic() ); IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getAnnotationDao().persist( annotation ); proteinType.addAnnotation( annotation ); IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getProteinDao().update( (ProteinImpl)protein );
public static void checkCvInteractorType( ) { if ( false == interatorTypeChecked ) { // Load CvInteractorType( interaction / MI: ) cvInteractionType = IntactContext.getCurrentInstance().getCvContext().getByMiRef(CvInteractorType.class, CvInteractorType.getInteractionMI()); if ( cvInteractionType == null ) { MessageHolder.getInstance().addCheckerMessage( new Message( "Could not find CvInteractorType( interaction )." ) ); } interatorTypeChecked = true; } }
public void loadCommonCvObjects() { getByMiRef( CvDatabase.class, CvDatabase.INTACT_MI_REF ); getByMiRef( CvDatabase.class, CvDatabase.GO_MI_REF ); getByMiRef( CvDatabase.class, CvDatabase.INTERPRO_MI_REF ); getByMiRef( CvDatabase.class, CvDatabase.FLYBASE_MI_REF ); getByMiRef( CvDatabase.class, CvDatabase.REACTOME_PROTEIN_PSI_REF ); getByMiRef( CvDatabase.class, CvDatabase.HUGE_MI_REF ); getByMiRef( CvXrefQualifier.class, CvXrefQualifier.IDENTITY_MI_REF ); getByMiRef( CvXrefQualifier.class, CvXrefQualifier.SECONDARY_AC_MI_REF ); getByMiRef( CvXrefQualifier.class, CvXrefQualifier.ISOFORM_PARENT_MI_REF ); // only one search by shortlabel as it still doesn't have MI number. getByLabel( CvTopic.class, CvTopic.ISOFORM_COMMENT ); getByLabel( CvTopic.class, CvTopic.NON_UNIPROT ); getByMiRef( CvAliasType.class, CvAliasType.GENE_NAME_MI_REF ); getByMiRef( CvAliasType.class, CvAliasType.GENE_NAME_SYNONYM_MI_REF ); getByMiRef( CvAliasType.class, CvAliasType.ISOFORM_SYNONYM_MI_REF ); getByMiRef( CvAliasType.class, CvAliasType.LOCUS_NAME_MI_REF ); getByMiRef( CvAliasType.class, CvAliasType.ORF_NAME_MI_REF ); getByMiRef( CvInteractorType.class, CvInteractorType.getProteinMI() ); }
else if (interactorType != null && GENE.equalsIgnoreCase(interactorType.getIdentifier())){ geneConverter.enrichGeneFromIntact(interactor, mitabInteractor);
/** * Rigourous Test :-) */ public void testIsValidArgument() { Institution institution = new Institution("EBI"); BioSource bioSource = new BioSource(institution, "human", "9606"); CvInteractorType cvInteractorType = new CvInteractorType(institution,"protein"); Protein protein = new ProteinImpl(institution, bioSource, "lsm7", cvInteractorType); // This should return true. assertTrue(MethodArgumentValidator.isValidArgument(protein,Protein.class) ); // This should return true as Protein is a sub class of Interactor assertTrue(MethodArgumentValidator.isValidArgument(protein,Interactor.class) ); //This should send an IllegalArgumentException try{ MethodArgumentValidator.isValidArgument(protein,BioSource.class); fail("This should have sent and IllegalArgumentException as protein is not a BioSource"); }catch(IllegalArgumentException e){ assertTrue(true); } //This should send an NullPointerException try{ assertTrue(MethodArgumentValidator.isValidArgument(null,Interactor.class) ); fail("This should have sent and NullPointerException as protein is null"); }catch( NullPointerException e){ assertTrue(true); } }
CvInteractorType proteinType = IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getCvObjectDao(CvInteractorType.class).getByXref(CvInteractorType.getProteinMI()); String message = "Could not find a CvInteractorType by MI reference: " + CvInteractorType.getProteinMI(); ControlledVocabularyRepository.getNoUniprotUpdateTopic() ); IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getAnnotationDao().persist( annotation ); proteinType.addAnnotation( annotation ); IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getProteinDao().update( (ProteinImpl)protein );
public static void checkCvInteractorType( ) { if ( false == interatorTypeChecked ) { // Load CvInteractorType( interaction / MI: ) cvInteractionType = IntactContext.getCurrentInstance().getCvContext().getByMiRef(CvInteractorType.class, CvInteractorType.getInteractionMI()); if ( cvInteractionType == null ) { MessageHolder.getInstance().addCheckerMessage( new Message( "Could not find CvInteractorType( interaction )." ) ); } interatorTypeChecked = true; } }
CvInteractorType proteinType = IntactContext.getCurrentInstance().getCvContext().getByMiRef(CvInteractorType.class, CvInteractorType.getProteinMI()); String message = "Could not find a CvInteractorType by MI reference: " + CvInteractorType.getProteinMI(); ControlledVocabularyRepository.getNoUniprotUpdateTopic() ); IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getAnnotationDao().persist( annotation ); proteinType.addAnnotation( annotation ); IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getProteinDao().update( (ProteinImpl)protein );
public static void checkCvInteractorType( ) { if ( false == interatorTypeChecked ) { // Load CvInteractorType( interaction / MI: ) cvProteinType = IntactContext.getCurrentInstance().getCvContext().getByMiRef(CvInteractorType.class, CvInteractorType.getInteractionMI()); if ( cvProteinType == null ) { MessageHolder.getInstance().addCheckerMessage( new Message( "Could not find CvInteractorType( interaction )." ) ); } interatorTypeChecked = true; } }
protected boolean equals( Object o, boolean checkOnActiveInstances) { if ( this == o ) { return true; } if ( o == null || getClass() != o.getClass() ) { return false; } if ( !super.equals( o ) ) { return false; } final InteractorImpl that = ( InteractorImpl ) o; if (checkOnActiveInstances) { if ( activeInstances != null ? !CollectionUtils.isEqualCollection(activeInstances, that.activeInstances ) : that.activeInstances != null ) { return false; } } if ( bioSource != null ? !bioSource.equals( that.bioSource ) : that.bioSource != null ) { return false; } if ( interactorType != null ? !interactorType.equals( that.interactorType ) : that.interactorType != null ) { return false; } return true; }
@Override public int hashCode() { int result = super.hashCode(); result = 29 * result + ( bioSource != null ? bioSource.hashCode() : 0 ); result = 29 * result + ( interactorType != null ? interactorType.hashCode() : 0 ); // next line is commented because is making hibernate (cglib) fail from time to time //result = 29 * result + ( activeInstances != null ? activeInstances.size() : 0 ); return result; }
public static void checkCvInteractorType( ) { if ( false == interatorTypeChecked ) { // Load CvInteractorType( interaction / MI: ) cvProteinType = IntactContext.getCurrentInstance().getCvContext().getByMiRef(CvInteractorType.class, CvInteractorType.getInteractionMI()); if ( cvProteinType == null ) { MessageHolder.getInstance().addCheckerMessage( new Message( "Could not find CvInteractorType( interaction )." ) ); } interatorTypeChecked = true; } }
protected boolean equals( Object o, boolean checkOnActiveInstances) { if ( this == o ) { return true; } if ( o == null || getClass() != o.getClass() ) { return false; } if ( !super.equals( o ) ) { return false; } final InteractorImpl that = ( InteractorImpl ) o; if (checkOnActiveInstances) { if ( activeInstances != null ? !CollectionUtils.isEqualCollection(activeInstances, that.activeInstances ) : that.activeInstances != null ) { return false; } } if ( bioSource != null ? !bioSource.equals( that.bioSource ) : that.bioSource != null ) { return false; } if ( interactorType != null ? !interactorType.equals( that.interactorType ) : that.interactorType != null ) { return false; } return true; }
@Override public int hashCode() { int result = super.hashCode(); result = 29 * result + ( bioSource != null ? bioSource.hashCode() : 0 ); result = 29 * result + ( interactorType != null ? interactorType.hashCode() : 0 ); // next line is commented because is making hibernate (cglib) fail from time to time //result = 29 * result + ( activeInstances != null ? activeInstances.size() : 0 ); return result; }
public static void checkCvInteractorType( ) { if ( false == interatorTypeChecked ) { // Load CvInteractorType( interaction / MI: ) cvProteinType = IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getCvObjectDao(CvInteractorType.class).getByXref(CvInteractorType.getInteractionMI()); if ( cvProteinType == null ) { MessageHolder.getInstance().addCheckerMessage( new Message( "Could not find CvInteractorType( interaction )." ) ); } interatorTypeChecked = 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; }
public static void checkCvInteractorType( ) { if ( false == interatorTypeChecked ) { // Load CvInteractorType( interaction / MI: ) cvInteractionType = IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getCvObjectDao(CvInteractorType.class).getByXref(CvInteractorType.getInteractionMI()); if ( cvInteractionType == null ) { MessageHolder.getInstance().addCheckerMessage( new Message( "Could not find CvInteractorType( interaction )." ) ); } interatorTypeChecked = 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; }