Skip to content

Commit

Permalink
do not use import_
Browse files Browse the repository at this point in the history
  • Loading branch information
mschubert committed Oct 23, 2017
1 parent be6e9df commit 9db106e
Show file tree
Hide file tree
Showing 29 changed files with 51 additions and 51 deletions.
6 changes: 3 additions & 3 deletions base/__init__.r
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ export_submodule('./refactor')
export_submodule('./relevel')
export_submodule('./lnapply')

outer = import_('./outer')$outer
outer = import('./outer')$outer

omit = import_('./omit')
list = import_('./list')
omit = import('./omit')
list = import('./list')

library(dplyr) # in global env
#`%>%` = magrittr::`%>%`
Expand Down
2 changes: 1 addition & 1 deletion base/lambda.r
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fun = import_('./functional')
fun = import('./functional')

#' Define a single-argument function
#'
Expand Down
2 changes: 1 addition & 1 deletion base/list.r
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import_('../base/operators')
import('../base/operators')

# http://stackoverflow.com/questions/8139677
flatten = function(x, vectors=FALSE) {
Expand Down
4 changes: 2 additions & 2 deletions base/match.r
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
###
### general utility functions without specific use
###
.op = import_('./operators', attach_operators=FALSE)
.omit = import_('./omit')
.op = import('./operators', attach_operators=FALSE)
.omit = import('./omit')

#' match() function with extended functionality
#'
Expand Down
2 changes: 1 addition & 1 deletion base/omit.r
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ empty = function(x, drop=FALSE, omit=TRUE) {
#' @param drop Whether to drop unused dimensions after removing NAs
#' @param omit Whether or not to perform action
dups = function(x, ..., drop=FALSE, omit=TRUE) {
dup = import_('./duplicated')$duplicated
dup = import('./duplicated')$duplicated

if (!omit)
x
Expand Down
2 changes: 1 addition & 1 deletion base/refactor.r
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import_('./operators')
import('./operators')

#' Creates a factor where levels are ordered by an external value
#'
Expand Down
2 changes: 1 addition & 1 deletion base/util.r
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import_('./operators')
import('./operators')

grep = function(pattern, x, ...) {
# http://stackoverflow.com/questions/2969315
Expand Down
2 changes: 1 addition & 1 deletion base/vector.r
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import_('./functional', attach = TRUE)
import('./functional', attach = TRUE)

#' Create a logical vector from a numeric index vector
#'
Expand Down
4 changes: 2 additions & 2 deletions data_frame/assemble.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import_('../base/operators')
.ar = import_('../array')
import('../base/operators')
.ar = import('../array')

#' Creates a data.frame from named vectors
#'
Expand Down
4 changes: 2 additions & 2 deletions data_frame/create_formula_index.r
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
# could i maybe use a grouped data_frame for this?

# start with st$.assocs_subset here, leave the row-wise calls to df$call
.b = import_('../base', attach_operators=FALSE)
.gfd = import_('./get_formula_data')
.b = import('../base', attach_operators=FALSE)
.gfd = import('./get_formula_data')

#' Gathers all data required for a formula and creates a subsetting index
#'
Expand Down
6 changes: 3 additions & 3 deletions data_frame/wrap_formula_indexing.r
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ wrap_formula_indexing = function(FUN) {
do.call(FUN, call_args)
}

df = import_('../data_frame')
idx = import_('../base/indexing')
func = import_('../base/functional')
df = import('../data_frame')
idx = import('../base/indexing')
func = import('../base/functional')
ci = import('../data_frame/create_formula_index')

# replace with: call_args = as.list(func$eval_call())[-1] ?
Expand Down
2 changes: 1 addition & 1 deletion io/binary.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# I/O helper functions on R binary files
.b = import_('../base')
.b = import('../base')
.l1k = import('./l1ktools_io')

#' Loads .gctx files
Expand Down
2 changes: 1 addition & 1 deletion io/text.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# I/O helper functions on text files
.b = import_('../base', attach_operators = FALSE)
.b = import('../base', attach_operators = FALSE)

#' Add \code{ext}ension parameter to \link{\code{base::file.path}}
file_path = function (..., ext = NULL, fsep = .Platform$file.sep) {
Expand Down
2 changes: 1 addition & 1 deletion plot/__init__.r
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ export_submodule('./venn') # bad style
export_submodule('./color')
export_submodule('./symmetrise_scale')

brew = import_('./brew')
brew = import('./brew')
2 changes: 1 addition & 1 deletion plot/color.r
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ p_effect = function(df, pvalue="p.value", effect="estimate", dir=1, thresh=0.05)
}

# Graphics helpers
import_('../base/functional', attach = TRUE)
import('../base/functional', attach = TRUE)

# Color helper functions {{{
transparent = function (colors, alpha = 0.5) {
Expand Down
6 changes: 3 additions & 3 deletions plot/linear_fit.r
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.b = import_('../base')
.st = import_('../stats')
#.spf = import_('../stats/process_formula')
.b = import('../base')
.st = import('../stats')
#.spf = import('../stats/process_formula')

#' Plots a given data.frame as a linear fit with optional subsets
#'
Expand Down
4 changes: 2 additions & 2 deletions plot/matrix.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.b = import_('../base')
.ar = import_('../array')
.b = import('../base')
.ar = import('../array')

#' Cluster the rows and columns, order factor levels to respect that
#'
Expand Down
8 changes: 4 additions & 4 deletions plot/volcano.r
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
library(ggrepel)
.b = import_('../base')
import_('./helpers', attach=TRUE)
color = import_('./color')
.b = import('../base')
import('./helpers', attach=TRUE)
color = import('./color')

#' Draw a volcano plot from calculated associations
#'
Expand Down Expand Up @@ -88,7 +88,7 @@ volcano = function(df, base.size=1, p=0.05, label_top=20, ceil=0, check_overlap=
if (is.null(module_name())) {
library(testthat)

color = import_('./color')
color = import('./color')
df = data.frame(estimate = -12:12/12)
df$adj.p = 10^(-10*abs(df$estimate))
df$label = LETTERS[1:25]
Expand Down
6 changes: 3 additions & 3 deletions process/idmap/gene.r
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
library(dplyr)
.b = import_('../../base')
.io = import_('../../io')
.ar = import_('../../array')
.b = import('../../base')
.io = import('../../io')
.ar = import('../../array')
.guess_id_type = import('./guess_id_type')$guess_id_type

#' Gene ID mapping function
Expand Down
6 changes: 3 additions & 3 deletions process/idmap/probeset.r
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
library(dplyr)
.b = import_('../../base')
.io = import_('../../io')
.ar = import_('../../array')
.b = import('../../base')
.io = import('../../io')
.ar = import('../../array')
.guess_id_type = import('./guess_id_type')$guess_id_type

#' probeset ID mapping function
Expand Down
2 changes: 1 addition & 1 deletion process/microarray/normalize.r
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.b = import_('../../base')
.b = import('../../base')

#' Function to normalize expression objects
#'
Expand Down
8 changes: 4 additions & 4 deletions stats/__init__.r
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
export_submodule('./nmf')
export_submodule('./util')
export_submodule('./roc')
batch = import_('./batch')
cor = import_('./correlation')
batch = import('./batch')
cor = import('./correlation')
fishers_exact_test = import('./fishers_exact_test')$fishers_exact_test
hypergeometric_test = import('./hypergeometric_test')$hypergeometric_test

.wrap = import_('../data_frame/wrap_formula_indexing')
.wrap = import('../data_frame/wrap_formula_indexing')
for (fname in list.files(module_file('export_indexed'), "\\.r$", recursive=TRUE)) {
.mod = import_(paste0("./export_indexed/", sub("\\.r$", "", fname)))
.mod = import(paste0("./export_indexed/", sub("\\.r$", "", fname)))
.FUN = ls(.mod)
assign(.FUN, .wrap$wrap_formula_indexing(.mod[[.FUN]]))
}
2 changes: 1 addition & 1 deletion stats/batch.r
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.ar = import_('../array')
.ar = import('../array')

merge = function(method, X, batch, covariate=NULL) {
if (method == "combat")
Expand Down
2 changes: 1 addition & 1 deletion stats/export_indexed/coxph.r
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import_('../../base/operators')
import('../../base/operators')

#' Function to calculate and return a cleaned Cox proportional hazards model
#'
Expand Down
2 changes: 1 addition & 1 deletion stats/export_indexed/lm.r
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import_('../../base/operators')
import('../../base/operators')

#' Function to calculate and return a cleaned linear model
#'
Expand Down
2 changes: 1 addition & 1 deletion stats/export_indexed/rlm.r
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import_('../../base/operators')
import('../../base/operators')

#' Function to calculate and return a cleaned linear model
#'
Expand Down
6 changes: 3 additions & 3 deletions stats/nmf.r
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# this should use data_frame infrastructure to calculate NMF clustering, optionally in cluster jobs
.b = import_('../base')
.io = import_('../io')
.df = import_('../data_frame')
.b = import('../base')
.io = import('../io')
.df = import('../data_frame')

#' Wrapper function that takes k, num.clusterings and performs max_iter iterations
#'
Expand Down
2 changes: 1 addition & 1 deletion stats/util.r
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.b = import_('../base')
.b = import('../base')

overlap_normals = function(mu1, sd1, mu2, sd2) {
min.f1f2 = function(x, mu1, mu2, sd1, sd2) {
Expand Down
2 changes: 1 addition & 1 deletion text.r
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# String helper functions

import_('./base/functional', attach = TRUE)
import('./base/functional', attach = TRUE)

ltrim = lp(sub, '^ +', '')

Expand Down

0 comments on commit 9db106e

Please sign in to comment.