/** * Prints the most counts in the database. * @param ps The printStream to use * * @since 1.9.0 */ public static void printDatabaseCounts(PrintStream ps) { final DaoFactory daoFactory = IntactContext.getCurrentInstance().getDataContext().getDaoFactory(); ps.println("Publications: "+ daoFactory.getPublicationDao().countAll()); ps.println("\tXrefs: "+ daoFactory.getXrefDao(PublicationXref.class).countAll()); ps.println("\tAliases: "+ daoFactory.getAliasDao(PublicationAlias.class).countAll()); ps.println("Experiments: "+ daoFactory.getExperimentDao().countAll()); ps.println("\tXrefs: "+ daoFactory.getXrefDao(ExperimentXref.class).countAll()); ps.println("\tAliases: "+ daoFactory.getAliasDao(ExperimentAlias.class).countAll()); ps.println("Interactors: "+ daoFactory.getInteractorDao().countAll()); ps.println("\tInteractions: "+ daoFactory.getInteractionDao().countAll()); ps.println("\tPolymers: " + daoFactory.getPolymerDao().countAll()); ps.println("\t\tProteins: "+ daoFactory.getProteinDao().countAll()); ps.println("\t\tNucleic Acids: "+ daoFactory.getInteractorDao(NucleicAcidImpl.class).countAll()); ps.println("\tSmall molecules: " + daoFactory.getInteractorDao(SmallMoleculeImpl.class).countAll()); ps.println("\tInteractor Xrefs: "+ daoFactory.getXrefDao(InteractorXref.class).countAll()); ps.println("\tInteractor Aliases: "+ daoFactory.getAliasDao(InteractorAlias.class).countAll()); ps.println("Components: "+ daoFactory.getComponentDao().countAll()); ps.println("Features: "+ daoFactory.getFeatureDao().countAll()); ps.println("\tRanges: "+ daoFactory.getRangeDao().countAll()); ps.println("CvObjects: "+ daoFactory.getCvObjectDao().countAll()); ps.println("BioSources: "+ daoFactory.getBioSourceDao().countAll()); ps.println("Annotations: "+ daoFactory.getAnnotationDao().countAll()); ps.println("Institutions: "+ daoFactory.getInstitutionDao().countAll()); }
/** * Retrieves the components from an interaction, initializing them if necessary. * Do not set the initialized collection of components because components cannot be orphan * * @param interaction the interaction * @return The returned components are ensured to be initialized * @since 2.4.0 */ public static Collection<Component> ensureInitializedParticipants(Interaction interaction) { Collection<Component> components; if (IntactCore.isInitialized(interaction.getComponents())) { components = interaction.getComponents(); } else { components = IntactContext.getCurrentInstance().getDaoFactory().getComponentDao().getByInteractionAc(interaction.getAc()); } return components; }
/** * Retrieves the experimental preparations from a participant, initializing them if necessary. * Do not set the initialized collection of experimental preparations because cannot be orphan * @param component the component * @return The returned experimental preparations are ensured to be initialized * @since 2.4.0 */ public static Collection<CvExperimentalPreparation> ensureInitializedExperimentalPreparations(Component component) { Collection<CvExperimentalPreparation> expPrep; if (IntactCore.isInitialized(component.getExperimentalPreparations())) { expPrep = component.getExperimentalPreparations(); } else { expPrep = IntactContext.getCurrentInstance().getDaoFactory().getComponentDao().getExperimentalPreparationsForComponentAc(component.getAc()); } return expPrep; }
/** * Retrieves the participant detection methods from a participant, initializing them if necessary. * Do not set the initialized collection of participant detection methods because cannot be orphan * @param component the component * @return The returned participant detection methods are ensured to be initialized * @since 2.4.0 */ public static Collection<CvIdentification> ensureInitializedParticipantIdentificationMethods(Component component) { Collection<CvIdentification> partDet; if (IntactCore.isInitialized(component.getParticipantDetectionMethods())) { partDet = component.getParticipantDetectionMethods(); } else { partDet = IntactContext.getCurrentInstance().getDaoFactory().getComponentDao().getParticipantIdentificationMethodsForComponentAc(component.getAc()); } return partDet; }
/** * Retrieves the experimental roles from a participant, initializing them if necessary. * Do not set the initialized collection of experimental roles because cannot be orphan * @param component the component * @return The returned experimental roles are ensured to be initialized * @since 2.4.0 */ public static Collection<CvExperimentalRole> ensureInitializedExperimentalRoles(Component component) { Collection<CvExperimentalRole> roles; if (IntactCore.isInitialized(component.getExperimentalRoles())) { roles = component.getExperimentalRoles(); } else { roles = IntactContext.getCurrentInstance().getDaoFactory().getComponentDao().getExperimentalRolesForComponentAc(component.getAc()); } return roles; }
int countOfExpressedIn = intactContext.getDaoFactory().getComponentDao().getByExpressedIn(child.getAc()).size(); if (countOfExpressedIn > 0){ throw new IntactObjectDeleteException("The bioSource " + child.getAc() + " cannot be deleted because it is still used in " + countOfExpressedIn + " participants as expressed in organism.");
c.getExperimentalPreparations().add((CvExperimentalPreparation) termFromDb); factory.getComponentDao().update(c); c.getExperimentalRoles().add((CvExperimentalRole) termFromDb); factory.getComponentDao().update(c); resultUpdate++; c.getParticipantDetectionMethods().add((CvIdentification) termFromDb); factory.getComponentDao().update(c); resultUpdate++;
List<Component> components = factory.getComponentDao().getByInteractorAc(processContext.getIntactAccession());
/** * Retrieves the participant detection methods from a participant, initializing them if necessary. * Do not set the initialized collection of participant detection methods because cannot be orphan * @param component the component * @return The returned participant detection methods are ensured to be initialized * @since 2.4.0 */ public static Collection<CvIdentification> ensureInitializedParticipantIdentificationMethods(Component component) { Collection<CvIdentification> partDet; if (IntactCore.isInitialized(component.getParticipantDetectionMethods())) { partDet = component.getParticipantDetectionMethods(); } else { partDet = IntactContext.getCurrentInstance().getDaoFactory().getComponentDao().getParticipantIdentificationMethodsForComponentAc(component.getAc()); } return partDet; }
/** * Retrieves the experimental roles from a participant, initializing them if necessary. * Do not set the initialized collection of experimental roles because cannot be orphan * @param component the component * @return The returned experimental roles are ensured to be initialized * @since 2.4.0 */ public static Collection<CvExperimentalRole> ensureInitializedExperimentalRoles(Component component) { Collection<CvExperimentalRole> roles; if (IntactCore.isInitialized(component.getExperimentalRoles())) { roles = component.getExperimentalRoles(); } else { roles = IntactContext.getCurrentInstance().getDaoFactory().getComponentDao().getExperimentalRolesForComponentAc(component.getAc()); } return roles; }
int countOfExpressedIn = intactContext.getDaoFactory().getComponentDao().getByExpressedIn(child.getAc()).size(); if (countOfExpressedIn > 0){ throw new IntactObjectDeleteException("The bioSource " + child.getAc() + " cannot be deleted because it is still used in " + countOfExpressedIn + " participants as expressed in organism.");
/** * Retrieves the experimental preparations from a participant, initializing them if necessary. * Do not set the initialized collection of experimental preparations because cannot be orphan * @param component the component * @return The returned experimental preparations are ensured to be initialized * @since 2.4.0 */ public static Collection<CvExperimentalPreparation> ensureInitializedExperimentalPreparations(Component component) { Collection<CvExperimentalPreparation> expPrep; if (IntactCore.isInitialized(component.getExperimentalPreparations())) { expPrep = component.getExperimentalPreparations(); } else { expPrep = IntactContext.getCurrentInstance().getDaoFactory().getComponentDao().getExperimentalPreparationsForComponentAc(component.getAc()); } return expPrep; }
/** * Retrieves the components from an interaction, initializing them if necessary. * Do not set the initialized collection of components because components cannot be orphan * * @param interaction the interaction * @return The returned components are ensured to be initialized * @since 2.4.0 */ public static Collection<Component> ensureInitializedParticipants(Interaction interaction) { Collection<Component> components; if (IntactCore.isInitialized(interaction.getComponents())) { components = interaction.getComponents(); } else { components = IntactContext.getCurrentInstance().getDaoFactory().getComponentDao().getByInteractionAc(interaction.getAc()); } return components; }
/** * Prints the most counts in the database. * @param ps The printStream to use * * @since 1.9.0 */ public static void printDatabaseCounts(PrintStream ps) { final DaoFactory daoFactory = IntactContext.getCurrentInstance().getDataContext().getDaoFactory(); ps.println("Publications: "+ daoFactory.getPublicationDao().countAll()); ps.println("\tXrefs: "+ daoFactory.getXrefDao(PublicationXref.class).countAll()); ps.println("\tAliases: "+ daoFactory.getAliasDao(PublicationAlias.class).countAll()); ps.println("Experiments: "+ daoFactory.getExperimentDao().countAll()); ps.println("\tXrefs: "+ daoFactory.getXrefDao(ExperimentXref.class).countAll()); ps.println("\tAliases: "+ daoFactory.getAliasDao(ExperimentAlias.class).countAll()); ps.println("Interactors: "+ daoFactory.getInteractorDao().countAll()); ps.println("\tInteractions: "+ daoFactory.getInteractionDao().countAll()); ps.println("\tPolymers: " + daoFactory.getPolymerDao().countAll()); ps.println("\t\tProteins: "+ daoFactory.getProteinDao().countAll()); ps.println("\t\tNucleic Acids: "+ daoFactory.getInteractorDao(NucleicAcidImpl.class).countAll()); ps.println("\tSmall molecules: " + daoFactory.getInteractorDao(SmallMoleculeImpl.class).countAll()); ps.println("\tInteractor Xrefs: "+ daoFactory.getXrefDao(InteractorXref.class).countAll()); ps.println("\tInteractor Aliases: "+ daoFactory.getAliasDao(InteractorAlias.class).countAll()); ps.println("Components: "+ daoFactory.getComponentDao().countAll()); ps.println("Features: "+ daoFactory.getFeatureDao().countAll()); ps.println("\tRanges: "+ daoFactory.getRangeDao().countAll()); ps.println("CvObjects: "+ daoFactory.getCvObjectDao().countAll()); ps.println("BioSources: "+ daoFactory.getBioSourceDao().countAll()); ps.println("Annotations: "+ daoFactory.getAnnotationDao().countAll()); ps.println("Institutions: "+ daoFactory.getInstitutionDao().countAll()); }