sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
8aecf4cfd34e65873f33de55142bd1c37dd216728209f34f97df1fc4095b427f
R
291
8
library(matlib) load("/home/clausb/R_image/allnetworks.Rdata", verbose = FALSE) load("/home/clausb/R_image/remainingmodels.Rdata") detvalues <- list() for (i in 1:length(remainingmodels)) { detvalues[[i]] <- det(bensface[[remainingmodels[[i]]]]) } save(detvalues, file = "detvalues.Rdata")
c2051d0ea78cfdee3fdf513268f802aa57eae43e8adc21a17d436fafd92825e9
R
304
9
suppressMessages(library(uwot)) args = commandArgs(trailingOnly=TRUE) datarray <- read.table(args[1], sep="\t") datarray <- as.matrix(datarray) embedding <- umap(datarray, n_threads=max(1, RcppParallel::defaultNumThreads())) write.table(embedding, file="", sep="\t", row.names=FALSE, col.names=FALSE)
dfe000a06acdac4ac6cbe89be48e94eb826f9aefa75544ff6e392224fa07d54b
R
305
10
load("/home/clausb/scripts/objects/tmat.Rdata") nameslist <- list() length(nameslist) <- length(unlist(as.list(unique(tmat['Trace'])))) names(nameslist) <- unlist(as.list(unique(tmat['Trace']))) for (i in 0:8){ nameslist[[i+1]] <- tmat[tmat['Trace'] == i,] } save(nameslist, file = "nameslist.Rdata")
b299d2c1ab1e8595afdcfa5cd1a719c5531221a33b02dc56147d59cdee1394e0
R
308
8
## Travis CI specific: Explicit garbage collection because it ## looks like Travis CI might run out of memory during 'covr' ## testing and we now have so many tests. /HB 2017-01-11 if ("covr" %in% loadedNamespaces()) { res <- gc() testme <- as.environment("testme") if (testme[["debug"]]) print(res) }
53a40d0e44f52831b781b4de7e40f86df711c9a8b0b8341081201db2608ecb7e
R
315
13
load("/home/clausb/R_image/allnetworks.Rdata", verbose = FALSE) load("/home/clausb/R_image/remainingmodels.Rdata") eigenvalues <- list() for (i in 1:length(remainingmodels)) { e <- eigen(bensface[[remainingmodels[[i]]]]) v <- e$values eigenvalues[[i]] <- v } save(eigenvalues, file = "eigenvalues.Rdata")
679d445825964df49e9a1b60daecf108cfd4252dcb0676466cde08c786004f57
R
329
17
slow_fcn <- function(x) { Sys.sleep(x / 10) sqrt(x) } plan(multisession, workers = 2) js <- capture_journals({ fs <- lapply(3:1, FUN = function(x) future(slow_fcn(x))) value(fs) }) ## Summarize all journals js_all <- Reduce(rbind, js) print(summary(js_all), digits = 2L) ## Shut down parallel workers plan(seq...
b5044e59ffe2721162e7d649f581656495deda092a3ddfceeedcd5c354ad52f3
R
333
7
morpheus <- function(reference.res.df, comparison.res.df) { reference <- reference.res.df[,c(1,3)] %>% dplyr::rename("L2FC.ref" = 2) comparison <- comparison.res.df[,c(1,3)] %>% dplyr::rename("L2FC.comparison" = 2) final <- left_join(reference, comparison, by = "genes") %>% arrange(desc(L2FC.ref)) retur...
8dcd9b0ea595a511af88ef51b94bba3eb3574c036352b7d30336628a3ec8e5e2
R
335
9
#' strawr #' #' API for fast data extraction for .hic files that provides programmatic access to the matrices. It doesn't store the pointer data for all the matrices, only the one queried, and currently we are only supporting matrices (not vectors). #' #' @docType package #' @import Rcpp #' @useDynLib strawr #' @name...
6c6b61c7920ab31f383d526fa3e135d0e8ca1a29f7469b1b58c7366baf915a10
R
339
8
test_that("skip_extended works", { current_value <- Sys.getenv("GALAMM_EXTENDED_TESTS") Sys.setenv(GALAMM_EXTENDED_TESTS = "true") expect_condition(skip_extended(), NA, class = "skip") Sys.setenv(GALAMM_EXTENDED_TESTS = "") expect_condition(skip_extended(), class = "skip") Sys.setenv(GALAMM_EXTENDED_TESTS =...
4f53b1634591bebc3120fb87561df23e8ac050d88031354ea9226d3b8cc99348
R
347
30
a %<-% { 1 } f <- futureOf(a) print(f) b %<-% { 2 } f <- futureOf(b) print(f) ## All futures fs <- futureOf() print(fs) ## Futures part of environment env <- new.env() env$c %<-% { 3 } f <- futureOf(env$c) print(f) f2 <- futureOf(c, envir = env) print(f2) f3 <- futureOf("c", envir = env) print(f3) fs <- futur...
a5fae6c42f399bfb5036669f2aefd7890319cb44349723cef55d0c1c5f8e3223
R
350
9
#' Package GRNOpt #' #' Gene Regulatory Network Inference Using Optimization #' #' \code{GRNOpt} infers Gene Regulatory Network (GRN) from booleanized transcriptomic data and Prior Knowledge Network (PKN) using optmization methods. The package also includes methods for simulation and visualization. #' #' @name GRNOpt #...
b58500a09113f747517ecc9eabe7942b3cee7ad7f86068180b6edd23ce93e6d0
R
353
8
RRHO_math <- function(deseqDF) { #this part does the math to get the rankValue used for RRHO rrho_ranks <- deseqDF[, c(1,3,6)] %>% mutate(rankValue = -1 * log10(pvalue) * sign(log2FoldChange)) %>% arrange(desc(rankValue)) #make dfs that only have gene name and rankValue rrho_output_df <- rrho_ranks[,c(1...
50e9295af423c4e2267afc569b4dcb9373a7299bc3a2416f78a771ed1c76fe26
R
361
22
## Use multicore futures plan(multicore) ## A global variable a <- 0 ## Create future (explicitly) f <- future({ b <- 3 c <- 2 a * b * c }) ## A multicore future is evaluated in a separate forked ## process. Changing the value of a global variable ## will not affect the result of the future. a <- 7 print(a) ...
1c22c6a07da17f370f210d47ddcb81c9ddc6ca409935c8adb520f7dea4745335
R
363
22
#' Function to calculate number of solutions #' #' @param grn_df #' @param pruned #' @param bool_data #' #' # g = grn_df # # g = grnAndBooldata(g, bool_data) # # pruned = grnAndBooldata(pruned, bool_data) # x = anti_join(g,pruned) # library(plyr) # y = count (x, 'target') # # join to have direction # # count that dire...
39739a0793613427c0b61cee1a78910cb23d89960806427b789419325df63d1c
R
376
14
#' Pipe operator #' #' See \code{magrittr::\link[magrittr:pipe]{\%>\%}} for details. #' #' @name %>% #' @rdname pipe #' @keywords internal #' NOT EXPORTED @export #' @importFrom magrittr %>% #' @usage lhs \%>\% rhs #' @param lhs A value or the magrittr placeholder. #' @param rhs A function call using the magrittr seman...
2602d987fb0cc587e41dac9234e88d2c04caf85e4a6c3d91532d8f30cfb564f2
R
378
14
## Enable journaling of futures oopts <- options(future.journal = TRUE) plan(multisession, workers = 2L) t_start <- Sys.time() fs <- lapply(1:3, FUN = function(x) future({ Sys.sleep(x); sqrt(x) })) vs <- value(fs) js <- lapply(fs, FUN = journal, baseline = t_start) print(js) ## Stop parallel workers and disable jour...
989f4641a077c4eb38bc06affb489618323f9ec72a3e4640ed12be7a0ee7398c
R
382
9
filtered_GOterms <- function(GO.plot.up.ref, rows, GO.plot.up) { ref_upreg <- GO.plot.up.ref[c(rows), ] ref_upreg_terms <- as.data.frame(ref_upreg$ID) %>% rename("terms" = 1) select_upreg_df <- GO.plot.up@result %>% filter(ID %in% ref_upreg_terms$terms) forM_upreg_df <- select_upreg_df %>% select(c(2,6)) %>% m...
fdf4e46dbc2e54352ce0d0ebbb5e5790503c87c41d593b95c94334fdc467b81b
R
383
23
library(ggplot2) library(tidyverse) library(rstan) library(broom) library(broom.mixed) library(zoo) library(dplyr) library(purrr) library(xlsx) library(stringr) library(cmprsk) library(survival) library(survminer) library(readxl) library(data.table) library(magrittr) library(Greg) library(timereg) library(ggsci) librar...
dba854ef10990a03d3e90547ebb71255aacb8c2ebe6f5a8b0f86f25163eb7755
R
387
15
# -- CRAN packages install.packages("data.table") install.packages("plyr") install.packages("glmnet") install.packages("WGCNA") install.packages("reshape2") install.packages("broom") install.packages("rtracklayer") install.packages("RNOmni") install.packages("tensorflow") install.packages("keras") # -- bioconductor pa...
957696a99471b5199bd260a9fe0fcbff6d7071e70c18da0d7e1999c07a93fd6e
R
389
13
#' @tags demo fibonacci #' @tags sequential library(future) plan(sequential) options(future.debug = FALSE) message("*** Fibonacci demo of the 'future' package ...") # Temporarily protect against non-default R_FUTURE_PLAN oopts <- options(future.plan = NULL) demo("fibonacci", package = "future", ask = FALSE) options(o...
ae272d8a54711b3c352d63d97fe36a5561318146d136e1f41cb20ea0143cf79d
R
395
27
#' @import dplyr #' @import tidyr #' @import ggplot2 #' @importFrom data.table as.data.table #' @importFrom mgcv gam #' @importFrom stats IQR qt quantile sd #' @importFrom utils read.table #' @importFrom broom glance #' @keywords internal "_PACKAGE" # allowing for the use of the dot when piping utils::globalVariable...
de737141dd9f566234055b0a3a900fd0bf872f71dea2ffe3bd74d689b9f06023
R
406
14
#' Extract the model frame from a galamm object #' #' @param formula An object of type `galamm` as described in [galammObject]. #' @param ... Other arguments. Currently not used. #' #' @returns A data frame. #' @export #' @family details of model fit model.frame.galamm <- function(formula, ...) { if (!is.null(formula...
e06e2d48554bec5552f03519e0449f4beb74d0060ef6362cbb0efcc960d4d62e
R
408
10
## This runs 'testme' test inst/testme/test-<name>.R scripts ## Don't edit - it was autogenerated by inst/testme/deploy.R testme <- function(name) { path <- system.file(package = 'future', 'testme', mustWork = TRUE) Sys.setenv(R_TESTME_PATH = path) Sys.setenv(R_TESTME_PACKAGE = 'future') Sys.setenv(R_TESTME_NAM...
08c5d2b47584a2d4e721db1d43e5722e6e8d4f4f3cbdaff0a2c17a8b0e35e82a
R
410
17
library(ggplot2) library(galamm) library(hexSticker) dat <- subset(cognition, domain == 3 & item == "31") p <- ggplot(dat, aes(x = x, y = y, group = id)) + geom_point(size = .1) + geom_line(linewidth = .1) + theme_void() + theme_transparent() sticker(p, package="galamm", p_size=20, s_x=1, s_y=1.1, s...
3b772b97fc3b4870c095d66d93e0a234132770da4104c62f2f5b86b8d2479d48
R
412
19
# Evaluate a future using the 'multisession' plan with(plan(multisession, workers = 2), { f <- future(Sys.getpid()) w_pid <- value(f) }) print(c(main = Sys.getpid(), worker = w_pid)) # Evaluate a future locally using the 'multisession' plan local({ with(plan(multisession, workers = 2), local = TRUE) f <- fu...
269e535d9231c428259ddbdf32ed3899499c2cc83fcd3a9d116b6472a57c221f
R
424
21
if (getRversion() >= "4.4.0") { library(future) library(parallel) plan(sequential) if (getRversion() >= "4.5.0") { cl <- makeCluster(1L, type = future::FUTURE) } else { cl <- makeClusterFuture(1L) } message("clusterCall(cl, identity, quote(y)) ...") arg <- quote(y) res <- clusterCall(cl, ...
9f648ccec7269b0e334b980b4193be26108b3129a426aca3daca8f449f6b3eb4
R
425
8
##------------------------------------------------- ## Set up an object to hold the data, ## initScClass <- function(){ setClass("scObject", representation(clust="list", densities="list", dimensions="numeric", marginalClust="list", sampleNames="character", vafs.1d="list", ...
bead099dbcba63da376dd9b2abd6874a3171efb89b3035d9be9859ac27a161e4
R
425
9
library(data.table) custom_read = function(filename, header = T, colClasses = NULL, fill = F){ if (grepl("gz$", filename)){ return(fread(paste('zcat ', filename, sep=""), header = header, sep="\t", stringsAsFactors=F, showProgress=F, colClasses = colClasses, fill = fill)) } else { return(fread(filename, he...
78c0f31cc820971aad21328b9e58d42bc377ca539f2e46373157adf921bc7c0a
R
426
9
# Build against static libraries from rwinlib VERSION <- commandArgs(TRUE) if(!file.exists(sprintf("../windows/libcurl-%s/include/curl/curl.h", VERSION))){ if(getRversion() < "3.3.0") setInternet2() download.file(sprintf("https://github.com/rwinlib/libcurl/archive/v%s.zip", VERSION), "lib.zip", quiet = TRUE) dir....
d3b6d799e2858fdb9a3cb2c5182c9e5c28a650b95fa9962bf1fcac34d9dff491
R
429
23
#' read96wells #' #' reads an array in 96-well plate format #' #' @param mat matrix with 8 rows and 12 columns #' @export read96wells<-function(mat){ v<-NULL for(i in 1:12){ v<-c(v,mat[,i]) } return(data.frame(well=paste0( rep(c("A","B","C","D","E","F","G","H"),12), sapply(c("01","02","03","04"...
d0ec435e4d2d0ec0648a83c5ec60e7052bc11b602f4e0ff7ab49e528600a18ab
R
430
23
## Use sequential futures plan(sequential) ## A global variable a <- 0 ## Create a sequential future f <- future({ b <- 3 c <- 2 a * b * c }) ## Since 'a' is a global variable in future 'f' which ## is eagerly resolved (default), this global has already ## been resolved / incorporated, and any changes to 'a' #...
752173f126a269c4eb401d289a7c9fa13896ef980b6cc32f26c41a65d851054b
R
455
28
\donttest{ ## Use multisession futures plan(multisession) ## A global variable a <- 0 ## Create future (explicitly) f <- future({ b <- 3 c <- 2 a * b * c }) ## A multisession future is evaluated in a separate R session. ## Changing the value of a global variable will not affect ## the result of the future. a ...
1751b6679e5c053e1786b0eb55cde04ebeda125cdd0ce8fdfb5f020bea9fb756
R
466
18
#!/usr/bin/env Rscript # Load TDA package if(require(TDA)==0) install.packages("TDA"); library(TDA) # Load Rips filtration rips_betti <- function(matriz, mdim){ # Compute distance matrix D=1-matriz # Take number of nodes l=dim(D)[1] # Maximum value of the rips filtration mscale <- 1 ...
084b4791a0a6f0eded508da0b596d5fea291c3ea99594caaeab7c12be0def96a
R
467
6
#' @title Data file containing the topology of all 60212 non-redundant four-node gene circuits #' @description This data contains the topology of all 60212 non-redundant four-node gene circuits. #' @format A list of 60212 circuits, each element is a matrix of adjacency matrix. #' Four columns/rows represent genes "A",...
ad8fdf1d5f2db5cb6cc881dc11a1da58ad485969fa43add9a1a471288ede9eed
R
467
17
--- vignette: > %\VignetteIndexEntry{Link to book} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r, echo=FALSE} # Some compileable code, apparently needed for the engine # to recognize this as Rmarkdown. link <- BiocStyle::Biocbook("SingleRBook", label="link") URL <- sub(".*\\((.+))", ...
026be16424194c4bbd02b5775d65f771af230149c096beec25c2114e95985b21
R
468
12
# Simple function to plot UMAP and dev.stage clust.stage.plot <- function(data, cluster.col = "seurat_clusters"){ clust.plot <- DimPlot(data, group.by = cluster.col) + ggtitle(paste("Clusters")) + theme(plot.title = element_text(hjust = 0.5)) stage.plot <- DimPlot(data, group.by = "orig.ident") + ...
558da1444f2d293fae04ef8bb72d54a49bc572cddb359160c5ad0165f82f03c1
R
471
30
\donttest{ ## Use cluster futures cl <- parallel::makeCluster(2, timeout = 60) plan(cluster, workers = cl) ## A global variable a <- 0 ## Create future (explicitly) f <- future({ b <- 3 c <- 2 a * b * c }) ## A cluster future is evaluated in a separate process. ## Regardless, changing the value of a global va...
a2ce77a519b1341edeb7b891ace9db316992b79fd084b061ab583324498b4852
R
478
33
A <- matrix(c(1,2,3,4,5,6), ncol = 2) pca <- prcomp(A) str(pca) View(pca) C <- t(t(A) - apply(t(A), 1, mean)) V <- cov(C) eigenRes <- eigen(V) t(t(eigenRes$vectors) %*% t(C)) pca$x setwd("C:\\Users\\patri\\Documents\\GitHub\\systemsgenetics\\genetica-libraries\\src\\test\\resources\\") testMatrix <- read.d...
bf51e7798bb3bd805af7975a9a4a7b7a3ece5c35293f0c8010a97776734a119f
R
482
20
## Like mean(), but fails 90% of the time shaky_mean <- function(x) { if (as.double(Sys.time()) %% 1 < 0.90) stop("boom") mean(x) } x <- rnorm(100) ## Calculate the mean of 'x' with a risk of failing randomly f <- future({ shaky_mean(x) }) ## Relaunch until success repeat({ v <- tryCatch(value(f), error = iden...
07e499329a98e3e63352c7854fa968abe46a9a9233f43f73f2f4739076d3dee9
R
490
15
```{r} setwd("coregulation_clustering") source("../downstreamer_functions.r") data <- read.downstreamer.batch("../data/final_paper/", potential_traits = c("GenePrioritization")) bonf.sig.genes <- unique(unlist(sapply(data, function(x){ x <- x$GenePrioritization return( rownames(x)[x$Bonferroni.significant & x$En...
3610a9873f6e4b2da25dbbeb3a6de1bee17f29f65e21ccc436c83ccd26741580
R
500
26
library(tidyverse) set.seed(11) n <- 200 hsced <- tibble( id = 1:n, b = rnorm(n) ) %>% uncount(3, .id = "tp") %>% uncount(2, .id = "item") %>% mutate( x = runif(nrow(.)), winv = if_else(item == 1, 1, 2), y = x + b + rnorm(nrow(.), sd = sqrt(winv)) ) %>% select(-b, -winv) %>% as.data.frame()...
70e70271e767517fa6b22b3b0566dc3ce351c6c83ec731bdf60060e53d6526f9
R
511
24
#' @tags FutureError #' @tags sequential library(future) message("*** FutureError class ...") ## Minimal ex <- FutureError(message = "Woops") print(ex) cond <- tryCatch(message("Woops", appendLF = FALSE), message = identity) ex2 <- FutureError(message = cond) print(ex2) stopifnot(conditionMessage(ex2) == conditionM...
a843559123c8a9c384771f7b9db2d95af8d8e4140c93e5110690231ea1b1471c
R
515
21
#' @keywords internal #' @aliases galamm-package NULL #' #' @references #' #' \insertRef{sorensenLongitudinalModelingAgeDependent2023}{galamm} #' "_PACKAGE" ## usethis namespace: start #' @useDynLib galamm, .registration = TRUE ## usethis namespace: end NULL ## usethis namespace: start #' @importFrom Rcpp sourceCpp #...
509e840917152367fa79f6bbf536087497e997e29ae98afdfaba5ccdd4e6689c
R
521
15
library(data.table) library(optparse) option_list = list( make_option(c("-i", "--infile"), help="gzipped expression file"), make_option(c("-o", "--outfile"), help="outfile (not gzipped)") ) opt = parse_args(OptionParser(option_list=option_list)) expression <- data.frame(fread(paste0('...
913ab676f4f9ca64e77f2eccf4004b9909c612a7e666be4f8d3cf980534db62d
R
525
11
custGO_barplot <- function(enrichGO.plot) { plot <- ggplot(enrichGO.plot) + geom_bar(stat = "identity", aes(fill = p.adjust, x = Count, y = reorder(Description, -p.adjust)), color = "black") + scale_fill_gradient(low = "#005F73", high = "whitesmoke", na.value = NA, guide = guide_colorbar(reverse = TRUE)) ...
0aecdc5365883daa7021facf185d8bba4a26e2c52e30f984448051eb656bb66c
R
526
19
library(R.matlab) library(circular) radiandata<-readMat("/media/user/4TB/facial/download/Kiki2/Thetas.mat") radiandata<-radiandata$theta data <- list( group1 = circular(c(radiandata[,1]), units="radians", template="geographics"), group2 = circular(c(radiandata[,2]), units="r...
c591a1a90faa20e96ae08643accc3078a7d9f4970d3936e923d38d7a1967196b
R
526
25
library(comprehenr) df <- read.csv('data/ZC0.csv') fnames = c('reversal','punish') cnames = c('pfc','pmc') stat = c() pval = c() rname = c() for ( fname in fnames ) { for (ctx in cnames) { xn = paste(fname,ctx,sep='_') x <- df[[xn]] yn = paste(fname,'prat',ctx,sep='_') y <- df[[yn]] w = wi...
6f2c05d470879a35b7e44f7f523bffe74592c7cd7399aee37e8d8ef0e2352b92
R
527
17
sortData <- function(dataset, output_file_name = "") { if (!file.exists(dataset)) { message("ERROR: Specified Input File does not Exist") return(FALSE) } if( output_file_name == "" || substr(output_file_name, nchar(output_file_name), nchar(output_file_name)) == "/" ){ message("ERROR: You...
089d3586ca45f44ece706edd01a96a9b8c94ae0920f42f1dda9826e08c17e23f
R
528
21
#' Title #' #' @param par #' #' @return #' NOT EXPORTED @export #' @keywords internal #' #' @examples slurm_singleTrait_likelihood = function(par){ theta=unlist(par) test = optim(theta, singleTrait_likelihood, betX=betX, pi1=pi1, sig1=sig1, w8s=w8s, m0=m0, M=M, nX=nX, bn=2^7, bins=10, ...
e75be0701d866b687b2ca8966eb2e964011d71225d7711fc86f3b93e4b3df7c7
R
531
25
#' Title #' #' @param slr_job #' #' @return #' @keywords internal #' NOT EXPORTED @export #' #' @examples get_job_status_lhc <- function (slr_job) { if (!(class(slr_job) == "slurm_job")) stop("input must be a slurm_job") stat <- suppressWarnings(system(paste("squeue -n", slr_job$jobname), ...
cf0868415d3855ac7d1042ef48f5b476cedd4847e6ecb6f9951bbaacc9070d89
R
533
22
#' Set random seed for future assignment #' #' @usage fassignment \%seed\% seed #' #' @inheritParams future #' #' @aliases %seed% #' @rdname futureAssign #' #' @export `%seed%` <- function(fassignment, seed) { fassignment <- substitute(fassignment) envir <- parent.frame(1) ## Temporarily set 'seed' argument ar...
c4ab52ee8bf4c70c95dcaec6626d8e8ebcfe24d210f24666d05e2da381724c85
R
543
22
#' Specify label for a future assignment #' #' @usage fassignment \%label\% label #' #' @inheritParams future #' #' @aliases %label% #' @rdname futureAssign #' #' @export `%label%` <- function(fassignment, label) { fassignment <- substitute(fassignment) envir <- parent.frame(1) ## Temporarily set 'label' argumen...
462c8fff9216cc5de440ba102d8991c940a0ea4fb25bdc9d4be4543e1a4c5f05
R
551
22
#' Control lazy / eager evaluation for a future assignment #' #' @usage fassignment \%lazy\% lazy #' #' @inheritParams future #' #' @aliases %lazy% #' @rdname futureAssign #' #' @export `%lazy%` <- function(fassignment, lazy) { fassignment <- substitute(fassignment) envir <- parent.frame(1) ## Temporarily set 'l...
a2608c1de1b84b439502e687124cd9c766709bf873c92e1dd263e45b5bff2297
R
551
21
load("/home/clausb/scripts/objects/strace.Rdata") for (i in 1:355983){ j <- i+1 if (strace[[i,1]] == strace[[j,1]]) { if (strace[[i,2]] == strace[[j,2]]) { if (strace[[i,3]] == strace[[j,3]]) { if (strace[[i,4]] == strace[[j,4]]) { if (strace[[i,5]] == strace[[j,5]]) { if (st...
8394c13c36fafe97d79c67ed42617e443aa565d9293688a695516665d3c2a526
R
553
15
bensface <- list() variabless <- 1:4 danya <- as.matrix(expand.grid(lapply(numeric(length(variabless)), function(x) c(0,1,2))), ncol=length(variabless)) tricep <- as.matrix(expand.grid(lapply(numeric(length(variabless)), function(x) c(1:81))), ncol=length(variabless)) bensface <- list() for (i in 1:nrow(tricep)){ te...
74a38ea92132208c9b3ea2bd5519b4af13546dc2d8bfe2c5241de935ff8a53a9
R
561
22
library(data.table) DT <- fread( file.path( 'figure-2', 'inputs', paste0('post_predictive_analysis_all_models_combined_imaging_non_', 'imaging_age_at_assessment.csv'))) eid_val <- unique(DT[evaluation == "Validation"]$eid) eid_gen <- unique(DT[evaluation == "Generalization"]$ei...
a54879b01b2186ac426fe709f7cec5b392bee1ba6ec01617b686fd0c3e994702
R
561
20
#' @importFrom parallelly makeClusterPSOCK makeNodePSOCK makeClusterPSOCK_args <- local({ .args <- NULL function() { if (is.null(.args)) { ## Arguments meant for makeClusterPSOCK() and makeNodePSOCK() args <- character(0L) for (name in c("makeClusterPSOCK", "makeNodePSOCK")) { if (!...
1d0cfc29fd2ea3aadfa1efc4d1b8189ef55fc6fd1d89bdb158c7bc4fc7d5ed82
R
575
29
#' @tags sequential library(future) message("*** sequential() ...") message("- sequential() w/ required packages ...") f <- future(median(1:3), lazy = TRUE) print(f) ## Doesn't work if covr that depends on stats is loaded try(unloadNamespace("stats")) v <- value(f) print(v) stopifnot(identical(v, 2L)) stopifnot(...
d633b43e9104f536d1eb4c9a1656d435e857140a04e265dfa8eca759e8a80e80
R
591
17
args=commandArgs(TRUE) fn=args[1] print("Reading in file") data=read.delim(fn, header=FALSE, nrow=5) nc = ncol(data) data=read.delim(fn, header=FALSE, colClasses=c(rep("character",nc-2),rep("numeric",2))) x1 = log10(data[,(nc-1)]+1) x2 = log10(data[,nc]+1) r.pear=cor(x1, x2) r.spe=cor(x1, x2, method="spe") ...
4e6e1b8cd4c6711b4d904444f8b1f33b1f3046b50d5b08baa2186f061cb1e223
R
592
16
test_that("gratia functions work", { dat <- subset(cognition, domain == 1 & item == "11" & id < 10) dat$y <- dat$y[, 1] mod <- galamm(y ~ s(x) + (1 | id), data = dat) expect_s3_class(draw(mod), "ggplot") expect_s3_class(draw(derivatives(mod)), "ggplot") expect_s3_class(appraise(mod), "ggplot") expect_s3_...
6b6cdc53ab0cbfe5243e2feb19710ba07a2ff4c8e1b79838f1f7fe9ce8346b91
R
592
29
#' @tags warn2 #' @tags error #' @tags future #' @tags sequential multisession multicore library(future) message("*** options(warn = 2) relays an error ...") for (strategy in supportedStrategies()) { message("Type of future: ", strategy) plan(strategy) f <- future({ stopifnot(getOption("warn") == 0) o...
db149908b1b3438d5660b8220c06bc67649f1da6cef61915230624900aa2bd25
R
595
22
library(tidyverse) diet0 <- read.delim("data-raw/diet.dat", header = TRUE, sep = "\t") diet0$fiber2[diet0$fiber2 == -99] <- NA_real_ diet <- diet0 %>% pivot_longer( cols = c(fiber1, fiber2, chd), values_to = "y", names_to = "item", values_drop_na = TRUE ) %>% mutate( chd = as.integer(item == "chd...
70a1e5abc01c1d0ff1f7de2146e18ef9b41df5fbb432d27a0970fbe142faf99b
R
598
39
#' @tags FutureGlobals library(future) message("*** FutureGlobals() ...") fg1 <- FutureGlobals() print(fg1) fg2 <- FutureGlobals(fg1) print(fg2) g <- globals::as.Globals(list(a = 1, b = 1:3)) print(g) fg3 <- FutureGlobals(g) print(fg3) fg4 <- as.FutureGlobals(g) print(fg4) print(resolved(fg3)) fg <- fg4 fg_un...
cf28b1908aac4064b6f764b507dec76ff7f776f9df352a9d18646bb56e9d8733
R
599
32
#' @tags futureOf #' @tags listenv environment #' @tags sequential library(future) library(listenv) message("*** futureOf() ...") a %<-% { 1 } %lazy% TRUE f1 <- futureOf("a") print(f1) f2 <- futureOf(a) print(f2) stopifnot(identical(f2, f1)) ## Get all futures in the current environment fs <- futureOf(drop = TRUE)...
9700128a6e88f04f42bfa984a8bb4c167ebf37d3b2c55b1cce541b7b07c83bc5
R
611
23
## Use sequential futures by default oplan <- local({ oopts <- options(future.debug = FALSE) on.exit(options(oopts)) future::plan(future::sequential) }) supportedStrategies <- function(cores = NA_integer_, excl = "cluster", ...) { strategies <- future:::supportedStrategies(...) strategies <- setdiff(strategi...
88c1c5deb519deb33a00e490c48dfd0457540e7d9d29fac45c6957d3a019b66a
R
615
31
.main_data <- function(discovery) { UseMethod(".main_data") } .main_data.genomescore_discovery <- function(discovery) { as.data.frame(discovery[[1]]) } .main_data.domainogram_discovery <- function(discovery) { as.data.frame(discovery) } .metric_name <- function(discovery) { UseMethod(".metric_name") } .metr...
1a8af8fe2daa3f36eb588723430ae22a13b73a491eb9aac1668580ad04a4ddc2
R
624
19
library(sRACIPE) library(igraph) library(combinat) print("ass") for(i in 1:10){ if (i == 1){ load("/work/lulab/Ben/distmat/NEWMAN_SUBSAMPLING/inception/split/Iterative_Subsampling/ASSOCIATION/output/ass.mat") ass.mat.total <- ass.mat print(i - 1) } else { load(paste0("/work/lulab/Ben/distmat/NEWMA...
e9f5c4e55a58fb80badca5c977ef1be267b2bf2e53fe9915a95e86ea248a7795
R
625
22
#' Control whether standard output should be captured or not #' #' @usage fassignment \%stdout\% capture #' #' @param capture If TRUE, the standard output will be captured, otherwise not. #' #' @aliases %stdout% #' @rdname futureAssign #' #' @export `%stdout%` <- function(fassignment, capture) { fassignment <- substi...
96af8d6aeda1b9774b13410b5cca578bb949e29fd659ca786d4a98cf09dc1a5c
R
627
26
library(ggplot2) tryCatch(options(stringsAsFactors = F), error = function(x) print('could not set option')) my_theme <- theme_minimal() + theme( text = element_text(family = 'Helvetica', size = 20), legend.text = element_text(size = 18), legend.title = element_text(size = 16), axis.text = element_...
3634808daa6f42286380103cd3cc2322b241a01f18cb1b2ccb3163a2e1f174fe
R
628
26
library(ggplot2) tryCatch(options(stringsAsFactors = F), error = function(x) print('could not set option')) my_theme <- theme_minimal() + theme( text = element_text(family = 'Helvetica', size = 20), legend.text = element_text(size = 18), legend.title = element_text(size = 16), axis.text = element_...
1d9b67440220c9b01ba7f54510d580d3143ff828fea0abc0dc0ecc532305a182
R
630
7
mod_sep_PPTs_huddles <- function(sep_df, timepoint) { sep_timepoint <- sep_df %>% filter(Timepoint == timepoint) sep_timepoint_huddles <- sep_timepoint %>% select(c(1:7)) sep_timepoint_huddles <- pivot_longer(sep_timepoint_huddles, cols = c("abspHuddle", "absnHuddle"), names_to = "stimulus", values_to = "raw_h...
bcb18e388a721013b2cd5dc01800ebfa601f1f595419ccdad7723977d4cbded5
R
631
24
hpo.matrix <- data.frame() input.path <- "~/Desktop/depict2/hpo_predictions/" input.files <- list.files(input.path, pattern="height*") for (file in input.files) { cat(file, "\n") data <- read.table(paste0(input.path, file), header=T, row.names =1) if (ncol(hpo.matrix) == 0) { hpo.matrix <- data } else { ...
77387f67cdfc40867434e6232b741aacc3140bef6a0d1c9d983629bde05abc19
R
633
33
if (getRversion() >= "4.4.0") { library(future) options(future.debug = FALSE) message("plan(cluster, workers = parallelly::makeClusterSequential()) ...") cl <- parallelly::makeClusterSequential() print(cl) plan(cluster, workers = cl) print(plan()) message("future(42)") f <- future(42) v <- value...
f78199dc2b0c1b36ae0b96e1bc0642813cfe64981e13e103ea26b8a9fe39f7aa
R
637
17
library(h2o) h2o.init(nthreads = -1) # This means nthreads = num available cores train_file <- "https://h2o-public-test-data.s3.amazonaws.com/bigdata/laptop/mnist/train.csv.gz" test_file <- "https://h2o-public-test-data.s3.amazonaws.com/bigdata/laptop/mnist/test.csv.gz" train <- h2o.importFile(train_file) test <- ...
b784cbae05fdfc496709a3d4ed05ee55851a9358c9782333e78b62b12022cd7a
R
638
21
#' Control whether standard output should be captured or not #' #' @usage fassignment \%conditions\% capture #' #' @param capture If TRUE, the standard output will be captured, otherwise not. #' #' @aliases %conditions% #' @rdname futureAssign #' @export `%conditions%` <- function(fassignment, capture) { fassignment ...
509ff3e46d8bea04e5ec16d4800ad5616cff0a48afa0c9b59901c5405a2b3aac
R
645
18
load("/work/lulab/Ben/distmat/NEWMAN_SUBSAMPLING/inception/input/ks.dist.mat.all.complete") load("/work/lulab/Ben/distmat/NEWMAN_SUBSAMPLING/inception/split/Iterative_Subsampling/ASSOCIATION/clean/input/clusters.g10.100k") for(i in 1:length(clusters.g10.100k)){ tmp.cluster <- clusters.g10.100k[[i]] tmp <- ks.dist...
9f96c12d113b6047af664f520f5644665df344dad93ce6a4c7a186622217295b
R
645
24
# example for colon (one month) shown. Uses processed data from step 1 # resulting top tables are in FinalProcessedData library(Biobase) library(limma) setwd(dirname(rstudioapi::callFun("getActiveDocumentContext")$path)) grp="dc1m" eset<-readRDS(file.path("../C_QCandNormalization",grp,"data/CorrectedEset.rds")) G...
c79704bd0581c3afb5a6634e5015738497130ba3252960730eae7e61e9580125
R
648
7
mod_sep_PPTs_huddles_p1vp2 <- function(sep_df, timepoint) { sep_timepoint <- sep_df %>% filter(Timepoint == timepoint) sep_timepoint_huddles <- sep_timepoint %>% select(c(1:7)) sep_timepoint_huddles <- pivot_longer(sep_timepoint_huddles, cols = c("abspHuddle", "absnHuddle"), names_to = "stimulus", values_to = ...
a34c8c37b047a5092c08b2ca9e28f2b582c7cfc88352f309dcf90cc9e6164e6d
R
649
27
args <- commandArgs(trailingOnly = TRUE) print(args) st.file = args[[1]] meta.file = args[[2]] k=as.numeric(args[[3]]) cut=as.numeric(args[[4]]) database = args[[5]] method = args[[6]] dir0=args[[7]] st.exp <- read.csv(file=st.file,stringsAsFactors=F,check.names=F,row.names=1) st.meta <- read.csv(file=meta.file,str...
0ea4b6926a95b63c3b2de919573264812a18a3f00fe154875d1ccdeb707dc000
R
655
15
# library(testthat); library(SingleR); source("test-utils.R") test_that("intersection works as expected for edge cases", { out <- SingleR:::.create_intersection(c("A", "B", "C", "a"), LETTERS) expect_identical(out$test, 1:3) expect_identical(out$reference, 1:3) out <- SingleR:::.create_intersection(c(...
efe440cf07374e152bb574516e432dad1da24edbf36a2d37cf9fd0da40dfaa21
R
660
24
library(data.table) library(optparse) option_list <- list( make_option(c("-i", "--infile"), help="Infile with rows genes and columns PC scores"), make_option(c("-o", "--outfile"), help="Outfile with first column scaled and then row scaled PC values") ) opt <- parse_args(OptionParser(option_l...
65474c9a805b1bbd1de794dc000905017f891b5fcd675e87e02be72c6ea39c80
R
662
22
# # test.mappings.R # # Copyright (c) 2013-2013 GBIC: Danny Arends, Harm-Jan Westra, Lude Franke and Ritsert C. Jansen # last modified Jul, 2013 # first written Jun, 2013 # setwd("~/Github/systemsgenetics/eqtl-mapping-pipeline/src/main/scripts") source("helper.functions.R") setwd("~/Github/Juha/") # Load the Illumina...
d35c9b206513891617a961e6020403329cc99952da32aa82d1058283e1d12f00
R
664
18
#### box plot for meta data stats #### box.plot <- function(dat, y_col, group_by, y_lab, x_lab){ ggplot(dat, aes(x = dat[[group_by]], y = dat[[y_col]], fill = dat[[group_by]])) + geom_boxplot() + xlab(x_lab) + ylab(y_lab) + theme( legend.position = "none", panel.grid.major = element_blank...
85fa06e6e3b27261fe501f85ff2b7a19f4a951598d4f1fb6247bfcab20f485cc
R
666
35
#' @tags mpi #' @tags cluster #' @tags skip_on_cran library(future) stopCluster <- parallel::stopCluster makeClusterMPI <- parallelly::makeClusterMPI message("*** MPI ...") pkg <- "Rmpi" if (requireNamespace(pkg, quietly = TRUE)) { cl <- makeClusterMPI(availableCores()) str(cl) plan(cluster, workers = cl) ...
0e017f639ce2057794d5add702aa0ce63a3d82440c82667b123a93a56e5a9b8f
R
669
21
#' Convert Edge List to Adjacency Matrix #' #' \code{el2adj} converts a standard edge list (e.g. geneA Activation geneB) #' to an adjacencey matrix (of class matrix) #' #' @param el Edge List #' @return Adjacency Matrix #' @family network conversion el2adj <- function(el){ library("igraph") colnames(el) <-...
6959f578e5eb2e63a9258b47242abb19cfacdd46100b100a989b76cd02754b30
R
680
32
qvalue <-function(pval) { lambda=seq(0,0.90,0.05); pi0 <- rep(0,length(lambda)) for(i in 1:length(lambda)) { pi0[i] <- mean(pval >= lambda[i])/(1-lambda[i]); } spi0 <- smooth.spline(lambda,pi0,df=3); pi0 <- predict(spi0,x=max(lambda))$y; pi0 <- min(pi0,1); m <- length(pval); u <- orde...
393d08a014ea9b27fc3d23c4781fc83eb2f64ad01f51b2d394358a29a2929951
R
688
15
library(gplots) lineage_matrix <- read.csv("/Volumes/GoogleDrive/My\ Drive/python_code/connectome_tools/lineage_analysis/lineage_matrix.csv") palette <- colorRampPalette(c("white", "orange", "brown4","brown4","brown4","brown4","brown4","brown4"))(n = 128) width <- 10 height <- 10 pointsize <- 4 #setEPS() #postscript(...
2082f3fe88372b6e5d767b28173af1d6f8c139d51fa70809d7271223e089e9cb
R
692
10
# plot quality metrics for each cluster QC.plot <- function(seurat_obj, group_by = "seurat_clusters", y_elements = c("nCount_RNA", "nFeature_RNA", "percent.mt") , y_lab = c("UMI Count", "Gene Count", "% MT"), x_lab = "Cluster ID"){ plots <- list() plots$a = box.plot(dat = seurat_obj@meta.data, y...
617d876cd6b4c8d843f3cfbc02d52b316d68bfba505628e56d7c592cfa81553d
R
703
33
#' @tags utils-internal session_uuid library(future) session_uuid <- future:::session_uuid message("*** session_uuid() ...") id0 <- session_uuid() print(id0) ## Reset session UUID (hack) environment(session_uuid)$uuids <- list() id <- session_uuid() print(id) stopifnot(id != id0) ## Assert that forked child proce...
17615db7e44b9a469a74a071db9138a5b4b2f6a2955954d4b6ba604288b144bd
R
715
33
# See http://www.biostat.jhsph.edu/~iruczins/teaching/jf/ch5.pdf data(longley) g <- lm(Employed~GNP+Population,data=longley) summary(g, cor=T) # GLS x <- model.matrix(g) # Construct sigma matrix Sigma <- diag(16) #Sigma <- 0.31041^abs(row(Sigma)-col(Sigma)) Sigma <- 0.3662414^abs(row(Sigma)-col(Sigma)) Sigi <...
95ab34ef3e2315b98bc2f9a86f2f3ce5bc3f3390cfa9410d8b08a1f3968d3e32
R
716
28
setwd("/groups/umcg-fg/tmp01/projects/downstreamer/depict2_bundle/summary_statistics/plaintext/pricePaper") files <- list.files(pattern = ".gz") file <- files[1] for(file in files){ summstats <- read.delim(gzfile(file)) summstats$P <- 2*pnorm(-abs(summstats$Z)) write.table(summstats, file = gzfile(paste0("...
a0fc66307a668fb5cf8162d93367840235bfb2d61fe0cfe185bae14ce49f8194
R
724
22
library(data.table) split_files <- function(fname, by = c("target", "variable")) { dt <- fread(file.path('inputs',fname)) dt_split <- split(dt, by = by) split_names <- gsub(" ", "", names(dt_split)) split_names <- gsub(".", "_", split_names, fixed = T) for (ii in seq_along(dt_split)) { ...
6e4121380a579d5f7bc5c3b8000462c2c97145f7a368f38618cfcfa2f48906c8
R
735
35
#' @tags startup onAttach library(future) options(future.debug = FALSE) plan("default") message("*** .onAttach() ...") pkgname <- "future" message("- .onAttach() w/ option future.startup.loadScript ...") for (value in list(NULL, FALSE, TRUE)) { options(future.startup.loadScript = value) .onAttach(pkgname, pk...
f7e7606c5257fc1be02a41cf68c18060168380f01fbc99e655af6dc928f6703b
R
744
19
#' Shows slots of ACTIONetExperiment (ACE) object #' #' @param object ACTIONetExperiment object #' #' @export #' @importMethodsFrom SummarizedExperiment show setMethod("show", "ACTIONetExperiment", function(object) { validObject(object) callNextMethod() cat( "rowMaps(", (length(rowMaps(object, all ...
3b598f49f9bdf8309c320631f6fe976117069066c63cd115501b721f1b4b4514
R
747
7
huddle_make_tidy <- function(wide_df, timepoint) { df <- wide_df %>% filter(Timepoint == timepoint) df_huddles <- df %>% select(Animal, Cohort, PairingType, Timepoint, Condition, abspHuddle, absnHuddle) #selects for all animal information and also the huddle columns df_huddles <- pivot_longer(df_huddles, cols ...
cd0ffd02062f9f6693084909e91494883cd41696492530fe17515239c12449fa
R
748
36
if (getRversion() >= "4.4.0") { library(future) library(parallel) a <- 42 FUN <- function(x) { message("Process ID: ", Sys.getpid()) list(a = a, mean = mean(rnorm(n = x))) } message("makeCluster():") plan(multisession) cl <- makeCluster(2) set.seed(42) clusterSetRNGStream(cl) clusterE...
3d3208276267670358a56313049d32365206571c39f9811d3bd6529785957770
R
764
21
--- title: "clustering lineage matrix" output: html_notebook --- ```{r} library(gplots) lineage_matrix <- read.csv("/Volumes/GoogleDrive/My\ Drive/python_code/connectome_tools/lineage_analysis/lineage_matrix.csv") palette <- colorRampPalette(c("white", "orange", "brown4","brown4","brown4","brown4","brown4","brown4"))...
5ca7d668b57fc128da9fa23519e45f5bca62cdf2e3f7e95115aa8f5f94db79b8
R
775
24
library(readr) library(stringr) ff <- read_lines("inst/include/autodiff/common/eigen.hpp") ind1 <- str_which(ff, "#include <Eigen/Core>") ff <- c(ff[1:ind1], "#include <Eigen/SparseCore>", ff[(ind1 + 1):length(ff)]) ind2 <- min(str_which(ff, "EIGEN_VERSION_AT_LEAST")) - 1 ff <- c(ff[1:ind2], "templ...
d253326116c06ca3055368de3b039746417e0a866f41c2373510f3329a623b5f
R
785
10
rrho_quad_genes <- function(rrhoPlot, newname) { newname.uu <- as.data.frame(stri_list2matrix(rrhoPlot[["genelist_uu"]])) %>% dplyr::rename("list1_uu" = 1, "list2_uu" = 2, "overlap_uu" = 3) newname.dd <- as.data.frame(stri_list2matrix(rrhoPlot[["genelist_dd"]])) %>% dplyr::rename("list1_dd" = 1, "list2_dd" = 2, "...
7902412d774d439264035ff6fa35a9b0795500de0a14c6b9ad470a9dd98f6db2
R
789
22
knit_vignettes <- function() { old_wd <- getwd() do.call(on.exit, list(bquote(setwd(.(old_wd))), add = TRUE)) setwd("vignettes-raw/") knitr::opts_chunk$set(error = FALSE) files <- c("lmm_factor", "glmm_factor", "mixed_response", "lmm_heteroscedastic", "semiparametric", "optimization", ...