Skip to content

Commit 24c362c

Browse files
author
Dong
committed
update
1 parent 5b5f7b0 commit 24c362c

2 files changed

Lines changed: 14 additions & 34 deletions

File tree

NetBID2.Rproj

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +0,0 @@
1-
Version: 1.0
2-
3-
RestoreWorkspace: Default
4-
SaveWorkspace: Default
5-
AlwaysSaveHistory: Default
6-
7-
EnableCodeIndexing: Yes
8-
UseSpacesForTab: Yes
9-
NumSpacesForTab: 2
10-
Encoding: UTF-8
11-
12-
RnwWeave: Sweave
13-
LaTeX: pdfLaTeX
14-
15-
AutoAppendNewline: Yes
16-
StripTrailingWhitespace: Yes
17-
18-
BuildType: Package
19-
PackageUseDevtools: Yes
20-
PackageInstallArgs: --no-multiarch --with-keep.source

R/pipeline_functions.R

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
#' @importFrom GEOquery getGEO
33
#' @importFrom RColorBrewer brewer.pal
44
#' @importFrom plot3D scatter3D
5-
#' @importFrom plotrix draw.ellipse
5+
#' @importFrom plotrix draw.ellipse draw.circle
66
#' @importFrom impute impute.knn
7-
#' @importFrom umap umap
7+
#' @importFrom umap umap umap.defaults
88
#' @importFrom rhdf5 H5Fopen H5Fclose
99
#' @importFrom DESeq2 DESeqDataSetFromTximport DESeq
1010
#' @importFrom ComplexHeatmap Heatmap
@@ -15,13 +15,13 @@
1515
#' @importFrom arm bayesglm
1616
#' @importFrom reshape melt
1717
#' @importFrom ordinal clm clmm
18-
#' @importFrom rmarkdown render
18+
#' @importFrom rmarkdown render pandoc_available html_document
1919
#' @importFrom Matrix rowSums
2020
#' @importFrom SummarizedExperiment assay
2121
#' @importFrom lme4 lmer
2222
#' @importFrom grDevices col2rgb colorRampPalette dev.off pdf rgb
2323
#' @importFrom graphics abline arrows axis barplot boxplot hist image layout legend lines mtext par points polygon rect segments strheight stripchart strwidth text
24-
#' @importFrom stats IQR aggregate as.dendrogram as.dist cutree density dist fisher.test gaussian glm hclust kmeans ks.test lm median model.matrix na.omit order.dendrogram p.adjust pchisq pnorm prcomp pt qnorm quantile sd
24+
#' @importFrom stats IQR aggregate as.dendrogram as.dist cutree density dist fisher.test gaussian glm hclust kmeans ks.test lm median model.matrix na.omit order.dendrogram p.adjust pchisq pnorm prcomp pt qnorm quantile sd splinefun
2525
#' @importFrom utils read.delim write.table
2626

2727
################################
@@ -3815,12 +3815,12 @@ draw.eset.QC <- function(eset,outdir = '.',do.logtransform = FALSE,intgroup=NULL
38153815
use_mat <- log2(use_mat)
38163816
}
38173817
if(generate_html==TRUE){
3818-
if(pandoc_available()==FALSE){
3818+
if(rmarkdown::pandoc_available()==FALSE){
38193819
stop('pandoc not available, please set Sys.setenv(RSTUDIO_PANDOC=$pandoc_installed_path), or set generate_html=FALSE')
38203820
}
38213821
output_rmd_file <- sprintf('%s/%sQC.Rmd',outdir,prefix)
38223822
file.copy(from=system.file('Rmd/eset_QC.Rmd',package = "NetBID2"),to=output_rmd_file)
3823-
rmarkdown::render(output_rmd_file, html_document(toc = TRUE))
3823+
rmarkdown::render(output_rmd_file, rmarkdown::html_document(toc = TRUE))
38243824
return(TRUE)
38253825
}
38263826
## pca
@@ -3920,7 +3920,7 @@ draw.meanSdPlot <- function(eset){
39203920
sd_g_l_m <- base::rowMeans(sd_g_l)
39213921
# col=get_transparent(brewer.pal(8,'Set1')[2],alpha=0.1)
39223922
par(mai=c(1,1,1,2))
3923-
dat <- spline(x=mean_g_l_m,y=sd_g_v,n=n*10)
3923+
dat <- stats::spline(x=mean_g_l_m,y=sd_g_v,n=n*10)
39243924
graphics::plot(y~x,data=dat,type='l',col=brewer.pal(8,'Set1')[1],lwd=2,xlab='rank(mean)',ylab='sd',
39253925
ylim=c(0,base::max(sd_g)),xlim=c(0,base::max(mean_g)),cex.lab=1.2)
39263926
pp <- par()$usr
@@ -3967,7 +3967,7 @@ draw.correlation <- function(use_mat,class_label,main='',correlation_strategy='p
39673967
uni_class <- base::unique(class_label)
39683968
class_label <- class_label[order(factor(class_label,levels=uni_class))]
39693969
use_mat <- use_mat[,names(class_label)]
3970-
cor_res <- cor(use_mat,method=correlation_strategy)
3970+
cor_res <- stats::cor(use_mat,method=correlation_strategy)
39713971
cc1 <- get.class.color(class_label,use_color=use_color,pre_define=pre_define);
39723972
cc1 <- get_transparent(cc1,0.5);
39733973
p1 <- cumsum(base::table(class_label)[uni_class]); p1 <- c(0,p1)
@@ -4292,7 +4292,7 @@ draw.umap.kmeans <- function(mat=NULL,all_k=NULL,obs_label=NULL,
42924292
if(base::length(base::setdiff(all_k,2:base::length(obs_label)))>0){
42934293
message('some value in all_k exceed the maximum sample size, check and re-try !');return(FALSE);
42944294
}
4295-
ori_cc <- umap.defaults;
4295+
ori_cc <- umap::umap.defaults;
42964296
ori_cc$n_epochs <- 2000;
42974297
ori_cc$n_neighbors <- base::min(15,round(ncol(mat)/2));
42984298
if(plot_type=='3D') ori_cc$n_components <- 3
@@ -4529,7 +4529,7 @@ get_clustComp_MICA <- function(outdir, all_k, obs_label, prjname = NULL,strategy
45294529
all_k_res <- list()
45304530
for (k in all_k) {
45314531
use_file <- sprintf('%s/%s_k%s_ClusterMem.txt',
4532-
outdir,prjname,use_k,prjname)
4532+
outdir,prjname,k,prjname)
45334533
d1 <- read.delim(use_file, stringsAsFactors = FALSE)
45344534
##Score
45354535
rownames(d1) <- d1$id
@@ -6075,7 +6075,7 @@ draw.bubblePlot <- function(driver_list=NULL,show_label=driver_list,Z_val=NULL,d
60756075
cc_r <- matrix(z2col(f_mat2,n_len=30,sig_thre=qnorm(1-0.1)),ncol=ncol(f_mat2),byrow = FALSE)
60766076
for(i in 1:nrow(f_mat1)){
60776077
for(j in 1:ncol(f_mat1)){
6078-
draw.circle(i-0.5,j-0.5,radius=f_mat1[i,j]/2,col=cc_r[i,j])
6078+
plotrix::draw.circle(i-0.5,j-0.5,radius=f_mat1[i,j]/2,col=cc_r[i,j])
60796079
}
60806080
}
60816081
## draw circle legend
@@ -8073,14 +8073,14 @@ draw.network.QC <- function(igraph_obj,outdir=NULL,prefix="",directed=TRUE,weigh
80738073
}
80748074
net <- igraph_obj
80758075
if(generate_html==TRUE){
8076-
if(pandoc_available()==FALSE){
8076+
if(rmarkdown::pandoc_available()==FALSE){
80778077
stop('pandoc not available, please set Sys.setenv(RSTUDIO_PANDOC=$pandoc_installed_path), or set generate_html=FALSE')
80788078
}
80798079
directed <- directed
80808080
weighted <- weighted
80818081
output_rmd_file <- sprintf('%s/%snetQC.Rmd',outdir,prefix)
80828082
file.copy(from=system.file('Rmd/net_QC.Rmd',package = "NetBID2"),to=output_rmd_file)
8083-
rmarkdown::render(output_rmd_file, html_document(toc = TRUE))
8083+
rmarkdown::render(output_rmd_file, rmarkdown::html_document(toc = TRUE))
80848084
return(TRUE)
80858085
}
80868086
###
@@ -8976,7 +8976,7 @@ NetBID.lazyMode.DriverEstimation <- function(project_main_dir=NULL,project_name=
89768976
print('Current db info:')
89778977
print(db_info)
89788978
if(!intgroup %in% colnames(Biobase::pData(cal.eset))){
8979-
message(sprintf('%s not included in the Biobase::pData(cal.eset), please check and re-try!',use_comp));return(FALSE)
8979+
message(sprintf('%s not included in the Biobase::pData(cal.eset), please check and re-try!',intgroup));return(FALSE)
89808980
}
89818981
phe <- Biobase::pData(cal.eset)
89828982
G1 <- rownames(phe)[which(phe[,intgroup]==G1_name)];G0 <- rownames(phe)[which(phe[,intgroup]==G0_name)];

0 commit comments

Comments
 (0)