GithubHelp home page GithubHelp logo

Replicate genome dendrogram about anvio HOT 3 CLOSED

lucaz88 avatar lucaz88 commented on August 30, 2024
Replicate genome dendrogram

from anvio.

Comments (3)

meren avatar meren commented on August 30, 2024

Hey @lucaz88,

The clustering of genomes in the pangenomic workflow takes place here in panops.py:

(...)
for clustering_tuple in [('gene_cluster presence absence', self.view_data),
                         ('gene_cluster frequencies', self.view_data_presence_absence)]:
    v, d = clustering_tuple
    newick = clustering.get_newick_tree_data_for_dict(d, 
                                                      transpose=True,
                                                      distance = self.distance,
                                                      linkage=self.linkage)
(...)

If you follow the function get_newick_tree_data_for_dict in panops.py you will find that the default clustering uses 'euclidean' distance with 'ward' linkage on l1-normalized vectors by default, where linkage is calculated like this:

linkage = hierarchy.linkage(vectors, metric=distance, method=linkage)

Your first dendrogram is almost identical to the one in anvi'o (if you rotate things around a bit), and differences are likely due to the normalization step. I hope this helps.

Best wishes,
Meren.

from anvio.

lucaz88 avatar lucaz88 commented on August 30, 2024

Thanks @meren !! I missed the normalization step! Now it looks identical without the need to do rotate anything 😉

from anvio.

meren avatar meren commented on August 30, 2024

Perfect :) Thank you for reporting back!

from anvio.

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.