private Query createGetByInteractorTypeQuery(String cvIdentifer, boolean includeChildren, boolean isCount) { List<String> cvIdentifiers = new ArrayList<String>(); cvIdentifiers.add(cvIdentifer); if (includeChildren) { CvObjectDao<CvInteractorType> cvObjectDao = IntactContext.getCurrentInstance().getDaoFactory() .getCvObjectDao(CvInteractorType.class); CvDagObject cvInteractorType = cvObjectDao.getByPsiMiRef(cvIdentifer); if (cvInteractorType != null) { final Set<String> childrenMIs = CvObjectUtils.getChildrenMIs(cvInteractorType); cvIdentifiers.addAll(childrenMIs); } else { if (log.isDebugEnabled()) log.debug("CvInteractorType with this identifier was not found in the database: "+cvIdentifer); } } String sqlQuery = (isCount? "select count(*) " : "") + "from " + getEntityClass().getName() + " i where " + "i.cvInteractorType.identifier in (:interactorTypeIdentifiers)"; Query query = getEntityManager().createQuery(sqlQuery); query.setParameter("interactorTypeIdentifiers", cvIdentifiers); return query; }
private Query createGetByInteractorTypeQuery(String cvIdentifer, boolean includeChildren, boolean isCount) { List<String> cvIdentifiers = new ArrayList<String>(); cvIdentifiers.add(cvIdentifer); if (includeChildren) { CvObjectDao<CvInteractorType> cvObjectDao = IntactContext.getCurrentInstance().getDaoFactory() .getCvObjectDao(CvInteractorType.class); CvDagObject cvInteractorType = cvObjectDao.getByPsiMiRef(cvIdentifer); if (cvInteractorType != null) { final Set<String> childrenMIs = CvObjectUtils.getChildrenMIs(cvInteractorType); cvIdentifiers.addAll(childrenMIs); } else { if (log.isDebugEnabled()) log.debug("CvInteractorType with this identifier was not found in the database: "+cvIdentifer); } } String sqlQuery = (isCount? "select count(*) " : "") + "from " + getEntityClass().getName() + " i where " + "i.cvInteractorType.identifier in (:interactorTypeIdentifiers)"; Query query = getEntityManager().createQuery(sqlQuery); query.setParameter("interactorTypeIdentifiers", cvIdentifiers); return query; }
cv = dao.getByPsiMiRef( mi ); if (cv == null) { out.println("ERROR: The MI reference you gave doesn't exists. Using the shortlabel instead.");
public Collection<String> getNucleicAcidMIs() { final CvObjectDao<CvInteractorType> itdao = IntactContext.getCurrentInstance().getDataContext() .getDaoFactory().getCvObjectDao( CvInteractorType.class); // 1. load the root term CvInteractorType root = itdao.getByPsiMiRef( CvInteractorType.NUCLEIC_ACID_MI_REF ); Collection<String> collectedMIs = new ArrayList<String>( ); if( root != null ) { // 2. traverse children and collect their MIs CvObjectUtils.getChildrenMIs( root, collectedMIs ); } return collectedMIs; }
public Collection<String> getNucleicAcidMIs() { final CvObjectDao<CvInteractorType> itdao = IntactContext.getCurrentInstance().getDataContext() .getDaoFactory().getCvObjectDao( CvInteractorType.class); // 1. load the root term CvInteractorType root = itdao.getByPsiMiRef( CvInteractorType.NUCLEIC_ACID_MI_REF ); Collection<String> collectedMIs = new ArrayList<String>( ); if( root != null ) { // 2. traverse children and collect their MIs CvObjectUtils.getChildrenMIs( root, collectedMIs ); } return collectedMIs; }
/** * Create a new InteractorXref for the protein * @param uniprotAc : the uniprot accession * @return the InteractorXref with the uniprot ac and qualifier identity */ private InteractorXref createIdentityInteractorXrefForUniprotAc(String uniprotAc){ IntactContext intactContext = IntactContext.getCurrentInstance(); if (uniprotAc == null){ return null; } final CvDatabase uniprot = intactContext.getDaoFactory().getCvObjectDao(CvDatabase.class).getByPsiMiRef( CvDatabase.UNIPROT_MI_REF ); final CvXrefQualifier identity = intactContext.getDaoFactory().getCvObjectDao(CvXrefQualifier.class).getByPsiMiRef(CvXrefQualifier.IDENTITY_MI_REF); InteractorXref xRef = new InteractorXref(intactContext.getInstitution(), uniprot, uniprotAc, identity); return xRef; }
database = context.getDataContext().getDaoFactory().getCvObjectDao( CvDatabase.class ).getByPsiMiRef( mi );
aliasType = context.getDataContext().getDaoFactory().getCvObjectDao( CvAliasType.class ).getByPsiMiRef( mi );
CvXrefQualifier identity = daoFactory.getCvObjectDao(CvXrefQualifier.class).getByPsiMiRef(CvXrefQualifier.IDENTITY_MI_REF); CvDatabase intact = daoFactory.getCvObjectDao(CvDatabase.class).getByPsiMiRef(CvDatabase.INTACT_MI_REF);
CvXrefQualifier identity = daoFactory.getCvObjectDao(CvXrefQualifier.class).getByPsiMiRef(CvXrefQualifier.IDENTITY_MI_REF); CvDatabase intact = daoFactory.getCvObjectDao(CvDatabase.class).getByPsiMiRef(CvDatabase.INTACT_MI_REF);
cv = dao.getByPsiMiRef(mi); } else { psi = IntactContext.getCurrentInstance().getDataContext().getDaoFactory() .getCvObjectDao(CvDatabase.class).getByPsiMiRef(CvDatabase.PSI_MI_MI_REF);
/** * * @return a new Dataset annotation with the dataset value contained in the DatasetSelector of this object */ private Annotation createNewDataset() throws DatasetException { CvTopic dataset = IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getCvObjectDao( CvTopic.class ).getByPsiMiRef( CvTopic.DATASET_MI_REF ); if (dataset == null){ throw new DatasetException("The CVTopic " + CvTopic.DATASET_MI_REF + " : " + CvTopic.DATASET + "doesn't exist in the database."); } Annotation annotation = new Annotation(dataset, this.selector.getDatasetValueToAdd()); return annotation; }
CvAliasType synType = IntactContext.getCurrentInstance().getDaoFactory().getCvObjectDao(CvAliasType.class).getByPsiMiRef(CvAliasType.SYNONYM_MI_REF); for (String syn : taxTerm.getSynonyms()){ bs.getAliases().add(new BioSourceAlias(IntactContext.getCurrentInstance().getInstitution(), bs, synType, syn));
String.valueOf(taxTerm.getTaxid())); if (!taxTerm.getSynonyms().isEmpty()){ CvAliasType synType = IntactContext.getCurrentInstance().getDaoFactory().getCvObjectDao(CvAliasType.class).getByPsiMiRef(CvAliasType.SYNONYM_MI_REF); for (String syn : taxTerm.getSynonyms()){ bs.getAliases().add(new BioSourceAlias(IntactContext.getCurrentInstance().getInstitution(), bs, synType, syn));
public static CvObjectXref createIdentityXref(CvDagObject term, String database, String identifier) { DaoFactory factory = IntactContext.getCurrentInstance().getDaoFactory(); CvObjectXref cvXref; CvXrefQualifier identity = factory.getCvObjectDao(CvXrefQualifier.class).getByPsiMiRef(CvXrefQualifier.IDENTITY_MI_REF); CvDatabase db = factory.getCvObjectDao(CvDatabase.class).getByPsiMiRef(database); if (identity == null){ identity = CvObjectUtils.createCvObject(IntactContext.getCurrentInstance().getInstitution(), CvXrefQualifier.class, CvXrefQualifier.IDENTITY_MI_REF, CvXrefQualifier.IDENTITY); IntactContext.getCurrentInstance().getCorePersister().saveOrUpdate(identity); } if (db == null){ db = CvObjectUtils.createCvObject(IntactContext.getCurrentInstance().getInstitution(), CvDatabase.class, database, database); IntactContext.getCurrentInstance().getCorePersister().saveOrUpdate(db); } // create identity xref cvXref = XrefUtils.createIdentityXref(term, identifier, identity, db); term.addXref(cvXref); return cvXref; }
public static CvObjectXref createSecondaryXref(CvDagObject term, String database, String identifier) { DaoFactory factory = IntactContext.getCurrentInstance().getDaoFactory(); CvObjectXref cvXref; CvXrefQualifier secondary = factory.getCvObjectDao(CvXrefQualifier.class).getByPsiMiRef(CvXrefQualifier.SECONDARY_AC_MI_REF); CvDatabase db = factory.getCvObjectDao(CvDatabase.class).getByPsiMiRef(database); if (secondary == null){ secondary = CvObjectUtils.createCvObject(IntactContext.getCurrentInstance().getInstitution(), CvXrefQualifier.class, CvXrefQualifier.SECONDARY_AC_MI_REF, CvXrefQualifier.SECONDARY_AC); IntactContext.getCurrentInstance().getCorePersister().saveOrUpdate(secondary); } if (db == null){ db = CvObjectUtils.createCvObject(IntactContext.getCurrentInstance().getInstitution(), CvDatabase.class, database, database); IntactContext.getCurrentInstance().getCorePersister().saveOrUpdate(db); } // create identity xref cvXref = XrefUtils.createIdentityXref(term, identifier, secondary, db); term.addXref(cvXref); return cvXref; }
CvTopic authorList = cvTopicDao.getByPsiMiRef(CvTopic.AUTHOR_LIST_MI_REF); // unique CvTopic journal = cvTopicDao.getByPsiMiRef(CvTopic.JOURNAL_MI_REF); // unique if ( journal == null ) { throw new IntactException( "Could not find CvTopic(" + CvTopic.JOURNAL + ") by MI in your intact node. abort update." ); CvTopic year = cvTopicDao.getByPsiMiRef(CvTopic.PUBLICATION_YEAR_MI_REF); // unique if ( year == null ) { throw new IntactException( "Could not find CvTopic(" + CvTopic.PUBLICATION_YEAR + ") by MI in your intact node. abort update." ); CvTopic email = cvTopicDao.getByPsiMiRef( CvTopic.CONTACT_EMAIL_MI_REF ); // not unique if ( email == null ) { throw new IntactException( "Could not find CvTopic(" + CvTopic.CONTACT_EMAIL + ") by MI in your intact node. abort update." );
private CvTopic createCvTopicObsolete() { final DaoFactory daoFactory = IntactContext.getCurrentInstance().getDataContext().getDaoFactory(); if ( obsoleteTopic != null ) { if (daoFactory.getBaseDao().isTransient(obsoleteTopic) && obsoleteTopic.getAc() != null) { obsoleteTopic = daoFactory.getCvObjectDao( CvTopic.class ).getByAc( obsoleteTopic.getAc() ); } } else { obsoleteTopic = daoFactory.getCvObjectDao( CvTopic.class ).getByPsiMiRef( CvTopic.OBSOLETE_MI_REF ); } if ( obsoleteTopic == null ) { // create the obsolete term (which is obsolete too!) obsoleteTopic = CvObjectUtils.createCvObject( IntactContext.getCurrentInstance().getInstitution(), CvTopic.class, CvTopic.OBSOLETE_MI_REF, CvTopic.OBSOLETE ); obsoleteTopic.setFullName( "obsolete term" ); addObsoleteAnnotation( obsoleteTopic, "Deprecated CV term that should not be used to annotate entries" ); } return obsoleteTopic; }
.getCvObjectDao(CvXrefQualifier.class).getByPsiMiRef(CvXrefQualifier.IDENTITY_MI_REF); .getCvObjectDao(CvDatabase.class).getByPsiMiRef(CvDatabase.PSI_MI_MI_REF);
.getCvObjectDao(CvXrefQualifier.class).getByPsiMiRef(CvXrefQualifier.IDENTITY_MI_REF); .getCvObjectDao(CvDatabase.class).getByPsiMiRef(CvDatabase.PSI_MI_MI_REF);