nanxstats / Rcpi

💊 Molecular informatics toolkit with integration of bioinformatics and cheminformatics tools for drug discovery
https://nanx.me/Rcpi/
Artistic License 2.0
37 stars 12 forks source link

failed to set 'from' and 'to' formats: inchi inchikey #10

Closed JustinZZW closed 4 years ago

JustinZZW commented 4 years ago

Hi Nan, I come across a problem when using convertMolFormat Function. This function work well when using example data. But the errors occured when I hope to convet from inchi to inchikey. The file was attached. test.zip

The code I used:

convMolFormat(infile = './test.inchi', outfile = 'test.inchikey', from = 'inchi', to = 'inchikey') 

The error:

Error in ChemmineOB::convertFormatFile(from = from, to = to, fromFile = infile,  : 
  failed to set 'from' and 'to' formats: inchi inchikey

I would appeciate a lot for your kindness helps

Best,

Zhiwei

nanxstats commented 4 years ago

Hmm, the issue seem to be rooted in the ChemmineOB wrapper, not much I can do from my side. I'd say it would be sufficient to call openbabel from the command line as an ad-hoc solution:

system("obabel -iinchi test.inchi -oinchikey > test.inchikey")
JustinZZW commented 4 years ago

Great! It works perfectly. Thanks a lot.