Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--delete option is not working properly #2647

Open
ivok2002 opened this issue Nov 21, 2023 · 1 comment
Open

--delete option is not working properly #2647

ivok2002 opened this issue Nov 21, 2023 · 1 comment

Comments

@ivok2002
Copy link

Environment Information

Open Babel version: 3.1.1
Operating system and version: Windows 10

Expected Behavior

Applying --append and --delete category options at the same time should add the category to the title and then delete it for the output file.

Actual Behavior

Looks like the category is firstly deleted and then added to the output file, producing ?? symbols.
Also there is an error message:
*** Open Babel Error in OpenBabel::OBDescriptor::GetValues
CAT not recognized as a property or a descriptor
1 molecule converted

Steps to Reproduce

obabel --addtotitle "_" --append "@cat" -isdf in.sdf -osdf -Oout.sdf --delete "CAT"

@fredrikw
Copy link
Contributor

Without having your exact file to test on I cannot say for sure but my best suggestion would be to change the command to a piped two-stage command:
obabel --addtotitle "_" --append "CAT" in.sdf -osdf | obabel -isdf -Oout.sdf --delete "CAT"
(I also changed the property name in --append to match the one in --delete, in my testing it made a difference if I used upper or lower case)

➜ obabel -:"CCC title" --gen2D -osdf --property CAT=test | obabel -isdf --addtotitle "_" --append "CAT" -osdf | obabel -
isdf -osdf --delete "CAT"
1 molecule converted
1 molecule converted
title_ test
 OpenBabel11232311102D

  3  2  0  0  0  0  0  0  0  0999 V2000
    1.7321   -0.0000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    0.8660    0.5000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
   -0.0000   -0.0000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
  1  2  1  0  0  0  0
  2  3  1  0  0  0  0
M  END
$$$$
1 molecule converted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants