当前位置: 首页>>代码示例>>Python>>正文


Python config.data_dir方法代码示例

本文整理汇总了Python中config.data_dir方法的典型用法代码示例。如果您正苦于以下问题:Python config.data_dir方法的具体用法?Python config.data_dir怎么用?Python config.data_dir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在config的用法示例。


在下文中一共展示了config.data_dir方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_default

# 需要导入模块: import config [as 别名]
# 或者: from config import data_dir [as 别名]
def test_default(self):
        """$ pdb_occ data/dummy.pdb"""

        # Simulate input
        # pdb_occ dummy.pdb
        sys.argv = ['', os.path.join(data_dir, 'dummy.pdb')]

        # Execute the script
        self.exec_module()

        # Validate results
        self.assertEqual(self.retcode, 0)  # ensure the program exited OK.
        self.assertEqual(len(self.stdout), 204)  # no lines deleted
        self.assertEqual(len(self.stderr), 0)  # no errors

        records = (('ATOM', 'HETATM'))
        occ_list = [l[54:60] for l in self.stdout if l.startswith(records)]
        unique_occ = list(set(map(float, occ_list)))
        self.assertEqual(unique_occ, [1.0])  # all occ values changed 
开发者ID:haddocking,项目名称:pdb-tools,代码行数:21,代码来源:test_pdb_occ.py

示例2: test_default

# 需要导入模块: import config [as 别名]
# 或者: from config import data_dir [as 别名]
def test_default(self):
        """$ pdb_gap data/dummy.pdb"""

        # Simulate input
        sys.argv = ['', os.path.join(data_dir, 'dummy.pdb')]

        # Execute the script
        self.exec_module()

        # Validate results
        self.assertEqual(self.retcode, 0)  # ensure the program exited OK.
        self.assertEqual(len(self.stdout), 5)  # no lines deleted
        self.assertEqual(len(self.stderr), 0)  # no errors

        self.assertEqual(self.stdout,
                         ["B:ARG4 < Seq. Gap > B:GLU6",
                          "A:ASN1 <    9.42A > A:ASN1",
                          "C:ARG5 < Seq. Gap > C:GLU2",
                          "C:GLU2 <   95.75A > C:MET-1",
                          "Found 4 gap(s) in the structure"]) 
开发者ID:haddocking,项目名称:pdb-tools,代码行数:22,代码来源:test_pdb_gap.py

示例3: test_default

# 需要导入模块: import config [as 别名]
# 或者: from config import data_dir [as 别名]
def test_default(self):
        """$ pdb_b data/dummy.pdb"""

        # Simulate input
        # pdb_b -20 dummy.pdb
        sys.argv = ['', os.path.join(data_dir, 'dummy.pdb')]

        # Execute the script
        self.exec_module()

        # Validate results
        self.assertEqual(self.retcode, 0)  # ensure the program exited OK.
        self.assertEqual(len(self.stdout), 204)  # no lines deleted
        self.assertEqual(len(self.stderr), 0)  # no errors

        records = (('ATOM', 'HETATM'))
        bfactors = [l[60:66] for l in self.stdout if l.startswith(records)]
        unique_bfac = list(set(map(float, bfactors)))
        self.assertEqual(unique_bfac, [10.00])  # all bfactors changed 
开发者ID:haddocking,项目名称:pdb-tools,代码行数:21,代码来源:test_pdb_b.py

示例4: test_default

# 需要导入模块: import config [as 别名]
# 或者: from config import data_dir [as 别名]
def test_default(self):
        """$ pdb_tidy data/dummy.pdb"""

        fpath = os.path.join(data_dir, 'dummy.pdb')
        sys.argv = ['', fpath]

        # Execute the script
        self.exec_module()

        # Validate results
        self.assertEqual(self.retcode, 0)  # ensure the program exited OK.
        self.assertEqual(len(self.stdout), 207)
        self.assertEqual(len(self.stderr), 0)  # no errors

        # Check if we added TER statements correctly
        n_ter = len([r for r in self.stdout if r.startswith('TER')])
        self.assertEqual(n_ter, 5)

        # Check if we added END statements correctly
        self.assertTrue(self.stdout[-1].startswith('END')) 
开发者ID:haddocking,项目名称:pdb-tools,代码行数:22,代码来源:test_pdb_tidy.py

示例5: test_valid_ensemble

# 需要导入模块: import config [as 别名]
# 或者: from config import data_dir [as 别名]
def test_valid_ensemble(self):
        """$ pdb_chkensemble data/ensemble_OK.pdb"""

        fpath = os.path.join(data_dir, 'ensemble_OK.pdb')
        sys.argv = ['', fpath]

        # Execute the script
        self.exec_module()

        # Validate results
        self.assertEqual(self.retcode, 0)  # ensure the program exited OK.
        self.assertEqual(len(self.stdout), 1)
        self.assertEqual(len(self.stderr), 0)  # no errors

        self.assertEqual(self.stdout[0],
                         "Ensemble of 2 models *seems* OK") 
开发者ID:haddocking,项目名称:pdb-tools,代码行数:18,代码来源:test_pdb_chkensemble.py

示例6: test_ensemble_diffatom

# 需要导入模块: import config [as 别名]
# 或者: from config import data_dir [as 别名]
def test_ensemble_diffatom(self):
        """$ pdb_chkensemble data/ensemble_error_1.pdb"""

        fpath = os.path.join(data_dir, 'ensemble_error_1.pdb')
        sys.argv = ['', fpath]

        # Execute the script
        self.exec_module()

        # Validate results
        self.assertEqual(self.retcode, 1)
        self.assertEqual(len(self.stdout), 0)
        self.assertEqual(len(self.stderr), 3)

        self.assertEqual(self.stderr,
                         ["Models 1 and 2 differ:",
                          "Atoms in model 1 only:",
                          "    2  H   ASN A   1 "]) 
开发者ID:haddocking,项目名称:pdb-tools,代码行数:20,代码来源:test_pdb_chkensemble.py

示例7: test_ensemble_nomodel

# 需要导入模块: import config [as 别名]
# 或者: from config import data_dir [as 别名]
def test_ensemble_nomodel(self):
        """$ pdb_chkensemble data/ensemble_error_2.pdb"""

        fpath = os.path.join(data_dir, 'ensemble_error_2.pdb')
        sys.argv = ['', fpath]

        # Execute the script
        self.exec_module()

        # Validate results
        self.assertEqual(self.retcode, 1)
        self.assertEqual(len(self.stdout), 0)
        self.assertEqual(len(self.stderr), 1)

        self.assertEqual(self.stderr[0],
                         "ERROR!! MODEL record missing before ATOM at line '3'") 
开发者ID:haddocking,项目名称:pdb-tools,代码行数:18,代码来源:test_pdb_chkensemble.py

示例8: test_ensemble_noendmdl

# 需要导入模块: import config [as 别名]
# 或者: from config import data_dir [as 别名]
def test_ensemble_noendmdl(self):
        """$ pdb_chkensemble data/ensemble_error_3.pdb"""

        fpath = os.path.join(data_dir, 'ensemble_error_3.pdb')
        sys.argv = ['', fpath]

        # Execute the script
        self.exec_module()

        # Validate results
        self.assertEqual(self.retcode, 1)
        self.assertEqual(len(self.stdout), 0)
        self.assertEqual(len(self.stderr), 1)

        self.assertEqual(self.stderr[0],
                         "ERROR!! ENDMDL record missing at line '10'") 
开发者ID:haddocking,项目名称:pdb-tools,代码行数:18,代码来源:test_pdb_chkensemble.py

示例9: test_ensemble_noendmdl2

# 需要导入模块: import config [as 别名]
# 或者: from config import data_dir [as 别名]
def test_ensemble_noendmdl2(self):
        """$ pdb_chkensemble data/ensemble_error_4.pdb"""

        fpath = os.path.join(data_dir, 'ensemble_error_4.pdb')
        sys.argv = ['', fpath]

        # Execute the script
        self.exec_module()

        # Validate results
        self.assertEqual(self.retcode, 1)
        self.assertEqual(len(self.stdout), 0)
        self.assertEqual(len(self.stderr), 1)

        self.assertEqual(self.stderr[0],
                         "ERROR!! MODEL record found before ENDMDL at line '6'") 
开发者ID:haddocking,项目名称:pdb-tools,代码行数:18,代码来源:test_pdb_chkensemble.py

示例10: main

# 需要导入模块: import config [as 别名]
# 或者: from config import data_dir [as 别名]
def main():
    fdir = config.data_dir
    train_data, _ = data_load.load_dataset(
        f'{fdir}/train/in.txt', f'{fdir}/train/out.txt')
    test_data, _ = data_load.load_dataset(
        f'{fdir}/test/in.txt', f'{fdir}/test/out.txt')
    print(cal_total_max_len([train_data, test_data])) 
开发者ID:WiseDoge,项目名称:CoupletAI,代码行数:9,代码来源:cal_max_len.py

示例11: test_one_option

# 需要导入模块: import config [as 别名]
# 或者: from config import data_dir [as 别名]
def test_one_option(self):
        """$ pdb_selatom -CA data/dummy.pdb"""

        # Simulate input
        # pdb_selatom dummy.pdb
        sys.argv = ['', '-CA', os.path.join(data_dir, 'dummy.pdb')]

        # Execute the script
        self.exec_module()

        # Validate results
        self.assertEqual(self.retcode, 0)  # ensure the program exited OK.
        self.assertEqual(len(self.stdout), 30)  # selected CA
        self.assertEqual(len(self.stderr), 0)  # no errors 
开发者ID:haddocking,项目名称:pdb-tools,代码行数:16,代码来源:test_pdb_selatom.py

示例12: test_multiple

# 需要导入模块: import config [as 别名]
# 或者: from config import data_dir [as 别名]
def test_multiple(self):
        """
        $ pdb_selatom -CA,CB data/dummy.pdb
        """

        sys.argv = ['', '-CA,CB', os.path.join(data_dir, 'dummy.pdb')]

        self.exec_module()

        self.assertEqual(self.retcode, 0)
        self.assertEqual(len(self.stdout), 39)  # CA + CB
        self.assertEqual(len(self.stderr), 0) 
开发者ID:haddocking,项目名称:pdb-tools,代码行数:14,代码来源:test_pdb_selatom.py

示例13: test_file_not_found

# 需要导入模块: import config [as 别名]
# 或者: from config import data_dir [as 别名]
def test_file_not_found(self):
        """$ pdb_selatom not_existing.pdb"""

        afile = os.path.join(data_dir, 'not_existing.pdb')
        sys.argv = ['', afile]

        self.exec_module()

        self.assertEqual(self.retcode, 1)  # exit code is 1 (error)
        self.assertEqual(len(self.stdout), 0)  # nothing written to stdout
        self.assertEqual(self.stderr[0][:22],
                         "ERROR!! File not found")  # proper error message 
开发者ID:haddocking,项目名称:pdb-tools,代码行数:14,代码来源:test_pdb_selatom.py

示例14: test_invalid_option

# 需要导入模块: import config [as 别名]
# 或者: from config import data_dir [as 别名]
def test_invalid_option(self):
        """$ pdb_selatom data/dummy.pdb"""

        sys.argv = ['', os.path.join(data_dir, 'dummy.pdb')]

        self.exec_module()

        self.assertEqual(self.retcode, 1)
        self.assertEqual(len(self.stdout), 0)
        self.assertEqual(self.stderr[0][:37],
                         "ERROR!! Atom name set cannot be empty") 
开发者ID:haddocking,项目名称:pdb-tools,代码行数:13,代码来源:test_pdb_selatom.py

示例15: test_invalid_option_2

# 需要导入模块: import config [as 别名]
# 或者: from config import data_dir [as 别名]
def test_invalid_option_2(self):
        """$ pdb_selatom -ABCDE data/dummy.pdb"""

        sys.argv = ['', '-ABCDE', os.path.join(data_dir, 'dummy.pdb')]

        self.exec_module()

        self.assertEqual(self.retcode, 1)
        self.assertEqual(len(self.stdout), 0)
        self.assertEqual(self.stderr[0][:37],
                         "ERROR!! Atom name is invalid: 'ABCDE'") 
开发者ID:haddocking,项目名称:pdb-tools,代码行数:13,代码来源:test_pdb_selatom.py


注:本文中的config.data_dir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。