Esempio n. 1
0
 def create_project(self, version):
     """Create a new project."""
     sys.stdout.write(
         "   ___  _______   ___                 __  _\n"
         "  / _ \\/ __/ _ | / _ \\___ __ _  ___  / /_(_)__  ___\n"
         " / , _/ _// __ |/ // / -_)  ' \\/ _ \\/ __/ / _ \\/ _ \\\n"
         "/_/|_/___/_/ |_/____/\\__/_/_/_/ .__/\\__/_/\\___/_//_/\n"
         "                             / /\n"
         "====================================================\n"
         "========================================\n"
         "=======================\n"
         "==============\n\n"
         "[https://reademption.readthedocs.io/en/latest/]\n\n")
     project_creator = ProjectCreator()
     project_creator.create_root_folder(self._args.project_path)
     project_creator.create_subfolders(self._paths.required_folders())
     project_creator.create_version_file(self._paths.version_path, version)
     sys.stdout.write('Created folder "%s" and required subfolders.\n' %
                      (self._args.project_path))
     sys.stdout.write(
         'Please copy read files into folder "%s" and '
         'reference sequences files into folder "%s".\n' %
         (self._paths.read_fasta_folder, self._paths.ref_seq_folder))
Esempio n. 2
0
def test_project_creator():
    # Import Object & define dummy project name
    root_folder_name = "a_test_project"
    projectcreator = ProjectCreator()

    # Test root folder creation
    projectcreator.create_root_folder(root_folder_name)
    assert os.path.exists(root_folder_name)
    shutil.rmtree(root_folder_name)

    # Test subfolder creation
    projectcreator.create_root_folder(root_folder_name)
    subfolders = ["test_a", "test_b", "test_c"]
    subfolders = [
        root_folder_name + "/" + subfolder for subfolder in subfolders
    ]
    projectcreator.create_subfolders(subfolders)
    for subfolder in subfolders:
        assert os.path.exists(subfolder)

    # Check if dummy project exists & delete it
    if os.path.exists(root_folder_name):
        shutil.rmtree(root_folder_name)
Esempio n. 3
0
 def create_project(self, version):
     """Create a new project."""
     sys.stdout.write(
         "   ___  _______   ___                 __  _\n"
         "  / _ \/ __/ _ | / _ \___ __ _  ___  / /_(_)__  ___\n"
         " / , _/ _// __ |/ // / -_)  ' \/ _ \/ __/ / _ \/ _ \\\n"
         "/_/|_/___/_/ |_/____/\__/_/_/_/ .__/\__/_/\___/_//_/\n"
         "                             / /\n"
         "====================================================\n"
         "========================================\n"
         "=======================\n"
         "==============\n\n"
         "[http://pythonhosted.org/READemption/]\n\n")
     project_creator = ProjectCreator()
     project_creator.create_root_folder(self._args.project_path)
     project_creator.create_subfolders(self._paths.required_folders())
     project_creator.create_version_file(self._paths.version_path, version)
     sys.stdout.write("Created folder \"%s\" and required subfolders.\n" % (
         self._args.project_path))
     sys.stdout.write("Please copy read files into folder \"%s\" and "
                      "reference sequences files into folder \"%s\".\n" % (
                          self._paths.read_fasta_folder,
                          self._paths.ref_seq_folder))
Esempio n. 4
0
 def create_project(self, version):
     """Create a new project."""
     sys.stdout.write(
         "   ___  _______   ___                 __  _\n"
         "  / _ \/ __/ _ | / _ \___ __ _  ___  / /_(_)__  ___\n"
         " / , _/ _// __ |/ // / -_)  ' \/ _ \/ __/ / _ \/ _ \\\n"
         "/_/|_/___/_/ |_/____/\__/_/_/_/ .__/\__/_/\___/_//_/\n"
         "                             / /\n"
         "====================================================\n"
         "========================================\n"
         "=======================\n"
         "==============\n\n"
         "[http://pythonhosted.org/READemption/]\n\n")
     project_creator = ProjectCreator()
     project_creator.create_root_folder(self._args.project_path)
     project_creator.create_subfolders(self._paths.required_folders())
     project_creator.create_version_file(self._paths.version_path, version)
     sys.stdout.write("Created folder \"%s\" and required subfolders.\n" % (
         self._args.project_path))
     sys.stdout.write("Please copy read files into folder \"%s\" and "
                      "reference sequences files into folder \"%s\".\n" % (
                          self._paths.read_fasta_folder,
                          self._paths.ref_seq_folder))
Esempio n. 5
0
class TestProjectCreator(unittest.TestCase):
    def setUp(self):
        self.root_folder_name = "a_test_project"
        self.projectcreator = ProjectCreator()

    def tearDown(self):
        if os.path.exists(self.root_folder_name):
            shutil.rmtree(self.root_folder_name)

    def test_create_root_folder(self):
        self.projectcreator.create_root_folder(self.root_folder_name)
        assert (os.path.exists(self.root_folder_name))
        shutil.rmtree(self.root_folder_name)

    def test_create_subfolders(self):
        self.projectcreator.create_root_folder(self.root_folder_name)
        subfolders = ["test_a", "test_b", "test_c"]
        subfolders = [
            self.root_folder_name + "/" + subfolder for subfolder in subfolders
        ]
        self.projectcreator.create_subfolders(subfolders)
        for subfolder in subfolders:
            assert (os.path.exists(subfolder))
class TestProjectCreator(unittest.TestCase):

    def setUp(self):
        self.root_folder_name = "a_test_project"
        self.projectcreator = ProjectCreator()
        
    def tearDown(self):
        if os.path.exists(self.root_folder_name):
            shutil.rmtree(self.root_folder_name)

    def test_create_root_folder(self):
        self.projectcreator.create_root_folder(self.root_folder_name)
        assert(os.path.exists(self.root_folder_name))
        shutil.rmtree(self.root_folder_name)
    
    def test_create_subfolders(self):
        self.projectcreator.create_root_folder(self.root_folder_name)
        subfolders = ["test_a", "test_b", "test_c"]
        subfolders = [self.root_folder_name + "/" + subfolder for 
                      subfolder in subfolders]
        self.projectcreator.create_subfolders(subfolders)
        for subfolder in subfolders:
            assert(os.path.exists(subfolder))
Esempio n. 7
0
 def setUp(self):
     self.root_folder_name = "a_test_project"
     self.projectcreator = ProjectCreator()
 def setUp(self):
     self.root_folder_name = "a_test_project"
     self.projectcreator = ProjectCreator()