private int interactionsForExperiment( String experimentAc ) { if ( interactionCount == null ) { interactionCount = ExperimentListGeneratorDao.countInteractionCountsForExperiments( searchPattern ); } if ( experimentAc == null ) { throw new NullPointerException( "Experiment AC is null" ); } if ( interactionCount.containsKey( experimentAc ) ) { return interactionCount.get( experimentAc ); } return 0; }
private Collection<SimpleDataset> datasetForExperiment( String experimentAc ) { if ( experiment2dataset == null ) { experiment2dataset = ExperimentListGeneratorDao.datasetForExperiments( searchPattern ); } if ( experimentAc == null ) { throw new NullPointerException( "Experiment AC is null" ); } if ( experiment2dataset.containsKey( experimentAc ) ) { return experiment2dataset.get( experimentAc ); } return null; }
/** * Checks for a negative interaction. NB This will have to be done using SQL otherwise we end up materializing all * interactions just to do the check. * <p/> * Also the new intact curation rules specify that an Experiment should ONLY contain negative Interactions if it is * annotated as 'negative'. Thus to decide if an Experiment is classified as 'negative', the Annotations of that * Experiment need to be checked for one with a 'negative' Controlled Vocab attached to it as a topic. </p> * <p/> * However at some point in the future there may be a possibility that only the Interactions will be marked as * 'negative' (not the Experiment), and so these should be checked also, with duplicate matches being ignored. </p> * This method has to be static because it is called by the static 'classifyExperiments'. */ private void classifyNegatives() { negativeExperiments = new HashSet<Experiment>(); negativeExperiments.addAll( ExperimentListGeneratorDao.getExpWithInteractionsContainingAnnotation( CvTopic.NEGATIVE, searchPattern ) ); negativeExperiments.addAll( ExperimentListGeneratorDao.getContainingAnnotation( Experiment.class, CvTopic.NEGATIVE, searchPattern ) ); log.debug( negativeExperiments.size() + " negative experiment found." ); }
/** * Query to obtain annotated objects by searching for an Annotation with the cvTopic label provided */ public static <T extends AnnotatedObjectImpl> List<T> getContainingAnnotation( Class<T> annObject, String cvshortLabel, String shortLabelLike ) { return getSession().createCriteria( annObject.getClass() ) .add( Restrictions.like( "shortLabel", shortLabelLike ) ) .createCriteria( "annotations" ) .createCriteria( "cvTopic" ) .add( Restrictions.eq( "shortLabel", cvshortLabel ) ).list(); }
public static Map<String, String> getExperimentAcAndLabelWithoutPubmedId( String shortLabelLike ) { List<Object[]> allExps = getSession().createCriteria( Experiment.class ) .add( Restrictions.like( "shortLabel", shortLabelLike ) ) .setProjection( Projections.projectionList() .add( Projections.distinct( Projections.property( "ac" ) ) ) .add( Projections.property( "shortLabel" ) ) ).list(); Map<String, String> filteredExpsMap = new HashMap<String, String>(); for ( Object[] exp : allExps ) { filteredExpsMap.put( (String) exp[ 0 ], (String) exp[ 1 ] ); } Map<String, String> expsAndPmid = getExperimentAcAndPmid( shortLabelLike ); for ( String expWithPmid : expsAndPmid.keySet() ) { filteredExpsMap.remove( expWithPmid ); } return filteredExpsMap; }
private List<String> taxIdsForExperiment( String experimentAc ) { if ( expAcToTaxid == null ) { expAcToTaxid = ExperimentListGeneratorDao.getExperimentAcAndTaxids( searchPattern ); } return expAcToTaxid.get( experimentAc ); }
public Set<String> getFilteredExperimentAcs() { if ( filteredExperimentAcs != null ) { return filteredExperimentAcs; } if ( !onlyWithPmid ) { filteredExperimentAcs = Collections.EMPTY_SET; } else { filteredExperimentAcs = new HashSet<String>(); Map<String, String> expAcAndLabels = ExperimentListGeneratorDao.getExperimentAcAndLabelWithoutPubmedId( searchPattern ); for ( Map.Entry<String, String> expAcAndLabel : expAcAndLabels.entrySet() ) { String ac = expAcAndLabel.getKey(); String shortlabel = expAcAndLabel.getValue(); output.println( "Filter out: " + shortlabel + " (" + ac + ")" ); filteredExperimentAcs.add( ac ); } output.println( filteredExperimentAcs.size() + " experiment filtered out." ); } return filteredExperimentAcs; }
/** * Fetch publication primaryId from experiment. * * @param experimentAc the experiment AC for which we want the primary pubmed ID. * * @return a pubmed Id or null if none found. */ private String getPubmedId( String experimentAc ) { if ( expAcToPmid == null ) { // map all exps to pmid expAcToPmid = ExperimentListGeneratorDao.getExperimentAcAndPmid( searchPattern ); } String pubmedId = expAcToPmid.get( experimentAc ); if ( pubmedId == null ) { experimentsWithErrors.put( experimentAc, "Null pubmed Id" ); } try { Integer.parseInt( pubmedId ); } catch ( NumberFormatException e ) { experimentsWithErrors.put( experimentAc, "Not a number pubmedId" ); } return pubmedId; }
/** * Query to obtain annotated objects by searching for an Annotation with the cvTopic label provided */ public static <T extends AnnotatedObjectImpl> List<T> getContainingAnnotation( Class<T> annObject, String cvshortLabel, String shortLabelLike ) { return getSession().createCriteria( annObject.getClass() ) .add( Restrictions.like( "shortLabel", shortLabelLike ) ) .createCriteria( "annotations" ) .createCriteria( "cvTopic" ) .add( Restrictions.eq( "shortLabel", cvshortLabel ) ).list(); }
public static Map<String, String> getExperimentAcAndLabelWithoutPubmedId( String shortLabelLike ) { List<Object[]> allExps = getSession().createCriteria( Experiment.class ) .add( Restrictions.like( "shortLabel", shortLabelLike ) ) .setProjection( Projections.projectionList() .add( Projections.distinct( Projections.property( "ac" ) ) ) .add( Projections.property( "shortLabel" ) ) ).list(); Map<String, String> filteredExpsMap = new HashMap<String, String>(); for ( Object[] exp : allExps ) { filteredExpsMap.put( (String) exp[ 0 ], (String) exp[ 1 ] ); } Map<String, String> expsAndPmid = getExperimentAcAndPmid( shortLabelLike ); for ( String expWithPmid : expsAndPmid.keySet() ) { filteredExpsMap.remove( expWithPmid ); } return filteredExpsMap; }
private List<String> taxIdsForExperiment( String experimentAc ) { if ( expAcToTaxid == null ) { expAcToTaxid = ExperimentListGeneratorDao.getExperimentAcAndTaxids( searchPattern ); } return expAcToTaxid.get( experimentAc ); }
public Set<String> getFilteredExperimentAcs() { if ( filteredExperimentAcs != null ) { return filteredExperimentAcs; } if ( !onlyWithPmid ) { filteredExperimentAcs = Collections.EMPTY_SET; } else { filteredExperimentAcs = new HashSet<String>(); Map<String, String> expAcAndLabels = ExperimentListGeneratorDao.getExperimentAcAndLabelWithoutPubmedId( searchPattern ); for ( Map.Entry<String, String> expAcAndLabel : expAcAndLabels.entrySet() ) { String ac = expAcAndLabel.getKey(); String shortlabel = expAcAndLabel.getValue(); log.debug( "Filter out: " + shortlabel + " (" + ac + ")" ); filteredExperimentAcs.add( ac ); } log.debug( filteredExperimentAcs.size() + " experiment filtered out." ); } return filteredExperimentAcs; }
/** * Fetch publication primaryId from experiment. * * @param experimentAc the experiment AC for which we want the primary pubmed ID. * * @return a pubmed Id or null if none found. */ private String getPubmedId( String experimentAc ) { if ( expAcToPmid == null ) { // map all exps to pmid expAcToPmid = ExperimentListGeneratorDao.getExperimentAcAndPmid( searchPattern ); } String pubmedId = expAcToPmid.get( experimentAc ); if ( pubmedId == null ) { experimentsWithErrors.put( experimentAc, "Null pubmed Id" ); } try { Integer.parseInt( pubmedId ); } catch ( NumberFormatException e ) { experimentsWithErrors.put( experimentAc, "Not a number pubmedId" ); } return pubmedId; }
/** * Query to obtain annotated objects by searching for an Annotation with the cvTopic label provided */ public static <T extends AnnotatedObjectImpl> List<T> getContainingAnnotation( Class<T> annObject, String cvshortLabel, String shortLabelLike ) { return getSession().createCriteria( annObject.getClass() ) .add( Restrictions.like( "shortLabel", shortLabelLike ) ) .createCriteria( "annotations" ) .createCriteria( "cvTopic" ) .add( Restrictions.eq( "shortLabel", cvshortLabel ) ).list(); }
public static Map<String, String> getExperimentAcAndLabelWithoutPubmedId( String shortLabelLike ) { List<Object[]> allExps = getSession().createCriteria( Experiment.class ) .add( Restrictions.like( "shortLabel", shortLabelLike ) ) .setProjection( Projections.projectionList() .add( Projections.distinct( Projections.property( "ac" ) ) ) .add( Projections.property( "shortLabel" ) ) ).list(); Map<String, String> filteredExpsMap = new HashMap<String, String>(); for ( Object[] exp : allExps ) { filteredExpsMap.put( (String) exp[ 0 ], (String) exp[ 1 ] ); } Map<String, String> expsAndPmid = getExperimentAcAndPmid( shortLabelLike ); for ( String expWithPmid : expsAndPmid.keySet() ) { filteredExpsMap.remove( expWithPmid ); } return filteredExpsMap; }
/** * Checks for a negative interaction. NB This will have to be done using SQL otherwise we end up materializing all * interactions just to do the check. * <p/> * Also the new intact curation rules specify that an Experiment should ONLY contain negative Interactions if it is * annotated as 'negative'. Thus to decide if an Experiment is classified as 'negative', the Annotations of that * Experiment need to be checked for one with a 'negative' Controlled Vocab attached to it as a topic. </p> * <p/> * However at some point in the future there may be a possibility that only the Interactions will be marked as * 'negative' (not the Experiment), and so these should be checked also, with duplicate matches being ignored. </p> * This method has to be static because it is called by the static 'classifyExperiments'. */ private void classifyNegatives() { negativeExperiments = new HashSet<Experiment>(); negativeExperiments.addAll( ExperimentListGeneratorDao.getExpWithInteractionsContainingAnnotation( CvTopic.NEGATIVE, searchPattern ) ); negativeExperiments.addAll( ExperimentListGeneratorDao.getContainingAnnotation( Experiment.class, CvTopic.NEGATIVE, searchPattern ) ); output.println( negativeExperiments.size() + " negative experiment found." ); }
private Collection<SimpleDataset> datasetForExperiment( String experimentAc ) { if ( experiment2dataset == null ) { experiment2dataset = ExperimentListGeneratorDao.datasetForExperiments( searchPattern ); } if ( experimentAc == null ) { throw new NullPointerException( "Experiment AC is null" ); } if ( experiment2dataset.containsKey( experimentAc ) ) { return experiment2dataset.get( experimentAc ); } return null; }
private List<String> taxIdsForExperiment( String experimentAc ) { if ( expAcToTaxid == null ) { expAcToTaxid = ExperimentListGeneratorDao.getExperimentAcAndTaxids( searchPattern ); } return expAcToTaxid.get( experimentAc ); }
private int interactionsForExperiment( String experimentAc ) { if ( interactionCount == null ) { interactionCount = ExperimentListGeneratorDao.countInteractionCountsForExperiments( searchPattern ); } if ( experimentAc == null ) { throw new NullPointerException( "Experiment AC is null" ); } if ( interactionCount.containsKey( experimentAc ) ) { return interactionCount.get( experimentAc ); } return 0; }
public Set<String> getFilteredExperimentAcs() { if ( filteredExperimentAcs != null ) { return filteredExperimentAcs; } if ( !onlyWithPmid ) { filteredExperimentAcs = Collections.EMPTY_SET; } else { filteredExperimentAcs = new HashSet<String>(); Map<String, String> expAcAndLabels = ExperimentListGeneratorDao.getExperimentAcAndLabelWithoutPubmedId( searchPattern ); for ( Map.Entry<String, String> expAcAndLabel : expAcAndLabels.entrySet() ) { String ac = expAcAndLabel.getKey(); String shortlabel = expAcAndLabel.getValue(); output.println( "Filter out: " + shortlabel + " (" + ac + ")" ); filteredExperimentAcs.add( ac ); } output.println( filteredExperimentAcs.size() + " experiment filtered out." ); } return filteredExperimentAcs; }