/** * get the value what will be used as ID of the protein. * * @param protein the protein for which we need an ID. * * @return the ID of the protein. */ public String getProteinId( Protein protein ) { // TODO test that. // TODO what if no AC available ? shortlabel (could be redondant) ? Object pointer/HashCode (will be unique in the scope of the document) ? return protein.getAc(); }
public PersistentProteinEvent(ProteinUpdateProcess process, Protein protein, String uniprotAc){ super(process); this.proteinAc = protein != null ? protein.getAc() : null; this.uniprotAc = uniprotAc; this.message = null; }
/** * get the value what will be used as ID of the protein. * * @param protein the protein for which we need an ID. * * @return the ID of the protein. */ public String getProteinId( Protein protein ) { // TODO test that. // TODO what if no AC available ? shortlabel (could be redondant) ? Object pointer/HashCode (will be unique in the scope of the document) ? return protein.getAc(); }
/** * get the value what will be used as ID of the protein. * * @param protein the protein for which we need an ID. * * @return the ID of the protein. */ public String getProteinId( Protein protein ) { // TODO test that. // TODO what if no AC available ? shortlabel (could be redondant) ? Object pointer/HashCode (will be unique in the scope of the document) ? return protein.getAc(); }
public DuplicatedProteinEvent(ProteinUpdateProcess updateProcess, Protein duplicatedProtein, Protein originalProtein, String uniprotAc, boolean wasMergeSuccessful){ super(updateProcess, duplicatedProtein, uniprotAc); this.originalProtein = originalProtein != null ? originalProtein.getAc() : null; this.wasMergeSuccessful = wasMergeSuccessful; }
protected List<ProteinImpl> getProteinTranscripts( Protein protein, String cvXRefQualifier) { if ( protein == null ) { throw new NullPointerException( "The master protein must not be null." ); } if ( cvXRefQualifier == null ) { throw new NullPointerException( "The Cv Xref qualifier must not be null." ); } String ac = protein.getAc(); if ( ac == null ) { // This protein doesn't have an AC, it cannot have protein transcripts. if (log.isWarnEnabled()) log.warn("Cannot find protein transcripts for a protein without AC: "+protein.getShortLabel()); return Collections.EMPTY_LIST; } Query query = getEntityManager().createQuery("select prot from ProteinImpl prot inner join " + "prot.xrefs as xref where " + "xref.cvXrefQualifier.identifier = :transcriptParentMi " + "and xref.cvDatabase.identifier = :intactMi " + "and xref.primaryId = :masterAc"); query.setParameter("transcriptParentMi", cvXRefQualifier); query.setParameter("intactMi", CvDatabase.INTACT_MI_REF); query.setParameter("masterAc", ac); return query.getResultList(); }
protected List<ProteinImpl> getProteinTranscripts( Protein protein, String cvXRefQualifier) { if ( protein == null ) { throw new NullPointerException( "The master protein must not be null." ); } if ( cvXRefQualifier == null ) { throw new NullPointerException( "The Cv Xref qualifier must not be null." ); } String ac = protein.getAc(); if ( ac == null ) { // This protein doesn't have an AC, it cannot have protein transcripts. if (log.isWarnEnabled()) log.warn("Cannot find protein transcripts for a protein without AC: "+protein.getShortLabel()); return Collections.EMPTY_LIST; } Query query = getEntityManager().createQuery("select prot from ProteinImpl prot inner join " + "prot.xrefs as xref where " + "xref.cvXrefQualifier.identifier = :transcriptParentMi " + "and xref.cvDatabase.identifier = :intactMi " + "and xref.primaryId = :masterAc"); query.setParameter("transcriptParentMi", cvXRefQualifier); query.setParameter("intactMi", CvDatabase.INTACT_MI_REF); query.setParameter("masterAc", ac); return query.getResultList(); }
public PersistentProteinEvent(ProteinUpdateProcess process, Protein protein){ super(process); this.proteinAc = protein != null ? protein.getAc() : null; InteractorXref uniprotXref = ProteinUtils.getUniprotXref(protein); if (uniprotXref != null){ this.uniprotAc = uniprotXref.getPrimaryId(); } else { this.uniprotAc = null; } this.message = null; }
public Protein createProteinSpliceVariant(Protein masterProt, String uniprotId, String shortLabel) { Protein spliceVariant = createProtein(uniprotId, shortLabel); if (masterProt.getAc() == null) { throw new IllegalArgumentException("Cannot create an splice variant if the master protein does not have an AC: "+masterProt.getShortLabel()); } CvXrefQualifier isoformParent = createCvObject(CvXrefQualifier.class, CvXrefQualifier.ISOFORM_PARENT_MI_REF, CvXrefQualifier.ISOFORM_PARENT); CvDatabase uniprotKb = createCvObject(CvDatabase.class, CvDatabase.INTACT_MI_REF, CvDatabase.INTACT); InteractorXref isoformXref = createXref(spliceVariant, masterProt.getAc(), isoformParent, uniprotKb); spliceVariant.addXref(isoformXref); return spliceVariant; }
public Protein createProteinChain(Protein masterProt, String uniprotId, String shortLabel) { Protein chain = createProtein(uniprotId, shortLabel); if (masterProt.getAc() == null) { throw new IllegalArgumentException("Cannot create a chain if the master protein does not have an AC: "+masterProt.getShortLabel()); } CvXrefQualifier chainParent = createCvObject(CvXrefQualifier.class, CvXrefQualifier.CHAIN_PARENT_MI_REF, CvXrefQualifier.CHAIN_PARENT); CvDatabase uniprotKb = createCvObject(CvDatabase.class, CvDatabase.INTACT_MI_REF, CvDatabase.INTACT); InteractorXref isoformXref = createXref(chain, masterProt.getAc(), chainParent, uniprotKb); chain.addXref(isoformXref); return chain; }
public Protein createProteinSpliceVariant(Protein masterProt, String uniprotId, String shortLabel) { Protein spliceVariant = createProtein(uniprotId, shortLabel); if (masterProt.getAc() == null) { throw new IllegalArgumentException("Cannot create an splice variant if the master protein does not have an AC: "+masterProt.getShortLabel()); } CvXrefQualifier isoformParent = createCvObject(CvXrefQualifier.class, CvXrefQualifier.ISOFORM_PARENT_MI_REF, CvXrefQualifier.ISOFORM_PARENT); CvDatabase uniprotKb = createCvObject(CvDatabase.class, CvDatabase.INTACT_MI_REF, CvDatabase.INTACT); InteractorXref isoformXref = createXref(spliceVariant, masterProt.getAc(), isoformParent, uniprotKb); spliceVariant.addXref(isoformXref); return spliceVariant; }
public List<ProteinImpl> getSpliceVariants( Protein protein ) { if ( protein == null ) { throw new NullPointerException( "The master protein must not be null." ); } String ac = protein.getAc(); if ( ac == null ) { // This protein doesn't have an AC, it cannot have splice variants. return new ArrayList<ProteinImpl>( 1 ); } return getSession().createCriteria( ProteinImpl.class ) .createAlias( "xrefs", "xref" ) .createAlias( "xref.cvXrefQualifier", "qual" ) .createAlias( "xref.cvDatabase", "database" ) .createCriteria( "qual.xrefs", "qualXref" ) .createCriteria( "database.xrefs", "dbXref" ) .add( Restrictions.eq( "qualXref.primaryId", CvXrefQualifier.ISOFORM_PARENT_MI_REF ) ) .add( Restrictions.eq( "dbXref.primaryId", CvDatabase.INTACT_MI_REF ) ) .add( Restrictions.eq( "xref.primaryId", ac ) ).list(); }
public Protein createProteinChain(Protein masterProt, String uniprotId, String shortLabel) { Protein chain = createProtein(uniprotId, shortLabel); if (masterProt.getAc() == null) { throw new IllegalArgumentException("Cannot create a chain if the master protein does not have an AC: "+masterProt.getShortLabel()); } CvXrefQualifier chainParent = createCvObject(CvXrefQualifier.class, CvXrefQualifier.CHAIN_PARENT_MI_REF, CvXrefQualifier.CHAIN_PARENT); CvDatabase uniprotKb = createCvObject(CvDatabase.class, CvDatabase.INTACT_MI_REF, CvDatabase.INTACT); InteractorXref isoformXref = createXref(chain, masterProt.getAc(), chainParent, uniprotKb); chain.addXref(isoformXref); return chain; }
/** * 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(); 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; }
if ( log.isDebugEnabled() ) { log.warn( "Could not find an Xref having CvXrefQualifier(isoform-parent) in splice variant: " + spliceVariant.getAc() ); log.warn( "Most likely, the given protein wasn't a (valid) splice variant." ); throw new IntactException( "Found more than one Xref having CvXrefQualifier(isoform-parent) in splice variant: " + spliceVariant.getAc() );
/** * retreives using the provided helper a Protein based on its Xref (uniprot, identity). * * @param uniprotID the primary id of the cross reference * * @return a Protein having Xref( uniprotId, uniprot, identity ) * * @throws IntactException if none or more than 2 proteins are found. */ private Collection<ProteinImpl> getProteinFromIntact(String uniprotID) throws IntactException { Collection<ProteinImpl> proteins = getProteinByXref(uniprotID, getUniprot(), getIdentity() ); if (proteins.size() == 0) { throw new IntactException("the ID '" + uniprotID + "' didn't return the expected number of protein: " + proteins.size() + ". Abort."); } spliceVariants.clear(); // now from that try to get splice variants (if any) for (Protein protein : proteins) { String ac = protein.getAc(); Collection<ProteinImpl> sv = getProteinByXref(ac, getIntact(), getIsoformParent() ); spliceVariants.addAll(sv); } proteins.addAll(spliceVariants); return proteins; }
@Transactional( "update" ) public void onProteinDuplicationFound(DuplicatesFoundEvent evt) throws ProcessorException { // reattach the updateProcess to the entity manager ProteinUpdateProcess updateProcess = IntactUpdateContext.getCurrentInstance().getUpdateFactory().getEntityManager().merge(this.updateProcess); Protein originalProtein = evt.getReferenceProtein(); for (Protein duplicate : evt.getProteins()){ Set<String> movedInteractions = evt.getMovedInteractions().get(duplicate.getAc()); RangeUpdateReport invalidRangeReport = evt.getComponentsWithFeatureConflicts().get(duplicate); Collection<String> updatedTranscripts = evt.getUpdatedTranscripts().get(duplicate.getAc()); Collection<InteractorXref> movedXrefs = evt.getMovedXrefs().get(duplicate.getAc()); RangeUpdateReport rangeReport = evt.getUpdatedRanges().get(duplicate.getAc()); String uniprotAc = evt.getPrimaryUniprotAc(); boolean isMergeSuccessful = (invalidRangeReport == null); DuplicatedProteinEvent duplicatedEvent = new DuplicatedProteinEvent(updateProcess, duplicate, originalProtein, uniprotAc, isMergeSuccessful); // add the moved interactions if (movedInteractions != null){ duplicatedEvent.getMovedInteractions().addAll(movedInteractions); } // add the updated transcripts if (updatedTranscripts != null){ duplicatedEvent.getUpdatedTranscripts().addAll(updatedTranscripts); } if (movedXrefs != null){ duplicatedEvent.addMovedReferencesFromXref(movedXrefs); } collectRangeUpdateEvents(rangeReport, duplicatedEvent); IntactUpdateContext.getCurrentInstance().getUpdateFactory().getDuplicatedProteinEventDao().persist(duplicatedEvent); } }
/** * 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; }