private Collection<Experiment> getExperiments( int firstResult, int maxResults ) { output.println( "Retrieving data from DB store, from " + firstResult ); if ( searchPattern.contains( "," ) ) { throw new IntactException( "Lists with comma-separated experiments are not accepted anymore" ); } Collection<Experiment> searchResults = getDaoFactory().getExperimentDao().getByShortLabelLike( searchPattern, true, firstResult, maxResults, true ); int resultSize = searchResults.size(); output.println( "done (retrieved " + resultSize + " experiment" + ( resultSize > 1 ? "s" : "" ) + ")" ); return searchResults; }
private Collection<Experiment> getExperiments( int firstResult, int maxResults ) { output.println( "Retrieving data from DB store, from " + firstResult ); if ( searchPattern.contains( "," ) ) { throw new IntactException( "Lists with comma-separated experiments are not accepted anymore" ); } Collection<Experiment> searchResults = getDaoFactory().getExperimentDao().getByShortLabelLike( searchPattern, true, firstResult, maxResults, true ); int resultSize = searchResults.size(); output.println( "done (retrieved " + resultSize + " experiment" + ( resultSize > 1 ? "s" : "" ) + ")" ); return searchResults; }
private Collection<Experiment> getExperiments( int firstResult, int maxResults ) { log.debug( "Retrieving data from DB store, from " + firstResult ); if ( searchPattern.contains( "," ) ) { throw new IntactException( "Lists with comma-separated experiments are not accepted anymore" ); } Collection<Experiment> searchResults = getDaoFactory().getExperimentDao().getByShortLabelLike( searchPattern, true, firstResult, maxResults, true ); int resultSize = searchResults.size(); log.debug( "done (retrieved " + resultSize + " experiment" + ( resultSize > 1 ? "s" : "" ) + ")" ); return searchResults; }
/** * Obtains the data from the dataSource, in preparation for the flat file generation. * * @param searchPattern for search by shortLabel. May be a comma-separated list. * * @throws IntactException thrown if there was a search problem */ private static HashSet getExperiments(String searchPattern) throws IntactException { //try this for now, but it may be better to use SQL and get the ACs, //then cycle through them and generate PSI one by one..... //The searchResults is a HashSet to avoid the redundancy of the same //Experiment HashSet searchResults = new HashSet(); System.out.print( "Retrieving data from DB store..." ); System.out.flush(); StringTokenizer patterns = new StringTokenizer( searchPattern, "," ); while ( patterns.hasMoreTokens() ) { String experimentShortlabel = patterns.nextToken().trim(); searchResults.addAll(IntactContext.getCurrentInstance() .getDataContext().getDaoFactory().getExperimentDao().getByShortLabelLike(experimentShortlabel)); } int resultSize = searchResults.size(); System.out.println( "done (found " + resultSize + " experiment" + ( resultSize > 1 ? "s" : "" ) + ")" ); return searchResults; }
/** * Obtains the data from the dataSource, in preparation for the flat file generation. * * @param searchPattern for search by shortLabel. May be a comma-separated list. * * @throws IntactException thrown if there was a search problem */ private static HashSet getExperiments(String searchPattern) throws IntactException { //try this for now, but it may be better to use SQL and get the ACs, //then cycle through them and generate PSI one by one..... //The searchResults is a HashSet to avoid the redundancy of the same //Experiment HashSet searchResults = new HashSet(); System.out.print( "Retrieving data from DB store..." ); System.out.flush(); StringTokenizer patterns = new StringTokenizer( searchPattern, "," ); while ( patterns.hasMoreTokens() ) { String experimentShortlabel = patterns.nextToken().trim(); searchResults.addAll(IntactContext.getCurrentInstance() .getDataContext().getDaoFactory().getExperimentDao().getByShortLabelLike(experimentShortlabel)); } int resultSize = searchResults.size(); System.out.println( "done (found " + resultSize + " experiment" + ( resultSize > 1 ? "s" : "" ) + ")" ); return searchResults; }
/** * Obtains the data from the dataSource, in preparation for the flat file generation. * * @param searchPattern for search by shortLabel. May be a comma-separated list. * * @throws IntactException thrown if there was a search problem */ private static HashSet getExperiments(String searchPattern) throws IntactException { //try this for now, but it may be better to use SQL and get the ACs, //then cycle through them and generate PSI one by one..... //The searchResults is a HashSet to avoid the redundancy of the same //Experiment HashSet searchResults = new HashSet(); System.out.print( "Retrieving data from DB store..." ); System.out.flush(); StringTokenizer patterns = new StringTokenizer( searchPattern, "," ); while ( patterns.hasMoreTokens() ) { String experimentShortlabel = patterns.nextToken().trim(); searchResults.addAll(IntactContext.getCurrentInstance() .getDataContext().getDaoFactory().getExperimentDao().getByShortLabelLike(experimentShortlabel)); } int resultSize = searchResults.size(); System.out.println( "done (found " + resultSize + " experiment" + ( resultSize > 1 ? "s" : "" ) + ")" ); return searchResults; }
syncedLabel = shortLabel; } else if (matchesMotSyncedLabel(shortLabel)) { ExperimentDao experimentDao = IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getExperimentDao(); List<String> expLabels = experimentDao.getShortLabelsLike(shortLabel+"-%");
public void updateAllExperiments() { int firstResult = 0; int maxResults = 100; beginTransaction(); int total = getDataContext().getDaoFactory().getExperimentDao().countAll(); commitTransaction(); Collection<Experiment> experiments; do { beginTransaction(); experiments = getDataContext().getDaoFactory().getExperimentDao().getAll(firstResult, maxResults); commitTransaction(); if (log.isInfoEnabled()) log.info("Processed "+firstResult+" out of "+total); for (Experiment experiment : experiments) { updateExperiment(experiment); } firstResult += maxResults; } while (!experiments.isEmpty()); if (log.isInfoEnabled()) log.info("Finished processing "+total+" experiments"); }
public Collection<GeneralMessage> check(Experiment experiment) throws SanityRuleException { Collection<GeneralMessage> messages = new ArrayList<GeneralMessage>(); int interactionCount = 0; if (experiment.getAc() != null) { interactionCount = IntactContext.getCurrentInstance().getDataContext().getDaoFactory() .getExperimentDao().countInteractionsForExperimentWithAc(experiment.getAc()); } if (interactionCount == 0) { interactionCount = experiment.getInteractions().size(); } if(interactionCount == 0){ messages.add(new GeneralMessage( MessageDefinition.EXPERIMENT_WITHOUT_INTERACTION, experiment )); } return messages; } }
public GeneratedEntry addExperimentWithShortLabel(String shortLabel) { Experiment experiment = intactContext.getDataContext().getDaoFactory() .getExperimentDao().getByShortLabel(shortLabel); checkResult(experiment, shortLabel, "experiment"); return addExperiment(experiment); }
protected Experiment fetchFromDataSource(Experiment intactObject) { return getIntactContext().getDataContext().getDaoFactory() .getExperimentDao().getByShortLabel(intactObject.getShortLabel()); }
public GeneratedEntry addExperimentWithAc(String ac) { Experiment experiment = intactContext.getDataContext().getDaoFactory() .getExperimentDao().getByAc(ac); checkResult(experiment, ac, "experiment"); return addExperiment(experiment); }
protected Set<SimpleBioSource> getBioSourcesForExperimentInteractions(Experiment experiment) { Set<SimpleBioSource> allBioSources = new HashSet<SimpleBioSource>(); String experimentAc = experiment.getAc(); int firstResult = 0; int maxResults = 50; Collection<Interaction> interactions; do { beginTransaction(); interactions = getDataContext().getDaoFactory() .getExperimentDao().getInteractionsForExperimentWithAc(experimentAc, firstResult, maxResults); for (Interaction interaction : interactions) { for (Component component : interaction.getComponents()) { BioSource bioSource = component.getInteractor().getBioSource(); if (bioSource != null) { allBioSources.add(new SimpleBioSource(bioSource)); } else { if (log.isDebugEnabled()) log.debug("Interactor without biosource: "+component.getInteractor()); } } } commitTransaction(); firstResult += maxResults; } while (!interactions.isEmpty()); return allBioSources; }
public Collection<GeneralMessage> check(Experiment experiment) throws SanityRuleException { Collection<GeneralMessage> messages = new ArrayList<GeneralMessage>(); if(ExperimentUtils.isOnHold(experiment)){ messages.add(new GeneralMessage( MessageDefinition.EXPERIMENT_ON_HOLD, experiment)); } else { // TODO this can be removed when all the experiments have a Publication object in the DB String pubmedId = ExperimentUtils.getPubmedId(experiment); if (pubmedId != null) { final List<Experiment> experimentsSamePubmed = IntactContext.getCurrentInstance().getDataContext().getDaoFactory() .getExperimentDao().getByPubId(pubmedId); for (Experiment experimentSamePubmed : experimentsSamePubmed) { if (ExperimentUtils.isOnHold(experimentSamePubmed)) { messages.add(new GeneralMessage( MessageDefinition.EXPERIMENT_ON_HOLD, experiment)); } } } } return messages; } }
public void exportEntries() throws IndexerException { int current = 0; log.debug( "Starting export of " + count + " experiment(s)." ); while ( current < count ) { DaoFactory daoFactory = IntactContext.getCurrentInstance().getDataContext().getDaoFactory(); ExperimentDao edao = daoFactory.getExperimentDao(); IntactContext.getCurrentInstance().getDataContext().beginTransaction(); List<Experiment> experiments = edao.getAll( current, CHUNK_SIZE ); if ( log.isDebugEnabled() ) { log.debug( "Exporting experiment range " + current + ".." + Math.min( count, current + CHUNK_SIZE ) + " out of " + count ); } for ( Experiment experiment : experiments ) { current++; exportEntry( experiment ); } try { IntactContext.getCurrentInstance().getDataContext().commitTransaction(); } catch ( IntactTransactionException e ) { throw new IndexerException( e ); } } }
experiment = IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getExperimentDao().getByShortLabel( shortlabel ); } catch ( IntactException e ) { MessageHolder.getInstance().addCheckerMessage( new Message( "An error occured while searching for " +
Query query = dataContext.getDaoFactory().getExperimentDao().getSession() .createQuery("select exp.ac from Experiment exp where exp.shortLabel like :label order by exp.created"); query.setString("label", expLabelPattern); Experiment experiment = dataContext.getDaoFactory().getExperimentDao().getByAc(ac);
experiment = IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getExperimentDao().getByShortLabel( shortlabel ); } catch ( IntactException e ) { MessageHolder.getInstance().addCheckerMessage( new Message( "An error occured while searching for " +
experiment = getDataContext().getDaoFactory().getExperimentDao().getByAc(experiment.getAc()); experiment = getDataContext().getDaoFactory().getExperimentDao().getByAc(experiment.getAc());
public int getEntryCount() throws IndexerException { if ( count == null ) { DaoFactory daoFactory = IntactContext.getCurrentInstance().getDataContext().getDaoFactory(); ExperimentDao edao = daoFactory.getExperimentDao(); IntactContext.getCurrentInstance().getDataContext().beginTransaction(); // TODO do not take into account interactor that do not interact. count = edao.countAll(); try { IntactContext.getCurrentInstance().getDataContext().commitTransaction(); } catch ( IntactTransactionException e ) { throw new IndexerException( e ); } } return count; } }