[BioC] Edge attributes in Rgraphviz

Robert Gentleman rgentlem at fhcrc.org
Tue Jan 29 19:41:10 CET 2008


Hi,

Srinivas Iyyer wrote:
> Dear Prof. Gentleman, 
> 
> I was using 1.16 and updated it to 1.17 version of
> Graphviz.  I see same problem with 1.17. am I wrong in
> assigning attributes to edges?

   And you are going to have to give a reproducible example, again, it 
would help to read the posting guide and follow the instructions, then 
we could have several fewer emails before we actually get close to the 
problem.
   So what is g4? That could be the problem, and how would I ever know 
since you don't tell me what g4 is?

> 
>  Here I do not intend to change some edges but all
> edges in the entire graph. I feel that the lines are
> too fat at some places in the graph. 

  Well that may be a pixelation problem. Unless you do something 
explicit all edges will have the same width, how they get rendered is 
not something you want to try and control by setting widths.

Robert

> 
> Kind regards, 
> Srini.
> 
> 
>> x = buildEdgeList(g4,
> +                     recipEdges='distinct',
> +                     edgeAttrs=list(c(color='green'))
> +                    )
> Error in buildEdgeList(g4, recipEdges = "distinct",
> edgeAttrs = list(c(color = "green"))) : 
>   STRING_ELT() can only be applied to a 'character
> vector', not a 'NULL'
> 
> 
>> natt = makeNodeAttrs(
> +                       g4, 
> +                       shape = "ellipse", 
> +                       fillcolor= "goldenrod1",
> +                       size=0,
> +                       fontsize=8,
> +                       label = substr(nodes(g4),6,
> 10)
> +                      )
> 
>>  lgGO = agopen(
> +               g4, 
> +               recipEdges = "distinct", 
> +               layoutType = "dot",
> +               nodeAttrs = natt, 
> +               name = "",
> +               edgeAttrs=list(c(color='green',
> +                                weight=0.3)
> +                              )
> +               )
> Error in buildEdgeList(graph, recipEdges, edgeAttrs,
> subGList, attrs$edge) : 
>   STRING_ELT() can only be applied to a 'character
> vector', not a 'NULL'
> 
> 
> 
>> sessionInfo()
> R version 2.6.1 (2007-11-26) 
> i386-pc-mingw32 
> 
> locale:
> LC_COLLATE=English_United
> States.1252;LC_CTYPE=English_United
> States.1252;LC_MONETARY=English_United
> States.1252;LC_NUMERIC=C;LC_TIME=English_United
> States.1252
> 
> attached base packages:
> [1] splines   tools     stats     graphics  grDevices
> utils     datasets  methods   base     
> 
> other attached packages:
>  [1] Rgraphviz_1.17.7    rgug4130a.db_2.0.2 
> GOstats_2.4.0       Category_2.4.0     
> genefilter_1.16.0   survival_2.34       RBGL_1.14.0   
>     
>  [8] annotate_1.16.1     xtable_1.5-2       
> GO.db_2.0.2         AnnotationDbi_1.0.6 RSQLite_0.6-4 
>      DBI_0.2-4           Biobase_1.16.2     
> [15] graph_1.16.1       
> 
> loaded via a namespace (and not attached):
> [1] cluster_1.11.9
> 
> 
> 
> 
> --- Robert Gentleman <rgentlem at fhcrc.org> wrote:
> 
>> You did not tell us what version - please include
>> the output of 
>> sessionInfo in your posts.
>>
>> Things have changed a lot and the devel version
>> 1.17.11 is somewhat 
>> improved. Is that what you are using, and if not
>> could you please try it?
>>
>> best wishes
>>    Robert
>>
>>
>> Srinivas Iyyer wrote:
>>> Dear group, 
>>>
>>> I am finding difficult to control edge size and
>> color
>>> in the following piece of code. 
>>> natt = makeNodeAttrs(
>>>                      g4, 
>>>                      shape = "ellipse", 
>>>                      fillcolor= "goldenrod1",
>>>                      size=0,
>>>                      fontsize=8,
>>>                      label = substr(nodes(g4),6,
>> 10)
>>>                     )
>>>> lgGO = agopen(
>>>              g4, 
>>>              recipEdges = "distinct", 
>>>              layoutType = "dot",
>>>              nodeAttrs = natt, 
>>>              name = "",
>>>              edgeAttrs=list(c(color='green',
>>>                               weight=0.3)
>>>                             )
>>>              )
>>>
>>> Error in buildEdgeList(graph, recipEdges,
>> edgeAttrs,
>>> subGList, attrs$edge) : 
>>>   STRING_ELT() can only be applied to a 'character
>>> vector', not a 'NULL'
>>>
>>>
>>> Here in agopen, I made a edgeAttrs list object
>> with 
>>> color and weight attributes and I get above error.
>>>
>>> Instead, I tried like the following:
>>>
>>>> x = buildEdgeList(g4,
>>>                     recipEdges='distinct',
>>>                    
>> edgeAttrs=list(c(color='green'))
>>>                    )
>>> Error in buildEdgeList(g4, recipEdges =
>> "distinct",
>>> edgeAttrs = list(c(color = "green"))) : 
>>>   STRING_ELT() can only be applied to a 'character
>>> vector', not a 'NULL'
>>>
>>>
>>> Also when I just make a buildEdgeList object, I
>> can
>>> make it with wight=1 (which is default)
>>>
>>>
>>>
>>>> x = buildEdgeList(g4,recipEdges='distinct')
>>>> y = unlist(x)
>>>> y[[1]]
>>> An object of class “pEdge”
>>> Slot "from":
>>> [1] "GO:0030199"
>>>
>>> Slot "to":
>>> [1] "GO:0030198"
>>>
>>> Slot "attrs":
>>> $arrowhead
>>> [1] "open"
>>>
>>> $weight
>>> [1] "1"
>>>
>>> $dir
>>> [1] "forward"
>>>
>>>
>>> Slot "subG":
>>> [1] 0
>>>
>>>
>>>
>>> How can I control, the edge global parameters. 
>>> I do not see makeEdgeAttr function just like
>>> makeNodeAttr. Could some one help me here please.
>> A
>>> working code is given at bottom. 
>>>
>>>> makeEdgeAttrs
>>> Error: object "makeEdgeAttrs" not found
>>>
>>>
>>>
>>>
>>>
>>> ##### code that works#######
>>> g4 <- GOGraph(summary(hgOver)$GOBPID, GOBPPARENTS)
>>>
>>> natt = makeNodeAttrs(g4, shape = "ellipse",
>> fillcolor
>>> = "goldenrod1",size=0,fontsize=8,label =
>>> substr(nodes(g4),6, 10))
>>>
>>> natt$fillcolor[summary(hgOver)$GOBPID] = "red" 
>>>
>>> lgGO = agopen(g4, recipEdges = "distinct",
>> layoutType
>>> = "dot",nodeAttrs = natt, name =
>>> "",edgeAttrs=list(c(color='green')))
>>>
>>> plot(lgGO)
>>>
>>> ###### end of code that works #######
>>>
>>>
>>>      
> ____________________________________________________________________________________
>>> Never miss a thing.  Make Yahoo your home page.
>>>
>>> _______________________________________________
>>> Bioconductor mailing list
>>> Bioconductor at stat.math.ethz.ch
>>> https://stat.ethz.ch/mailman/listinfo/bioconductor
>>> Search the archives:
> http://news.gmane.org/gmane.science.biology.informatics.conductor
>> -- 
>> Robert Gentleman, PhD
>> Program in Computational Biology
>> Division of Public Health Sciences
>> Fred Hutchinson Cancer Research Center
>> 1100 Fairview Ave. N, M2-B876
>> PO Box 19024
>> Seattle, Washington 98109-1024
>> 206-667-7700
>> rgentlem at fhcrc.org
>>
>>
> 
> 
> 
>       ____________________________________________________________________________________
> Never miss a thing.  Make Yahoo your home page. 
> http://www.yahoo.com/r/hs
> 

-- 
Robert Gentleman, PhD
Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M2-B876
PO Box 19024
Seattle, Washington 98109-1024
206-667-7700
rgentlem at fhcrc.org



More information about the Bioconductor mailing list