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; }
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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
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); }
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); }
/** * 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; }
for ( Iterator iterator = protein.getXrefs().iterator(); iterator.hasNext(); ) { Xref xref = (Xref) iterator.next();
for ( Iterator iterator = protein.getXrefs().iterator(); iterator.hasNext(); ) { Xref xref = (Xref) iterator.next();
for ( Iterator iterator = protein.getXrefs().iterator(); iterator.hasNext(); ) { Xref xref = (Xref) iterator.next();
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; }
/** * Get the intact master AC from the given Splice variant. * * @param protein the splice variant (Protein) for which we its intact master AC. * * @return the intact AC */ public final String getMasterAc(final Protein protein) { String ac = null; Collection<InteractorXref> xrefs = protein.getXrefs(); boolean found = false; for (Iterator<InteractorXref> iterator = xrefs.iterator(); iterator.hasNext() && !found;) { Xref xref = iterator.next(); if (getCvContext().getByMiRef(CvDatabase.class, CvDatabase.INTACT_MI_REF).equals(xref.getCvDatabase()) && getCvContext().getByMiRef(CvXrefQualifier.class, CvXrefQualifier.ISOFORM_PARENT_MI_REF).equals(xref.getCvXrefQualifier())) { ac = xref.getPrimaryId(); found = true; } } return ac; }
for ( Iterator iterator = protein.getXrefs().iterator(); iterator.hasNext(); ) { Xref xref = (Xref) iterator.next();
/** * Get the intact master AC from the given Splice variant. * * @param protein the splice variant (Protein) for which we its intact master AC. * * @return the intact AC */ public final String getMasterAc(final Protein protein) { String ac = null; Collection<InteractorXref> xrefs = protein.getXrefs(); boolean found = false; for (Iterator<InteractorXref> iterator = xrefs.iterator(); iterator.hasNext() && !found;) { Xref xref = iterator.next(); if ( getIntact().getIdentifier().equals( xref.getCvDatabase().getIdentifier() ) && ( getIsoformParent().getIdentifier().equals( xref.getCvXrefQualifier().getIdentifier() ) || getChainParent().getIdentifier().equals( xref.getCvXrefQualifier().getIdentifier() ) ) ) { ac = xref.getPrimaryId(); found = true; } } return ac; }
/** * 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; }
for ( Iterator iterator = protein.getXrefs().iterator(); iterator.hasNext(); ) { Xref xref = (Xref) iterator.next();
/** * 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; } }
/** * 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; }