Commit 1b4ec740 authored by domingue's avatar domingue

Major bug fixes and additions, fixing last commit

- renv:

	+ removed `renv` from dependencies
	+ deprecated `load_renv`
- added knitr to dependencies
- removed gene sampling for GO term enrichment which lead to different results for long gene lists
- fixed issue with exported function conflicting with other namespace
- added `prettycode`
parent 3d1f5ea3
Package: corescf
Title: Collection of Useful CSF Functions
Description: Collection of useful custom functions as part of the CSF workflows.
Version: 0.8.2.7000
Version: 0.8.2.9000
Authors@R: c(
person(given = "António",
family = "Domingues",
......@@ -22,7 +22,7 @@ Authors@R: c(
License: BSD_3_clause + file LICENSE
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.1.0
RoxygenNote: 7.1.1
Roxygen: list(markdown = TRUE)
biocViews:
Depends:
......@@ -50,7 +50,6 @@ Imports:
RColorBrewer,
docopt,
session,
renv,
ggdendro,
grid,
glue,
......
......@@ -157,7 +157,6 @@ importFrom(plyr,splat)
importFrom(purrr,discard)
importFrom(purrr,map)
importFrom(readr,read_tsv)
importFrom(renv,load)
importFrom(rlang,enexpr)
importFrom(rlang,enquo)
importFrom(rlang,get_expr)
......
......@@ -199,10 +199,6 @@ cp_test <- function(geneIds, annoDb, cp_species, q_cutoff = 0.05) {
# DEBUG geneIds <- glMapped %>% ungroup %>% filter(contrast==contrast[1])$entrez_gene_id
# geneIds=.$entrez_gene_id
if (length(geneIds) > 1500) {
geneIds <- sample(geneIds) %>% head(1500)
}
## disable gene symbols output for yeast because it's not supported by underlying annotation db
## see also https://github.com/GuangchuangYu/clusterProfiler/issues/91
readable <- cp_species != "yeast"
......
......@@ -89,19 +89,11 @@ check_version <- function(pkg, min_version) {
#'
#' Loads a renv library if detect
#'
#' @importFrom renv load
#'
#' @return NULL
#' @export
load_renv <- function() {
scripts_dir <- Sys.getenv("PRJ_SCRIPTS")
lock_file <- file.path(scripts_dir, "renv.lock")
if (scripts_dir != "" & file.exists(lock_file)) {
message("Project variables were detected. Loading renv")
renv::load(project = Sys.getenv("PRJ_SCRIPTS"))
} else {
stop("renv not loaded: Bash variable PRJ_SCRIPTS was not found.")
}
.Defunct("load_renv")
}
......@@ -132,6 +124,7 @@ load_all <- function(verbose = FALSE) {
load_pack("ggplot2")
load_pack("scales", warn_conflicts = F) # note this has a known conflict with purrr::discard
load_pack("grid")
load_pack("knitr")
load_pack("RColorBrewer")
## for table exploration without using Rstudio
......@@ -140,7 +133,7 @@ load_all <- function(verbose = FALSE) {
## replace masked functions with those of corescf
assign("set_names", corescf::set_names, envir = .GlobalEnv)
assign("frame_data", corescf::frame_data, envir = .GlobalEnv)
assign("distinct_all", corescf::distinct_all, envir = .GlobalEnv)
}
......
......@@ -24,7 +24,7 @@ cache_it <- function(expr, filePrefix = "cache") {
if (file.exists(cacheFile)) {
local(get(load(cacheFile)))
} else {
result <- eval(expr)
result <- eval(expr, envir = .GlobalEnv)
save(result, file = cacheFile)
result
}
......
......@@ -7,7 +7,7 @@
ac(...)
}
\arguments{
\item{...}{arguments to be passed to \code{\link[base:as.character]{base::as.character()}}}
\item{...}{arguments to be passed to \code{\link[base:character]{base::as.character()}}}
}
\value{
a string vector
......
......@@ -7,7 +7,7 @@
add_rownames(...)
}
\arguments{
\item{...}{arguments to be passed to \code{\link[tibble:rownames_to_column]{tibble::rownames_to_column()}}}
\item{...}{arguments to be passed to \code{\link[tibble:rownames]{tibble::rownames_to_column()}}}
}
\value{
a tibble
......
......@@ -13,5 +13,5 @@ as.df(dt)
a data.frame
}
\description{
DEPRECATED: use \code{\link[corescf:as_df]{corescf::as_df()}}
DEPRECATED: use \code{\link[=as_df]{as_df()}}
}
......@@ -13,7 +13,7 @@ diff_intersect(deData, sample_1, sample_twoes, .intersect_method, ...)
\item{sample_twoes}{Conditions to intersect with}
\item{.intersect_method}{Which function to use for the intersection? Example \code{\link[corescf:s1_gt_s2]{corescf::s1_gt_s2()}}}
\item{.intersect_method}{Which function to use for the intersection? Example \code{\link[=s1_gt_s2]{s1_gt_s2()}}}
\item{...}{Other methods passed to the intersection function}
}
......
......@@ -11,15 +11,15 @@ extract_col(x, col_index = 1, sep = "_", num_cols = 10)
\item{col_index}{Column index to retrieve, default is 1}
\item{sep}{separator to split strings, default is "_". Argument of \code{\link[stringr:str_split_fixed]{stringr::str_split_fixed()}}}
\item{sep}{separator to split strings, default is "_". Argument of \code{\link[stringr:str_split]{stringr::str_split_fixed()}}}
\item{num_cols}{maximum number of columns returned by \code{\link[stringr:str_split_fixed]{stringr::str_split_fixed()}}, default is 10. Argument of \code{\link[stringr:str_split_fixed]{stringr::str_split_fixed()}}}
\item{num_cols}{maximum number of columns returned by \code{\link[stringr:str_split]{stringr::str_split_fixed()}}, default is 10. Argument of \code{\link[stringr:str_split]{stringr::str_split_fixed()}}}
}
\value{
character vector
}
\description{
convenience method to extract a column, defaults to _ as separator and the first column. A wrapper around \link[stringr:str_split_fixed]{stringr::str_split_fixed}. I will take a string vector, separate the elements according to a pattern, and return a particular column from the resulting matrix
convenience method to extract a column, defaults to _ as separator and the first column. A wrapper around \link[stringr:str_split]{stringr::str_split_fixed}. I will take a string vector, separate the elements according to a pattern, and return a particular column from the resulting matrix
}
\examples{
\dontrun{
......
......@@ -11,7 +11,7 @@ filter_expressed_genes(df, id_col = "ensembl_gene_id", ...)
\item{id_col}{the column with gene identifiers. Default ensembl_gene_id}
\item{...}{Arguments to be passed to \code{\link[corescf:filterByExpression]{corescf::filterByExpression()}}}
\item{...}{Arguments to be passed to \code{\link[=filterByExpression]{filterByExpression()}}}
}
\value{
A data.frame
......
......@@ -15,7 +15,7 @@ getExpressedGenes(cuff, ...)
A matrix
}
\description{
Wrapper for \code{\link[cummeRbund:repFpkmMatrix]{cummeRbund::repFpkmMatrix()}} and \code{\link[corescf:filterByExpression]{corescf::filterByExpression()}}
Wrapper for \code{\link[cummeRbund:fpkmMatrix]{cummeRbund::repFpkmMatrix()}} and \code{\link[=filterByExpression]{filterByExpression()}}
}
\note{
cummeRbund is now very old and has been superseded by better tools. It should not be the first choice for gene expression analysis.
......
......@@ -23,7 +23,7 @@ lsosh(..., n = 10)
data.frame
}
\description{
Wrapper of \code{\link[corescf:lsos]{corescf::lsos()}} to just shows top 10 results
Wrapper of \code{\link[=lsos]{lsos()}} to just shows top 10 results
}
\examples{
\dontrun{
......
......@@ -14,5 +14,5 @@ a data.frame
}
\description{
Removes funky characters from colnames, and converts to lower case, to make them suitable for computational work
Uses \code{\link[corescf:pretty_names]{corescf::pretty_names()}}
Uses \code{\link[=pretty_names]{pretty_names()}}
}
......@@ -11,8 +11,8 @@ retainExprGenes(df, id_col = "ensembl_gene_id", ...)
\item{id_col}{the column with gene identifiers. Default ensembl_gene_id}
\item{...}{Arguments to be passed to \code{\link[corescf:filterByExpression]{corescf::filterByExpression()}}}
\item{...}{Arguments to be passed to \code{\link[=filterByExpression]{filterByExpression()}}}
}
\description{
#' Deprecated, use \code{\link[corescf:filter_expressed_genes]{corescf::filter_expressed_genes()}} instead.
#' Deprecated, use \code{\link[=filter_expressed_genes]{filter_expressed_genes()}} instead.
}
......@@ -15,7 +15,7 @@ rownames2column(df, colname)
a data.frame
}
\description{
Deprecated, use \code{\link[tibble:rownames_to_column]{tibble::rownames_to_column()}} instead.
Deprecated, use \code{\link[tibble:rownames]{tibble::rownames_to_column()}} instead.
}
\details{
tibbles usually don't have row names, nor are they kept in the conversion, so this function is needed to keep them as an extra column.
......
......@@ -11,5 +11,5 @@ a function
}
\description{
Select is a very common verb which appears in at least 3 packages. This function makes sure it's defaults to dplyr which is the most commonly used
Call \code{\link[MASS:select]{MASS::select()}}, \code{\link[tidygraph:select]{tidygraph::select()}}, or \code{\link[AnnotationDbi:select]{AnnotationDbi::select()}} for other usages
Call \code{\link[MASS:lm.ridge]{MASS::select()}}, \code{\link[tidygraph:reexports]{tidygraph::select()}}, or \code{\link[AnnotationDbi:AnnotationDb-class]{AnnotationDbi::select()}} for other usages
}
......@@ -13,7 +13,7 @@ vec2df(namedVec)
a data.frame
}
\description{
Deprecated, use \code{\link[corescf:vec_as_df]{corescf::vec_as_df()}} instead.
Deprecated, use \code{\link[=vec_as_df]{vec_as_df()}} instead.
}
\examples{
\dontrun{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment