Skip to content

Commit

Permalink
Merge branch 'hotfix-1.29.15'
Browse files Browse the repository at this point in the history
  • Loading branch information
arteymix committed Jul 5, 2023
2 parents 88ec353 + cb0ec4e commit 9fbfb87
Show file tree
Hide file tree
Showing 52 changed files with 679 additions and 857 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.14</version>
<version>1.29.15</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>gemma-cli</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,18 @@
*/
package ubic.gemma.core.apps;

import java.util.Arrays;
import java.util.List;

import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.apache.commons.lang3.StringUtils;

import ubic.gemma.model.expression.arrayDesign.ArrayDesign;
import ubic.gemma.model.expression.experiment.BioAssaySet;
import ubic.gemma.model.expression.experiment.ExpressionExperiment;
import ubic.gemma.persistence.service.expression.arrayDesign.ArrayDesignService;

import java.util.Arrays;
import java.util.List;

/**
* Delete one or more experiments from the system.
*
Expand Down Expand Up @@ -83,13 +82,13 @@ protected void doWork() throws Exception {
continue;
}

if ( !ads.getExpressionExperiments( a ).isEmpty() ) {
if ( ads.getExpressionExperimentsCount( a ) > 0 ) {
log.info( "Platform still has experiments that must be deleted first: " + p );
addErrorObject( p, "Experiments still exist for platform" );
continue;
}

if ( !ads.getSwitchedExperimentIds( a ).isEmpty() ) {
if ( ads.getSwitchedExpressionExperimentCount( a ) > 0 ) {
log.info( "Platform still has experiments (switched to anther platform) that must be deleted first: " + p );
addErrorObject( p, "Experiments (switched to anther platform) still exist for platform" );
continue;
Expand Down
2 changes: 1 addition & 1 deletion 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.14</version>
<version>1.29.15</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>gemma-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
import ubic.gemma.model.expression.experiment.ExpressionExperiment;
import ubic.gemma.model.expression.experiment.FactorValue;
import ubic.gemma.persistence.persister.Persister;
import ubic.gemma.persistence.service.common.auditAndSecurity.CurationDetailsService;
import ubic.gemma.persistence.service.expression.bioAssayData.RawExpressionDataVectorService;
import ubic.gemma.persistence.service.expression.experiment.ExpressionExperimentService;
import ubic.gemma.persistence.service.expression.experiment.ExpressionExperimentSetService;
Expand Down Expand Up @@ -75,9 +74,6 @@ public class SplitExperimentServiceImpl implements SplitExperimentService {
@Autowired
private RawExpressionDataVectorService rawExpressionDataVectorService;

@Autowired
private CurationDetailsService curationDetailsService;

@Autowired
private Persister persister;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@
package ubic.gemma.core.association.phenotype;

import ubic.basecode.ontology.model.OntologyTerm;
import ubic.basecode.ontology.providers.OntologyService;
import ubic.basecode.ontology.search.OntologySearchException;
import ubic.gemma.model.common.description.Characteristic;
import ubic.gemma.model.genome.gene.phenotype.valueObject.CharacteristicValueObject;

import javax.annotation.Nullable;
import java.util.Collection;
import java.util.Set;

Expand All @@ -29,48 +31,50 @@
public interface PhenotypeAssoOntologyHelper {

/**
* @return Gemma might be ready but the ontology thread not finish loading
* Returns the ontology services this helper is using.
*/
boolean areOntologiesAllLoaded();
Collection<OntologyService> getOntologyServices();

/**
* CharacteristicValueObject to Characteristic with no valueUri given
*
* @param characteristicValueObject characteristic VO
* @return vocab characteristic
* @return vocab characteristic
*/
Characteristic characteristicValueObject2Characteristic( CharacteristicValueObject characteristicValueObject );

/**
* For a valueUri return the OntologyTerm found
*
* @param valueUri value uri
* @return ontology term
* @return ontology term
*/
OntologyTerm findOntologyTermByUri( String valueUri ) throws EntityNotFoundException;
@Nullable
OntologyTerm findOntologyTermByUri( String valueUri );

/**
* search the disease,hp and mp ontology for a searchQuery and return an ordered set of CharacteristicVO
*
* @param searchQuery query
* @return characteristic VOs
* @return characteristic VOs
*/
Set<CharacteristicValueObject> findPhenotypesInOntology( String searchQuery ) throws OntologySearchException;

/**
* search the disease, hp and mp ontology for OntologyTerm
*
* @param searchQuery free text query?
* @return terms
* @return terms
*/
Collection<OntologyTerm> findValueUriInOntology( String searchQuery ) throws OntologySearchException;

/**
* Helper method. For a valueUri return the Characteristic (represents a phenotype)
*
* @param valueUri value uri
* @return Characteristic
* @return Characteristic
*/
@Nullable
Characteristic valueUri2Characteristic( String valueUri );

}
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,12 @@ public class PhenotypeAssoOntologyHelperImpl implements PhenotypeAssoOntologyHel
@Autowired
public PhenotypeAssoOntologyHelperImpl( OntologyService ontologyService, MondoOntologyService diseaseOntologyService, MammalianPhenotypeOntologyService mammalianPhenotypeOntologyService, HumanPhenotypeOntologyService humanPhenotypeOntologyService ) {
this.ontologyService = ontologyService;
// We add them even when they aren't available so we can use unit tests that mock or fake the ontologies.
this.ontologies = Arrays.asList( diseaseOntologyService, mammalianPhenotypeOntologyService, humanPhenotypeOntologyService );
if ( !diseaseOntologyService.isEnabled() ) {
log.debug( "DO is not enabled, phenotype tools will not work correctly" );
}
if ( !mammalianPhenotypeOntologyService.isEnabled() ) {
log.debug( "MPO is not enabled, phenotype tools will not work correctly" );
}
if ( !humanPhenotypeOntologyService.isEnabled() ) {
log.debug( "HPO is not enabled, phenotype tools will not work correctly" );
}
this.ontologies = Collections.unmodifiableList( Arrays.asList( diseaseOntologyService, mammalianPhenotypeOntologyService, humanPhenotypeOntologyService ) );
}

@Override
public boolean areOntologiesAllLoaded() {
// if these ontologies are not configured, we will never be ready. Check for valid configuration.
return ontologies.stream().allMatch( ubic.basecode.ontology.providers.OntologyService::isOntologyLoaded );
public Collection<ubic.basecode.ontology.providers.OntologyService> getOntologyServices() {
return ontologies;
}

@Override
Expand All @@ -81,7 +70,7 @@ public Characteristic characteristicValueObject2Characteristic(
// format the query for lucene to look for ontology terms with an exact match for the value
String value = "\"" + StringUtils.join( characteristicValueObject.getValue().trim().split( " " ), " AND " ) + "\"";

Collection<OntologyTerm> ontologyTerms = null;
Collection<OntologyTerm> ontologyTerms;
try {
ontologyTerms = this.ontologyService.findTerms( value );
for ( OntologyTerm ontologyTerm : ontologyTerms ) {
Expand All @@ -99,7 +88,7 @@ public Characteristic characteristicValueObject2Characteristic(
}

@Override
public OntologyTerm findOntologyTermByUri( String valueUri ) throws EntityNotFoundException {
public OntologyTerm findOntologyTermByUri( String valueUri ) {

if ( valueUri == null || valueUri.isEmpty() ) {
throw new IllegalArgumentException( "URI to load was blank." );
Expand All @@ -112,7 +101,7 @@ public OntologyTerm findOntologyTermByUri( String valueUri ) throws EntityNotFou
return ontologyTerm;
}

throw new EntityNotFoundException( valueUri + " - term not found" );
return null;
}

@Override
Expand Down Expand Up @@ -149,22 +138,15 @@ public Collection<OntologyTerm> findValueUriInOntology( String searchQuery ) thr

@Override
public Characteristic valueUri2Characteristic( String valueUri ) {

try {
OntologyTerm o = findOntologyTermByUri( valueUri );
if ( o == null )
return null;
Characteristic myPhenotype = Characteristic.Factory.newInstance();
myPhenotype.setValueUri( o.getUri() );
myPhenotype.setValue( o.getLabel() );
myPhenotype.setCategory( PhenotypeAssociationConstants.PHENOTYPE );
myPhenotype.setCategoryUri( PhenotypeAssociationConstants.PHENOTYPE_CATEGORY_URI );
return myPhenotype;
} catch ( EntityNotFoundException e ) {
e.printStackTrace();
OntologyTerm o = findOntologyTermByUri( valueUri );
if ( o == null )
return null;
}

Characteristic myPhenotype = Characteristic.Factory.newInstance();
myPhenotype.setValueUri( o.getUri() );
myPhenotype.setValue( o.getLabel() );
myPhenotype.setCategory( PhenotypeAssociationConstants.PHENOTYPE );
myPhenotype.setCategoryUri( PhenotypeAssociationConstants.PHENOTYPE_CATEGORY_URI );
return myPhenotype;
}

/**
Expand Down
Loading

0 comments on commit 9fbfb87

Please sign in to comment.