From ca5b2ebc7fdaa0ce95f71ecc50a9d917037858a0 Mon Sep 17 00:00:00 2001 From: shiyu22 Date: Tue, 7 Feb 2023 15:00:43 +0800 Subject: [PATCH] Update README with dc2 Signed-off-by: shiyu22 --- README.md | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 93e84c8..f0efaaa 100644 --- a/README.md +++ b/README.md @@ -20,25 +20,18 @@ This operator uses [RDKit](https://www.rdkit.org/docs/index.html) to generate th An example that use the Morgan algorithm to generate a fingerprint of the molecular formula 'Cc1ccc(cc1)S(=O)(=O)N'. - *Write the pipeline in simplified style:* - -```python -import towhee - -towhee.dc(['Cc1ccc(cc1)S(=O)(=O)N']) \ - .molecular_fingerprinting() \ - .show() -``` - - *Write a same pipeline with explicit inputs/outputs name specifications:* ```python -import towhee +from towhee.dc2 import pipe, ops, DataCollection + +p = ( + pipe.input('smiles') + .map('smiles', 'fingerprint', ops.molecular_fingerprinting.rdkit()) + .output('smiles', 'fingerprint') +) -towhee.dc['smiles'](['Cc1ccc(cc1)S(=O)(=O)N']) \ - .molecular_fingerprinting['smiles', 'fingerprint']() \ - .show() +DataCollection(p('Cc1ccc(cc1)S(=O)(=O)N')).show() ```