Class SampleServiceImpl
- java.lang.Object
-
- ca.corefacility.bioinformatics.irida.service.impl.CRUDServiceImpl<java.lang.Long,Sample>
-
- ca.corefacility.bioinformatics.irida.service.impl.sample.SampleServiceImpl
-
- All Implemented Interfaces:
CRUDService<java.lang.Long,Sample>
,SampleService
@Service public class SampleServiceImpl extends CRUDServiceImpl<java.lang.Long,Sample> implements SampleService
Service class for managingSample
.
-
-
Field Summary
-
Fields inherited from class ca.corefacility.bioinformatics.irida.service.impl.CRUDServiceImpl
CREATED_DATE_SORT_PROPERTY, repository, validator, valueType
-
-
Constructor Summary
Constructors Constructor Description SampleServiceImpl(SampleRepository sampleRepository, ProjectSampleJoinRepository psjRepository, AnalysisRepository analysisRepository, SampleSequencingObjectJoinRepository ssoRepository, QCEntryRepository qcEntryRepository, SequencingObjectRepository sequencingObjectRepository, SampleGenomeAssemblyJoinRepository sampleGenomeAssemblyJoinRepository, UserRepository userRepository, MetadataEntryRepository metadataEntryRepository, javax.validation.Validator validator)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Sample
create(@Valid Sample s)
Create a new object in the persistence store.java.lang.Double
estimateCoverageForSample(Sample sample, long referenceFileLength)
Given the length of a reference file, estimate the total coverage for this sample.java.lang.Double
estimateCoverageForSample(Sample sample, ReferenceFile referenceFile)
Given aReferenceFile
, estimate the total coverage for this sample.java.lang.Boolean
exists(java.lang.Long id)
Check to see if an identifier forType
exists in the database.java.util.Map<java.lang.Long,java.lang.Long>
getCoverageForSamplesInProject(Project project, java.util.List<java.lang.Long> sampleIds)
Get Coverage for samples within a project.org.springframework.data.domain.Page<ProjectSampleJoin>
getFilteredProjectSamples(java.util.List<Project> projects, ProjectSampleJoinSpecification filterSpec, int currentPage, int pageSize, org.springframework.data.domain.Sort sort)
Get aPage
ofProjectSampleJoin
for samples from 1 or more projects based on filtering criteria.org.springframework.data.domain.Page<ProjectSampleJoin>
getFilteredSamplesForProjects(java.util.List<Project> projects, java.util.List<java.lang.String> sampleNames, java.lang.String sampleName, java.lang.String searchTerm, java.lang.String organism, java.util.Date minDate, java.util.Date maxDate, int currentPage, int pageSize, org.springframework.data.domain.Sort sort)
Get aPage
ofProjectSampleJoin
for samples from 1 or more projects based on filtering criteria.java.util.List<java.lang.Long>
getLockedSamplesInProject(Project project)
Get a list ofSample
ids that are locked in this project.ProjectMetadataResponse
getMetadataForProjectSamples(Project project, java.util.List<java.lang.Long> sampleIds, java.util.List<MetadataTemplateField> fields)
Get the metadata collections for a set of samples in a project.java.util.Set<MetadataEntry>
getMetadataForSample(Sample sample)
Get theMetadataEntry
set associated with the givenSample
java.lang.Long
getNumberOfSamplesForProject(Project project)
java.util.List<QCEntry>
getQCEntriesForSample(Sample sample)
java.util.Map<java.lang.Long,java.util.List<QCEntry>>
getQCEntriesForSamples(java.util.List<Sample> samples)
Sample
getSampleBySampleName(Project project, java.lang.String sampleName)
Get theSample
with the given sample nameProjectSampleJoin
getSampleForProject(Project project, java.lang.Long sampleId)
SampleSequencingObjectJoin
getSampleForSequencingObject(SequencingObject seqObject)
Find aSample
assocaited with aSequencingObject
java.util.Map<java.lang.String,java.util.List<java.lang.Long>>
getSampleIdsBySampleNameForProjects(java.util.List<java.lang.Long> projectIds, java.util.List<java.lang.String> sampleNames)
Get theSample
identifiers with the given list of sample names from a list of projects.java.util.List<java.lang.String>
getSampleOrganismsForProject(Project project)
java.lang.Long
getSamplesCreated(java.util.Date createdDate)
Get count of samples created in the time periodjava.util.List<GenericStatModel>
getSamplesCreatedGrouped(java.util.Date createdDate, StatisticTimePeriod statisticTimePeriod)
Get list ofGenericStatModel
of samples created in the past n time period grouped by the format provided.java.util.Collection<Sample>
getSamplesForAnalysisSubmission(AnalysisSubmission submission)
Get a list of allSample
s associated with a givenAnalysisSubmission
java.util.List<Join<Project,Sample>>
getSamplesForProject(Project project)
Get the list ofSample
that belongs to a specific project.java.util.List<Sample>
getSamplesForProjectShallow(Project project)
org.springframework.data.domain.Page<ProjectSampleJoin>
getSamplesForProjectWithName(Project project, java.lang.String name, int page, int size, org.springframework.data.domain.Sort.Direction order, java.lang.String... sortProperties)
java.util.List<Sample>
getSamplesInProject(Project project, java.util.List<java.lang.Long> sampleIds)
java.lang.Long
getTotalBasesForSample(Sample sample)
Given a sample gets the total number of bases in all sequence files in this sample.Sample
mergeSampleMetadata(Sample s, java.util.Set<MetadataEntry> metadataToAdd)
Merge the given set ofMetadataEntry
into the givenSample
.Sample
mergeSamples(Project project, Sample mergeInto, java.util.Collection<Sample> toMerge)
Merge multiple samples into one.Sample
read(java.lang.Long id)
Read the object type by unique identifier.java.lang.Iterable<Sample>
readMultiple(java.lang.Iterable<java.lang.Long> idents)
Read multiple objects by the given collection of identifiersvoid
removeSequencingObjectFromSample(Sample sample, SequencingObject object)
Remove aSequencingObject
from a givenSample
.org.springframework.data.domain.Page<ProjectSampleJoin>
searchAllSamples(java.lang.String query, java.lang.Integer page, java.lang.Integer count, org.springframework.data.domain.Sort sort)
Search allSample
s in the database on the given queryorg.springframework.data.domain.Page<ProjectSampleJoin>
searchSamplesForUser(java.lang.String query, java.lang.Integer page, java.lang.Integer count, org.springframework.data.domain.Sort sort)
Search allSample
s in projects the current logged in user has access toSample
update(Sample object)
Update an objectSample
updateFields(java.lang.Long id, java.util.Map<java.lang.String,java.lang.Object> updatedFields)
Update properties of the given object by given fields.java.util.List<Sample>
updateMultiple(java.util.Collection<Sample> objects)
Update multiple objects at onceSample
updateSampleMetadata(Sample s, java.util.Set<MetadataEntry> metadataToSet)
Set the given set ofMetadataEntry
on the givenSample
and save it to the database-
Methods inherited from class ca.corefacility.bioinformatics.irida.service.impl.CRUDServiceImpl
count, delete, findAll, findRevisions, findRevisions, list, list, list, search, search
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ca.corefacility.bioinformatics.irida.service.CRUDService
count, delete, findAll, findRevisions, findRevisions, list, list, list, search, search
-
-
-
-
Constructor Detail
-
SampleServiceImpl
@Autowired public SampleServiceImpl(SampleRepository sampleRepository, ProjectSampleJoinRepository psjRepository, AnalysisRepository analysisRepository, SampleSequencingObjectJoinRepository ssoRepository, QCEntryRepository qcEntryRepository, SequencingObjectRepository sequencingObjectRepository, SampleGenomeAssemblyJoinRepository sampleGenomeAssemblyJoinRepository, UserRepository userRepository, MetadataEntryRepository metadataEntryRepository, javax.validation.Validator validator)
Constructor.- Parameters:
sampleRepository
- the sample repository.psjRepository
- the project sample join repository.analysisRepository
- the analysis repository.ssoRepository
- TheSampleSequencingObjectJoin
repositorysequencingObjectRepository
- theSequencingObject
repositoryqcEntryRepository
- a repository for storing and readingQCEntry
sampleGenomeAssemblyJoinRepository
- ASampleGenomeAssemblyJoinRepository
userRepository
- AUserRepository
metadataEntryRepository
- AMetadataEntryRepository
validator
- validator.
-
-
Method Detail
-
readMultiple
@Transactional(readOnly=true) @PreAuthorize("hasAnyRole(\'ROLE_ADMIN\', \'ROLE_SEQUENCER\') or hasPermission(#idents, \'canReadSample\')") public java.lang.Iterable<Sample> readMultiple(java.lang.Iterable<java.lang.Long> idents)
Read multiple objects by the given collection of identifiers- Specified by:
readMultiple
in interfaceCRUDService<java.lang.Long,Sample>
- Overrides:
readMultiple
in classCRUDServiceImpl<java.lang.Long,Sample>
- Parameters:
idents
- The unique identifiers of the objects to read- Returns:
- A collection of the requested objects
-
exists
@Transactional(readOnly=true) @PreAuthorize("hasAnyRole(\'ROLE_ADMIN\', \'ROLE_SEQUENCER\') or hasPermission(#id, \'canReadSample\')") public java.lang.Boolean exists(java.lang.Long id)
Check to see if an identifier forType
exists in the database.- Specified by:
exists
in interfaceCRUDService<java.lang.Long,Sample>
- Overrides:
exists
in classCRUDServiceImpl<java.lang.Long,Sample>
- Parameters:
id
- The identifier to check for.- Returns:
true
if the identifier exists,false
otherwise.
-
create
@PreAuthorize("hasAnyRole(\'ROLE_USER\', \'ROLE_SEQUENCER\')") public Sample create(@Valid @Valid Sample s)
Create a new object in the persistence store.- Specified by:
create
in interfaceCRUDService<java.lang.Long,Sample>
- Overrides:
create
in classCRUDServiceImpl<java.lang.Long,Sample>
- Parameters:
s
- The object to persist.- Returns:
- The object as it was persisted in the database. May modify the identifier of the object when returned.
-
updateFields
@PreAuthorize("hasPermission(#id, \'canUpdateSample\')") public Sample updateFields(java.lang.Long id, java.util.Map<java.lang.String,java.lang.Object> updatedFields) throws javax.validation.ConstraintViolationException, EntityExistsException, InvalidPropertyException
Update properties of the given object by given fields. The object must have a valid identifier prior to being passed to this method.- Specified by:
updateFields
in interfaceCRUDService<java.lang.Long,Sample>
- Overrides:
updateFields
in classCRUDServiceImpl<java.lang.Long,Sample>
- Parameters:
id
- The identifier of the object to update.updatedFields
- the object properties that should be updated.- Returns:
- The object as it was persisted in the database. May modify the identifier of the object when returned.
- Throws:
javax.validation.ConstraintViolationException
- If the object being persisted cannot be validated by validation rules associated with the object.EntityExistsException
- If the object being persisted violates uniqueness constraints in the database.InvalidPropertyException
- If the updated properties map contains a property name that does not exist on the domain model.
-
update
@PreAuthorize("hasPermission(#object, \'canUpdateSample\')") public Sample update(Sample object)
Update an object- Specified by:
update
in interfaceCRUDService<java.lang.Long,Sample>
- Overrides:
update
in classCRUDServiceImpl<java.lang.Long,Sample>
- Parameters:
object
- The object to update- Returns:
- The updated object
-
getMetadataForSample
@PreAuthorize("hasPermission(#sample, \'canReadSample\')") @PostFilter("hasPermission(filterObject, \'canReadMetadataEntry\')") public java.util.Set<MetadataEntry> getMetadataForSample(Sample sample)
Get theMetadataEntry
set associated with the givenSample
- Specified by:
getMetadataForSample
in interfaceSampleService
- Parameters:
sample
- theSample
to get metadata for- Returns:
- the metadata associated with the given sample
-
getLockedSamplesInProject
@PreAuthorize("hasPermission(#project, \'canReadProject\')") public java.util.List<java.lang.Long> getLockedSamplesInProject(Project project)
Get a list ofSample
ids that are locked in this project. This method exists as a faster way of determining ownership than getting the fullProjectSampleJoin
- Specified by:
getLockedSamplesInProject
in interfaceSampleService
- Parameters:
project
- theProject
to check- Returns:
- a List of locked sample IDs.
-
getMetadataForProjectSamples
@PreAuthorize("hasPermission(#project, \'canReadProject\')") @PostAuthorize("hasPermission(returnObject,\'readProjectMetadataResponse\')") public ProjectMetadataResponse getMetadataForProjectSamples(Project project, java.util.List<java.lang.Long> sampleIds, java.util.List<MetadataTemplateField> fields)
Get the metadata collections for a set of samples in a project. This will return a Map ofSample
ID with a Set of theMetadataEntry
s- Specified by:
getMetadataForProjectSamples
in interfaceSampleService
- Parameters:
project
- theProject
to get metadata forsampleIds
- theSample
ids to get metadata forfields
- the fields to get metadata from in the project. This must not be empty.- Returns:
- a map of metadata
-
updateSampleMetadata
@PreAuthorize("hasPermission(#s, \'canUpdateSample\')") @Transactional public Sample updateSampleMetadata(Sample s, java.util.Set<MetadataEntry> metadataToSet)
Set the given set ofMetadataEntry
on the givenSample
and save it to the database- Specified by:
updateSampleMetadata
in interfaceSampleService
- Parameters:
s
- theSample
to save metadata formetadataToSet
- the metadata to save to the sample- Returns:
- the updated
Sample
-
mergeSampleMetadata
@PreAuthorize("hasPermission(#s, \'canUpdateSample\')") @Transactional public Sample mergeSampleMetadata(Sample s, java.util.Set<MetadataEntry> metadataToAdd)
Merge the given set ofMetadataEntry
into the givenSample
. This will replace existing metadata that matches and add the new data to the sample.- Specified by:
mergeSampleMetadata
in interfaceSampleService
- Parameters:
s
- the sample to updatemetadataToAdd
- the metadata to add- Returns:
- the updated Sample
-
getSampleForProject
@Transactional(readOnly=true) @PreAuthorize("hasAnyRole(\'ROLE_ADMIN\',\'ROLE_SEQUENCER\') or (hasPermission(#project, \'canReadProject\') and hasPermission(#sampleId, \'canReadSample\'))") public ProjectSampleJoin getSampleForProject(Project project, java.lang.Long sampleId)
Get a specific instance of aSample
that belongs to aProject
. If theSample
is not associated to theProject
(i.e., no relationship is shared between theSample
andProject
, then anEntityNotFoundException
will be thrown.- Specified by:
getSampleForProject
in interfaceSampleService
- Parameters:
project
- theProject
to get theSample
for.sampleId
- the identifier of theSample
- Returns:
- the
ProjectSampleJoin
describing the relationship between projet and sample
-
getSampleOrganismsForProject
@PreAuthorize("hasPermission(#project, \'canReadProject\')") public java.util.List<java.lang.String> getSampleOrganismsForProject(Project project)
- Specified by:
getSampleOrganismsForProject
in interfaceSampleService
- Parameters:
project
- theProject
to get sample organisms for- Returns:
- a list of sample organisms
-
getSampleForSequencingObject
@PreAuthorize("hasPermission(#seqObject, \'canReadSequencingObject\')") public SampleSequencingObjectJoin getSampleForSequencingObject(SequencingObject seqObject)
Find aSample
assocaited with aSequencingObject
- Specified by:
getSampleForSequencingObject
in interfaceSampleService
- Parameters:
seqObject
- theSequencingObject
to get theSample
for- Returns:
- the
SampleSequencingObjectJoin
describing the relationship
-
getSampleBySampleName
@Transactional(readOnly=true) @PreAuthorize("hasAnyRole(\'ROLE_ADMIN\', \'ROLE_SEQUENCER\') or hasPermission(#project, \'canReadProject\')") public Sample getSampleBySampleName(Project project, java.lang.String sampleName)
Get theSample
with the given sample name- Specified by:
getSampleBySampleName
in interfaceSampleService
- Parameters:
project
- theProject
that theSample
belongs to.sampleName
- The name for the requested sample- Returns:
- A
Sample
with the given ID
-
getSampleIdsBySampleNameForProjects
@Transactional(readOnly=true) @PreAuthorize("hasAnyRole(\'ROLE_ADMIN\', \'ROLE_SEQUENCER\') or hasPermission(#project, \'canReadProject\')") public java.util.Map<java.lang.String,java.util.List<java.lang.Long>> getSampleIdsBySampleNameForProjects(java.util.List<java.lang.Long> projectIds, java.util.List<java.lang.String> sampleNames)
Get theSample
identifiers with the given list of sample names from a list of projects.- Specified by:
getSampleIdsBySampleNameForProjects
in interfaceSampleService
- Parameters:
projectIds
- TheProject
identifiers that theSample
belongs to.sampleNames
- The list of sample names- Returns:
- A list of
Sample
identifiers
-
removeSequencingObjectFromSample
@Transactional @PreAuthorize("hasPermission(#sample, \'canUpdateSample\')") public void removeSequencingObjectFromSample(Sample sample, SequencingObject object)
Remove aSequencingObject
from a givenSample
. This will delete theSampleSequencingObjectJoin
object- Specified by:
removeSequencingObjectFromSample
in interfaceSampleService
- Parameters:
sample
-Sample
to remove sequences fromobject
-SequencingObject
to remove
-
getSamplesForProject
@Transactional(readOnly=true) @PreAuthorize("hasRole(\'ROLE_ADMIN\') or hasPermission(#project, \'canReadProject\')") public java.util.List<Join<Project,Sample>> getSamplesForProject(Project project)
Get the list ofSample
that belongs to a specific project.- Specified by:
getSamplesForProject
in interfaceSampleService
- Parameters:
project
- theProject
to get samples for.- Returns:
- the collection of samples for the
Project
.
-
getSamplesForProjectShallow
@Transactional(readOnly=true) @PreAuthorize("hasRole(\'ROLE_ADMIN\') or hasPermission(#project, \'canReadProject\')") public java.util.List<Sample> getSamplesForProjectShallow(Project project)
Description copied from interface:SampleService
Get a shallow listing of theSample
s in aProject
. Note: This method will not return any metadata or associated objects.- Specified by:
getSamplesForProjectShallow
in interfaceSampleService
- Parameters:
project
- TheProject
to get samples for- Returns:
- a List of
Sample
-
getSamplesInProject
@Transactional(readOnly=true) @PreAuthorize("hasRole(\'ROLE_ADMIN\') or hasPermission(#project, \'canReadProject\')") public java.util.List<Sample> getSamplesInProject(Project project, java.util.List<java.lang.Long> sampleIds)
- Specified by:
getSamplesInProject
in interfaceSampleService
- Parameters:
project
-Project
to get samples for.sampleIds
- List ofSample
ids.- Returns:
- List of Samples from a
Project
.
-
getNumberOfSamplesForProject
@Transactional(readOnly=true) @PreAuthorize("hasRole(\'ROLE_ADMIN\') or hasPermission(#project, \'canReadProject\')") public java.lang.Long getNumberOfSamplesForProject(Project project)
Get the number ofSample
s for a givenProject
. This method will be faster than getSamplesForProjects- Specified by:
getNumberOfSamplesForProject
in interfaceSampleService
- Parameters:
project
- The project to get samples for- Returns:
- The number of
Sample
s in a givenProject
-
mergeSamples
@Transactional @PreAuthorize("hasPermission(#project, \'isProjectOwner\') and hasPermission(#mergeInto, \'canUpdateSample\') and hasPermission(#toMerge, \'canUpdateSample\')") public Sample mergeSamples(Project project, Sample mergeInto, java.util.Collection<Sample> toMerge)
Merge multiple samples into one. Merging samples copies theSequenceFile
references from the set of samples into one sample. The collection of samples intoMerge
are marked as deleted. All samples must be associated with the specified project. The relationship between each sample intoMerge
and the project p will be deleted.- Specified by:
mergeSamples
in interfaceSampleService
- Parameters:
project
- theProject
that all samples must belong to.mergeInto
- theSample
to merge other samples into.toMerge
- the collection ofSample
to merge.- Returns:
- the completely merged
Sample
(the persisted version ofmergeInto
).
-
read
@PreAuthorize("hasAnyRole(\'ROLE_ADMIN\', \'ROLE_SEQUENCER\') or hasPermission(#id, \'canReadSample\')") public Sample read(java.lang.Long id)
Read the object type by unique identifier.- Specified by:
read
in interfaceCRUDService<java.lang.Long,Sample>
- Overrides:
read
in classCRUDServiceImpl<java.lang.Long,Sample>
- Parameters:
id
- The unique identifier for this object.- Returns:
- The object corresponding to the unique identifier.
-
getSamplesForProjectWithName
@PreAuthorize("hasAnyRole(\'ROLE_ADMIN\') or hasPermission(#project, \'canReadProject\')") public org.springframework.data.domain.Page<ProjectSampleJoin> getSamplesForProjectWithName(Project project, java.lang.String name, int page, int size, org.springframework.data.domain.Sort.Direction order, java.lang.String... sortProperties)
- Specified by:
getSamplesForProjectWithName
in interfaceSampleService
- Parameters:
project
- The project to read fromname
- The sample name to searchpage
- The page numbersize
- The size of the pageorder
- The order of the pagesortProperties
- The properties to sort on- Returns:
- A
Page
ofJoin
s betweenProject
andSample
-
getTotalBasesForSample
@Transactional(readOnly=true) @PreAuthorize("hasRole(\'ROLE_ADMIN\') or hasPermission(#sample, \'canReadSample\')") public java.lang.Long getTotalBasesForSample(Sample sample) throws SequenceFileAnalysisException
Given a sample gets the total number of bases in all sequence files in this sample.- Specified by:
getTotalBasesForSample
in interfaceSampleService
- Parameters:
sample
- The sample to find the total number of bases.- Returns:
- The total number of bases in all sequence files in this sample.
- Throws:
SequenceFileAnalysisException
- If there was an error getting FastQC analyses for a sequence file.
-
estimateCoverageForSample
@Transactional(readOnly=true) @PreAuthorize("hasRole(\'ROLE_ADMIN\') or hasPermission(#sample, \'canReadSample\')") public java.lang.Double estimateCoverageForSample(Sample sample, long referenceFileLength) throws SequenceFileAnalysisException
Given the length of a reference file, estimate the total coverage for this sample.- Specified by:
estimateCoverageForSample
in interfaceSampleService
- Parameters:
sample
- The sample to estimate coverage for.referenceFileLength
- The length of the reference file in bases.- Returns:
- The estimate coverage of all sequence data in this sample.
- Throws:
SequenceFileAnalysisException
- If there was an error getting FastQC analyses for a sequence file.
-
estimateCoverageForSample
@Transactional(readOnly=true) @PreAuthorize("hasRole(\'ROLE_ADMIN\') or hasPermission(#sample, \'canReadSample\')") public java.lang.Double estimateCoverageForSample(Sample sample, ReferenceFile referenceFile) throws SequenceFileAnalysisException
Given aReferenceFile
, estimate the total coverage for this sample.- Specified by:
estimateCoverageForSample
in interfaceSampleService
- Parameters:
sample
- The sample to estimate coverage for.referenceFile
- TheReferenceFile
to estimate coverage for.- Returns:
- The estimate coverage of all sequence data in this sample.
- Throws:
SequenceFileAnalysisException
- If there was an error getting FastQC analyses for a sequence file.
-
getFilteredProjectSamples
@PreAuthorize("hasAnyRole(\'ROLE_ADMIN\') or hasPermission(#projects, \'canReadProject\')") public org.springframework.data.domain.Page<ProjectSampleJoin> getFilteredProjectSamples(java.util.List<Project> projects, ProjectSampleJoinSpecification filterSpec, int currentPage, int pageSize, org.springframework.data.domain.Sort sort)
Get aPage
ofProjectSampleJoin
for samples from 1 or more projects based on filtering criteria.- Specified by:
getFilteredProjectSamples
in interfaceSampleService
- Parameters:
projects
-List
ofProject
theSample
s must be found within.filterSpec
-ProjectSampleJoinSpecification
currentPage
-Integer
the current page the table is on.pageSize
-Integer
the number ofProjectSampleJoin
in thePage
.sort
-Sort
chained sort definitions to sort page by.- Returns:
- a
Page
ofProjectSampleJoin
that are filtered and sorted.
-
getFilteredSamplesForProjects
@PreAuthorize("hasAnyRole(\'ROLE_ADMIN\') or hasPermission(#projects, \'canReadProject\')") public org.springframework.data.domain.Page<ProjectSampleJoin> getFilteredSamplesForProjects(java.util.List<Project> projects, java.util.List<java.lang.String> sampleNames, java.lang.String sampleName, java.lang.String searchTerm, java.lang.String organism, java.util.Date minDate, java.util.Date maxDate, int currentPage, int pageSize, org.springframework.data.domain.Sort sort)
Get aPage
ofProjectSampleJoin
for samples from 1 or more projects based on filtering criteria.- Specified by:
getFilteredSamplesForProjects
in interfaceSampleService
- Parameters:
projects
-List
ofProject
theSample
s must be found within.sampleNames
-List
ofString
of Sample names to searchsampleName
-String
exact name of a specificSample
searchTerm
-String
search term to search for.organism
-String
organism ter to search for.minDate
-Date
minimum date the sample was modified.maxDate
-Date
maximum date the sample was modified.currentPage
-Integer
the current page the table is on.pageSize
-Integer
the number ofProjectSampleJoin
in thePage
.sort
-Sort
chained sort definitions to sort page by.- Returns:
- a
Page
ofProjectSampleJoin
that are filtered and sorted.
-
getSamplesForAnalysisSubmission
@PreAuthorize("hasPermission(#submission, \'canReadAnalysisSubmission\')") @PostFilter("hasPermission(filterObject, \'canReadSample\')") public java.util.Collection<Sample> getSamplesForAnalysisSubmission(AnalysisSubmission submission)
Get a list of allSample
s associated with a givenAnalysisSubmission
- Specified by:
getSamplesForAnalysisSubmission
in interfaceSampleService
- Parameters:
submission
- theAnalysisSubmission
- Returns:
- a Collection of
Sample
-
getQCEntriesForSample
@Transactional(readOnly=true) @PreAuthorize("hasRole(\'ROLE_ADMIN\') or hasPermission(#sample, \'canReadSample\')") public java.util.List<QCEntry> getQCEntriesForSample(Sample sample)
- Specified by:
getQCEntriesForSample
in interfaceSampleService
- Parameters:
sample
- theSample
to getQCEntry
for- Returns:
- a list of
QCEntry
-
getQCEntriesForSamples
@Transactional(readOnly=true) @PreAuthorize("hasRole(\'ROLE_ADMIN\') or hasPermission(#samples, \'canReadSample\')") public java.util.Map<java.lang.Long,java.util.List<QCEntry>> getQCEntriesForSamples(java.util.List<Sample> samples)
- Specified by:
getQCEntriesForSamples
in interfaceSampleService
- Parameters:
samples
- theSample
s to getQCEntry
s for- Returns:
- a map of sample id to
QCEntry
s
-
updateMultiple
@PreAuthorize("hasPermission(#objects, \'canUpdateSample\')") public java.util.List<Sample> updateMultiple(java.util.Collection<Sample> objects)
Update multiple objects at once- Specified by:
updateMultiple
in interfaceCRUDService<java.lang.Long,Sample>
- Overrides:
updateMultiple
in classCRUDServiceImpl<java.lang.Long,Sample>
- Parameters:
objects
- the objects to update- Returns:
- the updated objects
-
searchSamplesForUser
@PreAuthorize("permitAll()") public org.springframework.data.domain.Page<ProjectSampleJoin> searchSamplesForUser(java.lang.String query, java.lang.Integer page, java.lang.Integer count, org.springframework.data.domain.Sort sort)
Search allSample
s in projects the current logged in user has access to- Specified by:
searchSamplesForUser
in interfaceSampleService
- Parameters:
query
- the query string to searchpage
- which page to returncount
- the number of entities to returnsort
- how to sort the result- Returns:
- a page of
ProjectSampleJoin
-
searchAllSamples
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") public org.springframework.data.domain.Page<ProjectSampleJoin> searchAllSamples(java.lang.String query, java.lang.Integer page, java.lang.Integer count, org.springframework.data.domain.Sort sort)
Search allSample
s in the database on the given query- Specified by:
searchAllSamples
in interfaceSampleService
- Parameters:
query
- the query string to searchpage
- which page to returncount
- the number of entities to returnsort
- how to sort the result- Returns:
- a page of
ProjectSampleJoin
-
getSamplesCreated
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") public java.lang.Long getSamplesCreated(java.util.Date createdDate)
Get count of samples created in the time period- Specified by:
getSamplesCreated
in interfaceSampleService
- Parameters:
createdDate
- the minimum date for samples created- Returns:
- An
Long
count of samples created
-
getSamplesCreatedGrouped
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") public java.util.List<GenericStatModel> getSamplesCreatedGrouped(java.util.Date createdDate, StatisticTimePeriod statisticTimePeriod)
Get list ofGenericStatModel
of samples created in the past n time period grouped by the format provided.- Specified by:
getSamplesCreatedGrouped
in interfaceSampleService
- Parameters:
createdDate
- the minimum date for samples createdstatisticTimePeriod
- the enum containing format for which to group the results by- Returns:
- An
GenericStatModel
list
-
getCoverageForSamplesInProject
@Transactional(readOnly=true) @PreAuthorize("hasRole(\'ROLE_ADMIN\') or hasPermission(#project, \'canReadProject\')") public java.util.Map<java.lang.Long,java.lang.Long> getCoverageForSamplesInProject(Project project, java.util.List<java.lang.Long> sampleIds)
Get Coverage for samples within a project.- Specified by:
getCoverageForSamplesInProject
in interfaceSampleService
- Parameters:
project
- theProject
to use to calculate the coveragesampleIds
- theSample
ids to get coverage for- Returns:
- a map of sample id to coverage value
-
-