sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
7670e26c6acabe147f610205ca579e2b68f825b01380b844c1031f86f253387a
R
3,110
90
# This tests the classic marker detection scheme. # library(testthat); library(SingleR); source("setup.R"); source("test-markers.R") library(DelayedArray) median_by_label <- function(mat, labels) { ulabels <- SingleR:::.get_levels(labels) output <- matrix(0, nrow(mat), length(ulabels)) rownames(output) <- ...
7f4a867915f93cccfd3958da180faa530fc42c78857cf447dbb74676b5e16f87
R
3,126
89
--- title: "Intratumoral heterogeneity in Glioblastoma" output: html_document: default pdf_document: default --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` ## Load data We load the scRNA data of MGH106 sample from the public dataset of Gliobastoma (GSE131928) ```{r echo=TRUE, message=FA...
fdbd43592c3082607ddac743b41a13f74189e80f23d6ff235b64888feb2b7915
R
3,127
124
#==========================# # 3. Base (& target) QC # #==========================# ## Set up ---- filepath <- "" setwd(filepath) ### Load libraries ---- library(data.table) library(dplyr) library(magrittr) library(purrr) ### Load data ---- base <- fread("dat/genetics/base/Kunkle_etal_Stage1_results.txt", header ...
b8187e65a48d8ddb9acb08045a08498270afc2d008073224ddac3e5afaa32564
R
3,133
109
write.model<-function(Loadings,S_LD,cutoff,fix_resid=TRUE,bifactor=FALSE,mustload=FALSE,common=FALSE){ Model<-"" if(common == TRUE){ for(f in 1){ u<-1 Model1<-"" for(i in 1:nrow(S_LD)){ if(u == 1){ linestart<-paste("F", f, "=~", colnames(S_LD)[i], sep = "") u<-u+1...
7b42eb7228616cdca5ab700237d78f10a51f878bdfc380c79083cae63d7c9586
R
3,135
58
#' Match labels from two references #' #' Match labels from a pair of references, corresponding to the same underlying cell type or state #' but with differences in nomenclature. #' #' @param ref1,ref2 Numeric matrices of single-cell (usually normalized and log-transformed) expression values where rows are genes and c...
521777fcfe088a51b767ba6e79778d245d57220cc81b1445ac734a85079149a5
R
3,148
92
now <- function(x = Sys.time(), format = "[%H:%M:%OS3] ") { ## format(x, format = format) ## slower format(as.POSIXlt(x, tz = ""), format = format) } debug_indent <- local({ symbols <- rep(c("|", ":", ".", "'", ",", ";", "`"), times = 10L) function() { depth <- length(.debug[["stack"]]) if (depth == 0)...
0209d50a890cc048d7b64924ccddd910e52525208d121ee733aec98bfe4a3eca
R
3,151
106
# ## Create geneZscoresNullGwas matrix used to find correlated genes genes x traits # #Code to generate matrix from: http://r.789695.n4.nabble.com/Re-Generate-a-serie-of-new-vars-that-correlate-with-existingvar-td822187.html # generates ndistr vectors of same mean and sd, with various cor.coeffs # input : # ...
190230f171cdaa8f6ae2fdd769dba3d0a26ab5a1963f4558a25ef906488df6de
R
3,156
114
# AD Gene verification committee # https://adsp.niagads.org/index.php/gvc-top-hits-list/ library(dplyr) library(tidyr) library(purrr) library(janitor) library(tibble) library(glue) library(stringr) library(googlesheets4) library(readr) library(forcats) ## Snakemake ### Input path_snps <- snakemake@input[["snps"]] pat...
2287cdb9bb61f2b7a96aaaa3250c07212133d441fcba9b25ae5a0a53074b4ecb
R
3,196
82
```{r} setwd("evaluating_coregulation") source("../downstreamer_functions.r") tmp <- read.downstreamer.enrichments("../../downstreamer_main/data/pritchard_traits/") tmp <- read.downstreamer.batch("../../downstreamer_main/data/pritchard_traits/") ``` ```{r} # P1 x <- tmp$pritchard_traits_2021_33587031_Urate_1$GenePri...
8f78449e3e4277e097f9bbcceea158776a92b8c49dd796f1f885d822a18d6291
R
3,202
109
#' @tags FutureRegistry #' @tags sequential library(future) message("*** FutureRegistry() ...") for (where in c("multicore-dummy-uuid", "rscript")) { message(sprintf("*** FutureRegistry('%s', 'list') ...", where)) futures <- FutureRegistry(where, action = "list") print(futures) stopifnot(length(futures) == 0...
d503fcb6b8f51b2597434ffb516c66b8d3345b7f07b9265c87af5eab2ce45d91
R
3,206
79
#This script takes the output of Orthofinder of the species you wish to run. Both the model training set and the targets. #Finds Orthofinder/VERSION_RUN/SingleCopyOrthogroups.txt Orthofinder/VERSION_RUN/Orthogroups.csv Orthofinder/VERSION_RUN/Orthogroups.GeneCount.csv #You need to set the lines below # Remove all obje...
1f9a23de1ad11412466fe237a9928bb00c95e01e8d04e54c52f65873124fd771
R
3,209
152
#' @export normalize.scran <- function( ace, batch_attr = NULL, assay_name = "counts", BPPARAM = SerialParam() ) { .check_and_load_package(c("scran", "scater")) batch_attr = .get_attr_or_split_idx(ace, batch_attr, return_vec = TRUE) ace = scran::computeSumFactors( ace, clusters = batch...
3236783897bc4408d86d6d374bba638897074473a1462288c11439f44d03e0b2
R
3,215
101
factor_loadings <- function(object) { UseMethod("factor_loadings") } #' @title Extract factor loadings from galamm object #' #' @aliases factor_loadings factor_loadings.galamm #' @export factor_loadings #' @export #' #' @srrstats {G1.4} Function documented with roxygen2. #' @srrstats {G2.1a} Expected data types prov...
4a77e7ef977886f7c5bf9fb5dec9b54a35bb40dcd61597adfc18e5889944c1fd
R
3,216
108
#' @tags utils-internal deprecation library(future) deprecateArgument <- future:::deprecateArgument message("*** deprecateArgument() ...") ## Only a known set of functions is accepted res <- tryCatch(deprecateArgument("<unknown>", name = "a", value = 1L), error = identity) print(res) stopifnot(inher...
3aec2a37558e3bbb7175bec3a42824d89c19689d74c4fd6a3d92184802b5f87a
R
3,217
113
#' @tags nested-futures #' @tags detritus-files #' @tags sequential multisession multicore library(future) options(future.debug = FALSE) strategies <- supportedStrategies() message("*** Nested futures ...") for (strategy1 in rev(strategies)) { for (strategy2 in strategies) { message(sprintf("- plan(list('%s',...
da540341727405726831decfede06614abc73bec827a248a7de39da95a870c49
R
3,219
142
# Supplemental Material ## Pre-sale Examination Set (ref:examination-set) Examination Set. ```{r examination-set, echo=FALSE, message=FALSE, warning=FALSE} view_full_name %>% select(`Anatomical Region`, `View (Abbreviation)`, `View`) %>% mutate(`Anatomical Region` = str_replace_all(`Anatomical Region`, 'Front', ...
0b507715ce26c804b984a10be09b640a7529525e7bba55c88c7e25bbad39561e
R
3,243
185
#' @tags globals subassignment #' @tags sequential multisession multicore library(future) oopts <- c(oopts, options( future.globals.resolve = TRUE, future.globals.onMissing = "error" )) message("*** Globals - subassignments ...") message("*** Globals - subassignments w/ x$a <- value ...") ## Truth: x <- x0 <- ...
eec5ddc8cc1e127b0b43f14147bfad9db62c64b382f024aa77b33947c68ab010
R
3,247
100
#' @title Calculate variance-covariance matrix for GALAMM fit #' #' @srrstats {G1.4} Function documented with roxygen2. #' @srrstats {G2.3,G2.3b} Argument "parm" is case sensitive, as is documented here. #' @srrstats {G2.1a} Expected data types provided for all inputs. #' @srrstats {RE4.6} The variance-covariance matri...
30877ccedc4975d2dd3d15b73ab8b29bab9f934ec665689e4f99fcdf1e1c7867
R
3,248
64
--- output: github_document: pandoc_args: --webtex bibliography: vignettes/GENOVA.bib --- <!-- README.md is generated from README.Rmd. Please edit that file --> ```{r, echo = FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "vignettes/" ) ``` # GENOVA <img src="vignettes/logo_GE...
a89a4e9e77eadd7fe9894b348682d314f590e183763b4ef3fc4eaa59c9955a79
R
3,255
65
### Merge protein differential expression values with additional info from Uniprot #' Merge protein differential expression values with additional info from Uniprot #' Change the colnames of d.summary (line 14-25) according to the features you would like to add #' #' @param d Input a dataframe with the differentia...
76cac71b72fcb4e7345f2060ea89c55063a58894a30622bd3647835e22922a7d
R
3,256
54
deg_padj <- function(results.df) { upDEGS <- results.df %>% dplyr::filter(log2FoldChange>0.30) %>% dplyr::filter(padj < 0.05) downDEGS <- results.df %>% dplyr::filter(log2FoldChange<(-0.30)) %>% dplyr::filter(padj < 0.05) allDEGS <- rbind(upDEGS, downDEGS) upDEGS_genesonly <- as.data.frame(upDEGS$genes)...
7b4542b744d2a951321057ee096559eb730cde07318879ea7a556a86282e06a0
R
3,269
112
#' @tags utils-internal tweakable library(future) argnames <- future:::argnames tweakable <- future:::tweakable untweakable <- future:::untweakable `tweakable<-` <- future:::`tweakable<-` `untweakable<-` <- future:::`untweakable<-` message("*** argnames() ...") fcn_ab <- function(a, b, ...) NULL fcn_bc <- function(...
43a1aba26e365a19dfd8d83eb8399099509bf2f3d14b7f9522999ba6a625a127
R
3,275
90
library(data.table) simple.qq.plot <- function (observedPValues) { plot(-log10(1:length(observedPValues)/length(observedPValues)), -log10(sort(observedPValues))) abline(0, 1, col = "red") } genes <- fread("../../../ensgR75_protein_coding.txt", data.table=F) expr <- fread("zcat ../exp.tmm.log2.covCorrect.f...
efb2c9e32dd63e8b15b0701b0274c807dee20c69e43904deb1551557af78d577
R
3,281
88
## ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- source("0_SharedCode.R") stopifnot(SharedCode_version == c(11,0)) subjects <- readRDS(file.path(dir_data_misc, "HCP_S1...
140ee02cdfd013c6ab06c7a2a4f34dc6a588ba80c176a27f159fb9fc819795b8
R
3,288
98
#!/usr/bin/env Rscript ## ## Extract and plot fragment size distribution from a BAM file. ## ## usage: Rscript --vanilla fragment-sizes.R sample_name file.bam ## # increase output width options(width = 120) # print warnings as they occur options(warn = 1) # get scripts directory (directory of this file) and load r...
650eabc7f489bca05897ea7535155e25883b8ff884028389da17fcb87813176a
R
3,289
115
--- title: "Posterior Sampling" output: rmarkdown::html_vignette: fig_width: 6 fig_height: 4 bibliography: ../inst/REFERENCES.bib link-citations: yes vignette: > %\VignetteIndexEntry{Posterior Sampling} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r, include = FALSE} knitr::opts...
f8cf9d52229807d89b8e1998988d1bc30e60766c4cf62b14dce52dc2c6cd6e87
R
3,289
118
## ## Replacement for DESeq2::plotPCA() with sample labels and custom condition colors. ## Sample names will be shown next to each dot with minimal overlap. ## The axis will display proportion of variance for each principal component. ## Tested using DESeq2 versions 1.12 to 1.26. ## deseq2_pca = function(object, intg...
51138071db271714f9c9b68d935851c28cf8280769d970e649172a21c385f259
R
3,305
128
test_that("Heteroscedastic model works", { mod <- galamm( formula = y ~ x + (1 | id), dispformula = ~ (1 | item), data = hsced ) expect_snapshot(print(summary(mod), digits = 3)) expect_equal(mod$model$loglik, -2058.14021326104) expect_equal( summary(mod)$AICtab, c( AIC = 4126.280426...
1dca3bbe705faa12b3204612e2ead8e4a60ce98c6dabfee5f8049fd701250807
R
3,306
142
## Formula #1: ## expression: ~ rhs ## AST: (~ rhs) ## tweaked expression: rhs; ~ rhs ## ## Formula #2: ## expression: lhs ~ rhs ## AST: (~ lhs rhs) ## tweaked expression: rhs; lhs ~ rhs tweakFormulaCall <- function(expr) { if (!is.call(expr)) return(expr) expr <- unclass(expr) op <- expr[[1]] if ...
0648811d145dae6b19188a9edd6378119eea393a200d798a9ad80ef002d7a563
R
3,327
87
```{r} source("downstreamer_functions.r") setwd("evaluating_coregulation") source("data/source_olivier.r") eigen <- fread(eigenvectors165.file, data.table = F) rownames(eigen) <- eigen[,1] eigen <- eigen[,-1] ensembl <- read.table(ensembl.file, sep="\t", header=T) ensembl <- ensemb...
e6e8d0d7327bab08b723f81b1f21aa07ee8288a27d402d09434fc09ab9f5130c
R
3,338
80
projectDir <- getwd() setwd("D:\\UMCG\\Genetica\\Projects\\Depict2Pgs") source(paste0(projectDir, "/depict2_functions.r")) platelets <- read.depict2("excelsForEnrichment/30080_raw.gwas.imputed_v3.both_sexes_enrichtments_exHla_v69.xlsx") str(platelets$Coregulation) geneP <- read.de library(readr) table_tmp <- re...
a027497ccc0fc638d569087bf0730a50e941e015a7c0633c08319fdc3764bd3e
R
3,345
97
## -------------------------------------------------------------------------------------------------------------------------------------------------------------------- source("0_SharedCode.R") stopifnot(SharedCode_version == c(11,0)) baseNames <- c("CC2MP6") iters2 <- expand.grid( visit=seq(2), test=c(TRUE, FALSE...
9279ac159c3866b450e746ff2ed67c81d5b2ccbc7eeecc3ce994066ea0a2dda8
R
3,361
65
setwd(paste0(figureDirectory, "Figure7-expression")) library(ggplot2) library(grid) load("exprMethylConnection.RData") load("ExpressionComparisonPlot.RData") plotExpressionMethylation <- ggplot(exprMethylConnection, aes (x=reorder(Gene,medianDiff), y = value, fill = data)) + geom_hline(yintercept = 0, col = "bla...
e37a93750b0741bbe760f8659db4ea63e4c65c7a4e4c85b7ea883b4ed2e002b1
R
3,381
98
read_fusion <- function(files,trait.names=NULL,binary=NULL,N=NULL,perm=FALSE){ length <- length(files) if(is.null(trait.names)){ names.beta <- paste0("beta.",1:length) names.se <- paste0("se.",1:length) }else{ names.beta <- paste0("beta.",trait.names) names.se <- paste0("se."...
9d18b5238bd64721989a41e9a515a3c369edca910ddfd592256bcdacf510314c
R
3,387
101
stack_wide2 <- function(DT) { DT_wide <- data.table(eid = unique(DT$eid)) DT_tmp <- merge( DT_wide, DT[target == 'Age'][, c("eid")]) setkey(DT_wide, eid) DT_tmp <- DT[target == 'Age'][, .(age = true, age_pred = predicted, eid = eid)] setkey(DT_tmp, eid) DT_wide[DT_tmp, `:=`(age = i.age, age_p...
6823c319b655703f3354c7aafab37c194bc0ba4401dff2e39fa8329e70140a29
R
3,390
97
## -------------------------------------------------------------------------------------------------------------------------------------------------------------------- source("0_SharedCode.R") stopifnot(SharedCode_version == c(11,0)) baseNames <- c("CC2MP6") iters2 <- expand.grid( visit=seq(2), test=c(TRUE, FALSE...
0fcc774ab0f5da911a8e4251cddaac377f1d4d9ec1e358098c195514e3f0deb0
R
3,391
126
### general functions # function to summarize into reading frame 0,1,2 frame_counts = function(count, dir = '+', utr_length = 50){ # check length if(length(count) > (2*utr_length)){ # check if dividable by 3 if( (length(count)-(2*utr_length))%%3 == 0){ # if negative strand --> reverse if(dir ==...
482832b296e58d9417600646d3ea2e94f4fbdcb86dd827bd861f786edbf0d264
R
3,391
99
## -------------------------------------------------------------------------------------------------------------------------------------------------------------------- source("0_SharedCode.R") stopifnot(SharedCode_version == c(11,0)) baseNames <- c("CC2MP6") iters2 <- expand.grid( visit=seq(2), test=c(TRUE, FALSE...
587d188e192ee299f9046a1a4a0ddb4bef613c27b0b6a52a39bdbd01e35daa0c
R
3,397
124
library(Signac) library(Seurat) library(ggplot2) library(EnsDb.Mmusculus.v79) set.seed(1234) # load processed data matrices for each assay rna <- Read10X("data/snare-seq/GSE126074_AdBrainCortex_rna/", gene.column = 1) atac <- Read10X("data/snare-seq/GSE126074_AdBrainCortex_atac/", gene.column = 1) fragments <...
e37e00d4bf9a43efb62e4d6be4d7c6d3eb99f9a9f271d295460fd6d88b546848
R
3,424
61
#' srr_stats #' #' All of the following standards initially have `@srrstatsTODO` tags. These may #' be moved at any time to any other locations in your code. Once addressed, #' please modify the tag from `@srrstatsTODO` to `@srrstats`, or `@srrstatsNA`, #' ensuring that references to every one of the following standard...
e455ce6a14f2f1edc04274725d7e74a33ae78a734c16fd9c7d466622372185b0
R
3,425
59
#!/bin/env Rscript # # Author: Alex Eng # Date: 1/18/2018 ############################################################################### suppressPackageStartupMessages(library(argparse)) # Defining arguments and parser for command line arguments parser = ArgumentParser(description = "Calculate function-specific rob...
a50c410cc50cc2e0eb90da09b108c60a9fc680b6b40fe94137105cc691b4a999
R
3,440
105
--- title: "Heteroscedastic Linear Mixed Models" output: rmarkdown::html_vignette: fig_width: 6 fig_height: 4 bibliography: ../inst/REFERENCES.bib link-citations: yes vignette: > %\VignetteIndexEntry{Heteroscedastic Linear Mixed Models} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- `...
7b1b164cfd6e135e64e228b4edf1d6d5efbda74e1f561421e253d4fa733e1555
R
3,441
48
# Set directory to source file loaction setwd(paste0(figureDirectory, "Figure1-Stability-Dendrogram" ) ) library(RColorBrewer) library(stringr) library(pvclust) library(dendextend) load(file = "stabilityHclust_wardD2_manhattan.RData") patientColorManhD2 <- valuesManhD2.pv$hclust$labels[valuesManhD2.pv$hclust$order]...
6a9833fed6567a3ce87b3e3f1deedcb9231f2096049273913ad4c8286ce3fb40
R
3,459
96
library(tidyverse) library(plotly) setwd("/Users/philippehabets/Dropbox (Personal)/Git/fMRI-transcriptomics-cortisol/data") ## read in cell_type enrichment for higher and lower DEGs cells_high <- read_csv("cell_type_enrichment_higherDEGs.csv")%>% mutate(cellgroup = str_replace(cell_type, "(?s) .*", "")) %>% mut...
6986ad0b5ea43fa457931569cc0c5acd511dac22caf933d51eaf14cf28a7555b
R
3,490
103
#' Synchronising indices across experiments. #' #' Particularly when Hi-C data is loaded from different sources, it occurs that #' the assigned bin indices don't match between datasets. This function #' re-indexes a list of experiments to a shared set of bin indices. #' #' @param explist A \code{list} of GENOVA \code{c...
1ca842f81d8cae39650ea84b9dc8b9a32fabf10a39a94d751fa82c235f757d48
R
3,492
87
setwd("D:\\UMCG\\Genetica\\Projects\\Depict2Pgs") source(paste0("C:\\Users\\patri\\Documents\\GitHub\\systemsgenetics\\Downstreamer\\src\\main\\r\\downstreamer_main/downstreamer_functions.r")) traits <- read.delim("traits.txt", stringsAsFactors = F) pdf("Enrichment_comparisons.pdf", width = 7, height = 7, useDingb...
eb138e15a9e78a8ac0324e8f4e882d0477273cabc4f3d462c6bf405fd8e4fdeb
R
3,498
98
source(paste0("C:\\Users\\patri\\Documents\\GitHub\\systemsgenetics\\Downstreamer\\src\\main\\r\\downstreamer_main/downstreamer_functions.r")) setwd("D:\\UMCG\\Genetica\\Projects\\Depict2Pgs") traits <- read.delim("paperPheno.txt", stringsAsFactors = F) ensg <- read.delim("ensgR75_protein_coding.txt", stringsAsFactor...
08ba2b194c2a7d36a0372329f6bb827dde7cee28c7f63968f2767cd083a1cf42
R
3,516
109
## Kunkle, B. W. et al. Nat Genet 51, 414–430 (2019). library(MungeSumstats) library(tibble) library(tidyr) library(readr) library(purrr) library(plyr) library(dplyr) library(stringr) library(forcats) library(tabulizer) library(fuzzyjoin) ## Misc functions calc_se_from_beta_and_l95 = function(or, l95){ logOR = l...
b6087eb277e2677dd1f17a4704eeca5ded5ce308db5bf352e1279e8342c31a1b
R
3,523
108
select.subset.base <- function(exp, chrom, start, end){ sel <- exp$ABS[exp$ABS[,1]==chrom & exp$ABS[,2] >= start & exp$ABS[,2] <= end,4] start.i <- min(sel); end.i <- max(sel) #create matrix tmp = exp$ICE[exp$ICE$V1 >= start.i & exp$ICE$V1 <= end.i & ...
c78397a019c1a5357cfce5559e08b2cc725c2b04a6804a2d0de47c793d36d677
R
3,545
114
library(tidyverse) library(ggtree) library(Biostrings) # try to calculate the average branch length across the sites (per protein) #functions calculate_tree_length<-function(df, pos_aln, tree){ vec_sp<-df %>% filter(pos_alignment==pos_aln) %>% pull(., species) reduced_tree<-ape::drop.tip(tree, tree$tip.label[tree...
cbfebc8668bc468675859508ced61cd447cff118e1d7088d65d3e746b53116eb
R
3,556
104
```{r} setwd("evaluating_coregulation") source("../downstreamer_functions.r") source("data/source_olivier.r") # Read reference datasets ensembl <- read.table(ensembl.file,sep="\t", header=T, row.names = 1, stringsAsFactors = F) ensembl$gene.length = ensembl$Gene.end..bp. - ensembl$Gene.start..bp. rownames(ensembl) <- ...
5dea2870e5b85b16cbe1a6a20c51747452cfe03b17b36f6d06158d800b6db045
R
3,560
61
# PREPARE JASPAR 2020 DATA library(tidyverse) library(org.Hs.eg.db) # 1 DOWNLOAD AND TRANSPOSE,COMBINE PWMs #### setwd("/data/share/htp/TRNP1/paper_data/") system("fold=regulation/data/TFs/JASPAR_2020; mkdir -p $fold; mkdir -p $fold/JASPAR_collection; mkdir -p $fold/JASPAR_collection_transposed; mkdir -p $f...
8272206fe0d48813ff9e65fbde094596bdc2bb7b744ccfcba1abbe7d2a026726
R
3,564
123
#' Get the future of a future variable #' #' Get the future of a future variable that has been created directly #' or indirectly via [future()]. #' #' @param var the variable. If NULL, all futures in the #' environment are returned. #' #' @param envir the environment where to search from. #' #' @param mustExist If TRU...
c380f210750067a8ad523d76ad75f29fac7c8c31be1f177223452c9575cd083a
R
3,565
103
#' @keywords internal "_PACKAGE" #' @import utils graphics stats grDevices #' @import methods NULL # data.table is generally careful to minimize the scope for namespace # conflicts (i.e., functions with the same name as in other packages); # a more conservative approach using @importFrom should be careful to # import...
2762a91769fa5c4eb9f97a6690c956e6a2dc18fb8d26b698312df611cd05a0a2
R
3,578
113
#' @tags UniprocessFuture sequential library(future) message("*** UniprocessFuture ...") message("*** UniprocessFuture() ...") ## 'substitute = FALSE' takes the expression as-is f <- UniprocessFuture(expr = quote(6 * 7), substitute = FALSE, globals = list()) print(class(f)) stopifnot(inherits(...
d5a9cc0762f09d9d4b4c8dd99c50bbf25c430db5cc632c1dc7c8acc381cd00af
R
3,582
91
# Title : SN RNA-seq analysis # Objective : - # Created by: mvochteloo # Created on: 22/02/2021 # install.packages('Seurat') library(Seurat) library(Matrix) library(ggplot2) work_dir <- '/groups/umcg-biogen/tmp01/input/ROSMAP-scRNAseq/2020-10-22-MVochteloo-Copy/' list.files(work_dir) # Should show barcodes.tsv, ...
50f4967322abbe1ebc884561c3745795ea12c2f6ffc5ea343cbd6c491caf1090
R
3,587
102
library(ggplot2) library(ggbeeswarm) source('../config.r') source('../utils.r') data <- read.csv("./inputs/imaging.csv") data$fold <- factor(data$fold) data$modality <- factor( data$modality, levels = c("brain volumes (sMRI)", "white matter (dMRI)", "functional connectivity (fMRI)", "sMRI, dM...
41c3a6b461c08f2a9fc0f6994a924180e85520052ee634279939930ec7171b33
R
3,601
110
#' Directionality index #' #' The directionality index quantifies the degree of bias between upstream and #' downstream interactions given a bin on the diagonal. Such biases become #' apparent near the periphery of TADs: the upstream portion of a TAD interacts #' more with the downstream bins and inversely, the downstr...
bed5114cfc9507b30dcae4fa366658cdb8fdedf4f6137a44f1ee2f9305f08899
R
3,614
112
#' @tags nbrOfWorkers sequential library(future) plan(sequential) ## A "legacy" evaluator is one that does not provide a FutureBackend ## factory, in which case nbrOfWorkers() falls back to inspecting the ## 'workers' formal of the evaluator itself legacy <- function(classes, workers) { fcn <- eval(bquote(function...
565c692e5a313c11d3a96d717b62067641a8942a7535ba9d458d258ddb833480
R
3,615
109
##' @importFrom nlme VarCorr ##' @export VarCorr NULL #' @title Extract variance and correlation components from model #' #' @srrstats {G1.4} Function documented with roxygen2. #' @srrstats {G2.1a} Expected data types provided for all inputs. #' #' @param x An object of class \code{galamm} returned from \code{\link{ga...
57bbc33e517a90d23c7868fabe1228a2187a7f571a481b6c6f06e90973541681
R
3,617
100
#' Get an average virtual 4C of 2D-regions (e.g. loops). #' #' Extract matrices around a defined region a.k.a. the viewpoint #' #' @param explist Either a single GENOVA \code{contacts} object or list of #' GENOVA \code{contacts}. #' #' @param viewpoint A viewpoint location. One of the following: \itemize{ #' \...
16c32a0eb6422b721b2242bf418bddd01f83237ab532d098e328074ee4130370
R
3,634
107
--- title: "Permutation testing for META for dFC Metrics - COBRE RAW" author: "Fran Hancock" affiliation: Department of Neuroimaging, Institute of Psychiatry, Psychology and Neuroscience, King's College London, London, UK date: "`r format(Sys.time(), '%B %d, %Y')`" fontsize: 14pt output: html_document --- ```{r setup...
1eddaced2e0902304ca952a735dc4afa91cac767703300915aa3f7841148179e
R
3,656
118
library(data.table) library(arm) library(stargazer) source('../config.r') source('../utils.r') source('../read_data.r') extra_path <- file.path('inputs') get_family_model <- function(DT_family) { mod <- lm(scale(value) ~ # y scale(age_pred) + # brain age scale(age...
0a199f0003449690de49627ad6e4c0fdf44ac6eaf84de5491d8df25ad69b2440
R
3,657
131
projectDir <- getwd() setwd("D:\\UMCG\\Genetica\\Projects\\Depict2Pgs") source(paste0(projectDir, "/depict2_functions.r")) heightDs <- read.depict2("final_paper/inflammatory_bowel_disease_2017_29906448_hg19_enrichtments_exHla.xlsx") str(heightDs$Coregulation) library(readr) #table_tmp <- read_delim('phenotype_to_...
651b8d6ad79e576ffc834d20126d9224cfc32f51c9cb57a5ea87a879238f5368
R
3,658
145
--- title: "Categorization of COND based on HCP EP dynamic metrics" author: - name: "Fran Hancock" affiliation: Department of Neuroimaging, Institute of Psychiatry, Psychology and Neuroscience, King's College London, London, UK date: "`r format(Sys.time(), '%B %d, %Y')`" fontsize: 14pt output: html_document --- ...
e33aaa160c1d75908551585f1dbbb12b02fcded4384da5cc66bb991965f6d75d
R
3,664
82
## ----include = FALSE---------------------------------------------------------- knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) ## ----setup-------------------------------------------------------------------- library(RISC) library(RColorBrewer) data("raw.mat") mat0 = raw.mat[[1]] coldata0 = raw.mat[[2]]...
1b734d0e65184d91ea57569895021e1cbaf1338322522da6d4489a89e15097bc
R
3,673
108
```{r} if (basename(getwd()) == "downstreamer_main") {setwd("coregulation_clustering")} else {setwd("../coregulation_clustering")} source("../downstreamer_functions.r") library(apcluster) library(tidygraph) library(ggraph) nodes <- fread("data/44_traits/44_traits_nodes.tsv", data.table = F) edges <- fread("data/44...
6a1ac309bf49fdc58f1e9c83cab75d127c3bc1d9cbcfd14f7bba812d485bb0ee
R
3,679
107
source("downstreamer_functions.r") # Read excel files path <- "/home/work/Desktop/depict2/output/final_paper/excels/" files <- list.files(path, pattern=".*_enrichtments.*.xlsx") datasets <- list() for (file in files) { name <- gsub("\\_enrichtments\\_exHla\\.xlsx", "", file) name <- gsub("\\_enrichtments\\_exHla...
0ee9cdac6eee50ed6589064eca289d8da016d9dbea3297c067870c4b954dde6f
R
3,696
89
library(RISC) library(ggplot2) library(RColorBrewer) library(irlba) library(umap) PATH = "/Path to the data/GSE111113" ################################################################################### ### RISC raw ### ################################################################################### mat0 = read.t...
3d7b51b9d6cc64631e45d645f142a6c6ea6c40f9d8c87716a62f90079317e3ab
R
3,731
93
library(Biostrings) library(tidyverse) library(plyranges) discrepancies_list <- list.files("protein/other_protein_alignments/self_matches_diff", recursive = T, full.names = T)[-25] #exclude procavia discrepancies_rds<-lapply(discrepancies_list, function(x){readRDS(x)}) discrepancies_df<-bind_rows(discrepancies_rds) ...
3485c4c0ca0a5bbe151e2da5f4cba57c6a49fcef45e5220b802ea19b56e4e09e
R
3,732
101
#' @title Predictions from a model at new data values #' #' @srrstats {G1.4} Function documented with roxygen2. #' @srrstats {G2.1a} Expected data types provided for all inputs. #' @srrstats {G2.3,G2.3a} match.arg() used on "type" argument. #' @srrstats {G2.3,G2.3b} Argument "type" is case sensitive, which is documente...
a6c51d92ee36f1fe041889fa3a0991def89ff51433d00d0a58c240dc0e9a7d5f
R
3,746
130
#' Get future-specific session information and validate current backend #' #' @param test If TRUE, one or more futures are created to query workers #' and validate their information. #' #' @param anonymize If TRUE, user names and host names are anonymized. #' #' @return Nothing. #' #' @example incl/futureSessionInfo.R ...
2f6356dd228aef9673439244e3d1f99f3515ad27667a699ed7a4277ecd375622
R
3,757
98
## ----Install------------------------------------------------------------- library(devtools) #install_github("raguirreg/DeconCell") ## ----Libraries----------------------------------------------------------- library(DeconCell) library(edgeR) library(tidyverse) library(ghibli) data("count.table") dCell.exp <- dCell....
0bb472d0cf3e3ab47091fad22cc43fdf7fabb3e3c6147ed9f74d9f9b9badd9d7
R
3,767
133
--- title: "Posterior Sampling" output: rmarkdown::html_vignette: fig_width: 6 fig_height: 4 bibliography: ../inst/REFERENCES.bib link-citations: yes vignette: > %\VignetteIndexEntry{Posterior Sampling} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ``` r library(galamm) ``` Sampl...
9d7a31f964bec5785ee8fa7ee67e72ddb81d512348bedaa298022249ba93baa0
R
3,768
123
context("test-workflow") # Load raw data # load("../testdata/testdata.rda") mat0 = as.matrix(raw.mat[[1]]) coldata0 = as.data.frame(raw.mat[[2]]) coldata1 <- coldata0[coldata0$Batch0 == 'Batch1',] coldata2 <- coldata0[coldata0$Batch0 == 'Batch4',] mat1 <- mat0[,rownames(coldata1)] mat2 <- mat0[,rownames(coldata2)] ...
5d472618400e60ce86b9b408c5123d130d93cbc2e02411b1c940eeec08f5b3d8
R
3,790
78
#' buildcodon #' #' This function takes a RefCDS object as input and adds to it two fields required to run the codondnds function. Usage: RefCDS = buildcodon(RefCDS) #' #' @author Inigo Martincorena (Wellcome Sanger Institute) #' @details Martincorena I, et al. (2017) Universal patterns of selection in cancer and somat...
226e191fcfb0ebda4f8a17b9ddbd745a551d28210f9a7f13850321798458a44b
R
3,808
147
#' @tags globals #' @tags formula #' @tags sequential multisession multicore library(future) library(datasets) ## cars data set library(stats) ## lm(), poly(), xtabs() message("*** Globals - formulas ...") ## (i) lm(<formula>): ## From example("lm", package = "stats") ctl <- c(4.17, 5.58, 5.18, 6.11, 4.50, 4.61,...
d19f45fef721d36464257ce6a98b0a1478e508c054d496b9cb1dd664c85637a2
R
3,812
129
#' @tags early-signal #' @tags sequential multisession multicore #' @tags skip_on_cran #' @tags deprecated ## plan(..., earlySignal = TRUE) is deprecated as of future (> 1.68.0) ## Skip test if option 'future.plan.earlySignal' is "defunct" if (!identical(getOption("future.plan.earlySignal"), "defunct")) { library(fu...
e3a0ffc1624a09c563894f97dac1bd04e7e54fb637455d9e47b9645b5696c45b
R
3,838
150
#' @tags globals objectSize library(future) objectSize <- future:::objectSize message("objectSize() ...") env <- new.env() env$a <- 3.14 env$b <- 1:100 env2 <- new.env() env2$env <- env ## Namespaces will be skipped env3 <- getNamespace("utils") fcn <- function(...) TRUE objs <- list( NULL, TRUE, 1L, 3....
5500009b7d2d736c54c5ce39b5c42b405ccd4368d0d113e21ae23eaa6ee72cdc
R
3,845
55
#' Generate the HTML report including various summary data visualizations #' #' Generate the HTML report including various summary data visualizations. #' #' @param sample_manifest (Required). The sample barcodes file. The file should include sample_id, barcode_fwd, barcode_rev, sample (sample name, can be the same as ...
af6ce76c9580d85530ba5ae2c656305e027fe1fe98dabcebbe0c794d01b94357
R
3,846
124
#' @tags utils-internal prune library(future) with_assert <- future:::with_assert prune_call <- future:::prune_call prune_debug <- future:::prune_debug prune_fcns <- future:::prune_fcns prune_fcn <- future:::prune_fcn ## NOTE: prune_pkg_code() itself is not tested here, because it rewrites the ## functions of the in...
156495dc7df5d89fb674d49d1aac0113e5555e49abc206294e6a4f67d9c9f0e1
R
3,848
135
SharedCode_version = c(11, 0) # Change these depending on where files are in your computer ------------------- COMPUTER <- ifelse( grepl("Carbonate|/N", getwd()), "RED", ifelse(grepl("Volume", getwd()), "MPro", "Personal") ) secret_fnames <- "0_Secret-FilePaths.txt" if (!file.exists(secret_fnames)) { if (f...
cadf2fcf62e7fc9fe1fa9b76057936054b09e9233fcf4b8e6051dcf023bcdd21
R
3,854
127
#' @tags utils-internal sticky-globals cluster library(future) sticky_globals <- future:::sticky_globals clusterExportSticky <- future:::clusterExportSticky name <- "future:sticky_globals" ## Always leave the search path the way we found it on.exit({ if (name %in% search()) sticky_globals(pos = 0L) }) message("*...
e3d40cbdf6a0640e4b944d520dc53b5cf4444b1363fa80413fd7d7d2e23a9ce0
R
3,857
148
### script count reads per base and generate coverage plot around start and stop # load libs library(foreach) library(doParallel) source('functions.R') # load tool locations tool_path <- load_tool_location() # set max cores max_cores <- get_max_cores() # from functions.R # register max 8 cores because filtering proc...
a1f8556d9f39b725092ff4578827e6b246b5fe3692d96fe351409f8749e8aefd
R
3,874
131
library(data.table) library(ggplot2) library(ggbeeswarm) library(patchwork) source('../config.r') source('../utils.r') DT_cond_proxy <- fread('mod_cond_proxy.csv') DT_cond_proxy_bs <- fread('mod_cond_proxy_bs.csv') DT_cond_target <- fread('mod_cond_target.csv') DT_cond_target_bs <- fread('mod_cond_target_bs.csv') DT...
2fc7ea84c0a01fdc57d1dbbb3f8df5628f3df637e45b4233c6b56cc8a3f1a1be
R
3,908
115
library(data.table) library(ggplot2) library(ggbeeswarm) source('../config.r') source("../utils.r") data <- read.csv("./inputs/classification.csv") data2 <- read.csv("./inputs/classification_non_imaging_fresh.csv") data <- rbind( subset(data, Type %in% c('Imaging', 'Imaging & Non-imaging')), data2 ) #data <- sub...
b13bcfc4848cf5b57290cd1ecc84e95f348e8733504c91639e6e13ef0e71f9ec
R
3,920
120
#' @inheritParams FutureBackend-class #' #' @param wait.timeout Number of seconds before timing out. #' #' @param wait.interval Baseline number of seconds between retries. #' #' @param wait.alpha Scale factor increasing waiting interval after each #' attempt. #' #' @keywords internal #' @rdname FutureBackend-class #' #...
0f6dfd25b8c3e9ff5fda8234cbb07f39df3a9cbf2c0452db0031cdfef94d78b3
R
3,936
106
#' Merge summary statistics into a single input data frame #' #' @param input.files - list of data frames, where each data frame contains the summary statistics of a trait to use in the order of Exposure - Outcome #' @param trait.names - Vector containing the trait names in the order they're found in 'input files' #' @...
bc7835db47adf2ec5bdc792bd8b22febdc90c1ca47b4ea316cd038f939d7820f
R
3,939
89
# Performing Bayesian Linear Regression for Steady-State Rates from the OH family of tasks # Based on code and analysis from "Doing Bayesian Data Analysis, 2nd Edition", # John Kruschke, 2014. # Copyright (C) 2022 Richard Hugh Moulton # # This program is free software: you can redistribute it and/or modify # it under ...
9a36d6948961d84e4043acbfda8d923134d9c71ac20e7988fd0791d3c531438c
R
3,941
85
library(ComplexHeatmap) library(viridis) library(RColorBrewer) convert.row.names.to.annot <- function(name_list) { find.marker.position <- function(contents) { for (i in 1:length(contents)) { if (any(contents[i] == c('all', 'SF', 'CU', 'TA', 'TN', 'SC', 'SM'))) return(i) ...
372355f77676573e778bde3220d3eca1943872a079b1f1c43511374452faa715
R
3,947
72
behavior_cleaning_ggplot <- function(ss_ggplot, os_ggplot) { both_ggplot <- rbind(ss_ggplot, os_ggplot) both_ggplot <- mutate_at(both_ggplot, vars(Animal, PairingType, PairingTime, Cohort, Timepoint, Stimulus), as.factor) #refactor the Timepoints so that they plot in the order done in the experiment both_gg...
c2e80145ca553555ad82f8469d57818d3aad6ad7dd419282e25e06b48c6f9b3c
R
3,953
119
#' Intra and inter TAD contacts #' #' Calculate the coverage over TADs and between a TAD and its neighbours. #' #' @param explist Either a single GENOVA \code{contacts} object or a list of #' GENOVA \code{contacts} objects. #' @param tad_bed A BED-formatted \code{data.frame} with three columns #' containing the chr...
0948e671ebc2297d52c6e554ab8a195961e6a00d5bbd3c3c160ed7145e00bd71
R
3,958
134
#' Filter columns and rows of `ACTIONetExperiment` or `SummarizedExperiment`-like object. #' @export filter.ace <- function( ace, assay_name = "counts", min_cells_per_feat = NULL, min_feats_per_cell = NULL, min_umis_per_cell = NULL, max_umis_per_cell = NULL, return_fil_ace = TRUE ) { org_dim = dim(ac...
2c93f64d0b1862802c32f9810cca4e2020a1a6fbc3847205de5ee6d769df2685
R
3,959
56
setwd( paste0(figureDirectory, "Figure3-Genomic-Regions") ) library(ggplot2) library(cowplot) load("barplotOverviewDF.RData") load("enhancerGenePlotDf.RData") load("pathPlotDfAllFreq.RData") colors <- c(rep("blue3",10),rep("forestgreen",7),rep("gold3",3),rep("darkorchid",3 ),rep("deeppink2",1)) plot1 <- ggplot(ba...
59f124a105d36d27641871b4d4c1cdf5c24ab615dd5276bbeb84635d005e5ab9
R
3,963
127
#' Test data #' #' Retrieves a test \code{contacts} object from a local cache at either 40k or #' 150k resolution. The test data only contains human chromosomes 21 and 22. #' #' @param res The resolution of test data to use. Either \code{"40k"} or #' \code{"150k"}. #' @param download A \code{logical(1)}. If \code{FA...
76e9c4b9ec6e41f817f45a4dfef16cd461baa0214353f82a32bdf07d00663667
R
3,980
178
library(MungeSumstats) library(tibble) library(tidyr) library(readr) library(purrr) library(plyr) library(dplyr) library(stringr) library(forcats) library(tabulizer) library(fuzzyjoin) data(sumstatsColHeaders) # Snakemake input & output bellenguez.path <- snakemake@input[['bellenguez']] bellenguez_clean.path = snakem...
2a8d53958ad0aabcff540be84f443165902c4ff29ca4ac8fec6aa8017517a266
R
3,981
150
#' A representation of a set of globals used with futures #' #' @param object A named list. #' #' @param x An object to be coerced to a `FutureGlobals` object. #' #' @param resolved A logical indicating whether these globals #' have been scanned for and resolved futures or not. #' #' @param total_size The total ...
d022e82862b45cf66d62187c73d59d5f82cd4562507424b14d0a12337f637f72
R
3,988
137
--- title: "--" author: "rbarreiro" date: "--" output: html_document: theme: journal css: rmark.css --- ```{r setup, include=FALSE} suppressMessages({ library(tidyverse) library(scales) library(cowplot) library(ggbeeswarm) library(ggsci) library(viridis) library(knitr) library(ggpubr) lib...
83092bf20b5d3010e0006e56b6ce365914717b4b053a623f3dc1a356f8c53eb4
R
3,993
98
## ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- source("0_Share...
b9dd3077e32332d4f40ffd655ac198c5778418dbf23ce66019d515184413fdc3
R
3,993
120
### script to calibrate reads based on manual inspection # load libs library(foreach) library(doParallel) source('functions.R') # load parameters conf <- load_mapping_config() # load tool locations tool_path <- load_tool_location() # set max cores max_cores <- get_max_cores() # from functions.R # register max 8 cor...