예제 #1
0
 def test_run_agadir_on_multifastafiles(self):
     # arrange
     Paths.set_up_paths(use_cluster=True)
     # act
     agadir = Agadir(AgadCndtns.INCELL_MAML.value)
     agadir.run_agadir_on_multifastas(
         path_fastafile=TPLS.MC_TESTS_INPUT.value +
         '/mutants_multifastas/1...2/1_A/mutants/1_A_mutants.fasta',
         path_dst=TPLS.MC_TESTS_OUTPUT.value)
예제 #2
0
 def test_write_1_fastafile_per_fasta_from_multifastafile(self):
     # arrange
     path_dst = TPLS.MC_TESTS_INPUT.value
     Paths.set_up_paths(use_cluster=False)
     path_fastafile = os.path.join(TPLS.MC_TESTS_INPUT.value,
                                   'mutants_fastas_multifastafiles',
                                   '1...10', '1_A', 'mutants',
                                   '1_A_mutants.fasta')
     # act
     GUM.write_1_fastafile_per_fasta_from_multifastafile(
         path_dst, path_fastafile)
예제 #3
0
 def test_copy_files_to_3dot_dir_2(self):
     # act
     Paths.set_up_paths(use_cluster=False)
     GUM.copy_files_to_3dot_dir(
         path_src_dir='/Users/u0120577/ROB_HOMOLOGY_HUMAN/RepairPDBs',
         path_dst_dir=Paths.REPO_PDBS,
         file_extension='.pdb',
         starting_num=1,
         num_to_copy_per_subdir=1000)
     # assert
     self.assertTrue(
         os.path.exists(
             os.path.join(Paths.REPO_PDBS, 'pdbs_1000', '2001...3000',
                          'RepairPDB_2031.pdb')),
         'No file at  ~/REPO_PDB_FASTA/pdbs/pdbs_1000/2001...3000/RepairPDB_2031.pdb found'
     )
예제 #4
0
 def test_copy_files_to_3dot_dir_1(self):
     # act
     Paths.set_up_paths(use_cluster=False)
     # GUM.copy_files_to_3dot_dir(path_src_dir='/Users/u0120577/ROB_HOMOLOGY_HUMAN/Fasta',
     GUM.copy_files_to_3dot_dir(
         path_src_dir='/Users/u0120577/ROB_HOMOLOGY_HUMAN/pub_hg_fasta',
         path_dst_dir=Paths.REPO_FASTAS + '/29611_fastas_1000',
         file_extension=Str.FSTAEXT.value,
         starting_num=1,
         num_to_copy_per_subdir=1000)
     # assert
     self.assertTrue(
         os.path.exists(os.path.join(Paths.REPO_FASTAS,
                                     '29611_fastas_1000')),
         'No folder at  ~/REPO_PDB_FASTA/fastas/29611_fastas_1000 found')
     self.assertTrue(
         os.path.exists(
             os.path.join(Paths.REPO_FASTAS, '29611_fastas_1000',
                          '1...1000')),
         'No folder at  ~/REPO_PDB_FASTA/fastas/29611_fastas_1000/1...1000 found'
     )
     self.assertTrue(
         os.path.exists(
             os.path.join(Paths.REPO_FASTAS, '29611_fastas_1000',
                          '2001...3000')),
         'No folder at  ~/REPO_PDB_FASTA/fastas/29611_fastas_1000/2001...3000 found'
     )
     self.assertTrue(
         os.path.exists(
             os.path.join(Paths.REPO_FASTAS, '29611_fastas_1000',
                          '1...1000',
                          '0001c4ad-0f86-3c74-9010-11fe302e765c.fasta')),
         'No file at  ~/REPO_PDB_FASTA/fastas/29611_fastas_1000/1...1000/'
         '0001c4ad-0f86-3c74-9010-11fe302e765c.fasta found')
     self.assertTrue(
         os.path.exists(
             os.path.join(Paths.REPO_FASTAS, '29611_fastas_1000',
                          '2001...3000',
                          '048b6fff-4495-3872-bccf-3d6d77cad903.fasta')),
         'No file at  ~/REPO_PDB_FASTA/fastas/29611_fastas_1000/2001...3000/'
         '048b6fff-4495-3872-bccf-3d6d77cad903.fasta found')
from src.enums.Str import Str
from src.Cluster import Cluster
# import pydevd
# pydevd.settrace('localhost', port=51234, stdoutToServer=True, stderrToServer=True)

__author__ = "Shahin Zibaee"
__copyright__ = "Copyright 2018, The Switch lab, KU Leuven"
__license__ = "GPL"
__version__ = "1.0.0"
__maintainer__ = "Shahin Zibaee"
__email__ = "*****@*****.**"
__status__ = "Development"
"""
1. Set up paths. ("use_cluster" is set to False by default.)  
"""
Paths.set_up_paths(use_cluster=(
    len(sys.argv) > 1 and sys.argv[1].strip(' ') == 'use_cluster=True'))
"""
2. Get csv files you want to read and write to single file.
"""
using_cluster = GUM.using_cluster()
path_output_ac_or_bm_dir = ''
path_output_csvfiles = glob.glob(Paths.OUTPUT_BM + '/**/*' + Str.CSVEXT.value,
                                 recursive=True)
"""
(some private functions defined here)
"""


def _extract_pdbname(filename: str):
    regex = re.compile(r"RepairPDB_[0-9]+_")
    res = regex.search(filename)