def testAlignConcat(self): command = self.command + ' --align ca --pdb {1:s} {0:s} {0:s}'.format( self.dcdpath, self.pdbpath) namespace = prody_parser.parse_args(shlex.split(command)) namespace.func(namespace) select = self.ag.ca coords = self.dcd[:] concat = parseDCD(self.output) assert_equal(concat.numAtoms(), coords.numAtoms()) coords.setCoords(self.ag.getCoords()) coords.setAtoms(select) coords.superpose() coords.setAtoms(None) coords = coords._getCoordsets() concat = concat._getCoordsets() assert_equal(coords, concat[:3]) assert_equal(coords, concat[3:])
def testWrite(self): dcd = DCDFile(self.dcd, 'w') dcd.write(ENSEMBLE.getCoordsets()) dcd.close() e = parseDCD(self.dcd) assert_allclose(e._getCoordsets(), ENSEMBLE._getCoordsets(), rtol=RTOL, atol=ATOL, err_msg='failed to parse DCD file correctly')
def testSimpleConcat(self): command = self.command + ' {0:s} {0:s} {0:s}'.format(self.dcdpath) namespace = prody_parser.parse_args(shlex.split(command)) namespace.func(namespace) coords = self.dcd[:]._getCoordsets() concat = parseDCD(self.output)._getCoordsets() assert_equal(coords, concat[:3]) assert_equal(coords, concat[3:6]) assert_equal(coords, concat[6:])
def testWriteModeAppend(self): dcd = DCDFile(writeDCD(self.dcd, ENSEMBLE), 'a') dcd.write(ENSEMBLE.getCoordsets()) dcd.close() e = parseDCD(self.dcd) n_csets = len(ENSEMBLE) coordsets = e._getCoordsets() assert_equal(coordsets, coordsets, 'failed to parse DCD file correctly') assert_allclose(coordsets[:n_csets], ENSEMBLE._getCoordsets(), rtol=RTOL, atol=ATOL, err_msg='failed to parse DCD file correctly')
def testSelectConcat(self): command = self.command + ' -s ca --pdb {1:s} {0:s} {0:s}'.format( self.dcdpath, self.pdbpath) namespace = prody_parser.parse_args(shlex.split(command)) namespace.func(namespace) select = self.ag.ca assert_equal(select.numAtoms(), 10) coords = self.dcd[:] coords.setAtoms(select) coords = coords._getCoordsets() concat = parseDCD(self.output) assert_equal(concat.numAtoms(), select.numAtoms()) concat = concat._getCoordsets() assert_equal(select.numAtoms(), coords.shape[1]) assert_equal(select.numAtoms(), concat.shape[1]) assert_equal(coords, concat[:3]) assert_equal(coords, concat[3:])
def testParseDCD(self): e = parseDCD(writeDCD(self.dcd, ALLATOMS)) assert_equal(e._getCoordsets(), DCD._getCoordsets(), err_msg='failed to parse DCD file correctly')