Skip to content

Commit

Permalink
Merge branch 'hotfix-1.29.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
arteymix committed Mar 3, 2023
2 parents 3a6e231 + 3815697 commit e34a17f
Show file tree
Hide file tree
Showing 76 changed files with 548 additions and 390 deletions.
2 changes: 1 addition & 1 deletion gemma-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>gemma</artifactId>
<groupId>gemma</groupId>
<version>1.29.5</version>
<version>1.29.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>gemma-cli</artifactId>
Expand Down
3 changes: 2 additions & 1 deletion gemma-cli/src/main/config/log4j.properties
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,5 @@ log4j.logger.org.hibernate=WARN
log4j.logger.org.hibernate.cache.ReadWriteCache=ERROR
# Avoid warnings about collection fail-safe cleanup.
log4j.logger.org.hibernate.engine.loading.LoadContexts=ERROR
log4j.logger.net.sf.ehcache.hibernate.strategy.AbstractReadWriteEhcacheAccessStrategy=ERROR
log4j.logger.net.sf.ehcache.hibernate.strategy.AbstractReadWriteEhcacheAccessStrategy=ERROR
log4j.logger.org.hibernate.cache.ehcache.internal.strategy.AbstractReadWriteEhcacheAccessStrategy=ERROR
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ private Collection<ExperimentalFactor> guessFactors( ExpressionExperiment ee ) {
*/
private Collection<DifferentialExpressionAnalysis> tryToRedoBasedOnOldAnalysis( ExpressionExperiment ee ) {
Collection<DifferentialExpressionAnalysis> oldAnalyses = differentialExpressionAnalysisService
.findByInvestigation( ee );
.findByExperiment( ee );

if ( oldAnalyses.isEmpty() ) {
throw new IllegalArgumentException( "There are no old analyses to redo" );
Expand Down
30 changes: 26 additions & 4 deletions gemma-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>gemma</artifactId>
<groupId>gemma</groupId>
<version>1.29.5</version>
<version>1.29.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>gemma-core</artifactId>
Expand Down Expand Up @@ -64,9 +64,20 @@
<dependency>
<groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>2.1.3</version>
<version>${dom4j.version}</version>
<scope>runtime</scope>
</dependency>
<!-- Hibernate's JBoss logging will hook into Log4j 1.2 API -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-1.2-api</artifactId>
<version>${log4j.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
Expand All @@ -78,6 +89,11 @@
<goals>
<goal>test-jar</goal>
</goals>
<configuration>
<excludes>
<exclude>log4j-test.properties</exclude>
</excludes>
</configuration>
</execution>
</executions>
</plugin>
Expand Down Expand Up @@ -112,8 +128,8 @@
<version>1.5</version>
<dependencies><!-- yes, this needs to be here. -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version>${mysql.version}</version>
<scope>runtime</scope>
</dependency>
Expand Down Expand Up @@ -282,6 +298,12 @@
<groupId>ubc.chibi.compass-fork</groupId>
<artifactId>compass-fork</artifactId>
<version>1.2.0</version>
<exclusions>
<exclusion>
<groupId>commons-el</groupId>
<artifactId>commons-el</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- Apache Commons -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ public boolean deleteOldAnalyses( ExpressionExperiment expExp ) {
}

for ( DifferentialExpressionAnalysis diff : differentialExpressionAnalysisService
.findByInvestigation( expExp ) ) {
.findByExperiment( expExp ) ) {
try {
differentialExpressionAnalysisService.remove( diff );
} catch ( Exception e ) {
AnalysisUtilServiceImpl.log.warn( "Could not remove analysis: " + diff + ": " + e.getMessage() );
removedAll = false;
}
}
for ( CoexpressionAnalysis coex : coexpressionAnalysisService.findByInvestigation( expExp ) ) {
for ( CoexpressionAnalysis coex : coexpressionAnalysisService.findByExperiment( expExp ) ) {
try {
coexpressionAnalysisService.remove( coex );
} catch ( Exception e ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class LinkAnalysisPersisterImpl implements LinkAnalysisPersister {

@Override
public boolean deleteAnalyses( BioAssaySet ee ) {
Collection<CoexpressionAnalysis> oldAnalyses = coexpressionAnalysisService.findByInvestigation( ee );
Collection<CoexpressionAnalysis> oldAnalyses = coexpressionAnalysisService.findByExperiment( ee );

if ( oldAnalyses.isEmpty() )
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import ubic.gemma.model.expression.designElement.CompositeSequence;
import ubic.gemma.model.expression.experiment.*;
import ubic.gemma.persistence.service.analysis.expression.diff.DifferentialExpressionAnalysisService;
import ubic.gemma.persistence.service.analysis.expression.diff.DifferentialExpressionResultService;
import ubic.gemma.persistence.service.analysis.expression.diff.ExpressionAnalysisResultSetService;
import ubic.gemma.persistence.service.common.auditAndSecurity.AuditTrailService;
import ubic.gemma.persistence.service.expression.experiment.ExpressionExperimentService;
Expand Down Expand Up @@ -76,7 +75,7 @@ public class DifferentialExpressionAnalyzerServiceImpl implements DifferentialEx
@Override
public int deleteAnalyses( ExpressionExperiment expressionExperiment ) {
Collection<DifferentialExpressionAnalysis> diffAnalysis = differentialExpressionAnalysisService
.findByInvestigation( expressionExperiment );
.findByExperiment( expressionExperiment );

int result = 0;
if ( diffAnalysis == null || diffAnalysis.isEmpty() ) {
Expand Down Expand Up @@ -361,7 +360,7 @@ private void deleteAnalysisFiles( DifferentialExpressionAnalysis analysis ) {
private void deleteOldAnalyses( ExpressionExperiment expressionExperiment,
DifferentialExpressionAnalysis newAnalysis, Collection<ExperimentalFactor> factors ) {
Collection<DifferentialExpressionAnalysis> diffAnalyses = differentialExpressionAnalysisService
.findByInvestigation( expressionExperiment );
.findByExperiment( expressionExperiment );
int numDeleted = 0;
if ( diffAnalyses == null || diffAnalyses.isEmpty() ) {
DifferentialExpressionAnalyzerServiceImpl.log
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -743,8 +743,8 @@ private DifferentialExpressionAnalysis doAnalysis( BioAssaySet bioAssaySet,
*/

// this used to be a Set, but a List is much faster.
Map<String, List<DifferentialExpressionAnalysisResult>> resultLists = new HashMap<>();
Map<String, List<Double>> pvaluesForQvalue = new HashMap<>();
Map<String, List<DifferentialExpressionAnalysisResult>> resultLists = new HashMap<>( properDesignMatrix.getTerms().size() );
Map<String, List<Double>> pvaluesForQvalue = new HashMap<>( properDesignMatrix.getTerms().size() );

// We use the design matrix to ensure that we only consider terms that actually ended up in the model.
for ( String factorName : properDesignMatrix.getTerms() ) {
Expand Down Expand Up @@ -1332,7 +1332,7 @@ private Map<FactorValue, ExpressionDataDoubleMatrix> makeSubSets( DifferentialEx
"You cannot analyze a factor and use it for subsetting at the same time." );
}

Map<FactorValue, List<BioMaterial>> subSetSamples = new HashMap<>();
Map<FactorValue, List<BioMaterial>> subSetSamples = new HashMap<>( subsetFactor.getFactorValues().size() );
for ( FactorValue fv : subsetFactor.getFactorValues() ) {
assert fv.getMeasurement() == null;
subSetSamples.put( fv, new ArrayList<BioMaterial>() );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,15 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import org.springframework.stereotype.Service;
import ubic.gemma.core.analysis.expression.diff.DifferentialExpressionAnalyzerService;
import ubic.gemma.core.analysis.preprocess.batcheffects.ExpressionExperimentBatchCorrectionService;
import ubic.gemma.core.analysis.preprocess.filter.NoRowsLeftAfterFilteringException;
import ubic.gemma.core.analysis.preprocess.svd.SVDServiceHelper;
import ubic.gemma.core.analysis.report.ExpressionExperimentReportService;
import ubic.gemma.core.analysis.service.ExpressionDataFileService;
import ubic.gemma.core.datastructure.matrix.ExpressionDataDoubleMatrix;
import ubic.gemma.model.analysis.expression.diff.DifferentialExpressionAnalysis;
import ubic.gemma.model.common.auditAndSecurity.eventType.AuditEventType;
import ubic.gemma.model.common.auditAndSecurity.eventType.BatchCorrectionEvent;
import ubic.gemma.model.common.quantitationtype.QuantitationType;
import ubic.gemma.model.expression.arrayDesign.ArrayDesign;
Expand Down Expand Up @@ -251,7 +248,7 @@ private ExpressionExperiment processExceptForVectorCreate( ExpressionExperiment
* Redo any old diff ex analyses
*/
Collection<DifferentialExpressionAnalysis> oldAnalyses = differentialExpressionAnalysisService
.findByInvestigation( ee );
.findByExperiment( ee );

if ( !oldAnalyses.isEmpty() ) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ private void updatePhenotypeAssociationPublication( PhenotypeAssociation phe,
if ( toUpdate ) {

for ( PhenotypeAssociationPublication associationPublication : phe.getPhenotypeAssociationPublications() ) {
this.phenotypeAssociationService.removePhenotypePublication( associationPublication.getId() );
this.phenotypeAssociationService.removePhenotypePublication( associationPublication );
}

Collection<PhenotypeAssociationPublication> phenotypeAssociationPublications = new HashSet<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1419,6 +1419,11 @@ private ValidateEvidenceValueObject determineSameGeneAndPhenotypeAnnotated(
OntologyTerm ontologyTerm = this.ontologyService
.getTerm( phenotypeAlreadyPresent.getValueUri() );

if ( ontologyTerm == null ) {
log.warn( String.format( "Unexpected null term for value URI %s from the ontology service.", phenotypeAlreadyPresent.getValueUri() ) );
continue;
}

for ( OntologyTerm ot : ontologyTerm.getParents( true ) ) {
parentOrChildTerm.add( ot.getUri() );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,13 @@ public List<SearchResultDisplayObject> getAllTaxonExperimentGroup( Long taxonId
expressionExperimentSetService.thaw( set );
if ( set.getTaxon().getId().equals( taxonId ) ) {
ExpressionExperimentSetValueObject eevo = expressionExperimentSetService.loadValueObject( set );
newSRDO = new SearchResultDisplayObject( eevo );
newSRDO.setUserOwned( securityService.isPrivate( set ) );
( ( ExpressionExperimentSetValueObject ) newSRDO.getResultValueObject() )
.setIsPublic( securityService.isPublic( set ) );
setResults.add( newSRDO );
if ( eevo != null ) {
newSRDO = new SearchResultDisplayObject( eevo );
newSRDO.setUserOwned( securityService.isPrivate( set ) );
( ( ExpressionExperimentSetValueObject ) newSRDO.getResultValueObject() )
.setIsPublic( securityService.isPublic( set ) );
setResults.add( newSRDO );
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
*/
package ubic.gemma.core.ontology;

import org.springframework.beans.factory.InitializingBean;
import ubic.basecode.ontology.model.OntologyIndividual;
import ubic.basecode.ontology.model.OntologyResource;
import ubic.basecode.ontology.model.OntologyTerm;
Expand All @@ -28,6 +27,7 @@
import ubic.gemma.model.genome.Taxon;
import ubic.gemma.model.genome.gene.phenotype.valueObject.CharacteristicValueObject;

import javax.annotation.Nullable;
import java.util.Collection;
import java.util.List;
import java.util.Map;
Expand All @@ -36,7 +36,7 @@
* @author Paul
*/
@SuppressWarnings("unused") // Possible external use
public interface OntologyService extends InitializingBean {
public interface OntologyService {

/**
* Will add the give vocab characteristic to the expression experiment.
Expand Down Expand Up @@ -147,6 +147,7 @@ Collection<CharacteristicValueObject> findExperimentsCharacteristicTags( String
* @param uri uri
* @return the OntologyResource
*/
@Nullable
OntologyResource getResource( String uri );

SequenceOntologyService getSequenceOntologyService();
Expand All @@ -155,6 +156,7 @@ Collection<CharacteristicValueObject> findExperimentsCharacteristicTags( String
* @param uri uri
* @return the OntologyTerm for the specified URI.
*/
@Nullable
OntologyTerm getTerm( String uri );

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.compass.core.util.concurrent.ConcurrentHashSet;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
Expand Down Expand Up @@ -92,7 +94,7 @@
* @author pavlidis
*/
@Service
public class OntologyServiceImpl implements OntologyService {
public class OntologyServiceImpl implements OntologyService, InitializingBean, DisposableBean {
/**
* Throttle how many ontology terms we retrieve. We search the ontologies in a favored order, so we can stop when we
* find "enough stuff".
Expand Down Expand Up @@ -187,6 +189,16 @@ public void afterPropertiesSet() {

}

@Override
public void destroy() throws Exception {
String doLoad = Configuration.getString( "load.ontologies" );
if ( StringUtils.isBlank( doLoad ) || Configuration.getBoolean( "load.ontologies" ) ) {
for ( AbstractOntologyService serv : this.ontologyServices ) {
serv.cancelInitializationThread();
}
}
}

private void countOccurrences( Collection<CharacteristicValueObject> searchResults,
Map<String, CharacteristicValueObject> previouslyUsedInSystem ) {
StopWatch watch = new StopWatch();
Expand Down Expand Up @@ -298,6 +310,9 @@ public Collection<OntologyIndividual> findIndividuals( String givenSearch ) thro
Collection<OntologyIndividual> results = new HashSet<>();

for ( AbstractOntologyService ontology : ontologyServices ) {
if ( !ontology.isOntologyLoaded() ) {
continue;
}
Collection<OntologyIndividual> found = ontology.findIndividuals( query );
if ( found != null )
results.addAll( found );
Expand All @@ -317,6 +332,9 @@ public Collection<Characteristic> findTermAsCharacteristic( String search ) thro
}

for ( AbstractOntologyService ontology : ontologyServices ) {
if ( !ontology.isOntologyLoaded() ) {
continue;
}
Collection<OntologyTerm> found = ontology.findTerm( query );
if ( found != null )
results.addAll( this.convert( new HashSet<>( found ) ) );
Expand Down Expand Up @@ -549,6 +567,9 @@ public UberonOntologyService getUberonService() {
@Override
public OntologyResource getResource( String uri ) {
for ( AbstractOntologyService ontology : ontologyServices ) {
if ( !ontology.isOntologyLoaded() ) {
continue;
}
OntologyResource resource = ontology.getResource( uri );
if ( resource != null )
return resource;
Expand All @@ -564,6 +585,9 @@ public SequenceOntologyService getSequenceOntologyService() {
@Override
public OntologyTerm getTerm( String uri ) {
for ( AbstractOntologyService ontology : ontologyServices ) {
if ( !ontology.isOntologyLoaded() ) {
continue;
}
OntologyTerm term = ontology.getTerm( uri );
if ( term != null )
return term;
Expand Down Expand Up @@ -889,6 +913,9 @@ private Collection<CharacteristicValueObject> findCharacteristicsFromOntology( S

// search all Ontology
for ( AbstractOntologyService ontologyService : ontologyServicesToUse ) {
if ( !ontologyService.isOntologyLoaded() ) {
continue;
}

Collection<OntologyTerm> ontologyTerms = ontologyService.findTerm( searchQuery );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import ubic.gemma.model.expression.experiment.ExpressionExperiment;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.List;
import java.util.Set;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ private void accreteResultsOthers( LinkedHashSet<SearchResult<?>> results, Searc
results.addAll( gen );
}

if ( settings.getUseGo() ) {
if ( settings.hasResultType( Gene.class ) && settings.getUseGo() ) {
try {
// FIXME: add support for OR, but there's a bug in baseCode that prevents this https://github.com/PavlidisLab/baseCode/issues/22
String query = settings.getQuery().replaceAll( "\\s+OR\\s+", "" );
Expand Down Expand Up @@ -639,10 +639,7 @@ private Collection<SearchResult<ArrayDesign>> arrayDesignSearch( SearchSettings
}
// FIXME: this should not be necessary, the AD is eagerly fetched in the model definition (see https://github.com/PavlidisLab/Gemma/issues/483)
Hibernate.initialize( cs.getArrayDesign() );
SearchResult<ArrayDesign> sr = new SearchResult<>( cs.getArrayDesign(), "ArrayDesign associated to probes obtained by a Compass search." );
// indirect hit penalty
sr.setScore( INDIRECT_HIT_PENALTY * r.getScore() );
results.add( sr );
results.add( SearchResult.from( ArrayDesign.class, cs.getArrayDesign(), INDIRECT_HIT_PENALTY * r.getScore(), null, "ArrayDesign associated to probes obtained by a Compass search." ) );
}

watch.stop();
Expand Down Expand Up @@ -1043,7 +1040,7 @@ private Collection<SearchResult<CompositeSequence>> compositeSequenceSearch( Sea
*/
private <T extends Identifiable> Collection<SearchResult<T>> dbHitsToSearchResult( Collection<T> entities, @Nullable String matchText, String source ) {
StopWatch watch = StopWatch.createStarted();
List<SearchResult<T>> results = new ArrayList<>();
List<SearchResult<T>> results = new ArrayList<>( entities.size() );
for ( T e : entities ) {
if ( e == null ) {
if ( log.isDebugEnabled() )
Expand Down
Loading

0 comments on commit e34a17f

Please sign in to comment.