|
4 | 4 | # Project Website: http://rasbt.github.io/biopandas/ |
5 | 5 | # Code Repository: https://github.com/rasbt/biopandas |
6 | 6 |
|
| 7 | +import numpy as np |
7 | 8 | from biopandas.pdb import PandasPdb |
8 | 9 | import os |
9 | 10 |
|
@@ -37,6 +38,38 @@ def test_defaults(): |
37 | 38 | assert expect_res == got_res |
38 | 39 |
|
39 | 40 |
|
| 41 | +def test_sameindex(): |
| 42 | + TESTDATA_1t48 = os.path.join(os.path.dirname(__file__), 'data', |
| 43 | + '1t48_995.pdb') |
| 44 | + p1t48 = PandasPdb() |
| 45 | + p1t48.read_pdb(TESTDATA_1t48) |
| 46 | + print(p1t48) |
| 47 | + p1t48.df['ATOM'].index = np.zeros(p1t48.df['ATOM'].shape[0], dtype=int) |
| 48 | + |
| 49 | + expect_res = ['M', 'E', 'M', 'E', 'K', 'E', 'F', 'E', 'Q', |
| 50 | + 'I', 'D', 'K', 'S', 'G', 'S', 'W', 'A', 'A', |
| 51 | + 'I', 'Y', 'Q', 'D', 'I', 'R', 'H', 'E', 'A', |
| 52 | + 'S', 'D', 'F', 'P', 'C', 'R', 'V', 'A', 'K', |
| 53 | + 'L', 'P', 'K', 'N', 'K', 'N', 'R', 'N', 'R', |
| 54 | + 'Y', 'R', 'D', 'V', 'S', 'P', 'F', 'D', 'H', |
| 55 | + 'S', 'R', 'I', 'K', 'L', 'H', 'Q', 'E', 'D', |
| 56 | + 'N', 'D', 'Y', 'I', 'N', 'A', 'S', 'L', 'I', |
| 57 | + 'K', 'M', 'E', 'E', 'A', 'Q', 'R', 'S', 'Y', |
| 58 | + 'I', 'L', 'T', 'Q', 'G', 'P', 'L', 'P', 'N', |
| 59 | + 'T', 'C', 'G', 'H', 'F', 'W', 'E', 'M', 'V', |
| 60 | + 'W', 'E', 'Q', 'K', 'S', 'R', 'G', 'V', 'V', |
| 61 | + 'M', 'L', 'N', 'R', 'V', 'M', 'E', 'K', 'G', |
| 62 | + 'S', 'L', 'K'] |
| 63 | + |
| 64 | + transl = p1t48.amino3to1() |
| 65 | + expect_chain = ['A' for _ in range(transl.shape[0])] |
| 66 | + got_chain = list(transl['chain_id'].values) |
| 67 | + got_res = list(transl['residue_name'].values) |
| 68 | + |
| 69 | + assert expect_chain == got_chain |
| 70 | + assert expect_res == got_res |
| 71 | + |
| 72 | + |
40 | 73 | def test_multichain(): |
41 | 74 | TESTDATA_5mtn = os.path.join(os.path.dirname(__file__), |
42 | 75 | 'data', '5mtn_multichain.pdb') |
|
0 commit comments