@Override public String toString() { return "Alias[name: " + name + ", type: " + ( cvAliasType != null ? cvAliasType.getShortLabel() : "" ) + "]"; }
/** * Equality for Aliases is currently based on equality for * <code>CvAliasTypes</code> and names. * * @param o The object to check * * @return true if the parameter equals this object, false otherwise * * @see uk.ac.ebi.intact.model.CvAliasType */ @Override public boolean equals( Object o ) { if ( this == o ) return true; if ( !( o instanceof Alias ) ) return false; //NO! BasicObject's equals is the Java Object one!! //if ( !super.equals ( o ) ) return false; final Alias alias = ( Alias ) o; //NB according to the constructor, cvAliasType and name may be null, //so need to handle this here.... if ( cvAliasType != null ) { if ( !cvAliasType.equals( alias.cvAliasType ) ) return false; } else { if ( alias.cvAliasType != null ) return false; } if ( name != null ) { if ( !name.equals( alias.name ) ) return false; } else return alias.name == null; return true; }
@Override public void visitAlias( Alias alias ) { final CvAliasType type = alias.getCvAliasType(); if( type != null ) { final String mi = type.getIdentifier(); if ( mi != null ) { final String key = createCvKey( type.getClass(), mi ); final CvAliasType oboTerm = ( CvAliasType ) mi2cv.get( key ); if ( oboTerm == null ) { log.warn( "Could not find alias " + type.getClass().getSimpleName() + "( " + type.getShortLabel() + " ) by MI: " + mi ); } else { alias.setCvAliasType( oboTerm ); } } } }
public static List<String> getSynonyms(InteractionImpl complex) { List<String> synosyms = new ArrayList<String>(); for (Alias alias : complex.getAliases()) { if (alias.getName() != null && alias.getCvAliasType() != null && alias.getCvAliasType().getIdentifier().equals(CvAliasType.COMPLEX_SYNONYM_NAME_MI_REF)) { synosyms.add(alias.getName()); } } return synosyms; }
synonymType = new CvAliasType( owner, "synonym" ); synonymType.setIdentifier( "MI:1041" ); synonymType.addXref( new CvObjectXref(owner, psimi, "MI:1041", identity));
public A psiToIntact(psidev.psi.mi.xml.model.Alias psiObject) { psiStartConversion(psiObject); String name = psiObject.getValue(); String aliasType = psiObject.getType(); String aliasTypeAc = psiObject.getTypeAc(); if (name.length() == 0) { throw new PsiConversionException("Value in Alias is empty: "+psiObject); } CvAliasType cvAliasType = null; // a type ac must always be a mi term if (aliasType != null) { cvAliasType = new CvAliasType(getInstitution(), aliasType); if( aliasTypeAc != null ) { cvAliasType.setIdentifier(aliasTypeAc); psiMiPopulator.populateWithPsiMi(cvAliasType, aliasTypeAc); } else { if ( log.isWarnEnabled() ) log.warn( "Attempting to build an Alias ("+ aliasType + ") without nameAc, this will result in a CvTopic without Xref" ); } } A alias = newAliasInstance(aliasClass, cvAliasType, name); alias.setOwner(getInstitution()); psiEndConversion(psiObject); return alias; }
@Override public int hashCode() { int result = 29; if ( name != null ) result = 29 * result + name.hashCode(); if ( cvAliasType != null ) result = 29 * result + cvAliasType.hashCode(); return result; }
interactorGeneQuery.append(" (upper(name) = upper('"+name+"') and alias.ac = '"+entry.getKey().getAc()+"') or");
public static List<String> getSynonyms(InteractionImpl complex) { List<String> synosyms = new ArrayList<String>(); for (Alias alias : complex.getAliases()) { if (alias.getName() != null && alias.getCvAliasType() != null && alias.getCvAliasType().getIdentifier().equals(CvAliasType.COMPLEX_SYNONYM_NAME_MI_REF)) { synosyms.add(alias.getName()); } } return synosyms; }
@Override public int hashCode() { if (ac != null) return super.hashCode(); int result = 29; if ( name != null ) result = 29 * result + name.hashCode(); if ( cvAliasType != null ) result = 29 * result + cvAliasType.hashCode(); return result; }
public UpdatedAlias(Alias alias, UpdateStatus status){ super(); if (alias != null){ type = alias.getCvAliasType() != null ? alias.getCvAliasType().getAc() : null; this.name = alias.getName(); } else { this.type = null; this.name = null; } this.status = status != null ? status : UpdateStatus.none; this.parent = null; }
@Override public String toString() { return "Alias[name: " + name + ", type: " + ( cvAliasType != null ? cvAliasType.getShortLabel() : "" ) + "]"; }
public static Collection<Alias> getAliasByType(AnnotatedObject<?, ?> annotatedObject, String miOrLabel) { Collection<Alias> matchingAliases = new ArrayList<Alias>(); for (Alias alias : annotatedObject.getAliases()) { if (alias.getCvAliasType() != null && ( alias.getCvAliasType().getIdentifier().equals(miOrLabel) || alias.getCvAliasType().getShortLabel().equals(miOrLabel)) ) { matchingAliases.add(alias); } } return matchingAliases; }
public List<Alias> selectAliasByCvTopic(Collection<? extends Alias> aliases, CvAliasType aliasType) { List<Alias> result = null; for (Alias alias : aliases) { if (aliasType.equals(alias.getCvAliasType())) { if (result == null) { result = new ArrayList<Alias>(4); } result.add(alias); } } if (result == null) { result = Collections.EMPTY_LIST; } else { Comparator<Alias> c = new Comparator<Alias>() { public int compare(Alias alias1, Alias alias2) { String s1 = alias1.getName(); String s2 = alias2.getName(); if( s1 == null && s2 == null ) return 0; if( s1 == null ) return Integer.MIN_VALUE; if( s2 == null ) return Integer.MAX_VALUE; return s1.compareTo( s2 ); } }; if (result.size() > 1) { Collections.sort(result, c); } } return result; }
private static String getAlias(InteractionImpl complex, String id) { for (Alias alias : complex.getAliases()) { if (alias.getName() != null && alias.getCvAliasType() != null && alias.getCvAliasType().getIdentifier().equals(id)) { return alias.getName(); } } return null; }
@Override public int hashCode() { if (ac != null) return super.hashCode(); int result = 29; if ( name != null ) result = 29 * result + name.hashCode(); if ( cvAliasType != null ) result = 29 * result + cvAliasType.hashCode(); return result; }
@Override public String toString() { return "Alias[name: " + name + ", type: " + ( cvAliasType != null ? cvAliasType.getShortLabel() : "" ) + "]"; }
public static Collection<Alias> getAliasByType(AnnotatedObject<?, ?> annotatedObject, String miOrLabel) { Collection<Alias> matchingAliases = new ArrayList<Alias>(); for (Alias alias : annotatedObject.getAliases()) { if (alias.getCvAliasType() != null && ( alias.getCvAliasType().getIdentifier().equals(miOrLabel) || alias.getCvAliasType().getShortLabel().equals(miOrLabel)) ) { matchingAliases.add(alias); } } return matchingAliases; }
public List<Alias> selectAliasByCvTopic(Collection<? extends Alias> aliases, CvAliasType aliasType) { List<Alias> result = null; for (Alias alias : aliases) { if (aliasType.equals(alias.getCvAliasType())) { if (result == null) { result = new ArrayList<Alias>(4); } result.add(alias); } } if (result == null) { result = Collections.EMPTY_LIST; } else { Comparator<Alias> c = new Comparator<Alias>() { public int compare(Alias alias1, Alias alias2) { return alias1.getName().compareTo(alias2.getName()); } }; if (result.size() > 1) { Collections.sort(result, c); } } return result; }
private static String getAlias(InteractionImpl complex, String id) { for (Alias alias : complex.getAliases()) { if (alias.getName() != null && alias.getCvAliasType() != null && alias.getCvAliasType().getIdentifier().equals(id)) { return alias.getName(); } } return null; }