Question: consulting about the FELLA package
0
gravatar for jnzd_hemaozhang
11 months ago by
jnzd_hemaozhang0 wrote:

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 • 240 views
ADD COMMENTlink modified 11 months ago by sergi.picart20 • written 11 months ago by jnzd_hemaozhang0
Answer: consulting about the FELLA package
0
gravatar for sergi.picart
11 months ago by
sergi.picart20
sergi.picart20 wrote:

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 COMMENTlink written 11 months ago by sergi.picart20
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 267 users visited in the last hour