sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
27a1cff5c6d7f1e90ba294fac4118f2a042712c1192cf18dc8d260d61efe626c
R
163
6
#' Update the mfishtools library #' #' @export update_mfishtools <- function() { devtools::install_github("AllenInstitute/mfishtools", build_vignettes = TRUE) }
2f214cec783b1596283f4249585dcc67d5bf3b0b9184fe586e0d1c30d4ae692e
R
191
7
distance_from_2d_line <- function(a,b,c) { #a = point, b and c are two points on your line of interest. v1 <- b - c v2 <- a - b m <- cbind(v1,v2) d <- abs(det(m))/sqrt(sum(v1*v1)) }
f4bba63c0ea5a1721e51e3946736d7dc105ba14b43567e3dc4ad2e361cc6738e
R
198
7
# http://dirk.eddelbuettel.com/blog/2017/08/10/ Rd_files <- vignettes <- R_files <- description <- list( encoding = "UTF-8", language = "en", dictionaries = c("en_stats", "iTReX") )
32b37726c0de6c217e4887bb1d60b1aaf4eebdb161cda04fc6da61166626e10d
R
201
7
library(MOFA2) test_that("a pre-trained model can be loaded from disk", { filepath <- system.file("extdata", "model.hdf5", package = "MOFA2") expect_s4_class(load_model(filepath), "MOFA") })
06b11f513b8babd1dafa541be9f550bcd4d5c4c5d4823d97749b6df3d8d9cd41
R
202
5
withCallingHandlers({ install.packages("lhs", repos="https://cloud.r-project.org/") install.packages("rBayesianOptimization", repos="https://cloud.r-project.org/") }, warning = function(w) stop(w))
a3f909a682945491c66e74778f48bb18358b464cb095e40e4996beec9f5e77f4
R
205
11
#---> Libraries <---- require(dplyr) require(ggplot2) require(caTools) require(glmnet) library(survival) library(kernelshap) library(shapviz) require(caret) library(survex) library(survminer)
c7d29bbbdb5dedea53a458bba3ddb309f5436e0cc5528cb006a15792b784d601
R
206
6
# Test funcs. in misc.R test_that("simulateDataset gives expected output", { expect_equal(nrow(simulateDataset(n_genes = 30)), 30) expect_equal(nlevels(simulateDataset(n_rings = 4)$cluster), 4) })
8ef0bb7f97135dcc729984c5dd70a98d5f5a90150af28e01adb42005b0555691
R
208
3
################################# Fig.1i reduced_all <- readRDS("Customized directory/Manuscript.Wei.et.al/Rds/reduced_all.rds") DimPlot(reduced_all, reduction = 'umap', group.by = "orig.ident", shuffle = T)
aacc8aad9a12e314f258d14fd53b200650440c4a022cc54d022a58270621c84e
R
210
9
library(testthat) library(lightgbm) # nolint: unused_import. test_check( package = "lightgbm" , stop_on_failure = TRUE , stop_on_warning = FALSE , reporter = testthat::SummaryReporter$new() )
ef9963d5f2bc36ac0ef4cf849c6e5f8215562b9ca48efb96718f358c023e9ef7
R
217
8
ggplot_theme <- function() { theme( plot.title = element_markdown(size = 14), legend.title = element_text(size = 14), legend.text = element_text(size = 14), axis.text = element_text(size = 14) ) }
c834903f94bfc725b0654bc77e135bfa947874b6c64763ed6f3afbe20e888188
R
219
9
args <- commandArgs(TRUE) file_name <- args[1] index <- args[2] data_name <- load(file_name) eveGNN::export_to_gnn(eval(parse(text = data_name)), index) eveGNN::write_pars_to_gnn(eval(parse(text = data_name)), index)
6e16abce698ee820acff72817a665ded90e14c5fc426b9b658de900813db1e8c
R
220
10
#!/usr/bin/Rscript # default repo local({r <- getOption("repos") r["CRAN"] <- "https://cloud.r-project.org" options(repos=r) }) pkgs = c('optparse') install.packages(pkgs, repos='http://cran.us.r-project.org')
95a194ae1c7fb5fe4a3ea641ed90e28b254aa7234cd145360ec96b385b6e99a5
R
228
11
#' @keywords internal pdis = function(x, atlas){ vars = rownames(atlas) pat = apply(x, 1, sum) atlas = apply(atlas, 1, sum) parc.discon = matrix(pat / atlas,nrow=1) colnames(parc.discon)=vars return(parc.discon) }
56a4c3b9198fee3d94de8bcb7b81b023f478e7e6f1728a72a6cef37aa77fbe01
R
232
12
#' Pipe operator #' #' See \code{magrittr::\link[magrittr:pipe]{\%>\%}} for details. #' #' @name %>% #' @rdname pipe #' @keywords internal #' @return Function load #' @export #' @importFrom magrittr %>% #' @usage lhs \%>\% rhs NULL
66717f9da984c3fc558617260a8b2bb2d0647fb3c4853aca0e7aaffa4316a69a
R
232
10
#' @importFrom utils packageVersion .onAttach <- function(libname, pkgname) { if (!interactive()) { return() } packageStartupMessage( sprintf("Banksy version %s", packageVersion(pkg = "Banksy")) ) }
e6587df120511c90db64ed00fe3a375dc382d8b3294b4a310bbf2fc4cff081b8
R
234
6
## helper functions for constructing python calls used by targets ---- run_python_target <- function (command_args, out_path, conda_path) { with_path(conda_path, code = system2("python", args = command_args)) return (out_path) }
78e6de1b4ba8a3d09c694b39081b78b503a25c5aabf56c47b6926fc6412593cc
R
237
9
############################ ## iTReX ShinyApp file ## ## Author: Yannick Berker ## ############################ # nolint start: undesirable_operator. iTReX:::set_env() shinyApp(iTReX:::itrex_ui(), iTReX:::itrex_server) # nolint end
25ca2dd25e865769c2ed3ea8c4888f4667dc7724026765c39b81605bf5218894
R
240
14
set.seed(6879) props <- rbeta(1000, shape1=2, shape2=10) res = estimateBetaParam(props) test_that("estimateBetaParam works", { expect_equal(length(res), 2) expect_equal(round(res$a,2), 2.03) expect_equal(round(res$b,2),9.68) })
c1cfeb296fb610e8556cf7ce2fb1f8774f28769b5e163b0bae7c88e54b0f789d
R
240
9
library(Seurat) seurat_obj <- readRDS('multiome.rds') DefaultAssay(seurat_obj) <- 'SCT' seurat_obj <- CellCycleScoring(seurat_obj, g2m.features = cc.genes$g2m.genes, s.features = cc.genes$s.genes) saveRDS(seurat_obj, 'multiome.cc.rds')
4a3246202d12b56f05dc6cab4b3f469a948a9bdf73a22a817f4010aed0cf7564
R
244
9
grow <- function(x, ...) UseMethod("grow") grow.default <- function(x, ...) stop("grow has not been implemented for this class of object") grow.randomForest <- function(x, how.many, ...) { y <- update(x, ntree=how.many) combine(x, y) }
c43751faa6aaf26e05d7f3f10df695432fb3b5dc5b309f4a19a4c691c38e8ce7
R
246
6
## ## Set up variables across 2xx-scripts ## set.seed( seed = 12345 ) ## Ensure reproducible code blocks warning("Have set a fixed random seed, all runs will be identical unless this is changed (may be good or bad, depending on what you want)")
577f59dcf326e0ad72707a0218ae34c073804cf52d0bf27c2e2e623cba4cd574
R
251
4
# Declare variables used via non-standard evaluation (data.table / aggregate # formulas) so R CMD check does not raise "no visible binding for global # variable" notes. utils::globalVariables(c(".SD", "rows", "genes", "col1", "col2", "Homo_sapiens"))
04c913819c17929f67a01226c396fdb8a02b134625c22c58224f3cf62e5a4ddb
R
253
13
library("UMI4Cats") library(BSgenome.mm10.ensembl.local) bcpath = snakemake@params[['odir']] mm10 <- digestGenome( res_enz = "GATC", cut_pos = 0, name_RE = "dpnII", ref_gen = BSgenome.mm10.ensembl.local, out_path = bcpath, sel_chr = NULL )
4971ae8818519f6c41e6aacc45eaf24d89362690361260dbdcc0aa2a0caa4da7
R
264
5
options(timeout=1000) install.packages("BiocManager", repos = "http://cran.us.r-project.org") BiocManager::install("ShortRead") BiocManager::install("BSgenome") devtools::install_github("https://github.com/wardDeb/UMI4cats", dependencies = TRUE, upgrade = "never")
119383e079ed9ebbf6da480dfb80c4bc6936d88376d5560b9f54060bd4c33ca2
R
272
4
.onAttach <- function(libname, pkgname) { packageStartupMessage("MuSiC v1.0.0 support SingleCellExperiment! See Tutorial: https://xuranw.github.io/MuSiC/articles/MuSiC.html") packageStartupMessage("MuSiC2 for multi-condition bulk RNA-seq data is also available!") }
56fc2be856d841ef9c14413a3c27bdc6600a912e9c93944bbaee93adf9558363
R
273
9
test_that("`ggplotColors()` returns as expected", { expect_equal( ggplotColors(6), c("#F8766D","#B79F00","#00BA38","#00BFC4","#619CFF","#F564E3") ) }) test_that("`ggplotColors()` returns expected number of colors", { expect_equal(length(ggplotColors(10)),10) })
f1ac0d6dc59fe60d2b672c2c05f2089b70f15329f2b0c7ab1a9ca90e0591592b
R
275
11
# Generated by using Rcpp::compileAttributes() -> do not edit by hand # Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 RcppVersion <- function() { .Call(`_pROC_RcppVersion`) } delongPlacementsCpp <- function(roc) { .Call(`_pROC_delongPlacementsCpp`, roc) }
1b9bece668bbba938e27e206c40f2d2c36e342824a69451df83f1b48294b4f93
R
277
12
res<- speckle_example_data() test_that("`speckle_example_data` returns as expected", { r_to_json <- function(x) { path <- tempfile(fileext = ".json") jsonlite::write_json(x, path) path } expect_snapshot_file(r_to_json(res), "speckle_example_data.json") })
e45da1adf6e25b2fcaa8177d53cbcaade9f452da38accf5853e1ae65c829ab7b
R
278
17
##-------------------------------------## ## METADATA TAB ## ##-------------------------------------## replace_label <- function(var, old_label, new_label){ var <- gsub(paste0("^", old_label,"$"), new_label, as.character(var)) return(var) }
004bd52380723647e5cdffa58b822710895019e321ed62296047fde2425c4dbd
R
284
16
library(Seurat) seurat_obj <- readRDS('multiome.rds') geneset <- readLines('zr_fus.gene') seurat_obj <- AddModuleScore( object = seurat_obj, assay = 'SCT', slot = 'data', features = list(geneset), name = 'zr_score' ) saveRDS(seurat_obj, 'multiome.zrfus.rds')
25ad46fcc18bd8f61793ab51cda2327a0666bba2d45abbe983ac6e71f23540c1
R
287
6
withCallingHandlers({ install.packages("devtools", repos="https://cloud.r-project.org/") install.packages("Seurat", repos="https://cloud.r-project.org/") devtools::install_github("dviraran/SingleR", ref="db4823b380ba2c3142c857c8c0695200dd1736f6") }, warning = function(w) stop(w))
7fe9f17a94defeef259c5f74665950c049ddc41142e5e221b368502c7838fcbb
R
287
6
.onAttach <- function(libname, pkgname) { RFver <- read.dcf(file=system.file("DESCRIPTION", package=pkgname), fields="Version") packageStartupMessage(paste(pkgname, RFver)) packageStartupMessage("Type rfNews() to see new features/changes/bug fixes.") }
406ac892c24f627d2c55434c069065f378f435e7df6352895f05af6595c8946b
R
296
10
# Skip slow tests skip_slow <- function(message = "Slow test skipped") { if (exists("run_slow_tests", envir = .GlobalEnv)) { if (!get("run_slow_tests", envir = .GlobalEnv)) { skip(message) } } else if (!identical(Sys.getenv("RUN_SLOW_TESTS"), "true")) { skip(message) } }
7d857458e62fd5207e3e4d178b62a6e9bccf0ee3f594fcb81aad4c33c3edaf21
R
306
18
--- title: "Omics_Report" output: html_document --- ```{r, width=700, height=700} cat("DSS_asym") plot_igraph(network_l) ``` ```{r, width=700, height=700} if (is.null(s_network_l)) { cat("sDSS_asym values are not available for this sample") } else { cat("sDSS_asym") plot_igraph(s_network_l) } ```
ff3dd4e522f09ad0bd538eda97d7b2cae3c82b197d5ffb31137fa135e510ccc9
R
306
10
#' @keywords internal p2pnet = function(x, suffix){ pd.file = list.files(file.path(x, "Parcel_Disconnection")) pd.file = pd.file[grepl(paste0(suffix,"_disconnectivity.RData"),pd.file)] pd.path = file.path(x, "Parcel_Disconnection", pd.file) load(pd.path) dmat = disconnectivity return(dmat) }
784f40ea1c9edf8b4a44bed92fe92dc9964b83323b5f0295e82e844e5c471d8d
R
307
18
--- title: "HitNet_Report" output: html_document --- ```{r, width=700, height=700} cat("DSS_asym") plot_igraph(network_l) ``` ```{r, width=700, height=700} if (is.null(s_network_l)) { cat("sDSS_asym values are not available for this sample") } else { cat("sDSS_asym") plot_igraph(s_network_l) } ```
ceccc94f7ca8b64470cdfb3716e93df2aca38e51446bf353428d6d415742444f
R
308
6
treesize <- function(x, terminal=TRUE) { if(!inherits(x, "randomForest")) stop("This function only works for objects of class `randomForest'") if(is.null(x$forest)) stop("The object must contain the forest component") if(terminal) return((x$forest$ndbigtree+1)/2) else return(x$forest$ndbigtree) }
d34fedea62f7ceb553ef80d031e6f23d154479696e4eaaea9eb637a72578ef27
R
309
13
library(data.table) library(devtools) require(GenomicSEM) munge(c("/path/to/MDD.txt", "/path/to/ADHD.txt", "/path/to/BPD.txt"), hm3 = "/path/to/w_hm3.snplist", trait.names = c("MDD", "ADHD", "BPD"), info.filter = 0.9, maf.filter = 0.01) #Returns munged summary statistics for multivariable LDSC
cfbab83476092545626543f54b6758da76c7fe6ead15c74fffbf092eaee9b41c
R
312
15
#' @keywords internal ndis = function(x, atlas, groups){ vars = rownames(atlas) pat = apply(x, 1, sum) atlas = apply(atlas, 1, sum) pat=rowsum(pat, group=groups) atlas=rowsum(atlas, group=groups) net.discon = matrix(pat / atlas,nrow=1) colnames(net.discon)=rownames(pat) return(net.discon) }
405bd697f3426495c2070c9281ae828db14b30af8db16e6099b725eca1f92360
R
322
5
################################# ED.Fig.1d library(pheatmap) Combined_avg <- read.csv('Customized directory/Manuscript.Wei.et.al/Raw_Txt/Tumor_Bulk_Combined_gene_list_avg.csv', header = TRUE, row.names = 1) pheatmap(log2(as.matrix(Combined_avg)+1), scale = "row", cluster_cols = F, cluster_rows = F, treeheight_row = 0...
872d0e2fbb9df8d74d62f285e62d5d9c3dc7a7cc26f27767de6d9c0192b9b86e
R
324
4
# Shared publication typography. PDF text stays embedded and searchable. figure_style <- list(font='Liberation Sans', base_pt=8.5, small_pt=8, width_mm=178, control_label='Ctrl', effect_labels=c('D1/Ctrl','D3/Ctrl','D3/D1'), negative='#3b6fb6', neutral='white', positive='#d55e0...
9207acfcf95ca0bd8371c61c2cfe197b2eb084df2209808ad2b5df9eb9d03545
R
324
15
--- title: "iHeatmap" output: html_document --- ## `r PID` ```{r} t <- readxl::read_xlsx(file.path(output_dir, paste0(PID, "_mono.xlsx"))) t$DSS_asym <- as.numeric(t$DSS_asym) t <- data.table::as.data.table(t) ordered <- t[order(DSS_asym, -Drug.Name, na.last = TRUE), ] waterfall_with_hover_drcs(output_dir, ordered) ...
c096fad4f0c19e0136fa6321c98741b930d18aed3a3fad2a11e287f62e39535d
R
328
8
withCallingHandlers({ install.packages("BiocManager", repos="https://cloud.r-project.org/") BiocManager::install(ask = FALSE) BiocManager::install("SingleCellExperiment") install.packages("devtools", repos="https://cloud.r-project.org/") devtools::install_github("hemberg-lab/scmap") }, warning = function(w) s...
9c6d4a9171a11c18a0fbc51ea0a45a5fc5cc91a5afad523ef1f6bc6866fb7508
R
332
19
loadNamespace("pkgdown") loadNamespace("roxygen2") roxygen2::roxygenize( "R-package/" , load = "installed" ) pkgdown::build_site( "R-package/" , lazy = FALSE , install = FALSE , devel = FALSE , examples = TRUE , run_dont_run = TRUE , seed = 42L , preview = FALSE , new_proce...
b2a5a0648d00b056790c841975f84d015c99a6f6a96fe7c3534f7ada1f2d648a
R
333
10
# function to create density plot suppressPackageStartupMessages(library(ggplot2)) density_plot <- function(mat, color_var, title, xlab){ p <- ggplot(mat, aes_string(x = 'log2(value + 1)', fill = color_var)) + geom_density(alpha = .3) + theme_bw() + theme_Publication2() + ggtitle(title) + xlab(xlab) ...
8f8acfc23a866fd8b6b40499adf82d6bec766f543e2a8e4b8e85326385a4a141
R
335
21
library(glmnet) get_lm_results=function(fitted.model, test.x){ test.pred = predict(fitted.model, newdata = test.x) return(test.pred) } get_enet_results=function(fitted.model, test.x){ test.pred=predict(fitted.model, as.matrix(test.x), type="response", s = "lambda.min") return(test.p...
31d4668378b703188d04d45f195a31818bfa510305d082ffef16181afc923ac0
R
339
5
install.packages(c("yaml","ape","furrr","future.apply","purrr"), repos = "https://cloud.r-project.org") remotes::install_github("YuLab-SMU/ggtree", force = TRUE) remotes::install_github("thijsjanzen/treestats", force = TRUE) remotes::install_github("EvoLandEco/eve", force = TRUE) remotes::install_github("EvoLandEco/eve...
7a09f3e6568a90de873ccff80921b0eccc31e1b7c43602cf23e742a304a510b4
R
345
12
#' Re-exporting the pipe operator #' See \code{magrittr::\link[magrittr]{\%>\%}} for details. #' #' @name %>% #' @rdname pipe #' @param lhs see \code{magrittr::\link[magrittr]{\%>\%}} #' @param rhs see \code{magrittr::\link[magrittr]{\%>\%}} #' @export #' @importFrom magrittr %>% #' @usage lhs \%>\% rhs #' @return depe...
28cfe5364e50e380973a21f46924b38945e455dbbd7262c3476174607c85a4d7
R
348
15
library(neurobase) library(oro.nifti) writeLines('*** Reading Files ***') arg <- commandArgs(trailingOnly = TRUE) wmh <- readnii(arg[1]) wmh_mask = wmh[wmh != 0] writeLines('*** Generating Stats Table ***') out <- table(wmh_mask) out <- as.matrix(out) name <- arg[2] out = cbind(out, rep(name, nrow(out))) write.table...
8a3bb40babc9d011084d4da0c31cbe690fd5daf5f218421ac6afcffbf6041cc9
R
348
11
.libPaths("/home/xavier/R/library-pROC_revdeps") .libPaths("/home/xavier/R/library") pak::pkg_install("r-lib/revdepcheck") library(revdepcheck) # Don't make in parallel. Avoids running out of memory on some build tasks Sys.setenv("MAKEFLAGS"="") revdep_reset() revdepcheck::revdep_check(num_workers=2, timeout = as.dif...
b4ce24b2ce8d2b828cee48eae1ecc9a6f5114b7fabb96ed37cf42e043d8dfac0
R
354
14
set.seed(3485) y <- matrix(rnbinom(6000, mu = 100, size = 1), ncol = 6) lnorm.y2 <- normCounts(y, log=TRUE, prior.count=2) test_that("`normCounts` returns as expected", { r_to_json <- function(x) { path <- tempfile(fileext = ".json") jsonlite::write_json(x, path) path } expect_snapshot_file(r_to_js...
ba41eab3b66de3efdc669c21aac96a2d28d469b2a924ec0302d82090818cea25
R
358
21
--- title: Installation output: pkgdown: toc: FALSE --- `MuSiC` is implemented as an R package, `r BiocStyle::Githubpkg('xuranw', 'MuSiC')`, which can be installed from GitHub by: ```{r, eval = FALSE} # install devtools if necessary install.packages('devtools') # install bseqsc devtools::install_github('xura...
a546154cdd90bde90c5a44e903dcd2700feca6820566c4f00d6a64a440e278f3
R
359
11
#' @keywords internal tdis = function(x){ td.file = list.files(file.path(x, "Tract_Disconnection")) td.file = td.file[grepl(".csv",td.file)] td.path = file.path(x, "Tract_Disconnection", td.file) tract_discon = read.csv(td.path) tract.discon = matrix(tract_discon$Discon,nrow=1) colnames(tract.discon)=tract...
a2f6e47e49d5c895032123031bc13318d61d8c8a02e5254ee58237cfd72b3531
R
363
14
#' Pipe operator #' #' See \code{magrittr::\link[magrittr:pipe]{\%>\%}} for details. #' #' @name %>% #' @rdname pipe #' @keywords internal #' @export #' @importFrom magrittr %>% #' @usage lhs \%>\% rhs #' @param lhs A value or the magrittr placeholder. #' @param rhs A function call using the magrittr semantics. #' @ret...
7c4e5d1609d6aba6c4510851cae3d8b10c1aa16a8e8aed9311c6d5e49e7888d4
R
370
9
withCallingHandlers({ install.packages("BiocManager", repos="https://cloud.r-project.org/") BiocManager::install(ask = FALSE); BiocManager::install(c("scater", "MAST")) install.packages("devtools", repos="https://cloud.r-project.org/") devtools::install_github("satijalab/seurat") devtools::install_github("B...
275789f5aced5dc5ebc8edb807dccd3be2f62d53d9dbac6dd6dfb3853cd604a6
R
372
9
# plot data sources for ciliopathy genes library(ggplot2) variantsCiliopathy = read.csv('data/variantsCiliopathies.csv') #curated list of ciliopathy genes freqtable = as.data.frame(table(unique(variantsCiliopathy[,c("datasourceId", "diseaseId", "targetId")])[,1])) ggplot(freqtable, aes(x=reorder(Var1, -Freq), y=Fre...
813c8b69641e0da0ccc0f6c5b69fe166e7f6b0247479e99d8b785f236bbccf41
R
372
12
# This file is part of the standard setup for testthat. # It is recommended that you do not modify it. # # Where should you do additional test configuration? # Learn more about the roles of various files in: # * https://r-pkgs.org/tests.html # * https://testthat.r-lib.org/reference/test_package.html#special-files libr...
31f123dba39e1b56b3a06c0f24951bdefa5a34f15117ce988959ed06edc1174b
R
373
14
#!/usr/bin/env RScript args=commandArgs(trailingOnly=TRUE) org=args[1] corresFile=args[2] libpath=args[3] corresIDorg=read.table(corresFile,header=T,row.names=1) orgGO=as.character(corresIDorg[org,1]) if((!require(orgGO,character.only=TRUE, lib.loc=libpath))){ requireNamespace("BiocManager", quietly = TRUE) BiocMa...
97a20d417c008467f730ac1d1b7fb5285806202cf6a03d1b91a196192a9f5126
R
374
12
# This file is part of the standard setup for testthat. # It is recommended that you do not modify it. # # Where should you do additional test configuration? # Learn more about the roles of various files in: # * https://r-pkgs.org/tests.html # * https://testthat.r-lib.org/reference/test_package.html#special-files libr...
ce2f843ea25ba9b9bb5c6f824e066ee379b096e18038a613f9a394343bb67f15
R
374
11
# Skip expect_doppelganger if vdiffr is not installed expect_doppelganger <- function(title, fig, ...) { testthat::skip_if_not_installed("vdiffr") vdiffr::expect_doppelganger(title, fig, ...) } # expect_doppelganger for ggroc expect_ggroc_doppelganger <- function(title, fig, ...) { testthat::skip_if_not_installe...
5379b2baa0d2faa89ed29a2dbfd6e3f23a6352e38fd4859bc179dd25cffa6d1b
R
380
9
library(LAVA) input = process.input(input.info.file="/path/to/input.info.txt", sample.overlap.file="/path/to/sample.overlap.file", #Optional; NULL ref.prefix="/path/to/g1000_EUR/g1000_eur", phenos= c('F1')) loci = read.loci("/path/to/locus.txt") locus =...
96b28762cfe26c94fb66467a3e47e88bbd80c0a9ef43d3a3476c1578ec70cbbb
R
389
10
test_that(".METRICS_HIGHER_BETTER() should be well formed", { metrics <- .METRICS_HIGHER_BETTER() metric_names <- names(.METRICS_HIGHER_BETTER()) # should be a logical vector expect_true(is.logical(metrics)) # no metrics should be repeated expect_true(length(unique(metric_names)) == length(metri...
f5bef65af8f96766b345febd3179de80306127c296669dc36ff29ccdfd78a7ac
R
398
12
# This file is part of the standard setup for testthat. # It is recommended that you do not modify it. # # Where should you do additional test configuration? # Learn more about the roles of various files in: # * https://r-pkgs.org/testing-design.html#sec-tests-files-overview # * https://testthat.r-lib.org/articles/spec...
15efd594ff01ac60d6efec144bf9bb6c6d5b7e39a78e010a6fd26597c5e3f810
R
401
11
#' @keywords internal pdam = function(x, suffix){ pd.file = list.files(file.path(x, "Parcel_Damage")) pd.file = pd.file[grepl(paste0(suffix,"_percent_damage\\.csv"),pd.file)] pd.path = file.path(x, "Parcel_Damage", pd.file) parcel_damage = read.csv(pd.path) parcel.damage = matrix(parcel_damage$PercentDamage,...
2ce4e8fd168e410c439b39990bc574300fdaff943ba4fcb6538081f79f0d8cff
R
404
12
# This file is part of the standard setup for testthat. # It is recommended that you do not modify it. # # Where should you do additional test configuration? # Learn more about the roles of various files in: # * https://r-pkgs.org/testing-design.html#sec-tests-files-overview # * https://testthat.r-lib.org/articles/spec...
39c6482ac89a94eb7d2b5df1dd1d341d1591e3e8c6c087a337ecf070ae56db8c
R
404
12
# This file is part of the standard setup for testthat. # It is recommended that you do not modify it. # # Where should you do additional test configuration? # Learn more about the roles of various files in: # * https://r-pkgs.org/testing-design.html#sec-tests-files-overview # * https://testthat.r-lib.org/articles/spec...
e9f7ac1be96f962b6d51bbab4cac20e176974507d22419a25c8dd8fd1c75b653
R
404
11
source("../shinytest_helpers.R") set_window() app$setInputs(number_of_samples = "cohort") app$uploadFile(layout_table_file = demo_path("MRA_Layout.xlsx")) app$uploadFile(readout_matrices_file = demo_path("MRA_2ReadoutsXlsx.zip")) app$setInputs(start_oca = "click", timeout_ = 1500e3) app$setInputs(iTReX = "MRA-mod/Coho...
517e9e1263b5274082867c78e05b3ca0862b444583aa258be12ab41a740d2ed7
R
405
24
# ---> Libraries <---- require(dplyr) require(ggplot2) require(caTools) require(glmnet) library(randomForestSRC) library(pec) library(survex) # if (!require("BiocManager", quietly = TRUE)) # install.packages("BiocManager") # # BiocManager::install("survcomp", force = TRUE) require(survcomp) # l...
e8389bcc8d4a2f3089d32d33cbeba65f4083bda25c291b7b12c28c3764107624
R
406
11
# Generated by using Rcpp::compileAttributes() -> do not edit by hand # Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 col_max <- function(quantities, m, n) { .Call('_diann_col_max', PACKAGE = 'diann', quantities, m, n) } maxlfq_solve <- function(quantities, peptides, samples, margin = -10.0001) { .Cal...
43f37581f2d52a5bee3702352ddeaff0a34ffe1f8d936c867595fd0e79387840
R
411
12
library(tidyverse) library(dplyr) v39_eh_df <- read_tsv('results/ensembl_gene_symbol_gtf_gencode_v39.tsv') open_ped_can_eh_df <- read_tsv('input/OpenPedCan-v12-ensg-hugo-pmtl-mapping.tsv') %>% dplyr::select(gene_symbol, ensg_id) %>% dplyr::rename(ensembl = ensg_id) merged_eh_df <- distinct(bind_rows(v39_eh_df, o...
76e027abbb5c1dd3478db79c487424d3d397f4c6a429b70e45e6218bbeb0f6f4
R
413
19
library(Seurat) seurat_obj <- readRDS('multiome.rds') DefaultAssay(seurat_obj) <- 'SCT' seurat_obj <- PrepSCTFindMarkers(seurat_obj) diff_exp <- FindAllMarkers( object = seurat_obj, only.pos = TRUE, logfc.threshold = 0.25, min.pct = 0.05, recorrect_umi = FALSE ) write.ta...
b82752f2c46d91202b4b11389cfc8790d9fb99ab1e676b44f1df8141d9cff3d0
R
413
11
library(rgl) library(wholebrain) path.bin <- 'F:/1.课题/1.神经环路/20230713/Figure/bin' path.matrices <-'F:/1.课题/1.神经环路/20230713/Figure/data/3D_data' allen.annot.path <- paste(path.matrices , 'allen-mesh', sep = '/') load(paste(path.matrices ,'atlasspots.RData',sep='/')) load(paste(path.matrices , 'vivid-colors.RData', sep...
862f38e1a06072e52c7bf37a18a9aee794a81534b7648003043911cabcbff371
R
414
11
source("../shinytest_helpers.R") set_window() app$setInputs(number_of_samples = "cohort") app$uploadFile(layout_table_file = demo_path("MRA_Layout.xlsx")) app$uploadFile(readout_matrices_file = demo_path("MRA_2ReadoutsXlsx_Identical.zip")) app$setInputs(start_oca = "click", timeout_ = 1500e3) app$setInputs(iTReX = "MR...
7cf5bf7651503cd4fa5871fa80520ea24f88195f4d5f19504dbe4412326b2b19
R
424
17
#' @keywords internal p2pdis = function(x, atlas){ pat = x pat[upper.tri(pat)]=NA pat = melt(pat, na.rm=T) pat$Var = paste0(pat$Var2, "_to_",pat$Var1) atlas[upper.tri(atlas)]=NA atlas = melt(atlas, na.rm=T) atlas$Var = paste0(atlas$Var2, "_to_",atlas$Var1) pat$value = pat$value / atlas$value parc2p...
b195a1800319029b1fa22c88392963520ee4443b24e81da2a8b3daf596b819d6
R
425
13
# ------ Function to find the last row where relevant columns contains "+" and the next column has data find_last_valid_row <- function(col) { # Find rows with "+" rows <- grep("\\+", file_temp[[col]]) # Keep rows where next col has data rows <- rows[file_temp[[col + 1]][rows] != "" & !is.na(file_temp[[...
47e506099709147a306faf9c6958e2c0256ab3d5d7d60851c9d29f2438a5fa0b
R
427
8
withCallingHandlers({ install.packages("devtools", repos="https://cloud.r-project.org/") install.packages("BiocManager", repos="https://cloud.r-project.org/") BiocManager::install("fgsea") devtools::install_github("thomasp85/patchwork", ref="fd7958bae3e7a1e30237c751952e412a0a1d1242") devtools::install_github(...
b835a29b3b4c8c2afa7d4b14206923dc060ccd43608aff014f58008280a42715
R
427
7
### Saving Dataset for OSF Storage: library(Seurat) sctv2fileloc='path/to/datasets/' MayZhang10x<-readRDS(file = paste0(sctv2fileloc,'2024-06-18_May-Zhang2021_10x_6wks_MouseColDuodIle_SCTv2Integrated_HarmonyBC.RDS')) MayZhang10x@assays$SCT<-NULL MayZhang10x@assays$integrated<-NULL saveRDS(MayZhang10x,file = paste...
8beb673d8e98e698dae34e3d5854435e0448503801252e8efc78f6d8cbdd1641
R
431
8
withCallingHandlers({ install.packages("BiocManager", repos="https://cloud.r-project.org/") BiocManager::install(c("monocle", "DelayedArray", "DelayedMatrixStats", "org.Hs.eg.db", "org.Mm.eg.db")) install.packages("devtools", repos="https://cloud.r-project.org/") devtools::install_github(...
314c96e81b07256bb421c63c91b9678d58502acac917fac2069b74534244d0cd
R
434
11
--- title: Data download output: pkgdown: toc: FALSE --- * [Processed RNA-seq data from bulk pancreatic islets in healthy and hyperglycemic individuals (GSE50244)](https://github.com/xuranw/MuSiC/tree/master/vignettes/data/GSE50244bulkeset.rds) * [Single cell RNA-seq data of pancreatic islets from health...
f69b81b13cb3e2699f110159b46fb8e01828f89c29a8cd5d317a0dd2175257c3
R
434
8
withCallingHandlers({ install.packages("devtools", repos="https://cloud.r-project.org/") install.packages("BiocManager", repos="https://cloud.r-project.org/") BiocManager::install(c("bioDist", "ggplot2", "gplots", "cowplot", "dendextend", "corrplot", "reshape2", "plotly")) devtools::ins...
7f19cd6c6caa0dae95f5fd41b5f9bd58fa3e1e12b52eb1531a9497402df9b21c
R
435
11
# Function to read all the sheets of an Excel file read_excel_allsheets <- function(filename, tibble = FALSE) { # I prefer straight data.frames # but if you like tidyverse tibbles (the default with read_excel) # then just pass tibble = TRUE sheets <- readxl::excel_sheets(filename) x <- lapply(sheets, function...
a60ccf53f108d009b263b46df352d8c5cff9356964ef5c8a342bbdc0c46f7fcc
R
435
7
# vector of bridge recommendations assigned to each datapoint from the # cross-product normalization method and when setting the format 'format' # argument to TRUE. bridge_recommendations <- c("median_centering" = "MedianCentering", "quantile_smoothing" = "QuantileSmoothing", ...
190f395643fad0e055f051300bf9dd968310e0c56846f0f264e5ed50a69440fe
R
443
14
source("../shinytest_helpers.R") set_window() app$uploadFile(layout_table_file = demo_path("MRA_LayoutAndReadouts_BT-40_ST04.xlsx")) app$setInputs(upload_reference_samples = TRUE) app$uploadFile(reference_samples_file = demo_path("Controls_DKFZ_ST10-min.xlsx")) app$setInputs(start_oca = "click", timeout_ = 1500e3) ap...
a0e398c14178702a2724931f4a6d00ca3b49e6aa96ca023f6209ad3393609b84
R
443
12
source("../shinytest_helpers.R") set_window() app$setInputs(number_of_samples = "cohort") app$uploadFile(layout_table_file = demo_path("MRA_Layout.xlsx")) app$uploadFile(readout_matrices_file = demo_path("MRA_2ReadoutsXlsx.zip")) app$setInputs(Amin_select = "0") app$setInputs(start_oca = "click", timeout_ = 1500e3) ap...
6ad968f54fcfea0fdfd77e2fe6382022dc4ca7a50fdefbc45cd7ee97f7c508e0
R
445
12
source("../shinytest_helpers.R") set_window() app$setInputs(number_of_samples = "cohort") app$uploadFile(layout_table_file = demo_path("MRA_Layout.xlsx")) app$uploadFile(readout_matrices_file = demo_path("MRA_2ReadoutsXlsx.zip")) app$setInputs(Amin_select = "10") app$setInputs(start_oca = "click", timeout_ = 1500e3) a...
09ddaa8dfff31ee06c25f075d30cf0e48ef30e7a324df7e9d609d630560731bb
R
449
16
folder<-"/home/jbrenton/Regina_file_deposit" files<-list.files(folder) files<-files[grep("fastq.gz", files)] # filenames<-sub("(^.*)/.*", "\\1", files) sample_names<-c() for (i in 1:length(files)) { index<-which(!is.na(str_match(files[i], meta$CaseNo))) sample_names[i]<-unique(meta$CaseNo[index]) } new_files<-fil...
24bfa82906f37567c02467ddd0fbbfc6141c48b64d476c349b356fb329750104
R
451
18
data <- speckle_example_data() x <- table(data$clusters, data$samples) res = estimateBetaParamsFromCounts(x) test_that("estimateBetaParamsFromCounts works", { expect_equal(length(res), 6) expect_equal(res$n, 1100) expect_equal(length(res$alpha),ncol(data)) expect_equal(length(res$beta),ncol(data)) expect...
36fe7be6f6de7c60598960d1c914bf14ae75cfdd534ef031466a37f99bd67612
R
457
18
args <- commandArgs(TRUE) name <- args[1] if (!dir.exists(name)) { dir.create(name) } setwd(name) dir.create("BD_TES") setwd("BD_TES") bd_tes <- replicate(500, ape::rphylo(n = 200, birth = 0.6, death = 0.1, T0 = 10, fossils = FALSE), simplify = FALSE) bd_tes_list <- list(tes = bd_tes) eveGNN::export_to_gnn(bd_te...
1152ffdbf5b22ba646de1e7cced825ace4ad4e21223c9971d5d26343cf9cc7f2
R
460
14
# ======================================================= # Some global variables that can be used in all functions # ======================================================= #' @import utils NULL ## Set global variables to avoid NSE notes in R CMD check utils::globalVariables(c( "q.name", "q.len", "q.start", "q.e...
8b16ca4d2ed734a92780b0bc74a0ec62d240383fc42a0e14afcda9d2adf15d5d
R
467
7
# Requires R 4.6.1 plus a C/C++ toolchain and standard R build dependencies. if(as.character(getRversion())!='4.6.1') stop('The frozen environment requires R 4.6.1') dir.create('.Rlib',showWarnings=FALSE) .libPaths(c(normalizePath('.Rlib'),.libPaths())) options(repos=c(CRAN='https://cloud.r-project.org')) if(!requireNa...
dc1161abcc21f658f9e795475f7f80a956acdcaaf9781b0230057bffee073608
R
468
14
# File: /scripts/analysis/lme_RMS.R # Purpose: Linear mixed‑effects model for RMS post EEG biofeedback # Input: ../../data/processed/EMG_EEG_strength.csv # Output: model summary printed to console # Dependencies: lme4, emmeans (see docs/parameters.md) library(lme4) library(emmeans) data <- read.csv("../../data/proces...
ef74b055b6d1bfa3e66c5a300b765027fbf5740258adfc0099b69773db09e0fc
R
470
16
test_that("getLGBMthreads() and setLGBMthreads() work as expected", { # works with integer input ret <- setLGBMthreads(2L) expect_null(ret) expect_equal(getLGBMthreads(), 2L) # works with float input ret <- setLGBMthreads(1.0) expect_null(ret) expect_equal(getLGBMthreads(), 1L) # s...
6f005bfb92667faf18050a1d0f28ff55ba37b3a77e49f8a82fd9c2d7bfdbdb73
R
476
16
setwd('~/Documents/work/PTSD_2023/round3_medi/interaction_withMiRNA_NOV/code_for_share/Base_model/FACTORwave2_PTSSwave3/Life_Factor/') df <- readRDS('df.rds') fomular <- as.formula(sprintf("%s ~ %s", colnames(df)[1], paste(paste(colnames(df)[-c(1)], ...
8eb89b99f99e762dbb48cd3aa22a3a6422daecdac82441a63b6c8f9fb758144d
R
476
8
utils::globalVariables(c( ".", ".data", "Adjusted", "CFI.dif", "CIlower", "CIupper", "Crude", "Edge", "Edge weight bootstrapped (95% CI)", "Edge weight sample", "M(sd)", "RMSEA (90% CI)", "RMSEA.dif", "Significance", "VIF", "Var", "any_of", "dups", "eff.type", "group_category", "id", "key", "n(%)", "node1", "no...
64e2ec929ab40865ba868f6e400f9bfc1c8751ed43b8d9752de4296612899562
R
477
16
setwd('~/Documents/work/PTSD_2023/round3_medi/interaction_withMiRNA_NOV/code_for_share/Base_model/FACTORwave4_PTSSwave4//Life_Factor/') df <- readRDS('df.rds') fomular <- as.formula(sprintf("%s ~ %s", colnames(df)[1], paste(paste(colnames(df)[-c(1)], ...
1204e2b9896fb2b36f4c8bd46c8cd2d99100db1b3f864e45da4697e39fd35ed2
R
480
16
setwd('~/Documents/work/PTSD_2023/round3_medi/interaction_withMiRNA_NOV/code_for_share/Base_model/FACTORwave2and3_PTSSwave3/Life_Factor/') df <- readRDS('df.rds') fomular <- as.formula(sprintf("%s ~ %s", colnames(df)[1], paste(paste(colnames(df)[-c(1)], ...
6e4068c84cdcd71f4aa8460b1406d4590cdcc5c9af4eb22da6c0cfb3986890e2
R
480
13
source("../shinytest_helpers.R") set_window() app$setInputs(number_of_samples = "cohort") app$uploadFile(layout_table_file = demo_path("MRA_Layout.xlsx")) app$uploadFile(readout_matrices_file = demo_path("MRA_2ReadoutsXlsx.zip")) app$setInputs(Amin_select = "other") app$setInputs(Amin_slider = 25) app$setInputs(start_...
575f64f4523055173bbfb79d69790478d2e09bbef647fc33a9ea7de9525e734a
R
487
20
############################################### # # UI for homepage tab # ############################################### tab_HOME <- tabPanel( title = "", icon = NULL, #div(class="fa fa-home", role = "navigation"), value = "home", # tab ID htmlTemplate("www/landing-page.html", latest_upd...
6d1707f7d6007ca743f2f401962e3e032cfa72ad9544219af7966c71693a8a86
R
488
23
# Generated by using Rcpp::compileAttributes() -> do not edit by hand # Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 hyper_bench_vector <- function(xin, yin, N, n) { .Call(`_richR_hyper_bench_vector`, xin, yin, N, n) } name_table <- function(lh) { .Call(`_richR_name_table`, lh) } reverseList <- func...
465c01c7af4b58a8fd83ca6a8ac7e9e0ba96e86efc1b1a6a5a82e66d784da851
R
489
16
setwd('~/Documents/work/PTSD_2023/round3_medi/interaction_withMiRNA_NOV/code_for_share/Base_model/FACTORwave2_PTSSwave3/Life_Current_Factor_PRS//') df <- readRDS('df.rds') fomular <- as.formula(sprintf("%s ~ %s", colnames(df)[1], paste(paste(colnames(df)[-c(1)], ...