get_upset: generate the dataset for upset of UpSetR

get_upsetR Documentation

generate the dataset for upset of UpSetR

Description

generate the dataset for upset of UpSetR

Usage

get_upset(obj, ...)

## S4 method for signature 'data.frame'
get_upset(obj, sampleda, factorNames, threshold = 0)

## S4 method for signature 'phyloseq'
get_upset(obj, ...)

Arguments

obj

object, phyloseq or data.frame, if it is data.frame, the shape of it should be row sample * columns features.

...

additional parameters.

sampleda

data.frame, if the obj is data.frame, the sampleda should be provided.

factorNames

character, the column names of factor in sampleda

threshold

integer, default is 0.

Value

a data.frame for the input of 'upset' of 'UpSetR'.

Author(s)

Shuangbin Xu

Examples

## Not run: 
data(test_otu_data)
test_otu_data %<>% as.phyloseq()
upsetda <- get_upset(test_otu_data, factorNames="group")
otudafile <- system.file("extdata", "otu_tax_table.txt",
                         package="MicrobiotaProcess")
samplefile <- system.file("extdata","sample_info.txt", 
                         package="MicrobiotaProcess")
otuda <- read.table(otudafile, sep="\t", header=TRUE, 
                    row.names=1, check.names=FALSE,
                    skip=1, comment.char="")
sampleda <- read.table(samplefile,sep="\t", 
                       header=TRUE, row.names=1)
head(sampleda)
otuda <- otuda[sapply(otuda, is.numeric)]
otuda <- data.frame(t(otuda), check.names=FALSE)
head(otuda[1:5, 1:5])
upsetda2 <- get_upset(obj=otuda, sampleda=sampleda, 
                     factorNames="group")
#Then you can use `upset` of `UpSetR` to visualize the results.
library(UpSetR)
upset(upsetda, sets=c("B","D","M","N"), sets.bar.color = "#56B4E9",
      order.by = "freq", empty.intersections = "on")

## End(Not run)

xiangpin/MicrobiotaProcess documentation built on Nov. 12, 2024, 2:05 p.m.