If you want to delete all the data of a certain asset or participant category like in the case of a cleanup transaction, you have to do the following:
1. getting the asset or participant registry:
const myAssetRegistry = await getAssetRegistry(namespace +
'.MyAsset');
2. querying the all elements of the given asset or participant registry:
var allAssets = await myAssetRegistry.getAll();
3. delete all of the queried data:
await myAssetRegistry.removeAll(allAssets);