def test_from_dataframe(): import numpy as np import pandas a = np.random.random([100, 3]) * 100 atoms = pandas.DataFrame(a, columns=['z', 'y', 'x']) s = coarseactin.Scene(atoms) assert s['x'][20] == atoms['x'][20]
close_abps = list(set([mean_abp_paired.index[random.choice([a, b])] for a, b in pairs_colliding])) close_abps.sort() sel = mean_abp_paired.index.difference(close_abps) mean_abp_paired = mean_abp_paired.loc[sel] print('Number of pairs:', len(mean_abp_paired)) pairs_colliding = cKDTree(mean_abp_paired).query_pairs(colliding_distance*1.5) print('Number of collisions:', len(pairs_colliding)) print(pairs_colliding) full_model = full_model[full_model['chain_index'].isin(mean_abp_paired.index) | full_model['resName'].isin(['ACT', 'ACD'])] print('Rejoining model') # Split and rejoin the model so that ABPs are on a different chain full_model = coarseactin.Scene(full_model.sort_values(['chainID', 'resSeq', 'name'])) full_model_actin = coarseactin.Scene(full_model[full_model['resName'].isin(['ACT', 'ACD'])]) full_model_abps = coarseactin.Scene(full_model[~full_model['resName'].isin(['ACT', 'ACD'])]) # full_model_abps['chainID'] = 'A' full_model = coarseactin.Scene.concatenate([full_model_actin, full_model_abps]) full_model.write_cif(f'{Sname}.cif', verbose=True) ############## # Simulation # ############## import sys sys.path.insert(0, '.') import openmm import openmm.app
def test_from_matrix(): s = coarseactin.Scene([[0, 0, 0], [0, 0, 1]]) assert len(s) == 2
def test_from_numpy(): import numpy as np a = np.random.random([100, 3]) * 100 s = coarseactin.Scene(a) assert len(s) == 100