def _autoDetectTopology(folder): from htmd.molecule.readers import _TOPOLOGY_READERS topotypes = ['pdb', 'prmtop', 'psf'] + list(_TOPOLOGY_READERS.keys()) # Prepending PDB, PSF, PRMTOP so that they are the default topo = None for tt in topotypes: files = glob(path.join(folder, '*.{}'.format(tt))) if len(files) > 0: if len(files) > 1: logger.warning('Multiple "{}" files were found in folder {}. ' 'Picking {} as the topology'.format(tt, folder, files[0])) topo = files[0] break if topo is None: raise RuntimeError('No topology file found in folder {}. ' 'Supported extensions are {}'.format(folder, list(_TOPOLOGY_READERS.keys()))) return topo
def _autoDetectTopology(folder): from htmd.molecule.readers import _TOPOLOGY_READERS topotypes = ['pdb', 'prmtop', 'psf'] + list(_TOPOLOGY_READERS.keys( )) # Prepending PDB, PSF, PRMTOP so that they are the default topo = None for tt in topotypes: files = glob(path.join(folder, '*.{}'.format(tt))) if len(files) > 0: if len(files) > 1: logger.warning('Multiple "{}" files were found in folder {}. ' 'Picking {} as the topology'.format( tt, folder, files[0])) topo = files[0] break if topo is None: raise RuntimeError('No topology file found in folder {}. ' 'Supported extensions are {}'.format( folder, list(_TOPOLOGY_READERS.keys()))) return topo
def _autoDetectTopology(folder): topo = {} for tt in __topotypes: files = glob(path.join(folder, '*.{}'.format(tt))) if len(files) > 0: if len(files) > 1: logger.warning('Multiple "{}" files were found in folder {}. ' 'Picking {} as the topology'.format(tt, folder, files[0])) topo[tt] = files[0] if len(topo) == 0: raise RuntimeError('No topology file found in folder {}. ' 'Supported extensions are {}'.format(folder, list(_TOPOLOGY_READERS.keys()))) return list(topo.values())
logger.warning( 'Filtering was not able to write {} due to error: {}'. format(filttopo, e)) def _autoDetectTrajectories(folder): from htmd.molecule.readers import _TRAJECTORY_READERS import natsort for tt in _TRAJECTORY_READERS: trajectories = glob(path.join(folder, '*.{}'.format(tt))) if len(trajectories) > 0: return natsort.natsorted(trajectories) from htmd.molecule.readers import _TOPOLOGY_READERS __readers = list(_TOPOLOGY_READERS.keys()) __defaultReaders = ['pdb', 'prmtop', 'psf'] __otherReaders = list(np.setdiff1d(__readers, __defaultReaders)) __topotypes = __defaultReaders + __otherReaders # Prepending PDB, PSF, PRMTOP so that they are the default def _autoDetectTopology(folder): topo = {} for tt in __topotypes: files = glob(path.join(folder, '*.{}'.format(tt))) if len(files) > 0: if len(files) > 1: logger.warning('Multiple "{}" files were found in folder {}. ' 'Picking {} as the topology'.format( tt, folder, files[0])) topo[tt] = files[0]
mol.write(filttopo, filtsel) except Exception as e: logger.warning('Filtering was not able to write {} due to error: {}'.format(filttopo, e)) def _autoDetectTrajectories(folder): from htmd.molecule.readers import _TRAJECTORY_READERS import natsort for tt in _TRAJECTORY_READERS: trajectories = glob(path.join(folder, '*.{}'.format(tt))) if len(trajectories) > 0: return natsort.natsorted(trajectories) from htmd.molecule.readers import _TOPOLOGY_READERS __readers = list(_TOPOLOGY_READERS.keys()) __defaultReaders = ['pdb', 'prmtop', 'psf'] __otherReaders = list(np.setdiff1d(__readers, __defaultReaders)) __topotypes = __defaultReaders + __otherReaders # Prepending PDB, PSF, PRMTOP so that they are the default def _autoDetectTopology(folder): topo = {} for tt in __topotypes: files = glob(path.join(folder, '*.{}'.format(tt))) if len(files) > 0: if len(files) > 1: logger.warning('Multiple "{}" files were found in folder {}. ' 'Picking {} as the topology'.format(tt, folder, files[0])) topo[tt] = files[0] if len(topo) == 0: raise RuntimeError('No topology file found in folder {}. '