當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。