Skip to content

Commit

Permalink
first upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Bioinfoplanet committed Jun 13, 2020
1 parent e9cc722 commit cd55f03
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 14 deletions.
4 changes: 4 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ importFrom(ggplot2,geom_hline)
importFrom(ggplot2,geom_point)
importFrom(ggplot2,geom_vline)
importFrom(ggplot2,ggplot)
importFrom(ggplot2,ggsave)
importFrom(ggplot2,labs)
importFrom(ggplot2,scale_color_manual)
importFrom(ggplot2,scale_x_continuous)
Expand All @@ -39,5 +40,8 @@ importFrom(ggplotify,as.ggplot)
importFrom(limma,eBayes)
importFrom(limma,lmFit)
importFrom(limma,topTable)
importFrom(patchwork,wrap_plots)
importFrom(pheatmap,pheatmap)
importFrom(stringr,str_remove_all)
importFrom(stringr,str_split)
importFrom(stringr,str_to_upper)
31 changes: 22 additions & 9 deletions R/analysis_harder.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,16 @@
##' @param gene_number how many DEGs will heatmap show .
##' @return a list with deg data.frame, volcano plot and a list with DEGs.
##' @author Xiaojie Sun
##' @importFrom patchwork wrap_plots
##' @importFrom ggplot2 ggsave
##' @importFrom stringr str_split
##' @export
##' @examples
##' gse = "GSE42872"
##' geo_download(gse)
##' geo_download(gse,by_annopbrobe = F)
##' geo = geo_download(gse)
##' group_list = rep(c("A","B"),each = 3)
##' ids = AnnoProbe::idmap('GPL6244')
##' get_deg_all(geo$exp,group_list,ids)
##' @seealso
##' \code{\link{geo_download}};\code{\link{draw_volcano}};\code{\link{draw_venn}}

Expand Down Expand Up @@ -59,13 +64,21 @@ get_deg_all <- function(exp,
ht = rbind(head(np2,gene_number),
tail(np2,gene_number)),
top = head(np,gene_number))
heatmap = draw_heatmap(n,group_list,scale_before,n_cut_off,annotation_legend)
heatmap = draw_heatmap(n,group_list,
scale_before = scale_before,
n_cutoff = n_cutoff,
cluster_cols = cluster_cols,
annotation_legend = annotation_legend
)
if(as.numeric(dev.cur())!=1) graphics.off()
result = list(
deg = deg,
cgs = cgs,
plots = list(pca_plot,heatmap,volcano_plot)
plots = wrap_plots(heatmap,pca_plot,volcano_plot)
)
print(paste0(length(cgs$downgenes)," down genes,",length(cgs$upgenes)," up genes"))
ggsave(result$plots,filename = paste0(str_split(Sys.time()," ")[[1]][2],"_plots.png"),
height = 5,width = 15)
return(result)
}

Expand All @@ -77,15 +90,15 @@ get_deg_all <- function(exp,
##' @return a list with deg data.frame, volcano plot and a list with DEGs.
##' @author Xiaojie Sun
##' @importFrom stringr str_remove_all
##' @importFrom stringr str_to_upper
##' @export
##' @examples
##' gse = "GSE42872"
##' geo_download(gse)
##' geo_download(gse,by_annopbrobe = F)
##' find_anno(GPL570)
##' @seealso
##' \code{\link{geo_download}};\code{\link{draw_volcano}};\code{\link{draw_venn}}

find_anno <-function(gpl){
gpl = str_to_upper(gpl)
data("pkg_all")
data("exists_anno_list")
if(!any(pkg_all$gpl==gpl)) {
Expand All @@ -96,13 +109,13 @@ find_anno <-function(gpl){
print("no annotation avliable in Bioconductor and AnnoProbe")
}
}else {
qz = pkg_all$bioc_package[pkg_all$gpl==geo$gpl]
qz = pkg_all$bioc_package[pkg_all$gpl== gpl]
if(!suppressMessages(require(paste0(qz,".db"),character.only = T)))BiocManager::install(paste0(qz,".db"))
suppressMessages(library(paste0(qz,".db"),character.only = T))
ml1 = str_remove_all(paste0("`ids <- AnnoProbe::idmap\\(","\\'",gpl,"\\'","\\)`"),"\\\\")
ml2 = str_remove_all(paste0("`ids <- toTable\\(",qz,"SYMBOL\\)`"),"\\\\")
print(paste0(ml2," or ",ml1 ," is both avaliable"))
}
}
}


4 changes: 1 addition & 3 deletions man/find_anno.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions man/get_deg_all.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cd55f03

Please sign in to comment.