consulting about the FELLA package
1
0
Entering edit mode
@jnzd_hemaozhang-13132
Last seen 5.3 years ago

Recently I read one of your paper titled with “FELLA: an R package to enrich metabolomics data”, and met a problem. I want to present the results of network using the “plot()” function provided by the R package “FELLA”, but the graph can’t be drew with modification, for example, to change the color, shape and the distance between text and graph.

software error FELLA • 1.1k views
ADD COMMENT
0
Entering edit mode
sergi.picart ▴ 20
@sergipicart-11865
Last seen 2.4 years ago
Germany

Hello, First of all, thank you for using our tool - we highly appreacite it.

About your issue, you can fix it by taking the sub-graph as an igraph object and use its plotting arguments. You can play with pretty much every graphical attribute, I have attached an example.

# example on how to customise the plotting attributes of the sub-graph
library(igraph)
library(FELLA)

data("FELLA.sample")
data("input.sample")

myAnalysis <- enrich(
  compounds = input.sample, 
  method = "diffusion", 
  approx = "normality", 
  data = FELLA.sample)

# default plotting
plot(myAnalysis, method = "diffusion", data = FELLA.sample)

# export the graph
g <- generateResultsGraph(object = myAnalysis, data = FELLA.sample)

# again, default plotting
plotGraph(g)

# custom plotting
# currently there is no way to get the default parameters for the graph 
# and change them - would be a nice improvement to allow it
# 
# see ?igraph.plotting for a list of options
v.size <- c(
  "1" = 10,
  "2" = 6,
  "3" = 5,
  "4" = 4,
  "5" = 2
)
v.color <- stats::setNames(grDevices::palette()[1:5], 1:5)

plot(g, 
     vertex.size = v.size[V(g)$com], 
     vertex.color = v.color[V(g)$com], 
     vertex.label.dist = 1, 
     vertex.label.color = ifelse(V(g)$name %in% input.sample, 
                                 "indianred1", "gray20"), 
     edge.curved = TRUE, 
     edge.width = 3)

Of course, you can also export it to other data formats or use other visualisers (e.g. visNetwork). In the next release, we might try to make it easier to do within FELLA, i.e. not requiring to resort to igraph. Hope it helps

ADD COMMENT

Login before adding your answer.

Traffic: 909 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6