sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
04eef747e96a3010f9a4a070df57c42cb4312d7a7d952f929967279d18f0c5cd
R
1,224
50
# See http://www.biostat.jhsph.edu/~iruczins/teaching/jf/ch5.pdf data(longley) g <- lm(Employed~Population,data=longley) summary(g, cor=T) # GLS y <- as.matrix(longley$Employed) x <- as.matrix(model.matrix(g)[,2]) # Construct sigma matrix Sigma <- diag(16) Sigma <- 0.31041 ^ abs(row(Sigma)-col(Sigma)) rowna...
08bd695c0ca3bc72c445271adc001db4a6a9a36865b3718421b93419bb1c28d8
R
1,228
44
#' Specify globals and packages for a future assignment #' #' @usage #' fassignment \%globals\% globals #' fassignment \%packages\% packages #' #' @inheritParams future #' #' @param fassignment The future assignment, e.g. #' `x %<-% { expr }`. #' #' @param packages (optional) a character vector specifying packag...
d38b17b39734794a6c77f5325c1e428359d01e27d6ecc1d8ac10f589b2f08d5b
R
1,232
54
## Extract snpEff annotations library(tibble) library(tidyr) library(readr) library(purrr) library(plyr) library(dplyr) library(stringr) library(forcats) # library(vcfR) ## Snakemake ### Input file_ann.path = snakemake@input[['ann']] ### Output outfile = snakemake@output[['outfile']] ## snpEff raw_snpeff <- file_a...
09f7efc51b085a0a78cf4d632b3ba5fbb4e82e02b2ddedcff45e55106ca40736
R
1,239
51
#' @tags futureAssign #' @tags environment #' @tags sequential multisession multicore library(future) message("*** %<-% to environment ...") ## - - - - - - - - - - - - - - - - - - - - - - - - - - - - ## Async delayed assignment (infix operator) ## - - - - - - - - - - - - - - - - - - - - - - - - - - - - z <- new.env(...
eaefe72fc4b0ad98ba97f3b0e2130b56228d0f4fd268588868f13adae5be13fc
R
1,241
26
clust_corr_plotting <- function(matrix, save, filename) { corr_of_matrix <- round(cor(matrix), 2) p.mat_of_matrix <- ggcorrplot::cor_pmat(corr_of_matrix) corrplot(corr_of_matrix, method = "color", type = "lower", order = "hclust", diag = FALSE, tl.col = "black", addCoef.col = "black...
bbe0a3738ea9d1efe7f742b74f343f6578cd0cdf0c17f1de6ce11d463b404871
R
1,244
52
argnames <- function(..., exclude = "...") { fcns <- list(...) names <- lapply(fcns, FUN = function(fcn) { names(formals(fcn)) }) names <- unlist(names, use.names = FALSE) names <- unique(names) names <- setdiff(names, exclude) } tweakable <- function(x, ...) { attr(x, "tweakable", exact = TRUE) } u...
cb29bcbcf3c4248d281608562657033b07e6f66fbdaa57f29bc82fadfacd5381
R
1,260
8
rm(list = ls()) for(i in 1:61){ load(paste0("/work/lulab/Ben/distmat/output/ecdfs/rsetlist.ecdf.", i)) print(paste0("loaded ", i)) } all.ecdf <- c(rsetlist.ecdf.1,rsetlist.ecdf.2,rsetlist.ecdf.3,rsetlist.ecdf.4,rsetlist.ecdf.5,rsetlist.ecdf.6,rsetlist.ecdf.7,rsetlist.ecdf.8,rsetlist.ecdf.9,rsetlist.ecdf.10,rsetlist.e...
888d34b09dcb7a58bbf3a9544259b1a233dd1a00f5821118e7c5413fc5d3acaa
R
1,263
29
corr_plotting <- function(matrix, save, filename) { corr_of_matrix <- round(cor(matrix), 2) p.mat_of_matrix <- ggcorrplot::cor_pmat(corr_of_matrix) corrplot(corr_of_matrix, method = "color", type = "lower", diag = FALSE, tl.col = "black", addCoef.col = "black", number.cex = .5, ...
d2498ec601909aec8d1f3e705fb6440a83e12f9fd3f105ab76c1aead2c8caa89
R
1,264
47
#' @tags globals packages load attach #' @tags sequential multisession multicore library(future) options(future.debug = FALSE) message("*** Automatically attaching packages, if attached in parent ...") for (strategy in supportedStrategies()) { message(sprintf("- Strategy: %s ...", strategy)) plan(strategy) ...
8087656ada24fab75001de926db4a0e552c61b103fe748fdf7109ab4178b009b
R
1,265
31
ff <- list.files( path = "./readcounts", pattern = "*ReadsPerGene.out.tab$", full.names = TRUE ) counts.files <- lapply( ff, read.table, skip = 4 ) counts <- as.data.frame( sapply( counts.files, function(x) x[ , 2,drop=F] ) ) colnames(counts) <- gsub( "_ReadsPerGene\\.out\\.tab", "", gsub( "\\./readcounts/", "", ff ) )...
c1f9b8a281e22ac3f721bbf2ea80fae076d1d0d9d4444fd0b07499aa8d872667
R
1,267
59
#' @tags journals #' @tags sequential #' @tags multisession #' @tags multicore library(future) capture_journals <- future:::capture_journals options(future.debug = FALSE) strategies <- c("sequential", "multisession") if (future::supportsMulticore()) { strategies <- c(strategies, "multicore") } message("*** captur...
49d1f8e5b616f1736eaa0b48715901868ccefba2d7c6726499b612613888b3d2
R
1,271
36
```{r} if (basename(getwd()) == "downstreamer_main") {setwd("cellline_prediction_model")} else {setwd("../cellline_prediction_model")} source("../downstreamer_functions.r") labels <- read.table("../umap/data/lables.txt", sep="\t", header=T) labels <- rbind(labels, read.table("../umap/data/lablesZoom.txt", sep="\t", h...
c15350874d7cf0a7593b1c1474c61c7007bf3a5a377fc28ddd484aff05c7ddca
R
1,292
32
# gene_annotations is a dataframe from the seurat object misc slot with gene ensembl IDs and corresponding names # GO:0043565 = sequence specific DNA binding and GO:0003700 = DNA-binding transcription factor activity modules_to_TFs <- function(gm, gene_annotations, GO_terms = c('GO:0003700', 'GO:0043565')){ gene...
eb114c9c79955973ce25b9018864e554eb4134450a0b3ee8d394ffabb179da34
R
1,292
64
### script to generate BED (6 column) from GTF/GFF # load source('functions.R') # get args get_dir <- commandArgs(trailingOnly = TRUE) # check input file in_gtf <- get_dir[1] if(grep('.(gtf|gff[3]{0,1})$', in_gtf, ignore.case = T) != 1){ stop( paste0(in_gtf, ' without gtf or gff file ending!') ) } # check ...
1c34cc06b77bc427af337b75337002793deddf5ba52e3db5a719281524168e8a
R
1,300
60
#' @export fastColSums <- function(mat) { if (is.sparseMatrix(mat) && class(mat) != "dgCMatrix") { mat = as(mat, "dgCMatrix") } out = fast_column_sums(mat) return(out) } #' @export fastRowSums <- function(mat) { if (is.sparseMatrix(mat) && class(mat) != "dgCMatrix") { mat = as(mat, ...
c6a66cb1f6b67a62a83bc6f1db89c91c44fbcc2c65231ee42af3d3fed9008111
R
1,302
22
#load Mouse gene names mart_export_PVEnsembl_mouseEnsembl_mousegeneName <- read.csv("~/R/Thesis/RNAseq/Data/mart_export_PVEnsembl_mouseEnsembl_mousegeneName.txt", stringsAsFactors=FALSE) #getting a biomart df that only contains rows that have mouse stable IDs biomart_mouseE <- filter(mart_export_PVEnsembl_mouseEnse...
6bb0d28eb4d1df14da41499f12473806995ad2539ff01c2d709da05fd7aa7af3
R
1,303
35
setwd("C:\\Users\\patri\\Documents\\GitHub\\systemsgenetics\\genetica-libraries\\src\\test\\resources\\") testMatrix <- read.delim("testMatrix.txt", row.names = 1) write.table(cor(testMatrix), file = "testMatrixColumnCorMatrix.txt", quote = F, sep = "\t", col.names = NA) write.table(cov(testMatrix), file = "testMatr...
14881e3999dfb36ebec866dd9d070db7bf38e4144435ab6b46c345f404319316
R
1,310
35
table_tmp <- read_delim("/groups/umcg-fg/tmp01/projects/genenetwork/recount3/SRA_Metadata/metadata_sra1.txt", delim = "\t", quote = "", guess_max = 20000) sraMeta1 <- as.data.frame(table_tmp[,-1]) rm(table_tmp) table_tmp <- read_delim("/groups/umcg-fg/tmp01/projects/genenetwork/recount3/SRA_Metadata/metadata_sra2.txt"...
30e09963320eab7a1348f7b1d5c99510bcca9f1d9de7e857df02e05db31439b1
R
1,312
40
# The current RNG kind okind <- RNGkind() oseed <- globalenv()$.Random.seed # (a) A L'Ecuyer-CMRG seed based on a numeric-scalar seed seed1 <- future:::as_lecyer_cmrg_seed(42) str(seed1) ## int [1:7] 10407 -2133391687 507561766 1260545903 1362917092 -1772566379 -1344458670 # The RNG kind and the RNG state is preserved...
fedc960288a16e1e3bed8312d180f6a529c313dd403f58b0beb2f6cc5de08843
R
1,317
29
# Package definitions for dndscv # # Author: Inigo Martincorena ############################################################################### #' Detection of selection in cancer and somatic evolution #' #' The dNdScv R package is a suite of maximum-likelihood dN/dS methods designed #' to quantify selection in cancer...
0989c129c6e5eec264645d7f3281bf6e488b290016659c2048d675b1439a13ea
R
1,318
27
#' Contextualization until all nodes have at least one in degree #' #' This function takes 1 network (parent) as input and iteratively removes parentless nodes (nodes with In-degree = 0) #' and contextualize it. It returns a network which contain every node with atleast an In-degree of 1. #' #' @param parentNetwork ed...
8e3906d01ea7ea726380f5c72f6de0da23945605f91647a36917b1d9fa4857c2
R
1,325
36
## A version of base::sample() that does not change .Random.seed stealth_sample <- function(x, size = length(x), replace = FALSE, ...) { ## Nothing to do? if (size == 0L) return(x[integer(0)]) ## Nothing to randomize? if (length(x) == 1L) { if (!replace && size > 1L) { stopf("Cannot take a sample (n ...
f1d18e52cd5b54266b56cb9e7e2ac7ee20151c6689591967bcb4bea6150b1a8e
R
1,328
52
#' @tags bquote library(future) bquote_compile <- future:::bquote_compile bquote_apply <- future:::bquote_apply message("*** bquote_compile() & bquote_apply() ...") exprs <- list( A = quote(.(a)), B = quote(1 + .(a)), C = quote(.(a) + 2), D = quote({ .(a) }), E = quote({ 1 + .(a) }), F = quote(function(...
f23da277223c17b4f27e4ec4b5243993118eaa2bbfaacaf0e2442e5ddeb0d4b4
R
1,338
45
--- 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 three samples MGH102 , MGH104 and MGH105 from the public dataset of Gliobastoma (GSE131928) ...
a139c90b5ce8c2d443e88761cc2413a983ebb9040b08b1f83660f6a26e06579a
R
1,346
54
#' @tags relaying #' @tags sequential library(future) options(future.debug = FALSE) message("*** withRestart() and muffling ...") ## https://github.com/futureverse/future/issues/485 fcn <- function(...) { withRestarts({ cond <- simpleCondition("boom") class(cond) <- c("not_me", class(cond)) signalCond...
943c3084a6714c164a996f7f4cd035db754b1dd05d89110b4a2ee33439c9b80f
R
1,351
46
##' @importFrom lattice qqmath ##' @export qqmath NULL #' @title Quantile-quantile plots for galamm objects #' #' @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{galamm}...
d4e555431dcacf771df0559c89f090e7d490caeb8c46bb23d3018a153148d5a1
R
1,358
62
#' @tags requestNode #' @tags cluster #' @tags skip_on_cran library(future) message("*** requestNode() ...") message("*** requestNode() - exceptions ...") workers <- makeClusterPSOCK(2L) print(workers) res <- tryCatch({ requestNode(function() {}, workers = workers, timeout = -1.0) }, error = identity) stopifnot(...
2725b946be62a3e5f49dcb76642b47e0efbed059dcc36deb31e6b1cfffda2832
R
1,385
68
#' @tags relaying #' @tags sequential library(future) options(future.debug = FALSE) message("*** Relaying and split standard output and conditions ...") message(" - default (implicit split = FALSE)") plan(sequential) relay <- recordRelay({ f <- future({ cat("O\n") message("M") 1L }) }) message(" ...
b00ae5f553f1e508acd41b712c032ac2a4af609806bcfd0d77732cf6b575a66e
R
1,406
45
```{r} setwd("evaluating_coregulation") source("../downstreamer_functions.r") datasets <- read.downstreamer.batch("data/no_celline_gene_network_test_results/", potential_traits = c("GenePrioritization", "GenePrioritization200"), USE.CACHE = F) ``` ```{r} make.plot <- function(trait, main="") { curdata.x <- curse...
40e2f0c4a3fc2809edc51311c58f07273780439d995bb0d028eebe1ac784368b
R
1,408
76
### script to prepare annotation BED file to coverage start and stop region # load libs source('functions.R') # load tool locations tool_path <- load_tool_location() # get args get_dir <- commandArgs(trailingOnly = TRUE) # check input file in_bed <- get_dir[1] if(grep('.bed$',in_bed) != 1){ stop( paste0(in_be...
068a541b4922bc8f0a8a41d42785bf7ba9821a5f4716eaea74fa7fc5c0676ed5
R
1,421
43
## ------------------------------------------------------ ## A single future ## ------------------------------------------------------ x <- sample(100, size = 50) f <- future(mean(x)) v <- value(f) message("The average of 50 random numbers in [1,100] is: ", v) ## -----------------------------------------------------...
81614105bcf1f397a26dad7c3ce152e05af4e67d188629452fdcb8ee6c9f49cb
R
1,425
46
--- 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 three samples MGH102 , MGH104 and MGH105 from the public dataset of Gliobastoma (GSE131928) ...
a8a570fe482bfdd8b3d01d8655ee37e4abf5f219ce056ac6aa4b3f5ab942754e
R
1,427
46
#' @tags globals #' @tags where #' @tags sequential multisession multicore library(future) oopts <- c(oopts, options(future.debug = FALSE)) message("*** Globals - sanitizing attribute 'where' (futureverse/future-ideas#1120) ...") FutureGlobals <- future:::FutureGlobals ## Emulate a future_mapply() call with a 'FUN'...
ed90b4c7ee85eb9409fec4e220b9bf6fc67735b59125f347d930ebc56f702e95
R
1,436
53
#' @tags connections #' @tags misuse #' @tags sequential multisession multicore library(future) options( future.debug = FALSE, future.globals.onReference = "ignore" ## because we return a connection ) for (onMisuse in c("ignore", "warning", "error")) { message("onMisuse = ", sQuote(onMisuse)) options(future.c...
cf9bd102f0b8f86e6454bf6116810453af7aac1193a9007ec806966264b6af81
R
1,443
47
# load the data. gene <- "CLECL1" ct <- "macrophage" # gene <- "CYP24A1" # ct <- "neuron" setwd(paste0("~/Downloads/export_ieqtl_data/", gene, "/")) data <- read.csv("data.txt.gz", sep=",", header=TRUE, row.names = 1) info <- read.csv("info.txt.gz", sep=",", header=FALSE, row.names = 1) data$genotype[data$genotype...
51d3c7cd5ea0e17ca08c84396cb127fddb03ccf5f92d0668018b271889e6b607
R
1,452
52
#' bindRateData #' #' collects data exported from wave #' #' @param data.dir character-path of files #' @param norm.meth character #' @param out.name character #' @param returnData Boolean #' @param batchSelection character vector of file names to include #' @importFrom data.table fread #' @importFrom readr write_delim...
d1d934af013b60dd4bce2201241772a9f3fe3d3253959bd1d1389cf2d821350b
R
1,454
43
#' @title Extract square root of dispersion parameter from galamm object #' #' @srrstats {G1.4} Function documented with roxygen2. #' @srrstats {G2.1a} Expected data types provided for all inputs. #' #' @description #' Extracts the square root of the dispersion parameter(s) from an object of #' class \code{galamm}, ret...
488699a705f7aaa896a5c26d4e583b40c60d8599bf3efd6e00e2325cf9ebcd69
R
1,456
61
# Subsetting -------------------------------------------------------------- #' @title subset #' @param x A \code{contacts}-object #' @param chrom A vector of chromosomes to subset #' @param start A single postion in bp. #' @param end A single posttion in bp. #' @param ... Currently not in use. #' @examples #' \dontru...
bb5973bb719c39407f376d4ac3ed8c322a9ca54e35416a064195ef896d992ce1
R
1,460
36
#Create two-column parsed transition tables for all 28 analysed networks, save as csv files if(!require("BoolNet",character.only = TRUE)) install.packages("BoolNet") if(!require("gtools",character.only = TRUE)) install.packages("gtools") library("BoolNet") library("gtools") networkpath <- "./28nets_rules/" nets <- mixe...
2f5dca75651a00d51b79d4429ba6e3eae0bae3473fc34994985817251e4f81ee
R
1,464
51
#' @tags utils-internal connections sequential library(future) check_connection_details <- future:::check_connection_details plan(sequential) f <- future(42L) v <- value(f) message("*** check_connection_details() ...") ## A worker without a connection is not checked stopifnot(is.null(check_connection_details(list...
5ebc1a2c3ea0bc65dbfbcf436c595427fadbc44efc44d18dc7b2ba9a6af02c2f
R
1,469
31
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("MetaBrain/traits.txt") i <- 1 pdf("MetaBrain/withAndWithoutEqtls.pdf", height = 20, width = 10) #png...
ff4a28e2d310ec403a2d4b5f249d0f2ce5e7f72c6e2b446400deb7f00a6a517b
R
1,472
60
#' Plot a network #' #' #' #' @param el Edge List #' @param bool_data Boolean data #' @return tring to visualize #' @family network visualization plotNetwork <- function(el,bool_data=NULL){ library("DOT") x = as.data.frame(sapply(el, function(n){ gsub("[^[:alnum:]]","", n) }) ) dot(el2viz(x,bool_data)) } #' Con...
78e1a5a7e8ce6f33f4c0686634fc20d6bc20539f138fe9f214afc882abc85b5c
R
1,474
51
#' Display a part of a Hi-C matrix #' #' @name GENOVA_image #' @param x A \code{contacts_matrix} object, as returned by #' \code{\link[GENOVA]{select_subset}()}. #' @param col a list of colors such as that generated by #' \code{\link[grDevices]{hcl.colors}}, \code{\link[grDevices]{gray.colors}} #' or similar fun...
0339cbe6bbd528c53736704a7c7c05f1d8dcccea62ea4ee363fc071b7a82e926
R
1,477
71
### script to merge and sort calibrated reads # 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 cores because ...
84a762f35fd4bbebfaf797cbc857878df59d22bca53fecd12da20ec307af6891
R
1,481
50
if(!require("BoolNet",character.only = TRUE)) install.packages("BoolNet") library("BoolNet") file <- "./28nets_rules/Giacomantonio2010.txt" network <- loadNetwork(file) #Running this script required 0.02sec on a MacBook Pro #with a 2.3GHz Quad-Core processor and 16 GB of RAM starttime <- Sys.time() #List the attrac...
096867d40ce326b6fe7a8210ebeae0d0ef7b456db4a65d9a09ff3c200bd7acca
R
1,491
38
#' wellsPerInt #' #' table of well counts per sample for each interval #' @import dplyr #' @importFrom tidyr pivot_wider #' @param dat data frame #' @param measure character, what data column should be not na, defaults to "ocr" #' @param wellVar character, column name for well, defaults to "well" #' @param groupingVars...
c0f7e68d046c3055ced6ee62d2298590dd9472f2cdfa8fc0a85ac319c8cea722
R
1,491
63
# Generated by using Rcpp::compileAttributes() -> do not edit by hand # Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 sqrt_sp <- function(X) { .Call('_RISC_sqrt_sp', PACKAGE = 'RISC', X) } cent_sp_d <- function(X) { .Call('_RISC_cent_sp_d', PACKAGE = 'RISC', X) } multiply_sp_sp <- function(X, Y) { ...
a8b1a2aa68b01699648d609db12535d945e8ab3c43bc11941dd83a39957f1a03
R
1,497
52
library(SingleCellExperiment) set.seed(100) ########################################### ## Mocking up some example training data ## ########################################### Ngroups <- 5 Ngenes <- 1000 means <- matrix(rnorm(Ngenes*Ngroups), nrow=Ngenes) means[1:900,] <- 0 colnames(means) <- LETTERS[1:5] N <- 100 g...
0e221f083fd5172a544463d19929fd7561dda9fd58f9f23c5c79fd8f38c4ff04
R
1,498
53
#' Signals collected conditions for futures flagged for early signaling #' #' @param future A [Future] object. #' #' @param \ldots ... Not used. #' #' @return The `future` object. #' #' @details #' This function returns immediately ("no-op"), if the future (i) is _not_ #' flagged for early signaling, or (ii) not resolv...
28954011c74ec06746a21a79343d5ef0e15bdde4a70bf079427b2d163b5012bf
R
1,500
39
library(optparse) ### The .sh script that calls this R script has this: # for f in ../8_GeneNetwork_predictions/*AUC.txt; do # echo $f; # Rscript calculate_bonferonni.R -i $f -o $(basename ${f%.txt}.bonferonni.txt) -t $(basename ${f%.txt}).bonSigTerms.txt; # done option_list <- list( make_option(c("-i", "...
6ebf840b8b958a394e0dde14b71437deb2bd69d18ce03d95c9292ae87c31bcc9
R
1,504
43
#selecting candidate genes #we want to have ~ <1000 AA long proteins, preferentially from 1 exon, present in 30 species, overlap with human sequence at least 50% setwd("protein/other_protein_alignments/blat_output_full/") overlap_list<-list.files(recursive = T, pattern = ".rds") rbb_list<-lapply(overlap_list, functi...
891a3705d6e61f7e2a36594a9a4a0c2cd29775f3abd13223cd751aaa8a1420e7
R
1,520
31
#### compare PCA levels #### # loop through nested list containing Seurat objects for different filtering thresholds, developmental stages and PCA levels PCA.level.comparison <- function(data, PCA.levels = c(10, 15, 20, 30), cluster_res = 0.5){ if(class(data) == "list") { data.stage.PCA <- list() for (stage i...
51eabf3e6c5e54558a6536929589ae6b1521ee28f31a8cef435b53e08a6655bf
R
1,522
49
#' @importFrom SummarizedExperiment rbind cbind #' @export setMethod("cbind", "ACTIONetExperiment", function(..., deparse.level = 1) { args <- list(...) # args <- lapply(args, updateObject) args <- .clear_ace_slots_bind(args) out <- do.call(callNextMethod, args) return(out) }) #' @importFrom Summa...
907e3ed97a1c544765ca80d9fdd136923b9b5b7c6e411b7e0310604edbdb9e74
R
1,530
24
load("/projects/lu-lab/BenStuff/research/projects/oldhome/scripts/networks/clustscore/term2/input/clusterlistNUMBER1") scorelist_term2_NUMBER1 <- list() length(scorelist_term2_NUMBER1) <- length(clusterlistNUMBER1) for (i in 1:length(clusterlistNUMBER1)){ if (!is.null(clusterlistNUMBER1[[i]])){ dist_AB <- dist(cl...
18378d902b16530f005fcc3a29223111191c359feef3c4483e9da9ab37463139
R
1,545
44
#' Test a perturbation solution #' #' \code{testPerturb} Identifies a network and tests the simulation of the perturbation until it reaches an attractor #' #' @param pkn Prior Knowledge Network #' @param bool_data list of length two: first element is the starting, second is the desired phenotype #' @param rule "ID" (d...
a6913bd292e5bd9cea2e0d7b81c4d7ce406d348c72fd710d69cce6efcbe47a1d
R
1,547
41
import_from <- function(name, mode = "function", default = NULL, package) { ns <- getNamespace(package) if (exists(name, mode = mode, envir = ns, inherits = FALSE)) { get(name, mode = mode, envir = ns, inherits = FALSE) } else if (!is.null(default)) { default } else { stop(sprintf("No such '%s' %s: ...
49809f85bfbb89046d9b057084e750e9f3c94c9499b7825f0a8b8e3f1b5a942d
R
1,550
58
#### Run Gene Relevance on cell embeddings from siVAE # args = commandArgs(trailingOnly=TRUE) # logdir_in = args[1] logdir_in = 'out/data/siVAE' logdir_result = 'out/siVAE/gene_relevance' ## Load destiny for gene relevance library(destiny) ## Save to python numpy library(reticulate) library(parallel) li...
8bbdc4e5314c411904b52ab07196cbcec62962cbe0e7f38a34190fc4a9dbaed0
R
1,550
54
#' Computes quality scores for cells #' #' @param ace ACTIONet output #' #' @return Updated ace object with dblscore.expression, dblscore.centrality, and dblscore.combined scores #' #' @examples #' ace = compute.ACTIONet.doublet.score(ace) #' @export compute.ACTIONet.doublet.score <- function( ace, z.threshold = 1,...
f08939bf23f7f65e3e675b69f27fd3ee585161b0f89ce7baccf9162598fa1c4a
R
1,555
51
# # create.tstat.matrix.illumina.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/") # Loa...
51e6c6af230d27f9a931c63976b01b5ae6df42215cdfbcd489bc23e124b3ff41
R
1,562
40
plotMPpresZsMr<-function(mpdat,ref,test,filePrefix){ modColors = rownames(mpdat$preservation$observed[[ref]][[test]]) moduleSizes = mpdat$preservation$Z[[ref]][[test]][, 1]; plotMods = !(modColors %in% c("grey", "gold")); text = modColors[plotMods]; plotData = cbind(mp$preservation$observed[[ref]][[test]][, 2...
24c59b7d4571bf77b619a10a16e302508aa90219143edebd6b9acd64ebc23b87
R
1,569
38
source("../../downstreamer_main/downstreamer_functions.r") path <- "~/Desktop/collaborations/lude_cancer_gwas/" files <- list.files(path, pattern = "*.xlsx") data <- lapply(paste0(path, files), read.depict2) names(data) <- files plot.xy <- function(x.name, y.name, data) { p1 <- ggplot(data=d...
1ff5eb0b15b368539dd221243bed4ee4cf9e2f08948dacfa53368187f3194a79
R
1,596
37
# library(SingleR); library(testthat); source("setup.R"); source("test-plotMarkerHeatmap.R") colnames(test) <- sprintf("cell_%i", seq_len(ncol(test))) pred <- SingleR(test=test, ref=training, labels=training$label, genes="de") test_that("We can produce heatmaps of markers", { expect_s3_class(plotMarkerHeatmap(pre...
bc3e97a70332b4e54312012fce8670dc41c7579653f15d28dc847d8899c937f9
R
1,598
68
args = commandArgs(trailingOnly=TRUE) if (length(args)<4) { stop("At least four arguments must be supplied: inputdir eqtlsamples cases controls", call.=FALSE) } library(coloc) inputdir=args[1] eqtlsamples=args[2] cases=args[3] controls=args[4] #n1<-3780 # MS #s2<-14802 #n2<-26703+s2 #s2 = s2/n2 # ALS #s2<-2...
30b3369b9c693527f982917de1a095cb2aaa2b849c15a00af70506fab8728089
R
1,600
62
#' @tags timeouts #' @tags sequential multisession multicore library(future) options(future.debug = FALSE) ## Timeouts are only triggered after Sys.sleep() completes [1], ## so here we split up the sleep into multiple microsleeps sleep <- function(duration) { until <- Sys.time() + duration while (Sys.time() < unt...
14c268c90df6f4db092632124bd97c8159286e677e2cd5cebb75237181f395e8
R
1,603
61
whichIndex <- function(I, dim, dimnames = NULL) { ndim <- length(dim) stop_if_not((is.matrix(I) || is.data.frame(I)), ncol(I) == ndim) if (!is.null(dimnames)) stop_if_not(length(dimnames) == ndim) if (ndim == 0L) return(integer(0L)) if (is.data.frame(I)) { ## Convert each column to indices I2 <- arra...
338c5eabc24a6b9e051cdb050fecec45a3a44e9fa801a5186a2213fbb7aacccd
R
1,606
24
setwd(paste0(figureDirectory, "Figure2-Autocorrelation" ) ) library(ggplot2) load(file = "autocorrelationData.RData") autocorrelationQuantilesData <- autocorrelationData[[1]] autocorrelationQuantilesPermut <- autocorrelationData[[2]] autocorrelationQuantilesData$lag <- autocorrelationQuantilesData$lag -1 pdf(file...
e5d13281f3f94879280897d7967e8fb7799d817c7e1acd73387a719aed1641a3
R
1,620
66
#' @title Extract Log-Likelihood of galamm Object #' @srrstats {G1.4} Function documented with roxygen2. #' @param object Object #' @param ... Other arguments #' #' @return Object of class \code{logLik} #' @export #' #' #' @seealso [deviance.galamm()] for a function returning deviance and #' [logLik()] for the generic ...
7901f80826089cf821bf603cabb9f1fbffbb4ef3361b15c90a8038c06cb326e2
R
1,625
60
```{r} if (basename(getwd()) == "downstreamer_main") {setwd("coregulation_calculations")} else {setwd("../coregulation_calculations")} source("../downstreamer_functions.r") library(GenomicRanges) ensembl.file <- "data/ensgR75_protein_coding.txt" # Read reference datasets ensembl <- read.table(ensembl.file, sep="\t", ...
6f2dfacf3543f444241bdebd29c4da35362fa528c584d9751246b791c89192e8
R
1,628
29
partner_Latencies <- function(filename, tibble = FALSE) { #read in files to get the animal names sheets <- readxl::excel_sheets(filename) x <- lapply(sheets, function(X) readxl::read_excel(filename, sheet = X)) if(!tibble) x <- lapply(x, as.data.frame) #extract animal names from each df animal_nam...
9fa6f3d8b4acfdef468d58abfdb9e0972d50e8536a5ff7653ce219b7897330bc
R
1,630
62
#### Run Gene Relevance on cell embeddings from siVAE # args = commandArgs(trailingOnly=TRUE) # logdir_in = args[1] logdir_in = 'out/data/siVAE' logdir_result = 'out/siVAE/gene_relevance' ## Load destiny for gene relevance library(destiny) ## Save to python numpy library(reticulate) library(parallel) li...
2427c38a4defa06dcdaa67528c3ebd8607e6bdb9ddca558b0ce0a730b5e26b5a
R
1,634
48
setwd(paste0(figureDirectory, "Figure6-FreqGenes Heatmap")) library(ggplot2) library(pheatmap) library(grid) library(stringr) load("mostFreqAnnotationRowList.RData") mostFreqCpGs <-mostFreqAnnotationRowList[[1]] annotationRows <- mostFreqAnnotationRowList[[2]] ann_colorsN = list( cytokine = c("TRUE" = "darko...
8d4a1f3f3e21b3771636f13b8a81a582e99c64acafb63c2fa28270f940970ed7
R
1,637
62
#' Reference dataset extractors #' #' These dataset getter functions are deprecated as they have been migrated to the \pkg{celldex} package #' for more general use throughout the Bioconductor package ecosystem. #' #' @param ... Further arguments to pass to the \pkg{celldex} function of the same name. #' #' @return A \l...
aba3b892be8bc2acc6912f4f7110a11dd5977481efdb009d63454f3d0f4dab49
R
1,639
35
# Generated by using Rcpp::compileAttributes() -> do not edit by hand # Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 classify_integrated <- function(test, results, integrated_build, quantile, use_fine_tune, fine_tune_threshold, nthreads) { .Call('_SingleR_classify_integrated', PACKAGE = 'SingleR', test, r...
04c45b0bc684edc442eff0d9a819a6f1eb9c4631d97c865965911a33970b3742
R
1,645
61
#' @tags globals resolve #' @tags listenv #' @tags multisession #' @tags skip_on_cran library(future) library(listenv) ## Make sure futures are automatically resolved oopts <- c(oopts, options(future.globals.resolve = TRUE)) setTimeLimit(cpu = 60, elapsed = 60, transient = TRUE) message("*** Tricky use cases related...
bf0e18e25d663d9d3ad1e16020d0e06152c9ba0f2240e64827df4368e8643630
R
1,646
57
#!/usr/bin/env Rscript #$ -cwd #$ -o makepicardTab.$JOB_ID.out #$ -j y # Resources requested: #$ -l h_data=8G,h_rt=01:00:00 #$ -V # Email address to notify #$ -M videlock@mail #$ -m bea options(stringsAsFactors=FALSE) file.patterns=c("*.metricsAlign$","*rna_metrics$","*.metricsDup$") file.path="picardout" picList...
2c099e7684bdc0cd5981d1646e24e77220589553b81f2028db4514564d628986
R
1,651
56
library(tidyverse) theme_set(theme_bw()) theme_update( panel.grid = element_blank(), strip.background = element_blank() ) library(latex2exp) files <- list.files("results/cognition_model/simulation/model_fits/", pattern = "opt", full.names = TRUE) mod <- readRDS("results/cognition_model/cogniti...
cd71f52af08b903f3d64ee9a052159d750e47e151b49c25ecff3d5b47d902821
R
1,655
60
#### Run Gene Relevance on cell embeddings from siVAE # args = commandArgs(trailingOnly=TRUE) # logdir_in = args[1] logdir_in = 'out/data/siVAE' logdir_result = 'out/siVAE/gene_relevance' ## Load destiny for gene relevance library(destiny) ## Save to python numpy library(reticulate) library(parallel) li...
ef3cd42d73aa8e135ca3e732aa2f1bff8ed43cffa8b3ca8592fa28f5b246a7ab
R
1,657
36
library(Biostrings) #ok 1 very promising sequence (end), 1 a bit promising (start) --> let's check ferseq<-readDNAStringSet("/data/share/htp/TRNP1/dna_resequencing/Trnp1_Ferret/trinity_kmer_bwa/trinity-final.Trinity.fasta") fullest<-ferseq[names(ferseq)=="TRINITY_DN51_c0_g1_i1 len=501 path=[0:0-500]"] writeXStringSet...
9e48e9c0de64fb80bf121e0b4e71fefb15e105eb8001dc3535f322c41bc665c6
R
1,665
59
# Annotate with gnomAD minor allele frequency library(dplyr) library(tidyr) library(purrr) library(janitor) library(tibble) library(glue) library(stringr) library(readr) library(forcats) # library(vcfR) ## Snakemake ### Input path_gnomad <- snakemake@input[["gnomad"]] path_snps <- snakemake@input[["snps"]] ### Outpu...
bba0846642c39a0587a6fb20a434299eaae08bc18c1ce23cec405d4977357cf9
R
1,676
29
novel_Latencies <- function(filename, tibble = FALSE) { #read in files to get the animal names sheets <- readxl::excel_sheets(filename) x <- lapply(sheets, function(X) readxl::read_excel(filename, sheet = X)) if(!tibble) x <- lapply(x, as.data.frame) #extract animal names from each df animal_names...
6512253073b5aab8e14c1f903b78ed0a0af074c143e947abbdb0d22b2d61d0a2
R
1,681
59
#' Subsets rows/columns of an ACTIONetExperiment (ACE) object #' #' @param i,j rows and columns #' #' @export setMethod("[", c("ACTIONetExperiment", "ANY", "ANY"), function(x, i, j, ..., drop = TRUE) { rn <- x@rowNets cn <- x@colNets rf <- x@rowMaps cf <- x@colMaps if (!missing(i)) { if...
c4551efd55566634e631bf73e8bd83c063666b63696c9cedcb971e08a0e165b8
R
1,686
45
#install.packages("BiocManager", repos = "https://cran.r-project.org", dependencies=TRUE) #install.packages("dplyr", repos = "https://cran.r-project.org", dependencies=TRUE) #install.packages("tibble", repos = "https://cran.r-project.org", dependencies=TRUE) #install.packages("tidyr", repos = "https://cran.r-project.or...
05af4c0ad1bc3b711cb24feff669441670c8bdda58a82bae8addd557f57217b8
R
1,687
48
library(data.table) library(ggplot2) library(ggbeeswarm) library(patchwork) source('../config.r') source('../utils.r') data <- fread('mod24_cond_big.csv') data_swarm <- data[,.(coef = sample(coef, 200, replace = F)), by = .(target, family, name, type)] fig <- ggplot(data = data) + aes(y = ...
ced5a7f8c468ee28e5e873290fdea96b71b4383c6825ec69cf8afb3758f69485
R
1,688
67
#Code to generate matrix from: http://r.789695.n4.nabble.com/Re-Generate-a-serie-of-new-vars-that-correlate-with-existingvar-td822187.html # create the initial x variable x1 <- rnorm(100, 15, 5) # x2, x3, and x4 in a matrix, these will be modified to meet the criteria x234 <- scale(matrix( rnorm(300), ncol=3 )) # ...
c39cac15b2da60083ec97e4bf3a56f234bd2c8fae5a2332b0c83b6cafd43f423
R
1,694
58
#' Shuffle a symmetric matrix #' #' ShuffleHiC shuffles a matrix from `select_subset()`` diagonal-wise. That is, every diagonal in the matrix is shuffled independently. #' @examples #' \dontrun{ #' ## Shuffle a region on chromosome 1 #' HiCregion <- select_subset(EXP, chrom = "chr1", start = 15e6, end = 20e6) #' HiCreg...
bc2c1f25f1f2b9cfa24c0dfaafb2e6adba616f64eea6b98b3399aa590fc03972
R
1,699
51
#!/usr/bin/env Rscript library("optparse") library("tximport") # specify our desired options in a list # by default OptionParser will add an help option equivalent to option_list <- list( make_option(c("-t","--tx2gene"), default=NULL, help="Table with 2 columns: TXNAME and GENEID;", metavar="FILE.tsv"), make...
ba576751fe2167a65390f51c1ac06fcb6db2e6cf29ea172a923f05101686493c
R
1,701
51
#' Evaluate an expression using a temporarily set future plan #' #' @inheritParams plan #' #' @param data The future plan to use temporarily, e.g. `plan(multisession)`. #' #' @param expr The R expression to be evaluated. #' #' @param local If TRUE, then the future plan specified by `data` #' is applied temporarily in t...
2f3bab31bdb61f8b8bd1af05ec872c71412b541c3c2096ef95f7477b48bcf40d
R
1,708
49
#!/usr/bin/R library(heatmaply) library("optparse") option_list = list( make_option(c("-f", "--file"), type="character", default=NULL, help="dataset file name", metavar="character"), make_option(c("-o", "--out"), type="character", default="out.txt", help="output file name [default= %de...
df974dd3af289459d4ed260f7247e39f58b3584a9ac8b36f6d4498383ab0f200
R
1,709
52
#!/usr/bin/Rscript library(optparse) library(ggplot2) library(data.table) library(reshape2) library(grid) library(gtable) library(ggpubr) library('scales') option_list = list( make_option(c("-l", "--ld_scores"), type="character", help="File containing the LD scores between the top SNPs for each gene o...
52f9010d6600113f9924e3bf4c73c379f77d13d34b935a3fdd033805c604fa99
R
1,711
58
# R version:RStudio # 2022.02.1 Build 461 # © 2009-2022 RStudio, PBC # libraries needed: library(rlang) library("ggplot2") library("FactoMineR") library("factoextra") library("corrplot") library("tidyverse") data.file <- read.csv ("datafile.csv",sep=";", header=T, na.strings="NA", as.is=T) head(data.fi...
846dc1d9997df6e481ee04dc1607c58ba5ea0c1d97fc37a110ca880e2900f792
R
1,716
68
#' @tags globals #' @tags nse #' @tags listenv #' @tags nested-futures #' @tags sequential multisession multicore library(future) library(listenv) options(future.debug = FALSE) message("*** Globals w/ non-standard evaluation (NSE) ...") data <- data.frame(x = 1:5, y = 1:5) v0 <- subset(data, x < 3)$y for (strategy ...
18a928b855c4a5a5529ec4e23d7a8e2b494d840e3ba8400008dca46f28e3f264
R
1,725
76
#' Get all futures in a container #' #' Gets all futures in an environment, a list, or a list environment #' and returns an object of the same class (and dimensions). #' Non-future elements are returned as is. #' #' @param x An environment, a list, or a list environment. #' @param \ldots Not used. #' #' @return An obje...
005ceea729a648e1e28fed7d3a62d80b9b128a3e207f5f66cf9c5208b644ac30
R
1,727
51
#!/usr/bin/env Rscript library("optparse") library("tximport") # specify our desired options in a list # by default OptionParser will add an help option equivalent to option_list <- list( make_option(c("-t","--tx2gene_table"), default=NULL, help="Table with 2 columns: TXNAME and GENEID;", metavar="FILE.tsv"),...
62e40ca5504421afd2204ce7db8e51c4bfec9539018c4d5e14a6c11aa84b0115
R
1,735
48
library(sRACIPE) indexlist_to_rset <- function(index){ tmp <- ALLUNIQUEMODELS[[index]] colnames(tmp) <- c("A", "B", "C", "D") rownames(tmp) <- c("A", "B", "C", "D") tmp2 <- as.data.frame(matrix(ncol = 5)) colnames(tmp2) <- c("from", "to", "arrows.to.type", "color", "type") k <- 0 for (i in 1:4){ for ...
7e83979d73dc7c4138fffddbb9c253eab0c33a14dddf99b0a8da233b72241eb9
R
1,737
39
#### plot multiple feature plots at once #### multi.feature.plot <- function(seurat.obj, stage.name = NULL, gene.list, plot.clusters = T, plot.stage = F, cluster.col = "seurat_clusters", n.col = 4, label = "UMAP plots for GOI on normalised filtered data", legend.pos = "right", plot.cellty...
8d77f29713ba8ebd8cc4dd43b0b02471e4b305dbec45518785c1e70d99de97aa
R
1,742
63
get_connections <- function() { cons <- lapply(getAllConnections(), FUN = function(idx) { tryCatch({ con <- getConnection(idx) as.data.frame(c(index = idx, summary(con))) }, error = function(e) { NULL }) }) do.call(rbind, cons) } diff_connections <- function(after, before) { index...
bee0f1a6acb6d6c5602bd5231adbb2cb0b421dc3fb6a0cb5440bcb1083f79d60
R
1,753
60
# Require reticulate # Use reticulate to save # library(reticulate) # library(renv) # renv::install("reticulate") # renv::use_python() # 3 library(reticulate) sc <- import("scanpy") days = c('D11') # celltypes = c('FPP','P_FPP') celltypes = c('P_FPP') df.eff = read.table('diff_efficiency_neur.csv',sep=",",header=T)...
0c99e73699c799c172d477a7f608eb1927932ad757f9172325372c3fae7bc5a3
R
1,754
67
#' @tags globals non-exportable #' @tags detritus-files #' @tags cluster library(future) message("*** Non-exportable globals ...") options(future.debug = FALSE) options(future.globals.onReference = "warning") plan(cluster, workers = 1L) message("* R connections ...") ## Create a dummy, global connection with a hi...
2f494f4116b79daa212095ff56ce465e307b6b481bd9bd55e31e0fd72b201e1e
R
1,757
53
#' @usage #' x \%<-\% value #' value \%->\% x #' #' @aliases %<-% %->% #' @rdname futureAssign #' #' @export %<-% %->% `%<-%` <- function(x, value) { target <- substitute(x) expr <- substitute(value) envir <- parent.frame(1) futureAssignInternal(target, expr, envir = envir, substitute = FALSE) } `%->%` <- func...
27200b8f8bdbdbaffc30302d1448e064c6dfb069651932458791efc79d8cf780
R
1,760
66
setwd("C:\\UMCG\\Genetica\\Projects\\Depict2Pgs") library(GEOquery) GSE8759 <- getGEO("GSE8759", GSEMatrix=TRUE, AnnotGPL=TRUE) show(GSE8759) if (length(GSE8759) > 1) idx <- grep("GPL538", attr(gset, "names")) else idx <- 1 GSE8759 <- GSE8759[[idx]] str(GSE8759) experimentData(GSE8759) pheno <- pData(phenoData(...