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

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

Best Java code snippets using uk.ac.ebi.intact.model.InteractorXref (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.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());
            }
          }
        }
      }
    }
  }
}
origin: uk.ac.ebi.intact.core/intact-core-readonly

/**
 * Check if two interactors contain the same identity xrefs, excluding the IMEx partner identities
 *
 * @param interactor1
 * @param interactor2
 * @return
 */
public static boolean containTheSameIdentities(Interactor interactor1, Interactor interactor2) {
  List<InteractorXref> identities1 = getIdentityXrefs(interactor1, true);
  List<InteractorXref> identities2 = getIdentityXrefs(interactor2, true);
  if (identities1.size() != identities2.size()) {
    return false;
  }
  Comparator<InteractorXref> identityXrefComparator = new Comparator<InteractorXref>() {
    public int compare(InteractorXref o1, InteractorXref o2) {
      return o1.getPrimaryId().compareTo(o2.getPrimaryId());
    }
  };
  Collections.sort(identities1, identityXrefComparator);
  Collections.sort(identities2, identityXrefComparator);
  for (int i = 0; i < identities1.size(); i++) {
    if (!(identities1.get(i).equals(identities2.get(i)))) {
      return false;
    }
  }
  return true;
}
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.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.core/intact-core

  public int compare(InteractorXref o1, InteractorXref o2) {
    return o1.getPrimaryId().compareTo(o2.getPrimaryId());
  }
};
origin: uk.ac.ebi.intact.dataexchange.psimi/intact-psixml-converters

protected void fixSourceReferenceXrefsIfNecessary(Interaction interaction) {
  InteractorXref xrefToFix = null;
  if( ConverterContext.getInstance().isAutoFixInteractionSourceReference() ) {
    // Look up source reference xref and only try to fix identity if there is no source ref present.
    // if the qualifier is identity, we will check if the owner identity MI is the same as the database MI
    for (InteractorXref xref : interaction.getXrefs()) {
      if (xref.getCvXrefQualifier() != null &&
          getInstitutionPrimaryId() != null &&
          getInstitutionPrimaryId().equals( xref.getPrimaryId() ) &&
          !CvXrefQualifier.SOURCE_REFERENCE_MI_REF.equals(xref.getCvXrefQualifier().getIdentifier())) {
        xrefToFix = xref;
        break;
      }
    }
    if ( xrefToFix != null ) {
      log.warn("Interaction identity xref found pointing to the source database. It should be of type 'source-reference'. Will be fixed automatically: "+xrefToFix);
      CvXrefQualifier sourceReference = CvObjectUtils.createCvObject(interaction.getOwner(), CvXrefQualifier.class, CvXrefQualifier.SOURCE_REFERENCE_MI_REF, CvXrefQualifier.SOURCE_REFERENCE);
      xrefToFix.setCvXrefQualifier(sourceReference);
      addMessageToContext(MessageLevel.WARN, "Interaction identity xref found pointing to the source database. It should be of type 'source-reference'. Fixed.", true);
    }
  }
}
origin: uk.ac.ebi.intact.core/intact-core

protected ProteinImpl getProteinTranscriptsMasterProtein( Protein proteinTranscript, String cvXRefQualifier) {
  if ( proteinTranscript == null ) {
    throw new NullPointerException( "proteinTranscript must not be null." );
  }
  if ( cvXRefQualifier == null ) {
    throw new NullPointerException( "The Cv Xref qualifier must not be null." );
  }
  String masterProtAc = null;
  for (InteractorXref xref : proteinTranscript.getXrefs()) {
    if (xref.getCvXrefQualifier() != null && cvXRefQualifier.equals(xref.getCvXrefQualifier().getIdentifier())) {
      if (masterProtAc == null) {
        masterProtAc = xref.getPrimaryId();
      } else {
        throw new IntactException("This protein transcript contains more than one "+cvXRefQualifier+" xrefs: "+proteinTranscript.getShortLabel() );
      }
    }
  }
  // search protein by AC
  return getByAc(masterProtAc);
}
origin: uk.ac.ebi.intact.core/intact-core-readonly

public Interaction createInteractionRandomBinary(String imexId) {
  CvInteractionType cvInteractionType = createCvObject(CvInteractionType.class, CvInteractionType.DIRECT_INTERACTION_MI_REF, CvInteractionType.DIRECT_INTERACTION);
  CvInteractorType intType = createCvObject(CvInteractorType.class, CvInteractorType.INTERACTION_MI_REF, CvInteractorType.INTERACTION );
  Experiment experimentEmpty = createExperimentEmpty();
  Interaction interaction = new InteractionImpl(new ArrayList<Experiment>(Arrays.asList(experimentEmpty)),
                         cvInteractionType, intType, nextString("label"), getInstitution());
  experimentEmpty.getInteractions().add(interaction);
  createComponentBait(interaction, createProteinRandom());
  createComponentPrey(interaction, createProteinRandom());
  String shortLabel = InteractionUtils.calculateShortLabel(interaction);
  interaction.setShortLabel(shortLabel);
  if (imexId != null) {
    CvObjectBuilder cvBuilder = new CvObjectBuilder();
    CvXrefQualifier idQual = cvBuilder.createIdentityCvXrefQualifier(getInstitution());
    CvDatabase imexDb = createCvObject(CvDatabase.class, CvDatabase.IMEX_MI_REF, CvDatabase.IMEX);
    interaction.addXref(new InteractorXref(getInstitution(), imexDb, imexId, idQual));
  }
  return interaction;
}

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

/**
 * Checks if the current protein is a chain
 *
 * @param protein the protein to check
 * @return true if the protein is a chain
 */
public static boolean isFeatureChain(Protein protein) {
  Collection<InteractorXref> xrefs = protein.getXrefs();
  for (InteractorXref xref : xrefs) {
    if (xref.getCvXrefQualifier() != null) {
      String qualifierIdentity = xref.getCvXrefQualifier().getIdentifier();
      if (CvXrefQualifier.CHAIN_PARENT_MI_REF.equals(qualifierIdentity)) {
        return true;
      }
    }
  }
  return false;
}
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.core/intact-core-readonly

  public int compare(InteractorXref o1, InteractorXref o2) {
    return o1.getPrimaryId().compareTo(o2.getPrimaryId());
  }
};
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.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.core/intact-core-readonly

protected ProteinImpl getProteinTranscriptsMasterProtein( Protein proteinTranscript, String cvXRefQualifier) {
  if ( proteinTranscript == null ) {
    throw new NullPointerException( "proteinTranscript must not be null." );
  }
  if ( cvXRefQualifier == null ) {
    throw new NullPointerException( "The Cv Xref qualifier must not be null." );
  }
  String masterProtAc = null;
  for (InteractorXref xref : proteinTranscript.getXrefs()) {
    if (xref.getCvXrefQualifier() != null && cvXRefQualifier.equals(xref.getCvXrefQualifier().getIdentifier())) {
      if (masterProtAc == null) {
        masterProtAc = xref.getPrimaryId();
      } else {
        throw new IntactException("This protein transcript contains more than one "+cvXRefQualifier+" xrefs: "+proteinTranscript.getShortLabel() );
      }
    }
  }
  // search protein by AC
  return getByAc(masterProtAc);
}
origin: uk.ac.ebi.intact.core/intact-core

public Interaction createInteractionRandomBinary(String imexId) {
  CvInteractionType cvInteractionType = createCvObject(CvInteractionType.class, CvInteractionType.DIRECT_INTERACTION_MI_REF, CvInteractionType.DIRECT_INTERACTION);
  CvInteractorType intType = createCvObject(CvInteractorType.class, CvInteractorType.INTERACTION_MI_REF, CvInteractorType.INTERACTION );
  Experiment experimentEmpty = createExperimentEmpty();
  Interaction interaction = new InteractionImpl(new ArrayList<Experiment>(Arrays.asList(experimentEmpty)),
                         cvInteractionType, intType, nextString("label"), getInstitution());
  experimentEmpty.getInteractions().add(interaction);
  createComponentBait(interaction, createProteinRandom());
  createComponentPrey(interaction, createProteinRandom());
  String shortLabel = InteractionUtils.calculateShortLabel(interaction);
  interaction.setShortLabel(shortLabel);
  if (imexId != null) {
    CvObjectBuilder cvBuilder = new CvObjectBuilder();
    CvXrefQualifier idQual = cvBuilder.createIdentityCvXrefQualifier(getInstitution());
    CvDatabase imexDb = createCvObject(CvDatabase.class, CvDatabase.IMEX_MI_REF, CvDatabase.IMEX);
    interaction.addXref(new InteractorXref(getInstitution(), imexDb, imexId, idQual));
  }
  return interaction;
}

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

/**
 * Checks if the current protein is a splice variant
 *
 * @param protein the protein to check
 * @return true if the protein is a splice variant
 */
public static boolean isSpliceVariant(Protein protein) {
  Collection<InteractorXref> xrefs = protein.getXrefs();
  for (InteractorXref xref : xrefs) {
    if (xref.getCvXrefQualifier() != null) {
      String qualifierIdentity = xref.getCvXrefQualifier().getIdentifier();
      if (CvXrefQualifier.ISOFORM_PARENT_MI_REF.equals(qualifierIdentity)) {
        return true;
      }
    }
  }
  return false;
}
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.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.core/intact-core-readonly

  public int compare(InteractorXref o1, InteractorXref o2) {
    return o1.getPrimaryId().toLowerCase().compareTo(o2.getPrimaryId().toLowerCase());
  }
});
uk.ac.ebi.intact.modelInteractorXref

Javadoc

TODO comment this!

Most used methods

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

Popular in Java

  • Making http post requests using okhttp
  • setRequestProperty (URLConnection)
  • setContentView (Activity)
  • onCreateOptionsMenu (Activity)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Top 12 Jupyter Notebook extensions
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