Tabnine Logo
InteractorXref.getCvDatabase
Code IndexAdd Tabnine to your IDE (free)

How to use
getCvDatabase
method
in
uk.ac.ebi.intact.model.InteractorXref

Best Java code snippets using uk.ac.ebi.intact.model.InteractorXref.getCvDatabase (Showing top 20 results out of 315)

origin: uk.ac.ebi.intact.core/intact-core

private static Collection<InteractorXref> extractCrossReferencesFrom(Protein protein, String databaseMiRef, String qualifierMiRef) {
  Collection<InteractorXref> parents = new ArrayList<InteractorXref>();
  for (InteractorXref ref : protein.getXrefs()) {
    if (ref.getCvDatabase().getIdentifier().equals(databaseMiRef)) {
      if (ref.getCvXrefQualifier().getIdentifier().equals(qualifierMiRef)) {
        parents.add(ref);
      }
    }
  }
  return parents;
}
origin: uk.ac.ebi.intact.core/intact-core-readonly

private static Collection<InteractorXref> extractCrossReferencesFrom(Protein protein, String databaseMiRef, String qualifierMiRef) {
  Collection<InteractorXref> parents = new ArrayList<InteractorXref>();
  for (InteractorXref ref : protein.getXrefs()) {
    if (ref.getCvDatabase().getIdentifier().equals(databaseMiRef)) {
      if (ref.getCvXrefQualifier().getIdentifier().equals(qualifierMiRef)) {
        parents.add(ref);
      }
    }
  }
  return parents;
}
origin: uk.ac.ebi.intact.core/intact-core

/**
 * Retreives Imex identifier stored in the Xrefs.
 *
 * @param interaction the interaction to search on.
 * @return an imex id or null if not found.
 */
public static String getImexIdentifier(Interaction interaction) {
  if (interaction == null) {
    throw new IllegalArgumentException("You must give a non null interaction");
  }
  for (InteractorXref xref : interaction.getXrefs()) {
    if (CvDatabase.IMEX_MI_REF.equals(xref.getCvDatabase().getIdentifier())) {
      return xref.getPrimaryId();
    }
  }
  // Could not find an IMEx id
  return null;
}
origin: uk.ac.ebi.intact.core/intact-core-readonly

/**
 * Retreives Imex identifier stored in the Xrefs.
 *
 * @param interaction the interaction to search on.
 * @return an imex id or null if not found.
 */
public static String getImexIdentifier(Interaction interaction) {
  if (interaction == null) {
    throw new IllegalArgumentException("You must give a non null interaction");
  }
  for (InteractorXref xref : interaction.getXrefs()) {
    if (CvDatabase.IMEX_MI_REF.equals(xref.getCvDatabase().getIdentifier())) {
      return xref.getPrimaryId();
    }
  }
  // Could not find an IMEx id
  return null;
}
origin: uk.ac.ebi.intact.sanity/intact-sanity-rules

  public Collection<GeneralMessage> check( SmallMolecule smallMolecule ) throws SanityRuleException {
    Collection<GeneralMessage> messages = new ArrayList<GeneralMessage>();

    final Collection<InteractorXref> identities = XrefUtils.getIdentityXrefs( smallMolecule );
    switch( identities.size() ) {
      case 0:
        messages.add( new GeneralMessage( MessageDefinition.SMALL_MOLECULE_IDENTITY_MISSING, smallMolecule ) );
        break;

      case 1:
        final InteractorXref xref = identities.iterator().next();
        if ( ! CvObjectUtils.hasIdentity( xref.getCvDatabase(), CvDatabase.CHEBI_MI_REF ) ) {
          messages.add( new GeneralMessage(MessageDefinition.SMALL_MOLECULE_IDENTITY_INVALID_DB, smallMolecule ) );
        }
        break;

      default:
        // more than 1
        messages.add( new GeneralMessage( MessageDefinition.SMALL_MOLECULE_IDENTITY_MULTIPLE, smallMolecule ) );
    }

    return messages;
  }
}
origin: uk.ac.ebi.intact/intact-core

/**
 * Retreives Imex identifier stored in the Xrefs.
 *
 * @param interaction the interaction to search on.
 * @return an imex id or null if not found.
 */
public static String getImexIdentifier( Interaction interaction ) {
  if ( interaction == null ) {
    throw new IllegalArgumentException( "You must give a non null interaction" );
  }
  for ( InteractorXref xref : interaction.getXrefs() ) {
    CvObjectXref idCvDatabase = CvObjectUtils.getPsiMiIdentityXref( xref.getCvDatabase() );
    if ( idCvDatabase.getPrimaryId().equals( CvDatabase.IMEX_MI_REF ) ) {
      return xref.getPrimaryId();
    }
  }
  // Could not find an IMEx id
  return null;
}
origin: uk.ac.ebi.intact.core/intact-core

/**
 * Return the xref of the smallMolecule having as cvQualifier, the CvQualifier with psi-mi equal to
 * CvXrefQualifier.IDENTITY_MI_REF and as cvDatabase, the CvDatabase with psi-mi equal to CvDatabase.CHEBI_MI_REF
 * and returns it. Return null otherwise.
 *
 * @param smallMolecule a non null smallMolecule object.
 * @return the smallMolecule identity xref if the smallMolecule has one, null otherwise.
 */
public static InteractorXref getChebiXref(Interactor smallMolecule) {
  if (smallMolecule == null) {
    throw new NullPointerException("You must give a non null smallMolecule");
  }
  Collection<InteractorXref> xrefs = smallMolecule.getXrefs();
  for (InteractorXref xref : xrefs) {
    CvXrefQualifier qualifier = xref.getCvXrefQualifier();
    if (qualifier != null) {
      String qualifierIdentity = qualifier.getIdentifier();
      if (qualifierIdentity != null && CvXrefQualifier.IDENTITY_MI_REF.equals(qualifierIdentity)) {
        CvDatabase database = xref.getCvDatabase();
        String databaseIdentity = database.getIdentifier();
        if (databaseIdentity != null && CvDatabase.CHEBI_MI_REF.equals(databaseIdentity)) {
          return xref;
        }
      }
    }
  }
  return null;
}
origin: uk.ac.ebi.intact.core/intact-core

/**
 * Return the xref of the protein having as cvQualifier, the CvQualifier with psi-mi equal to
 * CvXrefQualifier.IDENTITY_MI_REF and as cvDatabase, the CvDatabase with psi-mi equal to CvDatabase.UNIPROT_MI_REF
 * and returns it. Return null otherwise.
 *
 * @param protein a non null Protein object.
 * @return the uniprotkb identity xref if the protein has one, null otherwise.
 */
public static InteractorXref getUniprotXref(Interactor protein) {
  if (protein == null) {
    throw new NullPointerException("Protein is null, shouldn't be null");
  }
  Collection<InteractorXref> xrefs = protein.getXrefs();
  for (InteractorXref xref : xrefs) {
    CvXrefQualifier qualifier = xref.getCvXrefQualifier();
    if (qualifier != null) {
      String qualifierIdentity = qualifier.getIdentifier();
      if (qualifierIdentity != null && CvXrefQualifier.IDENTITY_MI_REF.equals(qualifierIdentity)) {
        CvDatabase database = xref.getCvDatabase();
        String databaseIdentity = database.getIdentifier();
        if (databaseIdentity != null && CvDatabase.UNIPROT_MI_REF.equals(databaseIdentity)) {
          return xref;
        }
      }
    }
  }
  return null;
}
origin: uk.ac.ebi.intact.core/intact-core-readonly

/**
 * Return the xref of the protein having as cvQualifier, the CvQualifier with psi-mi equal to
 * CvXrefQualifier.IDENTITY_MI_REF and as cvDatabase, the CvDatabase with psi-mi equal to CvDatabase.UNIPROT_MI_REF
 * and returns it. Return null otherwise.
 *
 * @param protein a non null Protein object.
 * @return the uniprotkb identity xref if the protein has one, null otherwise.
 */
public static InteractorXref getUniprotXref(Interactor protein) {
  if (protein == null) {
    throw new NullPointerException("Protein is null, shouldn't be null");
  }
  Collection<InteractorXref> xrefs = protein.getXrefs();
  for (InteractorXref xref : xrefs) {
    CvXrefQualifier qualifier = xref.getCvXrefQualifier();
    if (qualifier != null) {
      String qualifierIdentity = qualifier.getIdentifier();
      if (qualifierIdentity != null && CvXrefQualifier.IDENTITY_MI_REF.equals(qualifierIdentity)) {
        CvDatabase database = xref.getCvDatabase();
        String databaseIdentity = database.getIdentifier();
        if (databaseIdentity != null && CvDatabase.UNIPROT_MI_REF.equals(databaseIdentity)) {
          return xref;
        }
      }
    }
  }
  return null;
}
origin: uk.ac.ebi.intact.core/intact-core-readonly

/**
 * Return the xref of the smallMolecule having as cvQualifier, the CvQualifier with psi-mi equal to
 * CvXrefQualifier.IDENTITY_MI_REF and as cvDatabase, the CvDatabase with psi-mi equal to CvDatabase.CHEBI_MI_REF
 * and returns it. Return null otherwise.
 *
 * @param smallMolecule a non null smallMolecule object.
 * @return the smallMolecule identity xref if the smallMolecule has one, null otherwise.
 */
public static InteractorXref getChebiXref(Interactor smallMolecule) {
  if (smallMolecule == null) {
    throw new NullPointerException("You must give a non null smallMolecule");
  }
  Collection<InteractorXref> xrefs = smallMolecule.getXrefs();
  for (InteractorXref xref : xrefs) {
    CvXrefQualifier qualifier = xref.getCvXrefQualifier();
    if (qualifier != null) {
      String qualifierIdentity = qualifier.getIdentifier();
      if (qualifierIdentity != null && CvXrefQualifier.IDENTITY_MI_REF.equals(qualifierIdentity)) {
        CvDatabase database = xref.getCvDatabase();
        String databaseIdentity = database.getIdentifier();
        if (databaseIdentity != null && CvDatabase.CHEBI_MI_REF.equals(databaseIdentity)) {
          return xref;
        }
      }
    }
  }
  return null;
}
origin: uk.ac.ebi.intact.dataexchange.uniprotexport/intact-uniprot-export

private Collection<ProteinImpl> getProteinByXref(String primaryId, CvDatabase database, CvXrefQualifier qualifier) {
  XrefDao<InteractorXref> xrefDao = IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getXrefDao(InteractorXref.class);
  Collection<InteractorXref> xrefs = xrefDao.getByPrimaryId(primaryId, false);
  Collection<ProteinImpl> proteins = new ArrayList<ProteinImpl>();
  for (InteractorXref xref : xrefs) {
    if ((null != database && database.equals(xref.getCvDatabase()))
      ||
      (null == database && null == xref.getCvDatabase())) {
      if ((null != qualifier && qualifier.equals(xref.getCvXrefQualifier()))
        ||
        (null == qualifier && null == xref.getCvXrefQualifier())) {
        proteins.add((ProteinImpl) xref.getParent());
      }
    }
  }
  return proteins;
}
origin: uk.ac.ebi.intact.util/intact-uniprot-export

private Collection<ProteinImpl> getProteinByXref(String primaryId, CvDatabase database, CvXrefQualifier qualifier) {
  XrefDao<InteractorXref> xrefDao = IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getXrefDao(InteractorXref.class);
  Collection<InteractorXref> xrefs = xrefDao.getByPrimaryId(primaryId, false);
  Collection<ProteinImpl> proteins = new ArrayList<ProteinImpl>();
  for (InteractorXref xref : xrefs) {
    if ((null != database && database.equals(xref.getCvDatabase()))
      ||
      (null == database && null == xref.getCvDatabase())) {
      if ((null != qualifier && qualifier.equals(xref.getCvXrefQualifier()))
        ||
        (null == qualifier && null == xref.getCvXrefQualifier())) {
        proteins.add((ProteinImpl) xref.getParent());
      }
    }
  }
  return proteins;
}
origin: uk.ac.ebi.intact/intact-core

/**
 * Return the xref of the protein having as cvQualifier, the CvQualifier with psi-mi equal to
 * CvXrefQualifier.IDENTITY_MI_REF and as cvDatabase, the CvDatabase with psi-mi equal to CvDatabase.UNIPROT_MI_REF
 * and returns it. Return null otherwise.
 * @param protein a non null Protein object.
 * @return the uniprotkb identity xref if the protein has one, null otherwise.
 */
public static InteractorXref getUniprotXref(Protein protein){
  if(protein == null){
    throw new NullPointerException("Protein is null, shouldn't be null");
  }
  Collection<InteractorXref> xrefs = protein.getXrefs();
  for(InteractorXref xref : xrefs){
    CvXrefQualifier qualifier = xref.getCvXrefQualifier();
    if(qualifier != null){
      CvObjectXref qualifierIdentityXref = CvObjectUtils.getPsiMiIdentityXref(qualifier);
      if(qualifierIdentityXref!= null && CvXrefQualifier.IDENTITY_MI_REF.equals(qualifierIdentityXref.getPrimaryId())){
        CvDatabase database = xref.getCvDatabase();
        CvObjectXref databaseIdentityXref = CvObjectUtils.getPsiMiIdentityXref(database);
        if(databaseIdentityXref != null && CvDatabase.UNIPROT_MI_REF.equals(databaseIdentityXref.getPrimaryId())){
          return xref;
        }
      }
    }
  }
  return null;
}
origin: uk.ac.ebi.intact.sanity/intact-sanity-rules

public Collection<GeneralMessage> check( NucleicAcid nucleicAcid ) throws SanityRuleException {
  Collection<GeneralMessage> messages = new ArrayList<GeneralMessage>();
  Collection<InteractorXref> xrefs = nucleicAcid.getXrefs();
  int identityCount = 0;
  for ( InteractorXref xref : xrefs ) {
    if ( xref.getCvXrefQualifier() != null ) {
      CvObjectXref qualifierIdentity = CvObjectUtils.getPsiMiIdentityXref( xref.getCvXrefQualifier() );
      if ( qualifierIdentity != null && CvXrefQualifier.IDENTITY_MI_REF.equals( qualifierIdentity.getPrimaryId() ) ) {
        CvObjectXref databaseIdentity = CvObjectUtils.getPsiMiIdentityXref( xref.getCvDatabase() );
        if ( cvDatabaseMis.contains( databaseIdentity.getPrimaryId() ) ) {
          identityCount++;
        } else {
          messages.add( new GeneralMessage(MessageDefinition.NUC_ACID_IDENTITY_INVALID_DB, nucleicAcid ) );
        }
      }
    }
  }
  if ( identityCount > 1 ) {
    messages.add( new GeneralMessage( MessageDefinition.NUC_ACID_IDENTITY_MULTIPLE, nucleicAcid ) );
  } else if ( identityCount == 0 ) {
    messages.add( new GeneralMessage( MessageDefinition.NUC_ACID_IDENTITY_MISSING, nucleicAcid ) );
  }
  return messages;
}
origin: uk.ac.ebi.intact.sanity/intact-sanity-rules

public Collection<GeneralMessage> check(Protein protein) throws SanityRuleException {
  Collection<GeneralMessage> messages = new ArrayList<GeneralMessage>();
  if(!CommonMethods.isNoUniprotUpdate(protein)){
    int uniprotIdentityCount = 0;
    Collection<InteractorXref> xrefs = protein.getXrefs();
    for(InteractorXref xref : xrefs){
      CvXrefQualifier qualifier = xref.getCvXrefQualifier();
      if(qualifier != null){
        CvObjectXref qualifierPsiMiXref = CvObjectUtils.getPsiMiIdentityXref(qualifier);
        if(qualifierPsiMiXref != null && CvXrefQualifier.IDENTITY_MI_REF.equals(qualifierPsiMiXref.getPrimaryId())){
          CvObjectXref databasePsiMiXref = CvObjectUtils.getPsiMiIdentityXref(xref.getCvDatabase());
          if(databasePsiMiXref != null && CvDatabase.UNIPROT_MI_REF.equals(databasePsiMiXref.getPrimaryId())){
            uniprotIdentityCount++;
          }
        }
      }
    }
    if(uniprotIdentityCount == 0){
      messages.add(new GeneralMessage(MessageDefinition.PROTEIN_UNIPROT_NO_XREF, protein));
    }else if(uniprotIdentityCount > 1){
      messages.add(new GeneralMessage(MessageDefinition.PROTEIN_UNIPROT_MULTIPLE_XREF, protein));
    }
  }
  return messages;
}
origin: uk.ac.ebi.intact.dataexchange.psimi/intact-psimitab-converters

if (!hasFoundIdentity && ref.getCvDatabase() != null && CvDatabase.CHEBI_MI_REF.equals(ref.getCvDatabase().getIdentifier())){
origin: uk.ac.ebi.intact.dataexchange.uniprotexport/intact-uniprot-export

/**
 * Get the uniprot primary ID from Protein and Splice variant.
 *
 * @param protein the Protein for which we want the uniprot ID.
 *
 * @return the uniprot ID as a String or null if none is found (should not occur)
 */
public String getUniprotID(final Protein protein) {
  if (protAcToUniprotIdCache.containsKey(protein.getAc())) {
    return protAcToUniprotIdCache.get(protein.getAc());
  }
  String uniprotId = null;
  Collection<InteractorXref> xrefs = protein.getXrefs();
  for (InteractorXref xref : xrefs) {
    if (getUniprot().getIdentifier().equals(xref.getCvDatabase().getIdentifier()) &&
        getIdentity().equals(xref.getCvXrefQualifier())) {
      uniprotId = xref.getPrimaryId();
      break;
    }
  }
  protAcToUniprotIdCache.put(protein.getAc(), uniprotId);
  return uniprotId;
}
origin: uk.ac.ebi.intact.dataexchange.uniprotexport/intact-uniprot-export

  /**
   * Get the uniprot primary ID from Protein and Splice variant.
   *
   * @param protein the Protein for which we want the uniprot ID.
   *
   * @return the uniprot ID as a String or null if none is found (should not occur)
   */
  public String getUniprotPrimaryAc(final Protein protein) {

    if (protAcToUniprotIdCache.containsKey(protein.getAc())) {
      return protAcToUniprotIdCache.get(protein.getAc());
    }

    String uniprotId = null;

    Collection<InteractorXref> xrefs = protein.getXrefs();

    for (InteractorXref xref : xrefs) {
      if (getUniprot().equals(xref.getCvDatabase()) &&
          getIdentity().equals(xref.getCvXrefQualifier())) {
        uniprotId = xref.getPrimaryId();
        break;
      }
    }

    protAcToUniprotIdCache.put(protein.getAc(), uniprotId);

    return uniprotId;
  }
}
origin: uk.ac.ebi.intact.util/intact-uniprot-export

/**
 * Get the uniprot primary ID from Protein and Splice variant.
 *
 * @param protein the Protein for which we want the uniprot ID.
 *
 * @return the uniprot ID as a String or null if none is found (should not occur)
 */
public String getUniprotID(final Protein protein) {
  if (protAcToUniprotIdCache.containsKey(protein.getAc())) {
    return protAcToUniprotIdCache.get(protein.getAc());
  }
  String uniprotId = null;
  Collection<InteractorXref> xrefs = protein.getXrefs();
  CvDatabase uniprotCv = IntactContext.getCurrentInstance().getCvContext().getByMiRef(CvDatabase.class, CvDatabase.UNIPROT_MI_REF);
  CvXrefQualifier identityCv = IntactContext.getCurrentInstance().getCvContext().getByMiRef(CvXrefQualifier.class, CvXrefQualifier.IDENTITY_MI_REF);
  for (InteractorXref xref : xrefs) {
    if (uniprotCv.equals(xref.getCvDatabase()) &&
      identityCv.equals(xref.getCvXrefQualifier())) {
      uniprotId = xref.getPrimaryId();
      break;
    }
  }
  //ProteinDao proteinDao = IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getProteinDao() ;
  //String uniprotId = proteinDao.getUniprotAcByProteinAc(protein.getAc());
  protAcToUniprotIdCache.put(protein.getAc(), uniprotId);
  return uniprotId;
}
origin: uk.ac.ebi.intact.dbupdate/protein-mapping

/**
 * Add all the cross references with qualifier 'identity' to the list of identifiers of the protein (intact cross references are ignored)
 * @param refs : the refs of the protein
 * @param context : the context of the protein
 */
private void addIdentityCrossreferencesToContext(Collection<InteractorXref> refs, UpdateContext context){
  for (InteractorXref ref : refs){
    if (ref.getPrimaryId() != null){
      if (ref.getCvXrefQualifier() != null){
        CvXrefQualifier qualifier = ref.getCvXrefQualifier();
        if (isIdentityCrossReference(qualifier)){
          CvDatabase database = ref.getCvDatabase();
          if (database != null){
            if (database.getIdentifier() != null && !CvDatabase.INTACT_MI_REF.equals(database.getIdentifier())){
              context.addIdentifier(database.getIdentifier(), ref.getPrimaryId());
            }
            else if (database.getShortLabel() != null && !CvDatabase.INTACT.equals(database.getShortLabel())) {
              context.addIdentifier(database.getShortLabel(), ref.getPrimaryId());
            }
          }
        }
      }
    }
  }
}
uk.ac.ebi.intact.modelInteractorXrefgetCvDatabase

Popular methods of InteractorXref

  • getCvXrefQualifier
  • getPrimaryId
  • <init>
  • equals
  • getParent
  • setCvXrefQualifier

Popular in Java

  • Reading from database using SQL prepared statement
  • startActivity (Activity)
  • getApplicationContext (Context)
  • notifyDataSetChanged (ArrayAdapter)
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • JOptionPane (javax.swing)
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now