Interface SampleRepository

  • All Superinterfaces:
    org.springframework.data.repository.CrudRepository<Sample,​java.lang.Long>, IridaJpaRepository<Sample,​java.lang.Long>, org.springframework.data.jpa.repository.JpaSpecificationExecutor<Sample>, org.springframework.data.repository.PagingAndSortingRepository<Sample,​java.lang.Long>, org.springframework.data.repository.Repository<Sample,​java.lang.Long>, org.springframework.data.repository.history.RevisionRepository<Sample,​java.lang.Long,​java.lang.Integer>, SampleRepositoryCustom

    public interface SampleRepository
    extends IridaJpaRepository<Sample,​java.lang.Long>, SampleRepositoryCustom
    A repository for storing Sample objects
    • Method Detail

      • getSamplesForProjectShallow

        @EntityGraph(value="sampleOnly",
                     type=FETCH)
        @Query("select j.sample from ProjectSampleJoin j where j.project = ?1")
        java.util.List<Sample> getSamplesForProjectShallow​(Project project)
        Get the Samples associated with a Project
        Parameters:
        project - The Project
        Returns:
        the list of associated Samples
      • getSampleBySampleName

        @Query("select j.sample from ProjectSampleJoin j where j.project = ?1 and j.sample.sampleName = ?2")
        Sample getSampleBySampleName​(Project p,
                                     java.lang.String sampleName)
                              throws EntityNotFoundException
        Get a Sample with the given string sample name from a specific project.
        Parameters:
        p - The Project that the Sample belongs to.
        sampleName - The string sample name for a sample
        Returns:
        The Sample for this identifier
        Throws:
        EntityNotFoundException - if a sample with this identifier doesn't exist
      • getSampleIdsBySampleNameInProjects

        @Query("select j.sample.sampleName, j.sample.id from ProjectSampleJoin j where j.project.id in ?1 and j.sample.sampleName in ?2")
        java.util.List<javax.persistence.Tuple> getSampleIdsBySampleNameInProjects​(java.util.List<java.lang.Long> projectIds,
                                                                                   java.util.List<java.lang.String> sampleNames)
                                                                            throws EntityNotFoundException
        Get the Sample identifiers with the given list of sample names from a list of projects.
        Parameters:
        projectIds - The Project identifiers that the Sample belongs to.
        sampleNames - The list of sample names
        Returns:
        A list of Sample identifiers
        Throws:
        EntityNotFoundException - if a sample with this identifier doesn't exist
      • findSampleByNameInProject

        @Query("select j from ProjectSampleJoin j where j.project = ?1 and j.sample.sampleName in ?2")
        org.springframework.data.domain.Page<ProjectSampleJoin> findSampleByNameInProject​(Project project,
                                                                                          java.util.List<java.lang.String> sampleNames,
                                                                                          org.springframework.data.domain.Pageable pageable)
        Get a Page of Samples based on a list of Sample names
        Parameters:
        project - The Project that the Sample belongs to.
        sampleNames - A List of String sample names
        pageable - Pageable information about which Samples to retrun
        Returns:
        The Page of ProjectSampleJoin
      • findSamplesForAnalysisSubmission

        @Query("SELECT j.sample FROM SampleSequencingObjectJoin j WHERE ?1 in elements(j.sequencingObject.analysisSubmissions)")
        java.util.Set<Sample> findSamplesForAnalysisSubmission​(AnalysisSubmission analysisSubmission)
        Get the Samples associated with a given AnalysisSubmission
        Parameters:
        analysisSubmission - the AnalysisSubmission.
        Returns:
        the set of associated Samples
      • countSamplesCreatedInTimePeriod

        @Query("select count(s.id) from Sample s where s.createdDate >= ?1")
        java.lang.Long countSamplesCreatedInTimePeriod​(java.util.Date createdDate)
        Get a count of all Samples created within time period
        Parameters:
        createdDate - the minimum created date for samples
        Returns:
        a count of Samples
      • countSamplesCreatedGrouped

        @Query("select new ca.corefacility.bioinformatics.irida.ria.web.admin.dto.statistics.GenericStatModel(function(\'date_format\', s.createdDate, ?2), count(s.id))from Sample s where s.createdDate >= ?1 group by function(\'date_format\', s.createdDate, ?2) order by function(\'date_format\', s.createdDate, ?2) asc")
        java.util.List<GenericStatModel> countSamplesCreatedGrouped​(java.util.Date createdDate,
                                                                    java.lang.String groupByFormat)
        Get a list of GenericStatModels for samples created in the past n time period and grouped by the format provided.
        Parameters:
        createdDate - The minimum created date for samples
        groupByFormat - the format for which to group the results by
        Returns:
        A list of GenericStatModels