Class GeneDaoImpl
- java.lang.Object
-
- ubic.gemma.persistence.service.AbstractDao<O>
-
- ubic.gemma.persistence.service.AbstractVoEnabledDao<O,VO>
-
- ubic.gemma.persistence.service.AbstractFilteringVoEnabledDao<O,VO>
-
- ubic.gemma.persistence.service.AbstractQueryFilteringVoEnabledDao<Gene,GeneValueObject>
-
- ubic.gemma.persistence.service.genome.GeneDaoImpl
-
- All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean
,BaseDao<Gene>
,BaseVoEnabledDao<Gene,GeneValueObject>
,CachedFilteringDao<Gene>
,CachedFilteringVoEnabledDao<Gene,GeneValueObject>
,FilteringDao<Gene>
,FilteringVoEnabledDao<Gene,GeneValueObject>
,GeneDao
@Repository public class GeneDaoImpl extends AbstractQueryFilteringVoEnabledDao<Gene,GeneValueObject> implements GeneDao, org.springframework.beans.factory.InitializingBean
Base Spring DAO Class: is able to create, update, remove, load, and find objects of typeGene
.- See Also:
Gene
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ubic.gemma.persistence.service.AbstractFilteringVoEnabledDao
AbstractFilteringVoEnabledDao.FilterablePropertiesConfigurer, AbstractFilteringVoEnabledDao.FilterablePropertyMeta
-
-
Field Summary
-
Fields inherited from class ubic.gemma.persistence.service.AbstractVoEnabledDao
REPORT_SLOW_QUERY_AFTER_MS
-
Fields inherited from class ubic.gemma.persistence.service.AbstractDao
log
-
Fields inherited from interface ubic.gemma.persistence.service.genome.GeneDao
OBJECT_ALIAS
-
-
Constructor Summary
Constructors Constructor Description GeneDaoImpl(SessionFactory sessionFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected GeneValueObject
doLoadValueObject(Gene entity)
Load a value object for a given entity.Gene
find(Gene gene)
Does a look up for the given entity in the persistent storage, usually looking for a specific identifier ( either id or a string property).Collection<Gene>
find(PhysicalLocation physicalLocation)
Find all genes at a physical location.Gene
findByAccession(String accession, ExternalDatabase source)
Collection<Gene>
findByAlias(String search)
Gets all the genes referred to by the alias defined by the search string.Gene
findByEnsemblId(String id)
Gene
findByNcbiId(Integer ncbiId)
Map<Integer,Gene>
findByNcbiIds(Collection<Integer> ncbiIds)
Quickly load exact matches.Collection<Gene>
findByOfficialName(String officialName)
Collection<Gene>
findByOfficialNameInexact(String officialName)
Collection<Gene>
findByOfficialSymbol(String officialSymbol)
Gene
findByOfficialSymbol(String symbol, Taxon taxon)
Collection<Gene>
findByOfficialSymbolInexact(String officialSymbol)
Map<String,Gene>
findByOfficialSymbols(Collection<String> query, Long taxonId)
Quickly load exact matches.Collection<Gene>
findByPhysicalLocation(PhysicalLocation location)
long
getCompositeSequenceCountById(long id)
Gets a count of the CompositeSequences related to the gene identified by the given id.Collection<CompositeSequence>
getCompositeSequences(Gene gene, ArrayDesign arrayDesign)
Collection<CompositeSequence>
getCompositeSequencesById(long id)
Gets all the CompositeSequences related to the gene identified by the given id.protected Query
getFilteringCountQuery(Filters filters)
Produce a query that will be used to retrieve the size ofAbstractQueryFilteringVoEnabledDao.getFilteringQuery(Filters, Sort)
.protected Query
getFilteringQuery(Filters filters, Sort sort)
Produce a query for retrieving value objects after applying a set of filters and a given ordering.Collection<Gene>
getMicroRnaByTaxon(Taxon taxon)
int
getPlatformCountById(Long id)
protected void
initializeCachedFilteringResult(Gene entity)
Initialize a result fromAbstractQueryFilteringVoEnabledDao.getFilteringQuery(Filters, Sort)
retrieved from the HibernateStandardQueryCache
.Collection<Gene>
loadKnownGenes(Taxon taxon)
List<Gene>
loadThawed(Collection<Long> ids)
Collection<Gene>
loadThawedLiter(Collection<Long> ids)
protected void
postProcessValueObjects(List<GeneValueObject> geneValueObjects)
Post-process VOs in bulk.void
remove(Gene gene)
Remove a persistent instanceint
removeAll()
Gene
thaw(Gene gene)
Gene
thawAliases(Gene gene)
Only thaw the Aliases, very light versionCollection<Gene>
thawLite(Collection<Gene> genes)
Gene
thawLite(Gene gene)
Gene
thawLiter(Gene gene)
-
Methods inherited from class ubic.gemma.persistence.service.AbstractQueryFilteringVoEnabledDao
count, countWithCache, getEntityTransformer, getFilteringIdQuery, getValueObjectTransformer, load, load, loadIds, loadIdsWithCache, loadValueObjects, loadValueObjects, loadValueObjectsWithCache, loadValueObjectsWithCache, loadWithCache, loadWithCache
-
Methods inherited from class ubic.gemma.persistence.service.AbstractFilteringVoEnabledDao
afterPropertiesSet, configureFilterableProperties, getFilter, getFilter, getFilter, getFilter, getFilter, getFilter, getFilterableProperties, getFilterablePropertyAllowedValues, getFilterablePropertyDescription, getFilterablePropertyIsUsingSubquery, getFilterablePropertyMeta, getFilterablePropertyMeta, getFilterablePropertyType, getSort
-
Methods inherited from class ubic.gemma.persistence.service.AbstractVoEnabledDao
doLoadValueObjects, loadAllValueObjects, loadValueObject, loadValueObjectById, loadValueObjects, loadValueObjectsByIds
-
Methods inherited from class ubic.gemma.persistence.service.AbstractDao
countAll, create, create, findByProperty, findByPropertyIn, findOneByProperty, findOrCreate, getBatchSize, getElementClass, getIdentifierPropertyName, getSessionFactory, load, load, loadAll, loadReference, loadReference, reload, reload, remove, remove, save, save, streamAll, streamAll, streamQuery, update, update
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ubic.gemma.persistence.service.BaseDao
countAll, create, create, findOrCreate, getElementClass, getIdentifierPropertyName, load, load, loadAll, loadReference, loadReference, reload, reload, remove, remove, save, save, streamAll, streamAll, update, update
-
Methods inherited from interface ubic.gemma.persistence.service.BaseVoEnabledDao
loadAllValueObjects, loadValueObject, loadValueObjectById, loadValueObjects, loadValueObjectsByIds
-
Methods inherited from interface ubic.gemma.persistence.service.FilteringDao
count, getFilter, getFilter, getFilter, getFilter, getFilter, getFilter, getFilterableProperties, getFilterablePropertyAllowedValues, getFilterablePropertyDescription, getFilterablePropertyIsUsingSubquery, getFilterablePropertyType, getSort, load, load, loadIds
-
Methods inherited from interface ubic.gemma.persistence.service.FilteringVoEnabledDao
loadValueObjects, loadValueObjects
-
-
-
-
Constructor Detail
-
GeneDaoImpl
@Autowired public GeneDaoImpl(SessionFactory sessionFactory)
-
-
Method Detail
-
find
public Collection<Gene> find(PhysicalLocation physicalLocation)
Description copied from interface:GeneDao
Find all genes at a physical location. All overlapping genes are returned. The location can be a point or a region. If strand is non-null, only genes on the same strand are returned.
-
findByAccession
public Gene findByAccession(String accession, @Nullable ExternalDatabase source)
- Specified by:
findByAccession
in interfaceGeneDao
-
findByAlias
public Collection<Gene> findByAlias(String search)
Gets all the genes referred to by the alias defined by the search string.- Specified by:
findByAlias
in interfaceGeneDao
- Parameters:
search
- search string- Returns:
- Collection
-
findByEnsemblId
public Gene findByEnsemblId(String id)
- Specified by:
findByEnsemblId
in interfaceGeneDao
-
findByNcbiId
public Gene findByNcbiId(Integer ncbiId)
- Specified by:
findByNcbiId
in interfaceGeneDao
-
findByOfficialSymbol
public Collection<Gene> findByOfficialSymbol(String officialSymbol)
- Specified by:
findByOfficialSymbol
in interfaceGeneDao
-
findByOfficialName
public Collection<Gene> findByOfficialName(String officialName)
- Specified by:
findByOfficialName
in interfaceGeneDao
-
findByOfficialNameInexact
public Collection<Gene> findByOfficialNameInexact(String officialName)
- Specified by:
findByOfficialNameInexact
in interfaceGeneDao
-
findByOfficialSymbol
public Gene findByOfficialSymbol(String symbol, Taxon taxon)
- Specified by:
findByOfficialSymbol
in interfaceGeneDao
-
findByOfficialSymbolInexact
public Collection<Gene> findByOfficialSymbolInexact(String officialSymbol)
- Specified by:
findByOfficialSymbolInexact
in interfaceGeneDao
-
findByOfficialSymbols
public Map<String,Gene> findByOfficialSymbols(Collection<String> query, Long taxonId)
Description copied from interface:GeneDao
Quickly load exact matches.- Specified by:
findByOfficialSymbols
in interfaceGeneDao
- Parameters:
query
- querytaxonId
- taxon id- Returns:
- map of gene symbol (toLowerCase()) to the gene. The actual query that led to the gene is not retained.
-
findByNcbiIds
public Map<Integer,Gene> findByNcbiIds(Collection<Integer> ncbiIds)
Description copied from interface:GeneDao
Quickly load exact matches.- Specified by:
findByNcbiIds
in interfaceGeneDao
- Parameters:
ncbiIds
- ncbi ids- Returns:
- map of NCBI Id to the gene.
-
findByPhysicalLocation
public Collection<Gene> findByPhysicalLocation(PhysicalLocation location)
- Specified by:
findByPhysicalLocation
in interfaceGeneDao
-
getCompositeSequenceCountById
public long getCompositeSequenceCountById(long id)
Gets a count of the CompositeSequences related to the gene identified by the given id.- Specified by:
getCompositeSequenceCountById
in interfaceGeneDao
- Parameters:
id
- id- Returns:
- Collection
-
getCompositeSequences
public Collection<CompositeSequence> getCompositeSequences(Gene gene, ArrayDesign arrayDesign)
- Specified by:
getCompositeSequences
in interfaceGeneDao
-
getCompositeSequencesById
public Collection<CompositeSequence> getCompositeSequencesById(long id)
Gets all the CompositeSequences related to the gene identified by the given id.- Specified by:
getCompositeSequencesById
in interfaceGeneDao
- Returns:
- Collection
-
getMicroRnaByTaxon
public Collection<Gene> getMicroRnaByTaxon(Taxon taxon)
- Specified by:
getMicroRnaByTaxon
in interfaceGeneDao
- Parameters:
taxon
- taxon- Returns:
- a collection of genes that are actually MicroRNA for a given taxon
-
getPlatformCountById
public int getPlatformCountById(Long id)
- Specified by:
getPlatformCountById
in interfaceGeneDao
- Parameters:
id
- id- Returns:
- how many platforms have a representation of this gene
-
loadKnownGenes
public Collection<Gene> loadKnownGenes(Taxon taxon)
- Specified by:
loadKnownGenes
in interfaceGeneDao
- Parameters:
taxon
- taxon- Returns:
- a collection of genes for the specified taxon (not all genes, ie not probe aligned regions and predicted genes)
-
loadThawed
public List<Gene> loadThawed(Collection<Long> ids)
- Specified by:
loadThawed
in interfaceGeneDao
-
loadThawedLiter
public Collection<Gene> loadThawedLiter(Collection<Long> ids)
- Specified by:
loadThawedLiter
in interfaceGeneDao
-
thawAliases
public Gene thawAliases(Gene gene)
Only thaw the Aliases, very light version- Specified by:
thawAliases
in interfaceGeneDao
-
thawLite
public Collection<Gene> thawLite(Collection<Gene> genes)
-
remove
public void remove(Gene gene)
Description copied from interface:BaseDao
Remove a persistent instance
-
find
public Gene find(Gene gene)
Description copied from interface:BaseDao
Does a look up for the given entity in the persistent storage, usually looking for a specific identifier ( either id or a string property).
-
doLoadValueObject
protected GeneValueObject doLoadValueObject(Gene entity)
Description copied from class:AbstractVoEnabledDao
Load a value object for a given entity.This should be fast and efficient, and avoid any database query or post-processing. If you need to perform additional queries, implement
AbstractVoEnabledDao.postProcessValueObjects(List)
instead.- Specified by:
doLoadValueObject
in classAbstractVoEnabledDao<Gene,GeneValueObject>
-
getFilteringQuery
protected Query getFilteringQuery(@Nullable Filters filters, @Nullable Sort sort)
Description copied from class:AbstractQueryFilteringVoEnabledDao
Produce a query for retrieving value objects after applying a set of filters and a given ordering.Note that if your implementation does not produce a
List
ofAbstractQueryFilteringVoEnabledDao
whenQuery.list()
is invoked, you must overrideAbstractQueryFilteringVoEnabledDao.getValueObjectTransformer()
.The make the cached query (i.e.
AbstractQueryFilteringVoEnabledDao.loadWithCache(Filters, Sort)
behave the same, you also have to explicitly initialize any lazy relations inAbstractVoEnabledDao.doLoadValueObject(Identifiable)
because the VO constructor will not initialize them.- Specified by:
getFilteringQuery
in classAbstractQueryFilteringVoEnabledDao<Gene,GeneValueObject>
- Parameters:
filters
- seeFilterQueryUtils.formRestrictionClause(Filters)
filters argument for description.- Returns:
- a Hibernated Query object ready to be used for TaxonVO retrieval.
-
initializeCachedFilteringResult
protected void initializeCachedFilteringResult(Gene entity)
Description copied from class:AbstractQueryFilteringVoEnabledDao
Initialize a result fromAbstractQueryFilteringVoEnabledDao.getFilteringQuery(Filters, Sort)
retrieved from the HibernateStandardQueryCache
.Lazy-loaded relations that are fetched in
AbstractQueryFilteringVoEnabledDao.getFilteringQuery(Filters, Sort)
must be initialized manually in this method to ensure that the entity has all the expected fields if they are retrieved from the second-level cache.- Specified by:
initializeCachedFilteringResult
in classAbstractQueryFilteringVoEnabledDao<Gene,GeneValueObject>
-
getFilteringCountQuery
protected Query getFilteringCountQuery(@Nullable Filters filters)
Description copied from class:AbstractQueryFilteringVoEnabledDao
Produce a query that will be used to retrieve the size ofAbstractQueryFilteringVoEnabledDao.getFilteringQuery(Filters, Sort)
.- Overrides:
getFilteringCountQuery
in classAbstractQueryFilteringVoEnabledDao<Gene,GeneValueObject>
- Returns:
- a
Query
which must return a singleLong
value
-
postProcessValueObjects
protected void postProcessValueObjects(List<GeneValueObject> geneValueObjects)
Description copied from class:AbstractVoEnabledDao
Post-process VOs in bulk.Use this as an opportunity to load extra informations that could not be populated in the initial
AbstractVoEnabledDao.doLoadValueObject(Identifiable)
orAbstractVoEnabledDao.doLoadValueObjects(Collection)
- Overrides:
postProcessValueObjects
in classAbstractVoEnabledDao<Gene,GeneValueObject>
-
-