dgrapov / CTSgetR

R interface to Chemical Translation Service (CTS)
14 stars 9 forks source link

Error in `map()`: ℹ In index: 1. Caused by error in `map()`: ℹ In index: 1. Caused by error in `x$searchTerm`: ! $ operator is invalid for atomic vectors Run `rlang::last_trace()` to see where the error occurred. #7

Open Super-dong94 opened 3 months ago

Super-dong94 commented 3 months ago

CTSgetR(id = "n-[2-(6-amino-9h-purin-9-yl)ethyl]-n-(2-furylmethyl)amine", from = "Chemical Name", to = "KEGG", db_name ='ctsgetr.sqlite')

Error in map(): ℹ In index: 1. Caused by error in map(): ℹ In index: 1. Caused by error in x$searchTerm: ! $ operator is invalid for atomic vectors Run rlang::last_trace() to see where the error occurred. Warning messages: 1: Factors converted to character 2: Factors converted to character

dgrapov commented 3 months ago

The issue was the url encoding, which is now fixed.

CTSgetR(id = "n-[2-(6-amino-9h-purin-9-yl)ethyl]-n-(2-furylmethyl)amine",
        from = "Chemical Name",
        to = "KEGG",
        db_name ='ctsgetr.sqlite')
#returns
id KEGG
1 n-[2-(6-amino-9h-purin-9-yl)ethyl]-n-(2-furylmethyl)amine <NA>

Note the backend workflow is to first get the InChIKey and then translate to KEGG

CTSgetR(id = "n-[2-(6-amino-9h-purin-9-yl)ethyl]-n-(2-furylmethyl)amine",
        from = "Chemical Name",
        to = "InChIKey",
        db_name ='ctsgetr.sqlite')

CTSgetR(id = 'OPXOUINPZODWMA-UHFFFAOYSA-N',
        to = "KEGG",
        from = "InChIKey",
        db_name ='ctsgetr.sqlite')
                           id KEGG
1 OPXOUINPZODWMA-UHFFFAOYSA-N <NA>

There is no KEGG entry for this entity in CTS e.g.

 curl 'cts.fiehnlab.ucdavis.edu/rest/score/Chemical%20Name/n-%5B2-%286-amino-9h-purin-9-yl%29ethyl%5D-n-%282-furylmethyl%29amine/biological'
#returns
{"searchTerm":"n-[2-(6-amino-9h-purin-9-yl)ethyl]-n-(2-furylmethyl)amine","from":"Chemical Name","result":[{"InChIKey":"OPXOUINPZODWMA-UHFFFAOYSA-N","score":0.0}]}
Super-dong94 commented 3 months ago

Thank you very much for your reply, I have updated CTSgetr. But there are still some errors.

CTSgetR(id = "sm 8:1;2o/32:0",

  • from = "Chemical Name",
  • to = "KEGG",
  • db_name='ctsgetr.sqlite') Error in map(): ℹ In index: 1. Caused by error in map(): ℹ In index: 1. Caused by error in x$searchTerm: ! $ operator is invalid for atomic vectors Run rlang::last_trace() to see where the error occurred. Warning message: Factors converted to character

CTSgetR(id = "(+/-)12(13)-dihome",

  • from = "Chemical Name",
  • to = "KEGG",
  • db_name='ctsgetr.sqlite') Error in map(): ℹ In index: 1. Caused by error in map(): ℹ In index: 1. Caused by error in x$searchTerm: ! $ operator is invalid for atomic vectors Run rlang::last_trace() to see where the error occurred. Warning message: Factors converted to character