Interface SampleService
-
- All Superinterfaces:
CRUDService<java.lang.Long,Sample>
- All Known Implementing Classes:
SampleServiceImpl
public interface SampleService extends CRUDService<java.lang.Long,Sample>
A service class for working with samples.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.DoubleestimateCoverageForSample(Sample sample, long referenceFileLength)Given the length of a reference file, estimate the total coverage for this sample.java.lang.DoubleestimateCoverageForSample(Sample sample, ReferenceFile referenceFile)Given aReferenceFile, estimate the total coverage for this sample.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 aPageofProjectSampleJoinfor 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 aPageofProjectSampleJoinfor samples from 1 or more projects based on filtering criteria.java.util.List<java.lang.Long>getLockedSamplesInProject(Project project)Get a list ofSampleids that are locked in this project.ProjectMetadataResponsegetMetadataForProjectSamples(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 theMetadataEntryset associated with the givenSamplejava.lang.LonggetNumberOfSamplesForProject(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)SamplegetSampleBySampleName(Project project, java.lang.String sampleName)Get theSamplewith the given sample nameProjectSampleJoingetSampleForProject(Project project, java.lang.Long identifier)SampleSequencingObjectJoingetSampleForSequencingObject(SequencingObject seqObject)Find aSampleassocaited with aSequencingObjectjava.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 theSampleidentifiers with the given list of sample names from a list of projects.java.util.List<java.lang.String>getSampleOrganismsForProject(Project project)java.lang.LonggetSamplesCreated(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 ofGenericStatModelof samples created in the past n time period grouped by the format provided.java.util.Collection<Sample>getSamplesForAnalysisSubmission(AnalysisSubmission submission)Get a list of allSamples associated with a givenAnalysisSubmissionjava.util.List<Join<Project,Sample>>getSamplesForProject(Project project)Get the list ofSamplethat 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.LonggetTotalBasesForSample(Sample sample)Given a sample gets the total number of bases in all sequence files in this sample.SamplemergeSampleMetadata(Sample sample, java.util.Set<MetadataEntry> metadataToAdd)Merge the given set ofMetadataEntryinto the givenSample.SamplemergeSamples(Project p, Sample mergeInto, java.util.Collection<Sample> toMerge)Merge multiple samples into one.voidremoveSequencingObjectFromSample(Sample sample, SequencingObject object)Remove aSequencingObjectfrom 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 allSamples 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 allSamples in projects the current logged in user has access toSampleupdateSampleMetadata(Sample sample, java.util.Set<MetadataEntry> metadataToSet)Set the given set ofMetadataEntryon the givenSampleand save it to the database-
Methods inherited from interface ca.corefacility.bioinformatics.irida.service.CRUDService
count, create, delete, exists, findAll, findRevisions, findRevisions, list, list, list, read, readMultiple, search, search, update, updateFields, updateMultiple
-
-
-
-
Method Detail
-
getSampleForProject
ProjectSampleJoin getSampleForProject(Project project, java.lang.Long identifier) throws EntityNotFoundException
Get a specific instance of aSamplethat belongs to aProject. If theSampleis not associated to theProject(i.e., no relationship is shared between theSampleandProject, then anEntityNotFoundExceptionwill be thrown.- Parameters:
project- theProjectto get theSamplefor.identifier- the identifier of theSample- Returns:
- the
ProjectSampleJoindescribing the relationship between projet and sample - Throws:
EntityNotFoundException- if no relationship exists betweenSampleandProject.
-
updateSampleMetadata
Sample updateSampleMetadata(Sample sample, java.util.Set<MetadataEntry> metadataToSet)
Set the given set ofMetadataEntryon the givenSampleand save it to the database
-
mergeSampleMetadata
Sample mergeSampleMetadata(Sample sample, java.util.Set<MetadataEntry> metadataToAdd)
Merge the given set ofMetadataEntryinto the givenSample. This will replace existing metadata that matches and add the new data to the sample.- Parameters:
sample- the sample to updatemetadataToAdd- the metadata to add- Returns:
- the updated Sample
-
getMetadataForSample
java.util.Set<MetadataEntry> getMetadataForSample(Sample sample)
Get theMetadataEntryset associated with the givenSample- Parameters:
sample- theSampleto get metadata for- Returns:
- the metadata associated with the given sample
-
getLockedSamplesInProject
java.util.List<java.lang.Long> getLockedSamplesInProject(Project project)
Get a list ofSampleids that are locked in this project. This method exists as a faster way of determining ownership than getting the fullProjectSampleJoin- Parameters:
project- theProjectto check- Returns:
- a List of locked sample IDs.
-
getMetadataForProjectSamples
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 ofSampleID with a Set of theMetadataEntrys
-
getSampleForSequencingObject
SampleSequencingObjectJoin getSampleForSequencingObject(SequencingObject seqObject)
Find aSampleassocaited with aSequencingObject- Parameters:
seqObject- theSequencingObjectto get theSamplefor- Returns:
- the
SampleSequencingObjectJoindescribing the relationship
-
getSamplesForProject
java.util.List<Join<Project,Sample>> getSamplesForProject(Project project)
Get the list ofSamplethat belongs to a specific project.
-
getSamplesInProject
java.util.List<Sample> getSamplesInProject(Project project, java.util.List<java.lang.Long> sampleIds)
-
getSampleOrganismsForProject
java.util.List<java.lang.String> getSampleOrganismsForProject(Project project)
- Parameters:
project- theProjectto get sample organisms for- Returns:
- a list of sample organisms
-
getNumberOfSamplesForProject
java.lang.Long getNumberOfSamplesForProject(Project project)
-
getSamplesForProjectWithName
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)
-
getSampleBySampleName
Sample getSampleBySampleName(Project project, java.lang.String sampleName)
Get theSamplewith the given sample name
-
getSampleIdsBySampleNameForProjects
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 theSampleidentifiers with the given list of sample names from a list of projects.
-
removeSequencingObjectFromSample
void removeSequencingObjectFromSample(Sample sample, SequencingObject object)
Remove aSequencingObjectfrom a givenSample. This will delete theSampleSequencingObjectJoinobject- Parameters:
sample-Sampleto remove sequences fromobject-SequencingObjectto remove
-
mergeSamples
Sample mergeSamples(Project p, Sample mergeInto, java.util.Collection<Sample> toMerge)
Merge multiple samples into one. Merging samples copies theSequenceFilereferences from the set of samples into one sample. The collection of samples intoMergeare marked as deleted. All samples must be associated with the specified project. The relationship between each sample intoMergeand the project p will be deleted.
-
getTotalBasesForSample
java.lang.Long getTotalBasesForSample(Sample sample) throws SequenceFileAnalysisException
Given a sample gets the total number of bases in all sequence files in this sample.- 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
java.lang.Double estimateCoverageForSample(Sample sample, long referenceFileLength) throws SequenceFileAnalysisException
Given the length of a reference file, estimate the total coverage for this sample.- 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
java.lang.Double estimateCoverageForSample(Sample sample, ReferenceFile referenceFile) throws SequenceFileAnalysisException
Given aReferenceFile, estimate the total coverage for this sample.- Parameters:
sample- The sample to estimate coverage for.referenceFile- TheReferenceFileto 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
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 aPageofProjectSampleJoinfor samples from 1 or more projects based on filtering criteria.- Parameters:
projects-ListofProjecttheSamples must be found within.filterSpec-ProjectSampleJoinSpecificationcurrentPage-Integerthe current page the table is on.pageSize-Integerthe number ofProjectSampleJoinin thePage.sort-Sortchained sort definitions to sort page by.- Returns:
- a
PageofProjectSampleJointhat are filtered and sorted.
-
getFilteredSamplesForProjects
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 aPageofProjectSampleJoinfor samples from 1 or more projects based on filtering criteria.- Parameters:
projects-ListofProjecttheSamples must be found within.sampleNames-ListofStringof Sample names to searchsampleName-Stringexact name of a specificSamplesearchTerm-Stringsearch term to search for.organism-Stringorganism ter to search for.minDate-Dateminimum date the sample was modified.maxDate-Datemaximum date the sample was modified.currentPage-Integerthe current page the table is on.pageSize-Integerthe number ofProjectSampleJoinin thePage.sort-Sortchained sort definitions to sort page by.- Returns:
- a
PageofProjectSampleJointhat are filtered and sorted.
-
getSamplesForAnalysisSubmission
java.util.Collection<Sample> getSamplesForAnalysisSubmission(AnalysisSubmission submission)
Get a list of allSamples associated with a givenAnalysisSubmission- Parameters:
submission- theAnalysisSubmission- Returns:
- a Collection of
Sample
-
getQCEntriesForSamples
java.util.Map<java.lang.Long,java.util.List<QCEntry>> getQCEntriesForSamples(java.util.List<Sample> samples)
-
searchSamplesForUser
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 allSamples in projects the current logged in user has access to- 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
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 allSamples in the database on the given query- 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
java.lang.Long getSamplesCreated(java.util.Date createdDate)
Get count of samples created in the time period- Parameters:
createdDate- the minimum date for samples created- Returns:
- An
Longcount of samples created
-
getSamplesCreatedGrouped
java.util.List<GenericStatModel> getSamplesCreatedGrouped(java.util.Date createdDate, StatisticTimePeriod statisticTimePeriod)
Get list ofGenericStatModelof samples created in the past n time period grouped by the format provided.- Parameters:
createdDate- the minimum date for samples createdstatisticTimePeriod- the enum containing format for which to group the results by- Returns:
- An
GenericStatModellist
-
getCoverageForSamplesInProject
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.
-
-