ipb-halle / MetFragR

R package for MetFrag
24 stars 14 forks source link

Database selection #12

Closed 4dsoftware closed 7 years ago

4dsoftware commented 8 years ago

Hi,

I wonder how I can choose an external sdf as database option, instead of using Kegg or PubChem. Is this feature coming up, or is it already in the R script but I did not find it?

Daniel

lucanard commented 8 years ago

You can already do this, using the function "score.molecules.from.sdf" that is already in the package. You can supply whatever sdf you want, I guess.

c-ruttkies commented 8 years ago

Hi,

sorry for the delay. The package has been redesigned and upgraded to version 2.0. The method score.molecules.from.sdf is still available and can be used for this purpose as lucanard mentioned.

Best regards, Christoph

MiriMet commented 8 years ago

Hi,

I am trying to use the method "score.molecules.from.sdf" following your example: file<-"sdf/MetFrag_Candidates.sdf" sdf <- system.file(file, package = "metfRag") molecules <- load.molecules(sdf)

And I get this error: Error in as.character.default(X[[i]], ...) : no method for coercing this S4 class to a vector

Miriam

c-ruttkies commented 8 years ago

Hi Miriam,

you don't need the load.molecules command anymore. I will throw it out of the manual. When you want to score molecules from a SDF file just go on as shown in the manual:

file <- "sdf/MetFrag_Candidates.sdf" sdf <- system.file(file, package = "metfRag") file <- "sdf/MetFrag_Peaklist.mf" queryfile <- system.file(file, package = "metfRag") peaktable <- read.table(queryfile, sep=" ", col.names=c("mz", "int"))

scored.molecules <- score.molecules.from.sdf(sdf, mzs=peaktable[,"mz"], ints=peaktable[,"int"], exact.mass=290.0646, number.threads = 1, mz.abs=0.001, mz.ppm=5, search.ppm=5, pos.charge=TRUE, mode=1, tree.depth=2)

Hope this helps.

Best regards, Christoph

MiriMet commented 8 years ago

Hi Christoph,

Thank you for you kind answer. Finally I decided to use metfrag with command line since R reported another error related to the memory space. I could use metfrag using PubChem database, but when I try to use the downloaded structures from HMDB in SDF format I get an error (I attached in this email).

Would you know how I can resolve it?

Thank you very much in advance,

Best regards,

Miriam

2016-09-10 10:49 GMT+02:00 c-ruttkies notifications@github.com:

Hi Miriam,

you don't need the load.molecules command anymore. I will throw it out of the manual. When you want to score molecules from a SDF file just go on as shown in the manual:

file <- "sdf/MetFrag_Candidates.sdf" sdf <- system.file(file, package = "metfRag") file <- "sdf/MetFrag_Peaklist.mf" queryfile <- system.file(file, package = "metfRag") peaktable <- read.table(queryfile, sep=" ", col.names=c("mz", "int"))

scored.molecules <- score.molecules.from.sdf(sdf, mzs=peaktable[,"mz"], ints=peaktable[,"int"], exact.mass=290.0646, number.threads = 1, mz.abs=0.001, mz.ppm=5, search.ppm=5, pos.charge=TRUE, mode=1, tree.depth=2)

Hope this helps.

Best regards, Christoph

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/c-ruttkies/MetFragR/issues/12#issuecomment-246100418, or mute the thread https://github.com/notifications/unsubscribe-auth/AUh_PfuAoQKyNkfuURWhgi-9oI_u2NDaks5qom8bgaJpZM4GWhQD .

c-ruttkies commented 8 years ago

Hi Miriam,

I didn't get an email with the attached error. Could you please send your example directly to cruttkie@ipb-halle.de ?

Thanks in advance.

Best regards, Christoph