Skip to content

Commit

Permalink
Merge pull request #1288 from PavlidisLab/feature-single-cell-ui-work
Browse files Browse the repository at this point in the history
UI work for single-cell
  • Loading branch information
arteymix authored Nov 15, 2024
2 parents e3e85c4 + 39fe57c commit f45ef66
Show file tree
Hide file tree
Showing 129 changed files with 3,733 additions and 2,534 deletions.
12 changes: 12 additions & 0 deletions .idea/runConfigurations/Build_static_assets.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/runConfigurations/Build_static_assets__dev_.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/runConfigurations/Deploy__dev_.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/runConfigurations/Deploy__staging_.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/runConfigurations/Serve_static_assets.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.springframework.util.Assert;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import ubic.gemma.model.common.quantitationtype.GeneralType;
import ubic.gemma.model.common.quantitationtype.QuantitationType;
import ubic.gemma.model.common.quantitationtype.QuantitationTypeValueObject;
import ubic.gemma.model.expression.bioAssayData.*;
Expand All @@ -39,10 +38,7 @@
import ubic.gemma.persistence.service.AbstractCriteriaFilteringVoEnabledDao;

import javax.annotation.Nullable;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.*;
import java.util.stream.Collectors;

import static ubic.gemma.persistence.util.QueryUtils.optimizeParameterList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
* @author kelsey
Expand Down Expand Up @@ -127,6 +128,8 @@ public interface QuantitationTypeService extends BaseService<QuantitationType>,
@Nullable
Class<? extends DataVector> getDataVectorType( QuantitationType qt );

Map<QuantitationType, Class<? extends DataVector>> getDataVectorTypes( Collection<QuantitationType> qts );

/**
* Infer all the mapped vector types that are subclasses of the given vector type.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@
import ubic.gemma.model.expression.experiment.ExpressionExperiment;
import ubic.gemma.persistence.service.AbstractFilteringVoEnabledService;

import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.*;

/**
* @author keshav
Expand Down Expand Up @@ -90,6 +87,18 @@ public Class<? extends DataVector> getDataVectorType( QuantitationType qt ) {
return quantitationTypeDao.getDataVectorType( qt );
}

@Override
@Transactional(readOnly = true)
public Map<QuantitationType, Class<? extends DataVector>> getDataVectorTypes( Collection<QuantitationType> qts ) {
Map<QuantitationType, Class<? extends DataVector>> vectorTypes = new HashMap<>();
for ( QuantitationType qt : qts ) {
if ( !vectorTypes.containsKey( qt ) ) {
vectorTypes.put( qt, getDataVectorType( qt ) );
}
}
return vectorTypes;
}

@Override
// no need for a transaction
public Collection<Class<? extends DataVector>> getMappedDataVectorType( Class<? extends DataVector> vectorType ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import ubic.gemma.model.expression.bioAssay.BioAssay;
import ubic.gemma.model.expression.bioAssay.BioAssayValueObject;
import ubic.gemma.model.expression.bioAssayData.BioAssayDimension;
import ubic.gemma.persistence.service.BaseVoEnabledDao;
import ubic.gemma.model.expression.experiment.BioAssaySet;
import ubic.gemma.persistence.service.FilteringVoEnabledDao;

import java.util.Collection;
Expand All @@ -40,5 +40,7 @@ public interface BioAssayDao extends FilteringVoEnabledDao<BioAssay, BioAssayVal

Collection<BioAssay> findByAccession( String accession );

Collection<BioAssaySet> getBioAssaySets( BioAssay bioAssay );

List<BioAssayValueObject> loadValueObjects( Collection<BioAssay> entities, Map<Long, ArrayDesignValueObject> arrayDesignValueObjects, boolean basic );
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import ubic.gemma.model.expression.bioAssay.BioAssay;
import ubic.gemma.model.expression.bioAssay.BioAssayValueObject;
import ubic.gemma.model.expression.bioAssayData.BioAssayDimension;
import ubic.gemma.model.expression.experiment.BioAssaySet;
import ubic.gemma.persistence.service.AbstractNoopFilteringVoEnabledDao;
import ubic.gemma.persistence.util.BusinessKey;

Expand Down Expand Up @@ -68,6 +69,22 @@ public Collection<BioAssay> findByAccession( String accession ) {
.setParameter( "accession", accession ).list();
}

@Override
public Collection<BioAssaySet> getBioAssaySets( BioAssay bioAssay ) {
Collection<BioAssaySet> results = new HashSet<>();
//noinspection unchecked
results.addAll( getSessionFactory().getCurrentSession()
.createQuery( "select distinct bas from ExpressionExperiment bas join bas.bioAssays ba where ba = :ba" )
.setParameter( "ba", bioAssay )
.list() );
//noinspection unchecked
results.addAll( getSessionFactory().getCurrentSession()
.createQuery( "select distinct bas from ExpressionExperimentSubSet bas join bas.bioAssays ba where ba = :ba" )
.setParameter( "ba", bioAssay )
.list() );
return results;
}

/**
* Method that allows specification of FactorValueBasicValueObject in the bioMaterialVOs
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,14 @@
import ubic.gemma.model.expression.bioAssay.BioAssayValueObject;
import ubic.gemma.model.expression.bioAssayData.BioAssayDimension;
import ubic.gemma.model.expression.biomaterial.BioMaterial;
import ubic.gemma.persistence.service.*;
import ubic.gemma.persistence.util.Filter;
import ubic.gemma.persistence.util.Sort;
import ubic.gemma.model.expression.experiment.BioAssaySet;
import ubic.gemma.persistence.service.BaseService;
import ubic.gemma.persistence.service.FilteringVoEnabledService;
import ubic.gemma.persistence.service.expression.biomaterial.BioMaterialService;

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

/**
* @author kelsey
Expand Down Expand Up @@ -66,6 +65,15 @@ public interface BioAssayService extends BaseService<BioAssay>, FilteringVoEnabl
@Secured({ "IS_AUTHENTICATED_ANONYMOUSLY", "AFTER_ACL_COLLECTION_READ" })
Collection<BioAssay> findByAccession( String accession );

/**
* @see BioMaterialService#findSubBioMaterials(BioMaterial, boolean)
*/
@Secured({ "IS_AUTHENTICATED_ANONYMOUSLY", "AFTER_ACL_COLLECTION_READ" })
Collection<BioAssay> findSubBioAssays( BioAssay bioAssay, boolean direct );

@Secured({ "IS_AUTHENTICATED_ANONYMOUSLY", "AFTER_ACL_COLLECTION_READ" })
Collection<BioAssay> findSiblings( BioAssay bioAssay );

@Override
@Secured({ "GROUP_USER", "AFTER_ACL_READ" })
BioAssay findOrCreate( BioAssay bioAssay );
Expand Down Expand Up @@ -94,6 +102,12 @@ public interface BioAssayService extends BaseService<BioAssay>, FilteringVoEnabl
@Secured({ "GROUP_USER", "ACL_SECURABLE_EDIT" })
void update( BioAssay bioAssay );

/**
* Obtain all the {@link BioAssaySet} that contain the given {@link BioAssay}.
*/
@Secured({ "IS_AUTHENTICATED_ANONYMOUSLY", "AFTER_ACL_COLLECTION_READ" })
Collection<BioAssaySet> getBioAssaySets( BioAssay bioAssay );

/**
* Removes the association between a specific bioMaterial and a bioAssay.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@
import ubic.gemma.model.expression.bioAssay.BioAssayValueObject;
import ubic.gemma.model.expression.bioAssayData.BioAssayDimension;
import ubic.gemma.model.expression.biomaterial.BioMaterial;
import ubic.gemma.model.expression.experiment.BioAssaySet;
import ubic.gemma.persistence.service.AbstractFilteringVoEnabledService;
import ubic.gemma.persistence.service.expression.arrayDesign.ArrayDesignDao;
import ubic.gemma.persistence.service.expression.biomaterial.BioMaterialDao;
import ubic.gemma.persistence.service.expression.biomaterial.BioMaterialService;

import java.util.*;
import java.util.function.Function;
Expand Down Expand Up @@ -81,6 +83,29 @@ public Collection<BioAssay> findByAccession( String accession ) {
return this.bioAssayDao.findByAccession( accession );
}

@Autowired
private BioMaterialService bioMaterialService;

@Override
@Transactional(readOnly = true)
public Collection<BioAssay> findSubBioAssays( BioAssay bioAssay, boolean direct ) {
Collection<BioMaterial> bms = bioMaterialService.findSubBioMaterials( bioAssay.getSampleUsed(), direct );
return bms.stream().map( BioMaterial::getBioAssaysUsedIn ).flatMap( Collection::stream ).collect( Collectors.toSet() );
}

@Override
@Transactional(readOnly = true)
public Collection<BioAssay> findSiblings( BioAssay bioAssay ) {
Collection<BioMaterial> bms = bioMaterialService.findSiblings( bioAssay.getSampleUsed() );
return bms.stream().map( BioMaterial::getBioAssaysUsedIn ).flatMap( Collection::stream ).collect( Collectors.toSet() );
}

@Override
@Transactional(readOnly = true)
public Collection<BioAssaySet> getBioAssaySets( BioAssay bioAssay ) {
return bioAssayDao.getBioAssaySets( bioAssay );
}

/**
* @see BioAssayService#removeBioMaterialAssociation(BioAssay, ubic.gemma.model.expression.biomaterial.BioMaterial)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,23 @@
*/
package ubic.gemma.persistence.service.expression.bioAssayData;

import ubic.gemma.model.common.quantitationtype.QuantitationType;
import ubic.gemma.model.expression.bioAssay.BioAssay;
import ubic.gemma.model.expression.bioAssayData.BioAssayDimension;
import ubic.gemma.model.expression.bioAssayData.BioAssayDimensionValueObject;
import ubic.gemma.model.expression.experiment.ExpressionExperiment;
import ubic.gemma.persistence.service.BaseVoEnabledDao;

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

/**
* @see ubic.gemma.model.expression.bioAssayData.BioAssayDimension
*/
public interface BioAssayDimensionDao extends BaseVoEnabledDao<BioAssayDimension, BioAssayDimensionValueObject> {

/**
* Find all the dimensions that contains all the given assays.
*/
Collection<BioAssayDimension> findByBioAssayContainsAll( Collection<BioAssay> bioAssays );

void thawLite( BioAssayDimension bioAssayDimension );

void thaw( BioAssayDimension bioAssayDimension );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,19 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.util.Assert;
import ubic.gemma.model.common.quantitationtype.QuantitationType;
import ubic.gemma.model.expression.bioAssay.BioAssay;
import ubic.gemma.model.expression.bioAssayData.BioAssayDimension;
import ubic.gemma.model.expression.bioAssayData.BioAssayDimensionValueObject;
import ubic.gemma.model.expression.experiment.ExpressionExperiment;
import ubic.gemma.model.expression.experiment.FactorValue;
import ubic.gemma.persistence.service.AbstractVoEnabledDao;

import javax.annotation.Nullable;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;

import static ubic.gemma.persistence.service.expression.biomaterial.BioMaterialUtils.visitBioMaterials;
import static ubic.gemma.persistence.util.QueryUtils.optimizeIdentifiableParameterList;

/**
* <p>
Expand Down Expand Up @@ -107,6 +106,19 @@ public BioAssayDimension find( BioAssayDimension bioAssayDimension ) {
return null;
}

@Override
public Collection<BioAssayDimension> findByBioAssayContainsAll( Collection<BioAssay> bioAssays ) {
if ( bioAssays.isEmpty() ) {
return Collections.emptySet();
}
//noinspection unchecked
return getSessionFactory().getCurrentSession()
.createQuery( "select bad from BioAssayDimension bad join bad.bioAssays ba where ba in :bas group by bad having count(ba) = :numBas" )
.setParameterList( "bas", optimizeIdentifiableParameterList( bioAssays ) )
.setParameter( "numBas", bioAssays.stream().distinct().count() )
.list();
}

@Override
public void thawLite( final BioAssayDimension bioAssayDimension ) {
Hibernate.initialize( bioAssayDimension );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@
package ubic.gemma.persistence.service.expression.bioAssayData;

import org.springframework.security.access.annotation.Secured;
import ubic.gemma.model.common.quantitationtype.QuantitationType;
import ubic.gemma.model.expression.bioAssay.BioAssay;
import ubic.gemma.model.expression.bioAssayData.BioAssayDimension;
import ubic.gemma.model.expression.bioAssayData.BioAssayDimensionValueObject;
import ubic.gemma.model.expression.experiment.ExpressionExperiment;
import ubic.gemma.persistence.service.BaseImmutableService;
import ubic.gemma.persistence.service.BaseVoEnabledService;

import java.util.Collection;

/**
* @author Paul
*/
Expand All @@ -40,6 +41,9 @@ public interface BioAssayDimensionService
@Secured({ "IS_AUTHENTICATED_ANONYMOUSLY" })
BioAssayDimension create( BioAssayDimension bioAssayDimension );

@Secured({ "IS_AUTHENTICATED_ANONYMOUSLY" })
Collection<BioAssayDimension> findByBioAssayContainsAll( Collection<BioAssay> bioAssays );

@Override
@Secured({ "GROUP_USER" })
void remove( BioAssayDimension bioAssayDimension );
Expand Down
Loading

0 comments on commit f45ef66

Please sign in to comment.