class BestPracticeAnalysisService(object):
    def __init__(self, general_project_repo):
        self.general_project_repo = general_project_repo
        self.file_system_service = FileSystemService()

    def get_samples(self, project_name):
        project = self.general_project_repo.get_project(
            project_name=project_name)
        for directory in self.file_system_service.list_directories(
                project.path):
            if self.file_system_service.isfile("{}.lst".format(directory)) and \
                    self.file_system_service.isfile("{}.md5".format(directory)):
                yield self.file_system_service.basename(directory)
 def __init__(self, base_path, file_system_service=FileSystemService()):
     """
     Instantiate a new FileSystemBasedRunfolderRepository
     :param base_path: the directory where runfolders are stored
     :param file_system_service: a service which can access the file system.
     """
     self._base_path = base_path
     self.file_system_service = file_system_service
Exemplo n.º 3
0
 def __init__(self, root_directory, filesystem_service=FileSystemService()):
     """
     Instantiate a `GeneralProjectRepository` instance
     :param root_directory: directory in which to look for projects
     :param filesystem_service: a file system service used to interact with the file system, defaults to
     `FileSystemService`
     """
     self.root_directory = root_directory
     self.filesystem_service = filesystem_service
Exemplo n.º 4
0
 def __init__(self,
              runfolder_service,
              file_system_service=FileSystemService()):
     """
     Instantiate a new OrganiseService
     :param runfolder_service: an instance of a RunfolderService
     :param file_system_service: an instance of FileSystemService
     """
     self.runfolder_service = runfolder_service
     self.file_system_service = file_system_service
 def __init__(self,
              session_factory,
              file_system_service=FileSystemService()):
     """
     Instantiate a new DatabaseBasedStagingRepository
     :param session_factory: factory method which can produce new sqlalchemy Session objects
     :param file_system_service: a service for accessing the file system. Mostly shadows normal
                                 stdlib methods for accessing the file system, but this allows for easier mocking
                                 in tests.
     """
     self.session = session_factory()
     self.file_system_service = file_system_service
Exemplo n.º 6
0
    def __init__(self,
                 sample_repository,
                 filesystem_service=FileSystemService(),
                 metadata_service=MetadataService()):
        """
        Instantiate a new UnorganisedRunfolderProjectRepository object

        :param sample_repository: a RunfolderProjectBasedSampleRepository instance
        :param filesystem_service:  a FileSystemService instance for accessing the file system
        """
        self.filesystem_service = filesystem_service
        self.sample_repository = sample_repository
        self.metadata_service = metadata_service
Exemplo n.º 7
0
 def __init__(self,
              delivery_sources_repo,
              general_project_repo,
              runfolder_service,
              staging_service,
              mover_service,
              project_links_directory,
              file_system_service=FileSystemService()):
     self.delivery_sources_repo = delivery_sources_repo
     self.staging_service = staging_service
     self.mover_service = mover_service
     self.general_project_repo = general_project_repo
     self.runfolder_service = runfolder_service
     self.project_links_directory = project_links_directory
     self.file_system_service = file_system_service
    def __init__(
            self,
            base_path,
            project_repository,
            file_system_service=FileSystemService(),
            metadata_service=MetadataService()):
        """
        Instantiate a new `FileSystemBasedUnorganisedRunfolderRepository` object.

        :param base_path: the directory where runfolders are stored
        :param project_repository: an instance of UnorganisedRunfolderProjectRepository
        :param file_system_service: a service which can access the file system
        """
        super(FileSystemBasedUnorganisedRunfolderRepository, self).__init__(
            base_path,
            file_system_service=file_system_service,
            metadata_service=metadata_service)
        self.project_repository = project_repository
Exemplo n.º 9
0
 def _assert_is_dir(directory):
     if not FileSystemService.isdir(directory):
         raise AssertionError("{} is not a directory".format(
             os.path.abspath(directory)))
 def __init__(self, general_project_repo):
     self.general_project_repo = general_project_repo
     self.file_system_service = FileSystemService()
Exemplo n.º 11
0
 def __init__(self, file_system_service=FileSystemService()):
     self.file_system_service = file_system_service
Exemplo n.º 12
0
 def test_list_files_recursively(self):
     self.assertListEqual(
         sorted(self.files),
         sorted(
             list(FileSystemService().list_files_recursively(
                 self.rootdir))))