/** * Collects all Xref having a CvXrefQualifier( target-species ) linked to the given experiement. * * @param experiment * * @return a Collection of Xref. never null. */ public List<ExperimentXref> getTargetSpeciesXrefs( Experiment experiment ) { List<ExperimentXref> targets = new ArrayList<ExperimentXref>(); for ( ExperimentXref xref : experiment.getXrefs() ) { if ( targetSpeciesQualifier.equals( xref.getCvXrefQualifier() ) ) { targets.add( xref ); } } return targets; }
/** * Search for all Xrefs having Xref with the given CvXrefQualifier. * * @param ao the non null AnnotatedObject to search on. * @param qu the non null CvXrefQualifier filter. * * @return a non null Collection of Xref, may be empty. */ public static Collection<Xref> searchXrefs( AnnotatedObject ao, CvXrefQualifier qu ) { if ( ao == null ) { throw new NullPointerException( "AnnotatedObject must not be null." ); } if ( qu == null ) { throw new NullPointerException( "CvXrefQualifier must not be null." ); } Collection<Xref> xrefs = new ArrayList<Xref>( ao.getXrefs().size() ); for ( Iterator<Xref> iterator = ao.getXrefs().iterator(); iterator.hasNext(); ) { Xref xref = iterator.next(); if ( qu.equals( xref.getCvXrefQualifier() ) ) { xrefs.add( xref ); } } return xrefs; }
/** * Search for all Xrefs having Xref with both the given CvDatabase and CvXrefQualifier. * * @param ao the non null AnnotatedObject to search on. * @param db the non null CvDatabase filter. * @param qu the non null CvXrefQualifier filter. * * @return a non null Collection of Xref, may be empty. */ public static Collection<Xref> searchXrefs( AnnotatedObject ao, CvDatabase db, CvXrefQualifier qu ) { if ( ao == null ) { throw new NullPointerException( "AnnotatedObject must not be null." ); } if ( db == null ) { throw new NullPointerException( "CvDatabase must not be null." ); } if ( qu == null ) { throw new NullPointerException( "CvXrefQualifier must not be null." ); } Collection<Xref> xrefs = new ArrayList<Xref>( ao.getXrefs().size() ); for ( Iterator<Xref> iterator = ao.getXrefs().iterator(); iterator.hasNext(); ) { Xref xref = iterator.next(); if ( db.equals( xref.getCvDatabase() ) && qu.equals( xref.getCvXrefQualifier() ) ) { xrefs.add( xref ); } } return xrefs; }
public Set getPumedIds(Set experiments) { Set pubmeds = new HashSet(); for (Iterator iterator = experiments.iterator(); iterator.hasNext();) { Experiment experiment = (Experiment) iterator.next(); boolean found = false; for (Iterator iterator1 = experiment.getXrefs().iterator(); iterator1.hasNext() && !found;) { Xref xref = (Xref) iterator1.next(); if (getCvContext().getByMiRef(CvDatabase.class, CvDatabase.PUBMED_MI_REF).equals(xref.getCvDatabase()) && getCvContext().getByMiRef(CvXrefQualifier.class, CvXrefQualifier.PRIMARY_REFERENCE_MI_REF).equals(xref.getCvXrefQualifier())) { found = true; pubmeds.add(xref.getPrimaryId()); } } // xref if (found == false) { getOut().println("ERROR: " + experiment.getShortLabel() + " " + CvDatabase.PUBMED + " has no (" + CvXrefQualifier.PRIMARY_REFERENCE + ") assigned."); } } // experiments return pubmeds; }
public Set<String> getPumedIds(Set<Experiment> experiments, final boolean stopOnceOneFound ) { Set<String> pubmeds = new HashSet<String>(); for ( Experiment experiment : experiments ) { boolean found = false; for (Iterator iterator1 = experiment.getXrefs().iterator(); iterator1.hasNext() && !found;) { Xref xref = (Xref) iterator1.next(); if (getPubmed().equals(xref.getCvDatabase()) && getPrimaryReference().equals(xref.getCvXrefQualifier())) { if( stopOnceOneFound ) { found = true; } pubmeds.add(xref.getPrimaryId()); } } // xref if (found == false) { getOut().println("ERROR: " + experiment.getShortLabel() + " " + CvDatabase.PUBMED + " has no (" + CvXrefQualifier.PRIMARY_REFERENCE + ") assigned."); } } // experiments return pubmeds; }
/** * 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; }
/** * 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; }
/** * 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; } }
private String getMiReference( CvObject cv ) { for ( Xref xref : cv.getXrefs() ) { if ( getPsi().equals( xref.getCvDatabase() ) ) { if ( getIdentity().equals( xref.getCvXrefQualifier() ) ) { return xref.getPrimaryId(); } } } return null; }
Xref xref = (Xref) iterator.next(); if ( CvDatabase.PSI_MI.equals( xref.getCvDatabase().getShortLabel() ) ) { if ( ControlledVocabularyRepository.getPrimaryXrefQualifier().equals( xref.getCvXrefQualifier() ) ) {
Xref xref = (Xref) iterator.next(); if ( CvDatabase.PSI_MI.equals( xref.getCvDatabase().getShortLabel() ) ) { if ( ControlledVocabularyRepository.getPrimaryXrefQualifier().equals( xref.getCvXrefQualifier() ) ) {
Xref xref = (Xref) iterator.next(); if ( CvDatabase.PSI_MI.equals( xref.getCvDatabase().getShortLabel() ) ) { if ( ControlledVocabularyRepository.getPrimaryXrefQualifier().equals( xref.getCvXrefQualifier() ) ) {
Xref xref = (Xref) iterator.next(); if ( CvDatabase.PSI_MI.equals( xref.getCvDatabase().getShortLabel() ) ) { if ( ControlledVocabularyRepository.getPrimaryXrefQualifier().equals( xref.getCvXrefQualifier() ) ) {
Xref xref = (Xref) iterator.next(); if ( CvDatabase.PSI_MI.equals( xref.getCvDatabase().getShortLabel() ) ) { if ( ControlledVocabularyRepository.getPrimaryXrefQualifier().equals( xref.getCvXrefQualifier() ) ) {
Xref xref = (Xref) iterator.next(); if ( CvDatabase.PSI_MI.equals( xref.getCvDatabase().getShortLabel() ) ) { if ( ControlledVocabularyRepository.getPrimaryXrefQualifier().equals( xref.getCvXrefQualifier() ) ) {
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; }
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; }
/** * 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; }
ExperimentXref experimentXref = iterator.next(); if (experimentXref.getCvXrefQualifier().equals(targetSpeciesQualifier)) { for (SimpleBioSource bioSourceToRemove : bioSourcesToRemove) { if (experimentXref.getPrimaryId().equals(bioSourceToRemove.getTaxId())) {
( qualifier != null && qualifier.equals( identity ) ) ) {