How do I look for shared OTUs in an abundance matrix?
1
1
Entering edit mode
4.9 years ago
Ming ▴ 110

Dear all,

Let's assume I have an abundance matrix that looks like this:

             SampleA SampleB SampleC
OTU1         5               6              0
OTU2         3               1              2
OTU3         1               0              1
OTU4         0               0              2

If I have a large abundance matrix, what software or scripts will you recommend constructing a Venn diagram that can look for shared OTUs, or OTUs that are unique to each sample? The software / script should also produce an output that denotes the number of unique and shared OTUs.

Thank you!

R venn diagram • 3.1k views
ADD COMMENT
0
Entering edit mode

For more than three sets, Euler diagrams quickly become unreadable. You may want to explore alternatives such as UpSetR.

ADD REPLY
0
Entering edit mode
4.9 years ago
zx8754 11k

Transpose the dataframe/matrix so that OTUs are the sets, then convert into logical, then plot:

# example data
df1 <- read.table(text = "SampleA SampleB SampleC
OTU1         5               6              0
OTU2         3               1              2
OTU3         1               0              1
OTU4         0               0              2", header = TRUE, stringsAsFactors = FALSE)


library(gplots)

venn(t(df1 > 0))
ADD COMMENT
0
Entering edit mode

Note that the venn() function from gplots is limited to a small number of sets

ADD REPLY
0
Entering edit mode

True, not sure what OP wants, OTUs as sets or samples as sets, in their example both less than 5 sets. So 4 set Venn should be OK. Agreed, UpSet is more suitable when sets are more than 4.

ADD REPLY

Login before adding your answer.

Traffic: 2234 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6