Code Monkey home page Code Monkey logo

Comments (9)

gmteunisse avatar gmteunisse commented on September 20, 2024

from fantaxtic.

luigallucci avatar luigallucci commented on September 20, 2024

@gmteunisse thank you for the fast reply!

I saw the palette section, I was wondering if instead of using:

 palette = c(Bacteroidetes = "red", 
                            Proteobacteria = "blue"),

I can also use a personalized object like this or directly a command of RColorBrewer

colourCount1=length(get_taxa_unique(e1_sub, taxonomic.rank = "Genus"))

pal <- colorRampPalette(brewer.pal(12,"Paired"))(colourCount1))

plot_nested_bar(top_e1$ps_obj,
                top_level = "Class",
                nested_level = "Genus",
                nested_merged_label = "NA and other <tax>",
                palette= pal,
                legend_title = "Phyla and genera") 

to assign the colour to the nested_level? e.g. trying this, just a blue color appears in the plot.

If that is not possible, could I also provide a color code in hex, like this, when defining the palette with taxoun_colours()?

pal3 <- taxon_colours(top_e1$ps_obj, 
                     tax_level = "Phylum", 
                     palette = c(Alphaproteobacteria = "#6d4c3d", 
                                 Campylobacterota = "#095256",
                                Gammaproteobacteria= "#ec7357"))

from fantaxtic.

gmteunisse avatar gmteunisse commented on September 20, 2024

from fantaxtic.

luigallucci avatar luigallucci commented on September 20, 2024

Yes, is working but is following the order of priority (I suppose) that RColorBrewer give in the adopted palette...moreover, I have a sample with really low diversity in terms of top_level. I'm plotting with class and genus. So, probably this makes the barplot not completely differentiated aesthetically as I had in mind.

Probably, a suitable alternative for me, could be to better define the plot with the advance usage settings. Can I group the genus less abundant then 5% and NA, make the nested legends and plot it using ggplot, right?

from fantaxtic.

gmteunisse avatar gmteunisse commented on September 20, 2024

from fantaxtic.

luigallucci avatar luigallucci commented on September 20, 2024

Indeed, this is what I mean with my second question: they are samples from enrichment (most of them), which makes the top level not diverse also at class level, which is my actual top level.

I can manage the colour to arrange it down to the order or family. I want to know if there is a way to have a significant control on the filtering level when choosing the top_taxa.

I'm working on that:

top_e1 <- top_taxa(e1_sub,
                        n_taxa = 10,
                        tax_level = "Genus",
                        grouping = "Sample_id")

If I want to drop all the taxa below a specific value (e.g. less than 10% abundant) and group these together using a label Less abundant < 10% or similar... is there a way to do that in fantaxtic? So, with more fine-tuned filtering.

from fantaxtic.

gmteunisse avatar gmteunisse commented on September 20, 2024

There’s no native support for that, but you can use some fantaxtic helper functions to do so. You would need to identify the taxon ids of the taxa that you want to merge; fantaxtic can do the rest. See this issue for a code example for merging:
#25

See this stackoverflow answer for an approach of identifying taxa by %: https://stackoverflow.com/questions/76631141/filter-phyloseq-to-use-in-fantaxtic

from fantaxtic.

luigallucci avatar luigallucci commented on September 20, 2024

Thank you for the reply and sorry for mine late one.

The second example is working perfectly; I have two additional questions to end that:

In your opinion, what is the difference between using max and sum? It probably is not really clear to me what max is doing.

The second question...plot_nested_bar is a ggplot object, so it can be treated equally. Can I modify the aesthetic parameters of the plot without modifying/losing the legend organization? on the way around, there is a way to reproduce the same legend organization in fantaxtic in a normal ggplot taxa plotbar?

from fantaxtic.

gmteunisse avatar gmteunisse commented on September 20, 2024

from fantaxtic.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.