コード例 #1
0
    def test_reconstruct_Hs_first_frame(self):
        """Test for build_system_hydrogens()."""
        dic_lipids_with_indexes = core.make_dic_lipids_with_indexes(self.universe_woH,
                                                                     self.dic_lipid,
                                                                     self.dic_OP)

        new_df_atoms = core.build_system_hydrogens(self.universe_woH, self.dic_lipid,
                                                   self.dic_Cname2Hnames, dic_lipids_with_indexes)

        assert new_df_atoms.shape == (1340, 7)

        # Test random atoms
        col_series=["atnum", "atname","resname", "resnum","x", "y", "z"]
        ref_atom = pd.Series([1, "C1", "POPC", 2, 34.41999816, 46.93999862, 26.30999946],
                             index=col_series)
        pd.testing.assert_series_equal(new_df_atoms.loc[0], ref_atom, check_names=False)

        ref_atom = pd.Series([2, "H11", "POPC", 2, 35.06161421, 47.69320272, 26.76728762],
                             index=col_series)
        pd.testing.assert_series_equal(new_df_atoms.loc[1], ref_atom, check_names=False)

        ref_atom = pd.Series([259, "H501", "POPC", 3, 74.16520229, 36.21701104, 35.03256486],
                             index=col_series)
        pd.testing.assert_series_equal(new_df_atoms.loc[258], ref_atom, check_names=False)

        ref_atom = pd.Series([1339, "HA22", "POPC", 11, 27.72946942, 16.74704078, 40.53260384],
                             index=col_series)
        pd.testing.assert_series_equal(new_df_atoms.loc[1338], ref_atom, check_names=False)
コード例 #2
0
    def test_reconstruct_Hs(self):
        """Test for build_all_Hs_calc_OP().

        The results should be indentical to the test_fast_build_all_Hs_calc_OP() test.
        """
        dic_lipids_with_indexes = core.make_dic_lipids_with_indexes(
            self.universe_woH, self.dic_lipid, self.dic_OP)

        pdb_wH = self.PATH_DATA / "10POPC_wH.pdb"
        universe_wH = mda.Universe(str(pdb_wH))
        ts = self.universe_woH.trajectory[0]
        core.build_all_Hs_calc_OP(self.universe_woH, ts, self.dic_lipid,
                                  self.dic_Cname2Hnames, universe_wH,
                                  self.dic_OP,
                                  self.dic_corresp_numres_index_dic_OP,
                                  dic_lipids_with_indexes)

        # Check statistics
        assert_almost_equal(np.mean(self.dic_OP[('C21', 'H212')]), -0.22229490)
        assert_almost_equal(np.mean(self.dic_OP[('CA2', 'HA23')]), 0.22305829)

        # Check few particular cases
        # Use of a loop to check key and value separately.
        # The values need to be assert with float desired precision.
        for (key), value in self.ref_OP.items():
            assert key in self.dic_OP.keys()
            assert_almost_equal(value, self.dic_OP[key])
コード例 #3
0
    def test_make_dic_lipids_with_indexes(self):
        """Test for make_dic_lipids_with_indexes()."""
        dic_lipids_with_indexes = core.make_dic_lipids_with_indexes(self.universe_woH,
                                                                     self.dic_lipid,
                                                                     self.dic_OP)

        assert dic_lipids_with_indexes['C1']  == ['CH3', 'N4', 'C5', 0, 3, 4]
        assert dic_lipids_with_indexes['C5']  == ['CH2', 'N4', 'C6', 4, 3, 5]
        assert dic_lipids_with_indexes['C13'] == ['CH', 'C12', 'C32', 'O14', 12, 11, 31, 13]
        assert dic_lipids_with_indexes['C24'] == ['CHdoublebond', 'C23', 'C25', 23, 22, 24]
        assert dic_lipids_with_indexes['C50'] == ['CH3', 'C49', 'C48', 49, 48, 47]