.jnew("edu/uic/ncdm/venn/data/VennData", as.character(组合), 中的错误:
Error in .jnew("edu/uic/ncdm/venn/data/VennData", as.character(combinations), :
我前一段时间用过,效果很好,不知道现在不能用了..
我使用 venneuler 创建维恩图。我正在做的是读取两个长度不同的数据帧 cosmic_atac 和 cosmic_rna,然后使用 cbindPad 然后 运行 venneuler 将它们组合成一个数据帧。不确定是什么错误任何帮助或建议将不胜感激。
cbindPad <- function(...){
args <- list(...)
n <- sapply(args,nrow)
mx <- max(n)
pad <- function(x, mx){
if (nrow(x) < mx){
nms <- colnames(x)
padTemp <- matrix(NA, mx - nrow(x), ncol(x))
colnames(padTemp) <- nms
if (ncol(x)==0) {
return(padTemp)
} else {
return(rbind(x,padTemp))
}
}
else{
return(x)
}
}
rs <- lapply(args,pad,mx)
return(do.call(cbind,rs))
}
dat <- cbindPad(cosmic_atac,cosmic_rna)
vennfun <- function(x) {
x$id <- seq(1, nrow(x)) #add a column of numbers (required for melt)
xm <- melt(x, id.vars="id", na.rm=TRUE) #melt table into two columns (value & variable)
xc <- dcast(xm, value~variable, fun.aggregate=length) #remove NA's, list presence/absence of each value for each variable (1 or 0)
rownames(xc) <- xc$value #value column = rownames (required for Venneuler)
xc$value <- NULL #remove redundent value column
xc #output the new dataframe
}
#
VennDat <- vennfun(dat)
genes.venn <- venneuler(VennDat)
Error in .jnew("edu/uic/ncdm/venn/data/VennData",
as.character(combinations), : java.lang.NoSuchMethodError:
dput(cosmic_atac)
structure(list(gene = c("ENSG00000136754", "ENSG00000143322",
"ENSG00000196914", "ENSG00000143437", "ENSG00000129993", "ENSG00000067955",
"ENSG00000114423", "ENSG00000142273", "ENSG00000165556", "ENSG00000109220",
"ENSG00000172409", "ENSG00000124795", "ENSG00000119772", "ENSG00000102034",
"ENSG00000187239", "ENSG00000163655", "ENSG00000106031", "ENSG00000123364",
"ENSG00000128713", "ENSG00000083168", "ENSG00000073614", "ENSG00000002834",
"ENSG00000130675", "ENSG00000133392", "ENSG00000165671", "ENSG00000110713",
"ENSG00000116132", "ENSG00000164985", "ENSG00000163902", "ENSG00000079102",
"ENSG00000184702", "ENSG00000125354", "ENSG00000072501", "ENSG00000138336",
"ENSG00000100815")), row.names = c(NA, -35L), class = c("tbl_df",
"tbl", "data.frame"))
dput(cosmic_rna)
structure(list(gene = c("ENSG00000136754", "ENSG00000143322",
"ENSG00000196914", "ENSG00000143437", "ENSG00000129993", "ENSG00000067955",
"ENSG00000114423", "ENSG00000165556", "ENSG00000109220", "ENSG00000172409",
"ENSG00000124795", "ENSG00000119772", "ENSG00000102034", "ENSG00000187239",
"ENSG00000163655", "ENSG00000106031", "ENSG00000083168", "ENSG00000073614",
"ENSG00000002834", "ENSG00000178053", "ENSG00000130675", "ENSG00000133392",
"ENSG00000165671", "ENSG00000110713", "ENSG00000164985", "ENSG00000163902",
"ENSG00000079102", "ENSG00000184702", "ENSG00000125354", "ENSG00000072501",
"ENSG00000138336", "ENSG00000100815")), row.names = c(NA, -32L
), class = c("tbl_df", "tbl", "data.frame"))
如果您将 dat
设为 data.table 并使 colnames 唯一:
library(data.table)
library(venneuler)
#> Loading required package: rJava
cosmic_atac <-
structure(list(gene = c("ENSG00000136754", "ENSG00000143322",
"ENSG00000196914", "ENSG00000143437", "ENSG00000129993", "ENSG00000067955",
"ENSG00000114423", "ENSG00000142273", "ENSG00000165556", "ENSG00000109220",
"ENSG00000172409", "ENSG00000124795", "ENSG00000119772", "ENSG00000102034",
"ENSG00000187239", "ENSG00000163655", "ENSG00000106031", "ENSG00000123364",
"ENSG00000128713", "ENSG00000083168", "ENSG00000073614", "ENSG00000002834",
"ENSG00000130675", "ENSG00000133392", "ENSG00000165671", "ENSG00000110713",
"ENSG00000116132", "ENSG00000164985", "ENSG00000163902", "ENSG00000079102",
"ENSG00000184702", "ENSG00000125354", "ENSG00000072501", "ENSG00000138336",
"ENSG00000100815")), row.names = c(NA, -35L), class = c("tbl_df",
"tbl", "data.frame"))
cosmic_rna <-
structure(list(gene = c("ENSG00000136754", "ENSG00000143322",
"ENSG00000196914", "ENSG00000143437", "ENSG00000129993", "ENSG00000067955",
"ENSG00000114423", "ENSG00000165556", "ENSG00000109220", "ENSG00000172409",
"ENSG00000124795", "ENSG00000119772", "ENSG00000102034", "ENSG00000187239",
"ENSG00000163655", "ENSG00000106031", "ENSG00000083168", "ENSG00000073614",
"ENSG00000002834", "ENSG00000178053", "ENSG00000130675", "ENSG00000133392",
"ENSG00000165671", "ENSG00000110713", "ENSG00000164985", "ENSG00000163902",
"ENSG00000079102", "ENSG00000184702", "ENSG00000125354", "ENSG00000072501",
"ENSG00000138336", "ENSG00000100815")), row.names = c(NA, -32L
), class = c("tbl_df", "tbl", "data.frame"))
cbindPad <- function(...){
args <- list(...)
n <- sapply(args,nrow)
mx <- max(n)
pad <- function(x, mx){
if (nrow(x) < mx){
nms <- colnames(x)
padTemp <- matrix(NA, mx - nrow(x), ncol(x))
colnames(padTemp) <- nms
if (ncol(x)==0) {
return(padTemp)
} else {
return(rbind(x,padTemp))
}
}
else{
return(x)
}
}
rs <- lapply(args,pad,mx)
return(do.call(cbind,rs))
}
dat <- cbindPad(cosmic_atac,cosmic_rna)
setDT(dat)
setnames(dat, make.unique(colnames(dat)))
vennfun <- function(x) {
x$id <- seq(1, nrow(x)) #add a column of numbers (required for melt)
xm <- melt(x, id.vars="id", na.rm=TRUE) #melt table into two columns (value & variable)
xc <- dcast(xm, value~variable, fun.aggregate=length) #remove NA's, list presence/absence of each value for each variable (1 or 0)
rownames(xc) <- xc$value #value column = rownames (required for Venneuler)
xc$value <- NULL #remove redundent value column
xc #output the new dataframe
}
#
VennDat <- vennfun(dat)
genes.venn <- venneuler(VennDat)
plot(genes.venn)
由 reprex package (v0.3.0)
于 2020-07-09 创建
我前一段时间用过,效果很好,不知道现在不能用了..
我使用 venneuler 创建维恩图。我正在做的是读取两个长度不同的数据帧 cosmic_atac 和 cosmic_rna,然后使用 cbindPad 然后 运行 venneuler 将它们组合成一个数据帧。不确定是什么错误任何帮助或建议将不胜感激。
cbindPad <- function(...){
args <- list(...)
n <- sapply(args,nrow)
mx <- max(n)
pad <- function(x, mx){
if (nrow(x) < mx){
nms <- colnames(x)
padTemp <- matrix(NA, mx - nrow(x), ncol(x))
colnames(padTemp) <- nms
if (ncol(x)==0) {
return(padTemp)
} else {
return(rbind(x,padTemp))
}
}
else{
return(x)
}
}
rs <- lapply(args,pad,mx)
return(do.call(cbind,rs))
}
dat <- cbindPad(cosmic_atac,cosmic_rna)
vennfun <- function(x) {
x$id <- seq(1, nrow(x)) #add a column of numbers (required for melt)
xm <- melt(x, id.vars="id", na.rm=TRUE) #melt table into two columns (value & variable)
xc <- dcast(xm, value~variable, fun.aggregate=length) #remove NA's, list presence/absence of each value for each variable (1 or 0)
rownames(xc) <- xc$value #value column = rownames (required for Venneuler)
xc$value <- NULL #remove redundent value column
xc #output the new dataframe
}
#
VennDat <- vennfun(dat)
genes.venn <- venneuler(VennDat)
Error in .jnew("edu/uic/ncdm/venn/data/VennData", as.character(combinations), : java.lang.NoSuchMethodError:
dput(cosmic_atac)
structure(list(gene = c("ENSG00000136754", "ENSG00000143322",
"ENSG00000196914", "ENSG00000143437", "ENSG00000129993", "ENSG00000067955",
"ENSG00000114423", "ENSG00000142273", "ENSG00000165556", "ENSG00000109220",
"ENSG00000172409", "ENSG00000124795", "ENSG00000119772", "ENSG00000102034",
"ENSG00000187239", "ENSG00000163655", "ENSG00000106031", "ENSG00000123364",
"ENSG00000128713", "ENSG00000083168", "ENSG00000073614", "ENSG00000002834",
"ENSG00000130675", "ENSG00000133392", "ENSG00000165671", "ENSG00000110713",
"ENSG00000116132", "ENSG00000164985", "ENSG00000163902", "ENSG00000079102",
"ENSG00000184702", "ENSG00000125354", "ENSG00000072501", "ENSG00000138336",
"ENSG00000100815")), row.names = c(NA, -35L), class = c("tbl_df",
"tbl", "data.frame"))
dput(cosmic_rna)
structure(list(gene = c("ENSG00000136754", "ENSG00000143322",
"ENSG00000196914", "ENSG00000143437", "ENSG00000129993", "ENSG00000067955",
"ENSG00000114423", "ENSG00000165556", "ENSG00000109220", "ENSG00000172409",
"ENSG00000124795", "ENSG00000119772", "ENSG00000102034", "ENSG00000187239",
"ENSG00000163655", "ENSG00000106031", "ENSG00000083168", "ENSG00000073614",
"ENSG00000002834", "ENSG00000178053", "ENSG00000130675", "ENSG00000133392",
"ENSG00000165671", "ENSG00000110713", "ENSG00000164985", "ENSG00000163902",
"ENSG00000079102", "ENSG00000184702", "ENSG00000125354", "ENSG00000072501",
"ENSG00000138336", "ENSG00000100815")), row.names = c(NA, -32L
), class = c("tbl_df", "tbl", "data.frame"))
如果您将 dat
设为 data.table 并使 colnames 唯一:
library(data.table)
library(venneuler)
#> Loading required package: rJava
cosmic_atac <-
structure(list(gene = c("ENSG00000136754", "ENSG00000143322",
"ENSG00000196914", "ENSG00000143437", "ENSG00000129993", "ENSG00000067955",
"ENSG00000114423", "ENSG00000142273", "ENSG00000165556", "ENSG00000109220",
"ENSG00000172409", "ENSG00000124795", "ENSG00000119772", "ENSG00000102034",
"ENSG00000187239", "ENSG00000163655", "ENSG00000106031", "ENSG00000123364",
"ENSG00000128713", "ENSG00000083168", "ENSG00000073614", "ENSG00000002834",
"ENSG00000130675", "ENSG00000133392", "ENSG00000165671", "ENSG00000110713",
"ENSG00000116132", "ENSG00000164985", "ENSG00000163902", "ENSG00000079102",
"ENSG00000184702", "ENSG00000125354", "ENSG00000072501", "ENSG00000138336",
"ENSG00000100815")), row.names = c(NA, -35L), class = c("tbl_df",
"tbl", "data.frame"))
cosmic_rna <-
structure(list(gene = c("ENSG00000136754", "ENSG00000143322",
"ENSG00000196914", "ENSG00000143437", "ENSG00000129993", "ENSG00000067955",
"ENSG00000114423", "ENSG00000165556", "ENSG00000109220", "ENSG00000172409",
"ENSG00000124795", "ENSG00000119772", "ENSG00000102034", "ENSG00000187239",
"ENSG00000163655", "ENSG00000106031", "ENSG00000083168", "ENSG00000073614",
"ENSG00000002834", "ENSG00000178053", "ENSG00000130675", "ENSG00000133392",
"ENSG00000165671", "ENSG00000110713", "ENSG00000164985", "ENSG00000163902",
"ENSG00000079102", "ENSG00000184702", "ENSG00000125354", "ENSG00000072501",
"ENSG00000138336", "ENSG00000100815")), row.names = c(NA, -32L
), class = c("tbl_df", "tbl", "data.frame"))
cbindPad <- function(...){
args <- list(...)
n <- sapply(args,nrow)
mx <- max(n)
pad <- function(x, mx){
if (nrow(x) < mx){
nms <- colnames(x)
padTemp <- matrix(NA, mx - nrow(x), ncol(x))
colnames(padTemp) <- nms
if (ncol(x)==0) {
return(padTemp)
} else {
return(rbind(x,padTemp))
}
}
else{
return(x)
}
}
rs <- lapply(args,pad,mx)
return(do.call(cbind,rs))
}
dat <- cbindPad(cosmic_atac,cosmic_rna)
setDT(dat)
setnames(dat, make.unique(colnames(dat)))
vennfun <- function(x) {
x$id <- seq(1, nrow(x)) #add a column of numbers (required for melt)
xm <- melt(x, id.vars="id", na.rm=TRUE) #melt table into two columns (value & variable)
xc <- dcast(xm, value~variable, fun.aggregate=length) #remove NA's, list presence/absence of each value for each variable (1 or 0)
rownames(xc) <- xc$value #value column = rownames (required for Venneuler)
xc$value <- NULL #remove redundent value column
xc #output the new dataframe
}
#
VennDat <- vennfun(dat)
genes.venn <- venneuler(VennDat)
plot(genes.venn)
由 reprex package (v0.3.0)
于 2020-07-09 创建