dbRDA plot question

1,032 views
Skip to first unread message

Marilou

unread,
Feb 7, 2015, 2:59:27 AM2/7/15
to qiime...@googlegroups.com
Hi,

I am using dbRDA to compare categories and plots and stats have been successfully generated.  The plot however contains sample labels instead of markers (that denote samples). Is there a way to change the sample labels in the plot with markers of different colors (representing samples). I am using MacQiime 1.8 and using the jacknifed matrix and I have attached files below.

compare_categories.py --method dbrda -i jacknifed_blasted/unweighted_unifrac_otu_table.blasted.txt -m BC7Map1.txt -c Resistotype_all -o jack_dbrda/dbrda/unweighted/Resistotype_all -n 999

Thanks in advance for the help.

Best,
marilou


unweighted_unifrac_otu_table.blasted.txt
dbrda_plot.pdf
dbrda_results.txt
BC7Map1.txt

Jai Ram Rideout

unread,
Feb 9, 2015, 12:13:07 PM2/9/15
to qiime...@googlegroups.com
Hi Marilou,

Unfortunately there isn't a way to customize the db-RDA plots generated by compare_categories.py. The scripts uses R's vegan::capscale function to generate the plot. You may be able to customize the plot by running the analysis directly in R instead of using compare_categories.py. Here's the R script that compare_categories.py is running in case you want to use this as a starting point.

Hope this helps,
Jai

--

---
You received this message because you are subscribed to the Google Groups "Qiime Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qiime-forum...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sophie

unread,
Feb 9, 2015, 12:23:19 PM2/9/15
to qiime...@googlegroups.com
Thanks Jai! Mailou - if you want to dig a bit more into the R, here's a response written by my colleague Jorge:

I think vegan decides to switch from text to points as the number of samples increases.

To force having points, it's necessary to modify the R code that runs the analysis (qiime/support_files/R/dbrda.r), replacing its last line:

plot(capscale.results, display=c("wa", "bp"))

with the following lines:

plot(capscale.results, display="wa", type="point")
text(capscale.results, col="blue", display="bp")

Moreover, if Marilou wants to color the samples according to the Resistotype_all column, it's possible to do so by eg doing this instead:

# More colors in http://www.stat.columbia.edu/~tzheng/files/Rcolor.pdf
colors <- c("coral", "coral4", "mediumblue", "darkgoldenrod2",
            "darkolivegreen3", "darkorchid1", "red2")

# Plot nothing, but get the figure
plot(capscale.results, type="none")
# Now plot samples, coloured by the factors in the column (-c option to script)
points(capscale.results, display ="wa", col=colors[factor],
      pch=21, bg=colors[factor])
# And arrows for factors
text(capscale.results, col="blue", display="bp")
# Include a legend that doesn't clash with points
legend("bottomleft", legend=levels(factor), bty="n",
       col=colors, pch=21, pt.bg=colors)

In general, it's possible to heavily customize ordination plots, but it's not really easy...
The plot we get is attached.

Thanks,
Sophie
dbrda_plot.pdf

Jai Ram Rideout

unread,
Feb 9, 2015, 12:29:49 PM2/9/15
to qiime...@googlegroups.com
Thanks Sophie and Jorge!

Marilou

unread,
Sep 3, 2015, 8:15:16 PM9/3/15
to Qiime Forum
Jai, Sophie, Jorge,

I would like to say thank you for this (albeit late!). I realized that I did not get into thanking you guys. Your suggestion (about customizing colors) below works and I got to customized my dbRDA plots. You guys are awesome. (:>)

Marilou

Jai Ram Rideout

unread,
Sep 4, 2015, 11:51:37 AM9/4/15
to qiime...@googlegroups.com
Glad to hear you got it working!

Jai
Reply all
Reply to author
Forward
0 new messages