This is a test version of Biostars. For the public version, visit https://www.biostars.org.
t-SNE for microbiome analysis

Hi

I wondered whether there is a good tutorial on how to make t-SNE plot on microbiome samples. I have a phyloseq object for which I have metadata age and gender. Ideally I want something like this: enter image description here

So different shapes for gender, and in my case (instead of species) the different timepoints as colors.

Thank you !

microbiome t-sne phyloseq

1 answer

t-SNE doesn't care about your labels, and in fact it should not even see them. Labeling comes in post-processing steps after the embedding has been done.

A complete solution:

It boils down to determining tetranucleotide frequencies for all contigs in your metagenome, though you probably want to apply some kind of lower-boundary cutoff. Typically people throw away contigs smaller than 1-2 kb, and sometimes going to 3-5 kB is warranted. CheckM can calculate 4n frequencies, and then you feed those into one of many t-SNE implementations. I suggest openTSNE because it is multithreaded and easy to use.

I have a custom script that will automate what I just described. From a large metagenome it will produce something like the embedding shown below, but unfortunately it is not yet ready for sharing.

enter image description here

Log in to answer this question.