I am writing an R package und usually load my functions with :: or @import/@importFrom in the header. This works great for most packages. However, I am using the STRINGdb package that uses S4 objects and methods. I am not sure how I can make specific method of this package available for use in my function.
I want to move it to Suggests instead of Imports in my description file so I cannot load it with @import. It uses functions of the following structure:
string_db <- STRINGdb$new(
version = "11",
species = organism_id,
score_threshold = score_threshold,
input_directory = ""
)
payload_id <- string_db$post_payload(coloring$database_string,
colors = coloring$color
I was able to make the S4 class generating function STRINGdb available with get().
STRINGdb <- get("STRINGdb", envir = loadNamespace("STRINGdb"))
string_db <- STRINGdb$new(
version = "11",
species = 511145, # Check on String database to get the right code (E.coli K12: 511145)
score_threshold = 0.900, # Cutoff score to consider something an interaction
input_directory = ""
)
Don't know if this is a particularly nice way to do it but it seems to work. I am not sure about the methods post_payload etc. How can I make them available? Using string_db$STRINGdb::post_payload does not work.
Help would be highly appreciated!