sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
351fcad53238df7250ddff3833aff7afa8f584b225833d922f4c14d734d66aa8
R
1,762
60
#this code calcuates raw PCC coexpressiox network and write to file library(Seurat) library(parallel) library(doParallel) setwd('/home3/junhacha/HumanNetv3/Benchmark/rawPCC/') data <- read.table('/home3/junhacha/HumanNetv3/Benchmark/BC_countdata_EC.tsv', sep = '\t', header = T) cell.type <- 'EC' seurat <- CreateAssa...
b90f78dac48953fb8c6550d2a237a278344fb29932e1ee5977fefc56d721f9b0
R
1,783
73
#' Back trace the expressions evaluated when an error was caught #' #' @param future A future with a caught error. #' #' @param envir the environment where to locate the future. #' #' @param \ldots Not used. #' #' @return A list with the future's call stack that led up to the error. #' #' @examples #' my_log <- functio...
fe2357afca1a8d0dc317a8a82c75b3ce8c94b4f34b28bdeb8de7d927ececd164
R
1,784
64
#srun --cpus-per-task=1 --mem=50gb --nodes=1 --qos=priority --time=168:00:00 --pty bash -i #remoter::server(verbose = T, port = 55556, sync = T) remoter::client("localhost", port = 55501) setwd("/groups/umcg-fg/tmp01/projects/genenetwork/recount3/") sraFiles <- list.files(path="rse-sra/SRA_Files/", pattern="sra...
93b14af21e02ccabfdc13b81e61d5b971cfec62d3511db05782f65e0f47f8e73
R
1,785
35
library(SnapATAC) library(Matrix) args = commandArgs(trailingOnly=TRUE) input_dir <- args[1] output_dir <- args[2] # Older version # for (sp in c("2C", "3C", "4B", "5D")) { # x1.sp <- createSnap(file=paste0(sp, ".snap"), sample=sp) # x1.sp <- addBmatToSnap(obj=x1.sp, bin.size=1000) # write.table(data.frame...
2d0fb57d13d85f05b0b3ae72455f8682e0544046aa6ef6e3e66e934b4a777ddd
R
1,795
70
####################################### # R script to read outputs from RACCOON # J. O. Nash @2022 # F. Comitani @2022 ####################################### open.h5<-function(file){ #This function reads in an hdf5 file # # args: # file (hdf5), path to the hdf5 file to read # return...
fddfc2a9e750a7d814b21c2539d159a2856687fd3f85a3b52953e211d330636c
R
1,799
54
#' Rebuild the index #' #' Rebuild the index (or indices), typically after restarting the R session. #' This is because the indices are held in external memory and are not serialized correctly by R. #' #' @param trained List containing the output of \code{\link{trainSingleR}}, #' possibly after some operations that inv...
137d472295d78151c8b04f3e49f5b2fa5587f577ffbb7c12d9e49e5ad892261d
R
1,804
40
x <- read.table("~/Desktop/depict2/output/maf_filtered/v51/height_2018_30124842_hg19_genePvalues.txt", header=T, row.names=1) y <- read.table("~/Desktop/depict2/output/height_paper/height_2018_30124842_hg19_genePvalues.txt", header=T, row.names=1) x[,1] <- -log10(x[,1]) y[,1] <- -log10(y[,1]) coreg.x <- read.table("~/...
8ac08b513aa849d597ce1d5b5a1b00578671e2a48acce55291046b838f2c903f
R
1,820
44
#' calcInt #' #' calculates the summarized data over the time points in each interval #' #' @param x data frame #' @param varname character, new name for column #' @param groupingVar character, variable to group by before summarizing #' @param intVar character-column name for intervals #' @param intervals character vec...
f4fe8a577e4f8ce7933ab80ceae140a7701230c32eeb5f0504ba462b8966984a
R
1,821
77
#' Function to write a network #' #' @param fName: file name #' @param network: network definition #' @param rule: "ID" or "MR" (currently only works for ID) #' #' @return success writeNetwork <- function(fName, network, rule= "ID"){ #TODO: writeNetwork currently only works for rule = "ID" #should be implemente...
89218537b6fee32b305343d8d977dc61555b3cc5785790e3bcc5e5d0d625257f
R
1,824
70
library(minet) library(reticulate) library(ggplot2) library(RColorBrewer) np = import("numpy") ####============================================================================ #### Set directories ####============================================================================ # args = ...
d975d4f6953d4528c5e616bb52fd620304b2b3ed0acab5d1eb841db91ec97bf8
R
1,826
63
#remoter::server(verbose = T, port = 55556, sync = T) remoter::client("localhost", port = 55001)#55556 55501 setwd("/groups/umcg-fg/tmp01/projects/downstreamer/depict2_bundle/") library(readxl) read.depict2 <- function(path, potential_traits=NULL) { if (is.null(potential_traits)) { potential_traits <- ex...
3b5c407e30a571f4b4af320e1fcfc0198dd39fadb33a8903b84e9a1f53e0ce72
R
1,832
60
#' @tags utils-internal cluster library(future) registerClusterTypes <- future:::registerClusterTypes makeClusterPSOCK_args <- future:::makeClusterPSOCK_args message("*** registerClusterTypes() ...") ## The 'FUTURE' cluster type is registered when the package is loaded stopifnot(identical(future:::FUTURE, "future::...
24bfafc193347523ecccc4c4f44dc2661476628fd252a3cb4b4212638ac57c04
R
1,833
67
## Marioni, R. E. et al. Translational Pscyh. (2018). 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 = log...
9409c50eef0226e853ab912b90ff9a1c6b46bf30cd3d5ea8970f77a6dc0b94d6
R
1,837
56
#' @tags globals reserved-keywords #' @tags sequential library(future) options(future.debug = FALSE) plan(sequential) message("Overriding reserved keyword functions ...") ## Identify globals used by the expanded future expression ...names <- globals::findGlobals(getExpression(future(NULL))) ...names <- ...names[sapp...
6a69af942d2ce977dc79e540d915e208da7e75a537127a5add6ba06268406f1c
R
1,848
56
library(ggplot2) library(grid) library(gridExtra) library(reshape2) # Figure 2A plotx <- read.table(plotx, "SourceData/Figure_2A_Source_Data.txt", sep = "\t", header = T) p1 <- ggplot(plotx[which(plotx$Data == "SAMPLE_NUM"),], aes(Tissue, Number, fill = Tissue))+ geom_bar(stat = "identity")+ coord_flip() + scal...
61d744bcf71fdbfa9310f3207d2aad1bb64bff47cf56ed40fccfd04b1df0f885
R
1,850
53
# first, compare site model with a fraction of proteins with omega>1 with a null model setwd("/data/share/htp/TRNP1/paper_data/") system("bash protein/scripts/summarise_PAML_out.sh") m8_vs_m7_trnp1<-read.table("protein/PAML/M8_vs_M7.txt", sep="\t") %>% distinct() %>% mutate(lnL=word(V3,7,7, sep=" "), p0=...
49da8d263a63e7849bc647bab3f74153112a319b6dd53df3a6493bb0d310af7e
R
1,851
52
# Disclosures of Conflicts of Interest - Raniere Gaia Costa da Silva: No relevant relationships. - Ambika Prasad Mishra: No relevant relationships. - Michael Doube: No relevant relationships. - Christopher Riggs: No relevant relationships. # Acknowledge We thank Dr. Anil Prabhu, Vincent Y. T. Tang, and Voss ...
04921c6e802b80be06505164b2f38ab25c74b92839204cd3cce3498c06c5e532
R
1,859
46
rm(list = ls()) library(igraph) library(parallel) load("/work/lulab/Ben/distmat/NEWMAN_SUBSAMPLING/inception/input/combos.list") load("/work/lulab/Ben/distmat/NEWMAN_SUBSAMPLING/inception/input/ks.dist.mat.all.complete") get.average.distance <- function(combos){ tmp1 <- names.list[[combos[1]]] #this is id of batch an...
f60b53cc4c6dc541d26bdf39e6a4003ee6b0818060c20cb9a4770d24268aa6ac
R
1,879
51
# Note: we can only lookup symbols that are available in the installed version of libcurl # Therefore you should only update the symbol table using the latest version of libcurl. # On Mac: 'brew install curl' will install to /usr/local/opt/curl blacklist <- c("CURL_DID_MEMORY_FUNC_TYPEDEFS", "CURL_STRICTER") # Functi...
30cfb550ad50bfd0a124d580a75d50edc18a2646b7f0445194f5c25ec49b4294
R
1,880
34
library(ComplexHeatmap) library(ggplot2) library(matrixStats) for (f in list.files("./", "*feature_ranks.csv")) { print(f) data <- read.table(f, header=T, sep=",", stringsAsFactors=F, row.names=1) print(dim(data)) data <- as.matrix(data[rowSums(abs(data) > 0) >= 2,]) print(dim(data)) annotatio...
b0638ceb658630d24bba9914d758576b8e91da00994abd90b8be969a183238d3
R
1,883
81
```{r} library(nlme) custom.gls <- function(x, y, Sigi) { x <- as.matrix(x, ncol=1) # Calculated beta on pre-computed inverse matrix # xtxi = b1 xtxi <- solve(t(x) %*% Sigi %*% x) # part between brackets is b2 beta <- xtxi %*% (t(x) %*% Sigi %*% y) # Calculate SE res <- y - (x %*% beta) ...
9a1f22ad84da9cac66985c4a59e9968c751f182c1b82ed4cc1a2b2ccd09911b6
R
1,890
55
```{r} library(qqman) source("downstreamer_functions.r") setwd("gwas_simulations") source("data/source_olivier.r") files <- list.files(simulated.sumstats.path, pattern="*assoc.txt.gz", full.names = T) curstats <- fread(paste0("zcat ", files[1]), data.table=F) rownames(curstats) <- make.names(cur...
2b5798c31ade7857e8a4ccbdc349463230c14d95a662c2d713ad1a808a235112
R
1,901
60
#' @tags interrupt #' @tags detritus-files #' @tags sequential multisession multicore library(future) options(future.debug = FALSE) strategies <- supportedStrategies() ## IMPORTANT: Skip when testing with 'covr', because value() cancels the ## still-running futures when one of them fails, which terminates their ## w...
b768acafba0d76f8e2f7372d7f64b09579470ab9a9f620d663e7f252cda9f1d5
R
1,904
63
library(Biostrings) library(stringr) library(tidyverse) library(plyranges) library(foreach) library(doParallel) prot_seqs_sp <- list.files("protein/other_protein_alignments/self_matches_fa", recursive = T, full.names = T) #for the cases where multiple sequences were matching equally good, count different positions...
edd084f454fc16a9685a6d9c97538a4e8a73f1cd7fe01bcbb1d37fbba23deab0
R
1,907
58
## ## Generate a heatmap for a matrix of values with specified genes/rows and samples/columns. ## plot_heatmap = function(mat, row_subset, col_subset, title, file_prefix = "plot.heatmap") { library(glue) library(pheatmap) # confirm that the subsets exist in the full matrix row_subset = intersect(row_subset...
bafbd1eb9247f6f6b9623c3fd0bcbadedc103b0db829d80cefda825224568b4e
R
1,908
72
```{r} setwd("evaluating_pathway_predictions") source("../downstreamer_functions.r") source("data/source_olivier.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("...
cb596f79c69649d56786f32676c37dabc196e0de46682245b9743275f26b8c07
R
1,919
51
# This tests that pruneScores works as expected. # library(testthat); library(SingleR); source("test-prune.R") test_that("validating per-cell check without finetuning", { scores <- rbind( c(0,0,0,0,1), c(0,0,0,1,1), c(0,0,1,1,1), c(0,1,1,1,1), c(1,1,1,1,1) ) colnames...
00d2a08889e437b1bfc2f1d73f0288e2a220c49db60481dd66274bbb38814e26
R
1,931
97
# Resources requested: #$ -l h_data=2G,h_rt=00:30:00 #$ -V # Email address to notify #$ -M user@mail #$ -m a rm(list=ls()); suppressMessages(library(GOstats,quietly = T)) suppressMessages(library(org.Mm.eg.db,quietly = T)) # options(echo=TRUE) options(stringsAsFactors = FALSE); onts<-c("BP","CC","MF") MMthreshs<-...
2cd635178151c0c5e40f2d9c3f2aa57167d33ace566a1d5df0c795bab15bc6f0
R
1,932
58
#remoter::server(verbose = T, port = 55556, sync = T) library(pbdZMQ) sessionInfo() remoter::client("localhost", port = 55506)#55501 55556 genes <- read.delim("/groups/umcg-fg/tmp01/projects/genenetwork/recount3/genes_Ensembl94.txt.gz", check.names = F) str(genes) #Ensembl Gene ID Chromosome Name ...
5e2e89463cc54e8f7e4e0053319d444791385f0be4147b7f8b52c6d95d899a29
R
1,937
77
# Annotate with Nearest Gene ## Nearest protein-coding gene according to GENCODE release 40 library(dplyr) library(tidyr) library(purrr) library(janitor) library(tibble) library(glue) library(stringr) library(readr) library(forcats) # library(rtracklayer) # Snakemake ## Input path_snps <- snakemake@input[["snps"]] pa...
994cda0d87cb3c421353c738d0445c450e49c26cfeeec0eb6b0cd973aa52fecc
R
1,952
75
with_assert <- function(expr, ...) { invisible(expr) } prune_call <- function(expr, name) { if (!is.call(expr)) return(expr) expr <- unclass(expr) fcn <- expr[[1]] if (!is.symbol(fcn)) return(expr) if (as.character(fcn) != name) return(expr) NULL } prune_debug <- function(expr) { if (!is...
3770667b480ef32ee866dd17da105af223b57e58a73482f35315e1f291fa8cef
R
1,955
66
#' @tags interrupt lazy #' @tags detritus-files #' @tags multisession multicore library(future) options(future.debug = FALSE) strategies <- supportedStrategies() strategies <- setdiff(strategies, "sequential") ## IMPORTANT: Skip when testing with 'covr', because value() cancels the ## still-running futures when one ...
fe5d06fc52c97b0e41da650dcc1edbd4dd8c147898af9d6d526d5be1c6002e70
R
1,971
63
#remoter::server(verbose = T, port = 55556, sync = T) remoter::client("localhost", port = 55556)#55556 55501 55504 setwd("/groups/umcg-fg/tmp02/projects/downstreamer/depict2_bundle/") library(readxl) read.depict2 <- function(path, potential_traits=NULL) { if (is.null(potential_traits)) { potential_traits...
dd278e33efde48a78a7a31fd3d339853b141ac23f5fb1ae266b6fbc617fd19e1
R
1,972
61
#' Functions Moved to 'parallelly' #' #' The following function used to be part of \pkg{future}, but has since #' been migrated to \pkg{parallelly}. The migration started with #' \pkg{future} 1.20.0 (November 2020). They were moved because they #' are also useful outside of the \pkg{future} framework. #' #' _If you are...
6cd9b10482920f3fbc92ad556694fcfbcd1b49c542c2151661a95f11f2754e59
R
1,974
43
#' Class "galamm" #' #' An S3 class for objects returned by [galamm()]. #' Contains information about the fitted model, random effects, parameters, and #' smooth terms. #' #' @section Components: #' * `call`: the matched call used when fitting the model. #' * `random_effects`: a list with: #' * `b`: random effects in...
549f32260301a18db5000a8190c0a719c1785406643a2fc01629d0eb4cd5ad50
R
1,987
40
library(sRACIPE) if (!file.exists("/projects/lu-lab/BenStuff/research/projects/oldhome/scripts/networks/clustscore/output/scorelistNUMBER1")){ load("/projects/lu-lab/BenStuff/research/projects/oldhome/scripts/networks/rset/rsetlists/output/rsetlistNUMBER1") scorelistNUMBER1 <- list() length(scorelistNUMBER1) <- ...
5c211f138fb9c6d776077698e22842e504ac98e328534ff34e024c5567cd4a88
R
1,991
88
#' @tags futureAssign #' @tags listenv #' @tags sequential multisession multicore library(future) library(listenv) message("*** %<-% to listenv ...") ## - - - - - - - - - - - - - - - - - - - - - - - - - - - - ## Future assignment via infix operator ## - - - - - - - - - - - - - - - - - - - - - - - - - - - - z <- list...
71fb4e53b257ef24f3b971a113bed19420c52f0ab42ff5c6b1089c545071e89e
R
2,018
81
--- 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...
4b89ae0fb92409b659fc26aab508bb91122cbfc575ca3538ad5f56c03bc9b42e
R
2,020
64
#' @tags utils-internal import library(future) import_from <- future:::import_from import_parallelly <- future:::import_parallelly import_parallel <- future:::import_parallel import_parallel_fcn <- future:::import_parallel_fcn ## NOTE: Only *exported* functions are used below, so that these tests do not ## depend on...
b7678e39d96bbe55892914917b70c1f015ae4a83d4e9d83437b11f19eba42cd8
R
2,022
61
library('circlize') # Read connectivity data main_dir <- '/Users/karimia/code/Brain_Network/matlab/figs/chord_modularity' file_name <- "combined_hemis" out_name <- "Modules_2_3" full_csv_name <- file.path(main_dir, paste(file_name, '.csv',sep = "")) T <- read.csv(full_csv_name) # set the row names and remove the Row ...
4850c89e00af075dfd4416201ccf010e372db5e2f48aeaac22f20a5e87e8b568
R
2,025
85
### script to identify high expressed genes (features) # load libs source('functions.R') # load tool locations tool_path <- load_tool_location() # get args get_dir <- commandArgs(trailingOnly = TRUE) # check input files in_bam <- get_dir[1] if(grep('.sort.bam$',in_bam) != 1){ stop( paste0(in_bam, ' is not a B...
54e3d2e74370ad1546f2cd6db92d8ed4e64d3b0893f24bd5ab86ea4edd7d17bf
R
2,033
56
```{r} setwd("evaluating_coregulation") source("../downstreamer_functions.r") source("data/source_olivier.r") library(ggsignif) datasets <- read.downstreamer.batch(main.downstreamer.output.path, USE.CACHE = T) ced.prio <- as.data.frame(read_excel(aadriaan.ced.prio, col_types = c(rep("text", 4)...
09480747667be61a67aa9738a7c6c64aae7928f5dc788846e74216d1f413ae0b
R
2,043
51
#' Title Get top percent of diffHubs default is 5percent #' #' @param diffPR.df output dataframe of diffPR(), #' @param top.percent top percentage of diffPR hub genes to retrieve, default is 0.05 #' #' @return dataframe of top percentage diffPR genes for each celltype #' @export #' #' @examples #' sorted.net.list <- So...
fa8c9961e448f557f7a3f51b9225fdc0d031755b7a0b93bcb57be7f9c455fdea
R
2,051
59
# Cell-type marker conversion library(homologene) library(readr) setwd("/Users/philippehabets/Dropbox/Git/fMRI-transcriptomics-cortisol/data/") # Read markers. Used Neuroexpresso Version: 1.2 dir <- "neuroExpresso/" filenames <- list.files(dir) conversion_table <- sapply(filenames, function(f){ m <- unlist(read.tabl...
2b246cbb1d79c489b3e245af2f50c35e4ed320b6113be02802ffea98980a4ee4
R
2,053
55
library(data.table) input_file <- '../test_less_genes/output/5_covariatesRemoved/1000_genes_test.duplicateSamplesRemoved_extractedColumnsnoVarianceRowsRemoved.DESeqNorm.CovariatesRemoved.txt' expression <- fread(input_file, check.names=F) expression <- data.frame(expression, check.names=F) rownames...
1671ed203966d8d438f10a0d2f40306adfd460eaa7fe0bb6fdaf8d06535718da
R
2,077
86
#' @importFrom utils globalVariables globalVariables(c(".", "..")) bquote_compile <- function(expr, substitute = TRUE) { if (substitute) expr <- substitute(expr) tmpl <- list() unquote <- function(e, at = integer(0L)) { n <- length(e) if (n == 0L) return() if (is.pairlist(e)) { for (kk in...
25feb18d106ca7551bfd7615adca2c492414766adb25784a081deb55a7d181e7
R
2,078
72
#' @tags worker-interrupt #' @tags detritus-files #' @tags multisession multicore library(future) options(future.debug = FALSE) strategies <- supportedStrategies() ## Signalling SIGINT to an R future process might end up ## terminating the whole R process. Because of that, we ## might get a FutureError, because we c...
7106e5fec0fc0c75b2eca5353a91899d7d61782115747608355923dcb58a2704
R
2,078
45
```{r} setwd("../downstreamer_collaborations/biogen/") source("../../downstreamer_main/downstreamer_functions.r") # Read excel files base <- read.downstreamer.batch("/home/work/Desktop/depict2/collaborations/biogen/hand_grip_strength/2021-04-09/") ``` ```{r} a <- read.table("/home/work/Desktop/depict2/collaboration...
8345ad28c020ac5e642da211a5223439b8e94b808ff98f579ea0db151b304823
R
2,079
76
#!/usr/bin/R library(micropan) library(dendextend) 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 fi...
62a55b26da06a34fbb640967c8a013b584a9c7840a6f2d2248e18cc8e7ba8056
R
2,081
84
#' @tags futureOf #' @tags environment #' @tags sequential library(future) suppressWarnings(rm(list = c("x", "z"))) message("*** futureOf() with environment ...") message("*** futureOf() with environment - future assignments ...") x <- new.env() x$a %<-% { 1 } f1 <- futureOf("a", envir = x) print(f1) f2 <- future...
1c77c9ed936d58caedc249ad7adf699c7d6fc281095b48b24c19d001a5ba47a5
R
2,092
83
### script to filter(=keep) reads of a certain length # 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 ...
3bc1f7906425865ecff02fceb25fa0b5088920a36a00f03dca29dc9d07366f9c
R
2,096
73
#!/usr/local/R-4.1.2/bin/R library(RColorBrewer) library(dendextend) library("optparse") #args = commandArgs(trailingOnly=TRUE) option_list = list( make_option(c("-f", "--file"), type="character", default=NULL, help="dataset file name", metavar="character"), make_option(c("-o", "--out"), type...
0711b3b82fb5ea7524a59cf6aac0d8570e6ff23f62c9b6180341d03b695509ac
R
2,098
60
library('circlize') # Read connectivity data main_dir <- '/Users/karimia/code/Brain_Network/matlab/figs/chord_modularity' file_name <- "mod_averaged" out_name <- "Modules_averaged" full_csv_name <- file.path(main_dir, paste(file_name, '.csv',sep = "")) T <- read.csv(full_csv_name) # set the row names and remove the R...
33147e5953c2321c6cf6332b9ff3621c092a05c3f56804c6bf3ed82b168c7bcb
R
2,101
68
extract_optim_parameters <- function(object) { UseMethod("extract_optim_parameters") } #' @title Extract parameters from fitted model for use as initial values #' #' @srrstats {G1.4} Function documented with roxygen2. #' @srrstats {G2.1a} Expected data types provided for all inputs. #' #' @description This function ...
d5da63d166ad2029a1950e8a0df3240218661a153bab54897ab9e0b28e6928e2
R
2,109
62
#' @tags utils-internal rng library(future) stealth_sample <- future:::stealth_sample message("*** stealth_sample() ...") ## Nothing to sample stopifnot(identical(stealth_sample(1:10, size = 0L), integer(0))) stopifnot(identical(stealth_sample(letters, size = 0L), character(0))) ## Nothing to randomize, because th...
028285d8a75b4ea5c4306204f5347745597d93e53ba6c6f921471bcdf6121997
R
2,121
84
library(tidyverse) library(mgcv) library(mvtnorm) set.seed(123) tps <- 8 tests <- c(3, 2, 4) family <- c("gaussian", "binomial", "gaussian") trials <- c(1, 1, 1) n <- 200 lambda <- list( c(1, 1.4, .3), c(1, 2), c(1, 1, 1, 2) ) # Residual standard deviation for Gaussian model sdeps1 <- .1 f0 <- function(x) 2 * s...
6e1f4d31a023978865e63888060e99b321d86b0d730d1ee80f93b503de2669f1
R
2,121
48
#' getsitedc #' #' This function takes a RefCDS object and a bigwig file with duplex coverage as input and adds to the RefCDS two fields required to use site-level duplex coverage in dndscv. Usage: RefCDS = getsitedc(RefCDS) #' #' @author Inigo Martincorena (Wellcome Sanger Institute) #' @details Martincorena I, et al....
66a573471e9ea13d40f8ab149ee2c645fffbb34f9203577f45f0d6195f4c48f7
R
2,132
58
#' Load, parse and check BEDPE. #' #' This function loads a BEDPE file. Columns 2 and 4 and 5 and 6 will be sorted numerically. #' If only a BED-file is present, duplicate BED-columns 1,2,3 as: 1,2,2,1,3,3. #' #' @param loop.bed Path to bedpe file. #' @param header Does the file come with a header? #' @export #' @retur...
a128387e0012fa38aeab27d9a35600ae2eb23ef0ce1de16a9bd784b28f9ac3a8
R
2,132
76
#' @tags utils-internal whichIndex message("*** whichIndex() ...") dims <- list( c(1), c(1, 1), c(2), c(2, 1), c(3, 4, 3) ) for (dim in dims) { printf("Dimensions: (%s)\n", paste(dim, collapse = ", ")) dimnames <- lapply(dim, FUN = function(n) letters[seq_len(n)]) X <- array(seq_len(prod(dim)), dim =...
f1bbdec937e3d6f7394e0cd5f32fb5477e2d53ef422a2daafbd3281a0c44649c
R
2,139
64
```{r} if (basename(getwd()) == "downstreamer_main") {setwd("evaluating_coregulation")} else {setwd("../evaluating_coregulation")} source("../downstreamer_functions.r") source("data/source_olivier.r") eqtlgen.cis <- read.table("data/cisQtlEnrichment.txt") metabrain.cis <- read.table("data/cisQtlEnrichmentBrain.txt") ...
756cb7e21ad1726ced68c7e02dfcd3aad06b19bff1b28f8dc36d3cec92b55e76
R
2,140
37
library(data.table) gn.expression <- fread("zcat /groups/umcg-wijmenga/tmp04/projects/depict2/depict2_bundle/reference_datasets/human_b37/expression_databases/31.07.pc1.illumina.wantedgenes.DESeqNorm_log2.duplicatesRemoved.ProbesWithZeroVarianceRemoved.CovariatesRemoved.txt.gz", data.table=F) rownames(gn.exp...
3b4e89f8794309abf489b7dcd1a609ccdd3f689a9daedf59ced80758d8e66b7a
R
2,142
61
```{r} setwd("evaluating_coregulation") source("../downstreamer_functions.r") source("data/source_olivier.r") files <- list.files("~/Desktop/depict2/collaborations/harm_jan/", pattern="*.xlsx", full.names=T) datasets <- list() for (file in files) { name <- gsub("\\_hg19\\_enrichtments\\_exHla\\.xlsx", "", basename(f...
d79e37633800289e8049d4f933ce9097ed0195b7d4ad4c5427d0df242095ea48
R
2,146
81
#' @tags result sequential library(future) plan(sequential) message("*** result() ...") ## A resolved future gives a FutureResult f <- future(42L) v <- value(f) res <- result(f) stopifnot(inherits(res, "FutureResult")) stopifnot(identical(res[["value"]], 42L)) ## Asking again returns the already collected result r...
414ef9ea90175cb366a4ebdfa281f32d1607c182359ce5cad7164a9362bbd8e2
R
2,151
69
########################################################################################## ## Create gene x gene co-expression matrix containing proportionality metric (rho) ## using human cortex gene expression matrix from Velmeshev 2019 (scRNA-seq) ## ## Author: Yu-Han Hsu ############################################...
d4dfebc7a6f42516faec0e1bd3854a1e41e373d4d99cb5c8f2875f17f069d25b
R
2,168
68
########################################################################################## ## Generate MAGMA common variant enrichment plots for ASD PPI networks ## ## Author: Yu-Han Hsu ########################################################################################## rm(list=ls()) library(ggplot2) # read ...
123744dd0ad3a5bb98220471c58edf00ac22d57ce7c2e5a965f7cdfdb8d44215
R
2,171
60
library(data.table) library(rtracklayer) dir <- "~/crg2/utils/wgs_gene_coverage/" print("Reading GTF file...") gtf <- readGFF("/hpf/largeprojects/ccm_dccforge/dccdipg/Common/genomes/hg19.ncbiRefSeq.gtf") ## Filter out additional chromosomes chr_names <- paste("chr", c(seq(1:22), "X", "Y"), sep="") gtf <- gtf[which...
36df7249584ce027e428e8becdc1cd276ec37cf5bbb2addadd82324a9d1423a1
R
2,174
54
library(tidyverse) TDPortal <- read.csv("All_Hits_Rat_Brain.csv", header = TRUE,check.names = FALSE) load("x53m.RData") ### Change headers to match TDPortal ### Remove redundant or extra columns w_cluster <- w_cluster %>% mutate(`Scan#` = `Scan(s)`) %>% select(-`Scan(s)`) %>% select(-NormRecal...
2a308aab160d32e4988c99e9b60332eb501a3da9253f6f8653a99e5777df9efe
R
2,181
60
load(file = "hpoEnrichmentSession4b.RData") str(recount3Zscores) pascalxZscores2 <- pascalxZscores colnames(pascalxZscores2) <- gwas$Name[match(colnames(pascalxZscores2), gwas$machine_friendly_id)] pascalDist <- as.dist(1 - cor(pascalxZscores2, use = "pa")) pascalDist[is.nan(pascalDist)] <- 1 pascalDist[is.na(pasc...
e58fe87ce9762c36cf414860427cf265c6c8e2b5050550010dc057009ffc60d6
R
2,184
61
load("allnetworks.RData", verbose = FALSE) done <- "models removed" doner <- "models remaining" trash <- list() trashcount <- 0 pb <- txtProgressBar(min = 0, max = length(bensface), style = 3) for (i in (1:length(bensface))){ if (colSums(bensface[[i]])[1] == 0){ trashcount <- trashcount+1 trash[trashcount] <-...
8fd3776e4d9b22d25a4a0c0fcfa3bfa527f50138589a5e182a49e385eb9664be
R
2,196
66
```{r} source("downstreamer_functions.r") setwd("gwas_simulations") source("data/source_olivier.r") files <- list.files(gwas.simulation.path, pattern=".*normalizedGenePvalues.txt", full.names = T) genep <- read.enrichments(files) # Read reference datasets ensembl <- read.table(ensembl.file, sep="\t", header=T, row.na...
e6ac9e43ef592e23c52858990ec669e5a878524e12d54db3148a15c34d9d4d54
R
2,197
89
#' @tags journal sequential library(future) journal <- future:::journal oopts <- options(future.journal = TRUE) plan(sequential) mkfuture <- function(x) { f <- future(x) value(f) f } f1 <- mkfuture(1L) f2 <- mkfuture(2L) message("*** journal() - Future ...") j <- journal(f1) print(class(j)) stopifnot(inher...
3277ea440cd4afd69518f55f51d3c53486c9ada0c1a28fb08b69033314e4e076
R
2,200
81
##' @importFrom nlme ranef ##' @export ranef NULL #' @title Extract random effects from galamm object. #' #' @srrstats {G1.4} Function documented with roxygen2. #' @srrstats {G2.1a} Expected data types provided for all inputs. #' #' @param object An object of class \code{galamm}, returned from #' \code{\link{galamm}...
71d1f6dd2375458eabb6e1ba1d323b1e7e4b6e05a088ca3888d5ad81d85987f1
R
2,200
84
#' @tags debug listenv #' @tags sequential multisession library(future) message("*** backtrace( ) - explicit future ...") f <- future({ 42L; stop("Woops") }) v <- value(f, signal = FALSE) print(v) calls <- backtrace(f) print(calls) message("*** backtrace( ) - explicit future ... DONE") message("*** backtrace( ) -...
75a0bf7665be41209b312eb6ec310f1b5aa15629ba9fca83d3e24e230a8d7c3b
R
2,213
70
library(R.matlab) library(dplyr) Sys.setenv(JAVA_HOME= "/usr/bin/java") #set java environment library(RDAVIDWebService) david<-DAVIDWebService$new(email="p.c.habets@lumc.nl", url="https://david.ncifcrf.gov/webservice/services/DAVIDWebService.DAVIDWebServiceHttpSoap12Endpoint/") david path_DEG <- file.choose() #choose...
c11d5ed98bbbb26a89c7ca3f0bacc27246562bf12ec64834e8863aa5e4c097e8
R
2,215
59
# # tstat.postprocessing.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/") ProbeAnnotati...
5da5e29badbca9802abbba3d41f1a34a7ff52673c6172505b8841aab1fe9d06f
R
2,224
70
#################################################################################### #' RISC data #################################################################################### #' #' The RISC object contains all the basic information used in single cell RNA-seq #' analysis, including raw counts/UMIs, normalized...
1a2fadf649c354053b2085732e51b26a04005558c4b331fd4b090efdbf469b13
R
2,228
59
#' GenesetHnv3 #' #' @param geneset geneset of interest. provided multipe genelist as a named list or as a character vector #' @param reference.network default HumanNetv3 #' #' @return a dataframe of genelist with connectivity, detected genes in the HumanNetv3 and the normalized connectivity #' @export #' #' @examples ...
2c4f2b510521b8836e7c8a3c231f2c96232940b8a8c229d20cf9b45668e2b9fb
R
2,229
93
setwd(dirname(rstudioapi::callFun("getActiveDocumentContext")$path)) library(tidyverse) gi.dc <- readRDS("../WGCNA/Colon/geneINFOall.rds") gries<-read.csv("griesprot.csv") keep=gries$p.li<0.05 gries.li<-gries[keep,] protnames<-strsplit(gries.li$Protein.Name,";") uniprot_mapping <- function(ids) { uri <- 'ht...
f7828df2dde8df1c26b8bcb95b93d1e7a2bd90ffaa75aba1f3585701aed68db2
R
2,232
66
library(Biostrings) library(tidyverse) library(nlme) library(ape) library(geiger) # PERMUTATIONS # SHUFFLE TILES TO TEST FOR INTRON SIGNIFICANCE #### #plot only the ones with GI and brain weight present +human1 activity --> 45 species btw pheno_data<-read_rds("pheno_data/pheno_data.rds") mammaltree<-read.tree("prote...
a6857850b53bf2f1de8e5662f27f88c1c9c5ff444e74b529494efd86b45027be
R
2,236
65
setwd("C:\\UMCG\\Genetica\\Projects\\Depict2Pgs") trait = "Height_v33/Height" library(readr) table_tmp <- read_delim(paste0(trait, "_eigen_Enrichment_betasExHla.txt"), delim = "\t", quote = "") eigenBeta<- as.matrix(table_tmp[,-1]) rownames(eigenBeta) <- table_tmp[,1][[1]] rm(table_tmp) table_tmp <- read_delim(pa...
b84c69ba330b4b47a0bf3501ceef03c462bec3a54fe7a5977e91645fb811ea31
R
2,241
71
#' @tags multisession #' @tags connections worker-termination #' @tags detritus-files library(future) options(future.debug = FALSE) message("*** multisession - connections must not leak when futures error ...") if (.Platform[["OS.type"]] == "windows") { ## This test takes very long to run on MS Windows (e.g. 5-10 ...
c150f88f9a5c03b7d3d5a5f50c3cd01207997dd78c850ec913abe6328c1da129
R
2,243
72
source ("Library.R") options(mc.cores = parallel::detectCores()) rstan_options(auto_write = TRUE) #####melanogaster#### d <- read.csv("normmax_imaging_4C_melanogaster.csv") d$x <- d$IPI d$y <- d$normmax observation <- list(N = nrow(d), x = d$x, y = d$y, Ninds = length(unique(d$ID)), id = d$ID) params = c(a0 = 0.1...
b4c19e4503c46860f1c82fcba8700f06efcde522fb66fa5075a7295b2b5bb4cc
R
2,247
87
--- title: "Statistics for age and sex - HCPEP and Cobre" 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, include=FA...
cc3c4b2c8079174233a469ad8c2002ea21b28564b3b91e20c5f7322aa49c78e1
R
2,256
70
plot_smooth <- function(object, ...) { UseMethod("plot_smooth") } #' @title Plot smooth terms for galamm fits #' #' @srrstats {G1.4} Function documented with roxygen2. #' @srrstats {G2.1a} Expected data types provided for all inputs. #' #' @description #' Plots smooth terms of a fitted \code{galamm} object. This fun...
583a99d71bb42f5d445d0f433510126280df843d56dd87c376127620bbadd637
R
2,260
61
```{r} if (basename(getwd()) == "downstreamer_main") {setwd("evaluating_coregulation")} else {setwd("../evaluating_coregulation")} source("../downstreamer_functions.r") source("data/source_olivier.r") library(UpSetR) # Cached 2021-04-16 #datasets <- read.downstreamer.batch(main.downstreamer.output.path, US...
4f15d21d01ad32663263e4536c1b5805b34e43918983581514c5aee6c3027634
R
2,262
56
require(ggplot2) require(viridis) require(UpSetR) require(ComplexHeatmap) require(plyr) df <- read.table("marker_name_list.csv", header=T, sep=",") df <- df[,-c(1)] df <- df[1:100,] print(head(df)) gdf <- read.table("rank_gene_list_celltype.csv", header=T, sep=",") gdf <- gdf[,-c(1)] gdf <- gdf[1:1000,] print(head(gdf)...
a1aad956beed1e658bcaad3090146cb40b1d0529bdc1d2e69b967e68709e2e9a
R
2,264
78
setwd("D:\\UMCG\\Genetica\\Projects\\Depict2Pgs\\output\\ds2\\") library(readxl) read.depict2 <- function(path, potential_traits=NULL) { if (is.null(potential_traits)) { potential_traits <- excel_sheets(path) potential_traits <- potential_traits[grep("Overview", potential_traits, invert=T)] } output...
5277dbad31c212edd251684f91adc42445fd7f96f6dac96365a2aa0d19ffc67d
R
2,268
50
#' geneciloc #' #' Function to calculate confidence intervals for dN/dS values per gene under the dNdSloc model using a Poisson ratio. #' #' @author Inigo Martincorena (Wellcome Sanger Institute) #' @details Martincorena I, et al. (2017) Universal patterns of selection in cancer and somatic tissues. Cell. 171(5):1029-1...
fe5f7070b443c53518f42bbd03b9f6d30b6e8a8043da55c71fc4ab45315bbc7a
R
2,268
79
## ## Generate a volcano plot from a data frame of genes, fold changes (log-scale), and p-values. ## plot_volcano = function(stats_df, gene_col, fc_col, p_col, fc_cutoff = 0, p_cutoff = 0.05, ...
ca9ddfcbc4b665d22f8bb270ad0826e12faf278e19f04e497795534af5411f8d
R
2,271
82
#' @tags cancel #' @tags detritus-files #' @tags detritus-connections #' @tags sequential multisession multicore library(future) options(future.debug = FALSE) strategies <- supportedStrategies() #strategies <- setdiff(strategies, "sequential") for (strategy in strategies) { message(sprintf("plan('%s') ...", strate...
821a3ec1d428d849c7fcd7cbf4b5f3fd814b4e7ca34e5dea36e735496dc68a49
R
2,277
47
if (!requireNamespace("devtools", quietly = TRUE)) install.packages("devtools") devtools::install_github("DKFZ-biostats/explainedVariance", dependencies = TRUE) library(explainedVariance) library(lme4) library(tidyverse) # load and prepare data reflectance <- read_csv("reflectance_clamping.csv") reflectance$stag...
9271898bb275ee8e9f97e68def5498ca8a6cf6dcdefd0af3dd4069cde9e0c42a
R
2,281
79
library(data.table) library(gridExtra) library(grid) library(ggplot2) library(lattice) library(viridis) library(optparse) option_list = list( make_option(c("-m", "--matrix"), type='character', help="Matrix to make pairwise hexbins of"), make_option(c("-o", "--outfile"), type='character', ...
ba3a69396c59c79fd07c304fda79c2bd877b8ead3f5b881db34cc05ba0fb4ee7
R
2,281
91
#' Outputs details on the current \R session #' #' @param env If TRUE, `Sys.getenv()` information is returned. #' #' @return Invisibly a list of all details. #' #' @importFrom utils sessionInfo #' @export #' @keywords internal sessionDetails <- function(env = FALSE) { ## Gather all details details <- list( "Sys...
68652bd882b71da452254f5c66f49fef6c9d1aa095a980a88fc275c94167bf76
R
2,282
57
# For ensembl readnames ensembl <- read.table("~/Documents/data/reference/ensembl/ensembl_gene_position_export.txt", sep="\t", header=T, stringsAsFactors = F) ensembl <- unique(ensembl[,c(1, 5)]) rownames(ensembl) <- ensembl[,1] # Read coregulation matrix cur.df <- read.table("~/Desktop/gene_network_niersteen_filtere...
420a746c2398a8e7b1c46b17e206f2edebb094cc8ae25c3637a2958e958eed0b
R
2,289
92
library(future) library(graphics) plot_what_is_done <- function(counts) { for (kk in seq_along(counts)) { f <- counts[[kk]] ## Already plotted? if (!inherits(f, "Future")) next ## Not resolved? if (!resolved(f)) next message(sprintf("Plotting tile #%d of %d ...", kk, n)) counts[[kk]] <...
6131f346a94f143937e3e8a26394212676d7dd9430814abb123c0e9cb3749f48
R
2,302
75
## Create a universally unique identifier (UUID) for an R object #' @importFrom tools md5sum uuid <- local({ ## We need to trick 'R CMD check' that 'md5' is a function already, ## because with md5 <- NULL, 'codetools' triggers a check NOTE. md5 <- function(x) { ## 1. Use the native tools::md5sum(bytes = ...),...
ddd8e9abc2a8f9cd7b28a3e403219cb27bc9dd2a926bade19e4c4c0a2ed0fdca
R
2,302
86
#' @tags relaying stdout #' @tags sequential multisession multicore library(future) message("*** Standard output ...") truth_rows <- utils::capture.output({ print(1:50) str(1:50) cat(letters, sep = "-") cat(1:6, collapse = "\n") write.table(datasets::iris[1:10,], sep = "\t") }) truth <- paste0(paste(truth_r...
c1ea2fa500447454f85c73017dadfbb07ee8c3526bba91083924c10b6aad1bed
R
2,309
80
#=========================# # 4.Prep target QC files # #=========================# ## Set up ---- filepath <- "" setwd(filepath) ### Load libraries ---- library(dplyr) library(magrittr) ## Sex checks (checking whether genetic and self-report match) ---- # Genetic QC files performed by Marzia Scelsi # Two different ...
207776bb838a2360f85c7c06f6326bad79ad8b48a86e802c54b00bf14acfe9a6
R
2,314
98
#' @tags rng rng-utils message("*** RNG ...") set_random_seed(seed = NULL) seed <- get_random_seed() stopifnot(is.null(seed)) set_random_seed(seed = 42L) seed <- get_random_seed() stopifnot(identical(seed, 42L)) res <- tryCatch({ seed <- as_lecyer_cmrg_seed(seed = FALSE) }, error = identity) print(res) stopifnot(...
55cb4adad7f2ca1acff666ab299eecaf75ba5ff805e596aa443fc516bd0899f5
R
2,317
52
## ----setup, include=FALSE----------------------------------------------------- knitr::opts_chunk$set(echo = TRUE, warning = FALSE, message = FALSE, fig.width = 7, fig.height = 6, fig.align = "center") ## ----------------------------------------------------------------------------- library(motif4node) library(ggplot2...