public GeneratedEntry addInteractionWithAc(String ac) { Interaction interaction = intactContext.getDataContext().getDaoFactory() .getInteractionDao().getByAc(ac); checkResult(interaction, ac, "interaction"); return addInteraction(interaction); }
@Override protected String findAcForInteraction( Interaction interaction ) { // replace all this eventually by just using the CRC InteractionDao interactionDao = getDaoFactory().getInteractionDao(); CrcCalculator crcCalculator = new CrcCalculator(); // Get the interactors where exactly the same interactors are involved List<String> interactorPrimaryIDs = InteractionUtils.getInteractorPrimaryIDs( interaction ); List<Interaction> interactionsWithSameInteractors = interactionDao.getByInteractorsPrimaryId( true, interactorPrimaryIDs.toArray( new String[interactorPrimaryIDs.size()] ) ); for ( Interaction interactionWithSameInteractor : interactionsWithSameInteractors ) { String interactionCrc = crcCalculator.crc64( interaction ); String interactionWithSameInteractorCrc = crcCalculator.crc64( interactionWithSameInteractor ); if ( interactionCrc.equals( interactionWithSameInteractorCrc ) ) { return interactionWithSameInteractor.getAc(); } } return null; }
public GeneratedEntry addInteractionWithShortLabel(String shortLabel) { Interaction interaction = intactContext.getDataContext().getDaoFactory() .getInteractionDao().getByShortLabel(shortLabel); checkResult(interaction, shortLabel, "interaction"); return addInteraction(interaction); }
/** * Retrieves the interactions from an experiment, initializing them if necessary. * * @param experiment the experiment * @return The returned interactions are ensured to be initialized * @since 2.4.0 */ public static Collection<Interaction> ensureInitializedInteractions(Experiment experiment) { Collection<Interaction> interactions; if (IntactCore.isInitialized(experiment.getInteractions())) { interactions = experiment.getInteractions(); } else { interactions = IntactContext.getCurrentInstance().getDaoFactory().getInteractionDao().getByExperimentAc(experiment.getAc(), 0, Integer.MAX_VALUE); } return interactions; }
/** * Calculates the next available suffix using a short label - which is * the highest suffix + 1 * * @param shortLabel the label to use * @return the next available suffix. */ protected static Integer calculateNextSuffix( String shortLabel ) { String labelWithoutSuffix = removeSuffix( shortLabel ); // we get all the labels with the same bait-prey combination List<String> shortLabelsWithSuffix = IntactContext.getCurrentInstance().getDataContext().getDaoFactory() .getInteractionDao().getShortLabelsLike( labelWithoutSuffix + "%" ); int maxSuffix = -1; for ( String labelWithSuffix : shortLabelsWithSuffix ) { InteractionShortLabel label = new InteractionShortLabel( labelWithSuffix ); Integer suffix = label.getSuffix(); if ( suffix != null ) { maxSuffix = Math.max( maxSuffix, suffix ); } else { maxSuffix = 0; } } if ( maxSuffix == -1 ) { return null; } return maxSuffix + 1; }
/** * 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 interactions from an experiment, initializing them if necessary. * * @param experiment the experiment * @return The returned interactions are ensured to be initialized * @since 2.4.0 */ public static Collection<Interaction> ensureInitializedInteractions(Experiment experiment) { Collection<Interaction> interactions; if (IntactCore.isInitialized(experiment.getInteractions())) { interactions = experiment.getInteractions(); } else { interactions = IntactContext.getCurrentInstance().getDaoFactory().getInteractionDao().getByExperimentAc(experiment.getAc(), 0, Integer.MAX_VALUE); } return interactions; }
/** * Calculates the next available suffix using a short label - which is * the highest suffix + 1 * * @param shortLabel the label to use * @return the next available suffix. */ protected static Integer calculateNextSuffix( String shortLabel ) { String labelWithoutSuffix = removeSuffix( shortLabel ); // we get all the labels with the same bait-prey combination List<String> shortLabelsWithSuffix = IntactContext.getCurrentInstance().getDataContext().getDaoFactory() .getInteractionDao().getShortLabelsLike( labelWithoutSuffix + "%" ); int maxSuffix = -1; for ( String labelWithSuffix : shortLabelsWithSuffix ) { InteractionShortLabel label = new InteractionShortLabel( labelWithSuffix ); Integer suffix = label.getSuffix(); if ( suffix != null ) { maxSuffix = Math.max( maxSuffix, suffix ); } else { maxSuffix = 0; } } if ( maxSuffix == -1 ) { return null; } return maxSuffix + 1; }
/** * 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()); }
public GeneratedEntry addInteractionWithAc(String ac) { Interaction interaction = intactContext.getDataContext().getDaoFactory() .getInteractionDao().getByAc(ac); checkResult(interaction, ac, "interaction"); return addInteraction(interaction); }
public GeneratedEntry addInteractionWithShortLabel(String shortLabel) { Interaction interaction = intactContext.getDataContext().getDaoFactory() .getInteractionDao().getByShortLabel(shortLabel); checkResult(interaction, shortLabel, "interaction"); return addInteraction(interaction); }
@Override protected String findAcForInteraction( Interaction interaction ) { // replace all this eventually by just using the CRC InteractionDao interactionDao = getDaoFactory().getInteractionDao(); CrcCalculator crcCalculator = new CrcCalculator(); // Get the interactors where exactly the same interactors are involved List<String> interactorPrimaryIDs = InteractionUtils.getInteractorPrimaryIDs( interaction ); List<Interaction> interactionsWithSameInteractors = interactionDao.getByInteractorsPrimaryId( true, interactorPrimaryIDs.toArray( new String[interactorPrimaryIDs.size()] ) ); for ( Interaction interactionWithSameInteractor : interactionsWithSameInteractors ) { String interactionCrc = crcCalculator.crc64( interaction ); String interactionWithSameInteractorCrc = crcCalculator.crc64( interactionWithSameInteractor ); if ( interactionCrc.equals( interactionWithSameInteractorCrc ) ) { return interactionWithSameInteractor.getAc(); } } return null; }
InteractionDao interactionDao = IntactContext.getCurrentInstance().getDaoFactory().getInteractionDao(); List<InteractionImpl> interactionsInIntact = interactionDao.getByAc(intactAcs); List<InteractionImpl> interactionsInIntactPassingExport = new ArrayList(interactionsInIntact);
/** * Filter the binary interactions of a given list of interactions and return a list composed with only binary interactions * @param interactionAcs : the list of interaction accessions * @param eligibleInteractions : the list of eligible interactions for uniprot export */ private void filterTrueBinaryInteractions(List<String> interactionAcs, List<String> eligibleInteractions) { // process each interaction of the list final int interactionCount = interactionAcs.size(); for (int i = 0; i < interactionCount; i++) { TransactionStatus status = IntactContext.getCurrentInstance().getDataContext().beginTransaction(); // get the IntAct interaction object String interactionAc = interactionAcs.get(i); Interaction interaction = IntactContext.getCurrentInstance().getDaoFactory().getInteractionDao().getByAc(interactionAc); // the interaction exists in IntAct if (interaction != null){ logger.info("\t\t Interaction: Shortlabel:" + interaction.getShortLabel() + " AC: " + interaction.getAc()); if (InteractionUtils.isBinaryInteraction(interaction)){ eligibleInteractions.add(interactionAc); } } IntactContext.getCurrentInstance().getDataContext().commitTransaction(status); } // i }
experiments = IntactContext.getCurrentInstance().getDaoFactory().getInteractionDao().getByAc(interaction.getAc()).getExperiments(); interaction.setExperiments(experiments); } else {
experiments = IntactContext.getCurrentInstance().getDaoFactory().getInteractionDao().getByAc(interaction.getAc()).getExperiments(); interaction.setExperiments(experiments); } else {
Interaction intactInteraction = IntactContext.getCurrentInstance().getDaoFactory().getInteractionDao().getByAc(interactionAc);
Interaction intactInteraction = IntactContext.getCurrentInstance().getDaoFactory().getInteractionDao().getByAc(interactionAc);
Interaction intactInteraction = IntactContext.getCurrentInstance().getDaoFactory().getInteractionDao().getByAc(interaction);