How can i draw PCoA with single OTU (having importance) by coloring based on abundance?

84 views
Skip to first unread message

shriram patel

unread,
Apr 22, 2016, 1:54:47 AM4/22/16
to Qiime 1 Forum
Hello guys, 

One of the OTU in my dataset is significantly associated with treatment group. I want to plot that OTU only by PCoA by coloring samples based on its abundance.

How can I draw PCoA with single OTU in community by coloring samples based on abundance of that OTUs (like red for high abundance and green for low abundance).

Every suggestions are appreciated.

Thanking You, 

with best

 

TonyWalters

unread,
Apr 22, 2016, 8:35:09 AM4/22/16
to Qiime 1 Forum
Hello Shriram,

You'll have to create a metadata column in your mapping file that contains that OTU abundance value. I would follow a process as described in this post to sort the data in your mapping/OTU table, and copy the column with target OTU into your mapping file.

https://groups.google.com/forum/#!topic/qiime-forum/8ennxleJPME

Note-you shouldn't have to create a new OTU table-I'm referring just to the conversion to tab-delimited, and sorting by SampleID for the mapping/OTU table.

shriram patel

unread,
Apr 22, 2016, 1:33:32 PM4/22/16
to Qiime 1 Forum
Hello TonyWalters, 

Thank You for your suggestions.

I did exactly as you said. First added abundance value in mapping file for that particular OTU and plotted make_emperior.oy by passsing --add_unique_columns and --color_by that OTU abundance. and it worked fine for me. 

My another question related to this is: What is I want to do exactly the same (color samples by abundance value of particular OTU) for creating 2d PCoA, because emperior creates 3d PCoA only. Is there any way I can do it here or in R?

Thank you again for your quick solution

Best

TonyWalters

unread,
Apr 22, 2016, 1:39:18 PM4/22/16
to Qiime 1 Forum
Hello,

Can you use make_2d_plots.py (http://qiime.org/scripts/make_2d_plots.html) with the --colorby parameter pointing to the header in your mapping file for the OTU abundance?

shriram patel

unread,
Apr 22, 2016, 2:26:37 PM4/22/16
to Qiime 1 Forum
Hello, 

I have already tried it using make_2d_plots.py. It create plot based on OTU abundance value specified in mapping file. But it gives different colors to each of the abundance value rather than gradient of color (like red for high abundance than blue for low in gradient). 

Is there any way to plot 2d PcoA based on OTU abundance value in gradient colors?

Thank You very much for your precious time.

Reagrds

TonyWalters

unread,
Apr 22, 2016, 2:32:23 PM4/22/16
to Qiime 1 Forum
Can you make a preference file with make_prefs_file.py (http://qiime.org/scripts/make_prefs_file.html) using your mapping file, and pass this with -p when calling make_2d_plots.py and see if that adds the gradient colors?

shriram patel

unread,
Apr 22, 2016, 4:22:31 PM4/22/16
to Qiime 1 Forum
Hello, 

It worked like a charm.

Based on abundance value it generated gradient color, but in addition sample point shape (square, triangle, circle) also changed. 
Instead, Is there any way to make constant sample point shape for all the sample, while color changes based on abundance value of OTU?

Thanks

TonyWalters

unread,
Apr 22, 2016, 6:12:10 PM4/22/16
to Qiime 1 Forum
Shiram, I haven't personally had much luck trying to manually modify the prefs file, but you might run the make_prefs_file.py script, and only pass the column for the OTU abundance with -b when calling make_prefs_file.py, so it limits what preferences are set?

shriram patel

unread,
Apr 23, 2016, 10:20:21 AM4/23/16
to Qiime 1 Forum
Hello TonyWalters, 

Sorry for the late reply.

I tried adding only OTU abundance column and passing it in prefs file but it didn't work.

Is there anyway to do it in R, where there are many pkgs available for drawing PcoA?


With Best

TonyWalters

unread,
Apr 23, 2016, 10:37:58 AM4/23/16
to Qiime 1 Forum
The short answer is yes, see (also other examples if you search for "principle coordinates in R":
http://www.davidzeleny.net/anadat-r/doku.php/en:pcoa_nmds
http://www.inside-r.org/packages/cran/ape/docs/pcoa
https://cran.r-project.org/web/packages/vegan/vegan.pdf

But, tech support for doing this is beyond the scope of QIIME tech support, so answers will be limited.



shriram patel

unread,
Apr 23, 2016, 11:52:28 AM4/23/16
to Qiime 1 Forum
Thanks TonyWalters

Your suggestions were awesome and helpe me a lot.

Especially i wasn't aware about prefers file...
Thanks again for your super quick support.

With Best, 

Colin Brislawn

unread,
Apr 24, 2016, 3:31:01 PM4/24/16
to Qiime 1 Forum
Hello Shriram,

I make all my graphs in R largely using the Phyloseq package. Phyloseq has excellent documentation and makes great PCoA plots: 

I like Tony mentioned, this forum is to support qiime. This means we can't help much with scripts that are not part of qiime, but I'm happy to recommend the R scripts that work well for me. 

Colin

shriram patel

unread,
Apr 25, 2016, 7:57:42 AM4/25/16
to Qiime 1 Forum
Hello Colin, 

Thank you very much for sharing the package.

With best, 
Shriram
Reply all
Reply to author
Forward
0 new messages