joey711 / phyloseq

phyloseq is a set of classes, wrappers, and tools (in R) to make it easier to import, store, and analyze phylogenetic sequencing data; and to reproducibly share that data and analysis with others. See the phyloseq front page:
http://joey711.github.io/phyloseq/
584 stars 187 forks source link

plot_net(type="taxa") doesn't read sample_data() #885

Open GeoMicroSoares opened 6 years ago

GeoMicroSoares commented 6 years ago

Hello there,

I can't seem to colour my taxa network with plot_net() and I'm not sure why. It works for type="samples", but for "taxa" it gives a object not found error. Reproducible example below:

> data("GlobalPatterns")
> gp<-GlobalPatterns
> gp.r <-  transform_sample_counts(gp, function(x) {x/sum(x)} ) 
> gp.r.f = filter_taxa(gp.r, function(x) sum(x) > .05, TRUE)
> plot_net(gp.r.f, maxdist = 0.8, type="taxa", 
         laymeth="fruchterman.reingold",
         color="SampleType",
         point_alpha = 0.6)
Error in FUN(X[[i]], ...) : object 'SampleType' not found

However, the same command works for type="samples".

> plot_net(gp.r.f, maxdist = 0.8, type="samples", 
         laymeth="fruchterman.reingold",
         color="SampleType",
         point_alpha = 0.6)

image

Any help will be appreciated!

> packageVersion("phyloseq")
[1] ‘1.22.3’

> R.version
               _                          
platform       x86_64-pc-linux-gnu         
arch           x86_64                      
os             linux-gnu                   
system         x86_64, linux-gnu           
status                                     
major          3                           
minor          4.3                         
year           2017                        
month          11                          
day            30                          
svn rev        73796                       
language       R                           
version.string R version 3.4.3 (2017-11-30)
nickname       Kite-Eating Tree  
mariaasierra commented 5 years ago

I've got the same question. Have you found any solution yet?

Jigyasa3 commented 4 years ago

Have a look at this code- https://bitbucket.org/natasha_klmnk/subway_art/src/master/lib/coops_func.R