def pdb2map_save(op): ms = pdb2map(op) import iomap as IM for n in ms: v = ms[n] IM.map2mrc(v, op['savepath'] + '{}.mrc'.format(n)) data = {} i = 0 for n in ms: data[i] = {n: ms[n]} i = i + 1 import numpy as np np.save(op['savepath'] + 'data.npy', data)
y = packing_result['optimal_result']['y'] / 10 z = packing_result['optimal_result']['z'] / 10 print('initialization', packing_result['optimal_result']['initialization']) x0 = np.array(packing_result['optimal_result']['initialization'][0]) / 10 y0 = np.array(packing_result['optimal_result']['initialization'][1]) / 10 z0 = np.array(packing_result['optimal_result']['initialization'][2]) / 10 box_size = packing_result['general_info']['box_size'] / 10 # merge map to hugemap, save random angle in packing_result import map_tomo.merge_map as MM initmap, init_angle_list = MM.merge_map(v, protein_name, x0, y0, z0, box_size) packmap, pack_angle_list = MM.merge_map(v, protein_name, x, y, z, box_size) packing_result['optimal_result']['initmap_rotate_angle'] = init_angle_list packing_result['optimal_result']['packmap_rotate_angle'] = pack_angle_list IM.map2mrc(initmap, output['initmap']['mrc']) IM.map2mrc(packmap, output['packmap']['mrc']) # save packing info with open(output['json']['pack'], 'w') as f: json.dump(packing_result, f, cls=MM.NumpyEncoder) # trim hugemap trim_initmap = trim_margin(initmap) trim_packmap = trim_margin(packmap) print('initmap shape', initmap.shape) print('trimmed shape', trim_initmap.shape) print('packmap shape', packmap.shape) print('trimmed shape', trim_packmap.shape) IM.map2mrc(trim_initmap, output['initmap']['trim']) IM.map2mrc(trim_packmap, output['packmap']['trim'])
op = { 'model': { 'missing_wedge_angle': 30, 'SNR': 0.4 }, 'ctf': { 'pix_size': 1.0, 'Dz': -5.0, 'voltage': 300, 'Cs': 2.0, 'sigma': 0.4 } } def map2tomo(map1, op): vb = TSRSC.do_reconstruction(map1, op, verbose=True) # vb = td(map1, op, verbose=True) print('vb', 'mean', vb.mean(), 'std', vb.std(), 'var', vb.var()) return vb if __name__ == '__main__': import iomap as IM packmap = IM.readMrcMap('../IOfile/packmap/mrc/packmap1.mrc') vb = map2tomo(packmap, op) IM.map2mrc(vb, '../IOfile/tomo/mrc/tomo_SNR04.mrc') IM.map2png(vb, '../IOfile/tomo/png/tomo_SNR04.png')
import aitom.structure.pdb.situs_pdb2vol__batch as TSPS ms = TSPS.batch_processing(op) # use resize_center_batch_dict() to change maps into same size ms = {_: ms[_][10.0][10.0]['map'] for _ in ms} import numpy as np for n in ms: print(n, np.shape(ms[n])) import tomominer.image.vol.util as TIVU ms = TIVU.resize_center_batch_dict(vs=ms, cval=0.0) print('#resize#') for n in ms: print(n, np.shape(ms[n])) return ms if __name__ == '__main__': ms = pdb2map(op) import iomap as IM for n in ms: v = ms[n] IM.map2mrc(v, '../IOfile/map_single/{}.mrc'.format(n)) data = {} i = 0 for n in ms: data[i] = {n:ms[n]} i = i + 1 import numpy as np np.save('../IOfile/map_single/data.npy', data)