sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
de4ea67066e958e3b7d5669b7cbf4137bee068c43407511c79a0971f955083a7
R
1,654
24
### DTS script to attempt to pool some PI data into two groupsif there are more than two groups PoolGrps=FALSE if(NofGroups>2 & length(unique(groupdescriptions))==2 & PIs_present){ PoolGrps=TRUE #we have several groups, but only one control and one experimental group #find out which group belongs to which pool ...
630b7dbbcab99d7a59d8e87d432baf88efb4ca397e1fd5a566b402744926a99c
R
1,657
53
# Load libraries ---------------------------------------------------------- library(tidyverse) library(here) # Load data --------------------------------------------------------------- prop_ers_per_tissue <- readr::read_csv( here::here("results", "ers", "prop_ers_per_tissue.csv") ) # Main -----------------------...
a34d16e6519d818c3230ae32a6dffe9feab54e6d39d47e3989c6e358c23dfe8c
R
1,657
62
## Preprocessing data of Velmeshev et al., Science (2023) rm(list = ls()) library(tidyverse) # Lineage and branch-specific genes. df = readxl::read_excel('~/Dropbox/CWAS_paper_WD/Data/raw_annotations/Velmeshev2023_TableS2.xlsx') #df %>% # group_by(lineage) %>% # dplyr::count() %>% View() table(df$lineage) mge = c('...
4d2fb9255c051232a557f415c5cb356d817072ffa52c77181a6ebb71f42dc917
R
1,658
67
#!/usr/bin/env Rscript library(MOFA2) library(argparse) library(tidyverse) get_args <- function() { # create parser object parser <- ArgumentParser() parser$add_argument("--dataset-name", type = "character", default = NULL, help = "dataset key from params.yaml to use") args <- parser$parse_args() ...
f3a7de64221dce334b85a59de1013d5b2e9054ac412e3106caf9f65338117299
R
1,658
50
#' Extract Model Comparison Estimates #' #' @param model_data Object returned by \code{'hBayesDM'} model function #' @param ic Information Criterion. 'looic', 'waic', or 'both' #' @param ncore Number of cores to use when computing LOOIC #' #' @importFrom loo relative_eff loo waic #' @importFrom posterior as_draws_array...
e44b34637bef612bd5006765bd7b7ffd11b4dd220eb170c3a378b1d889624abd
R
1,665
42
#!/usr/bin/env Rscript --vanilla #load the libraries library(tidyverse) library(proBatch) #load the data #TODO: update "m_score" according to proper JPP outputpro good_columns =c("peptide_group_label", "filename", "Intensity", "m_score",'ProteinName') cols_to_get <- rep(list(col_guess()), length(good_columns)) names(...
c5a6cc50036e48af4900300b1b167f14a7bba939783a2d65d38bce055bdcafef
R
1,670
33
#!/usr/bin/env Rscript --vanilla #load the libraries library(readr) library(dplyr) library(stringr) #load the given annotation sample_annotation_original <- read_delim('data_PanCancer/1_original_data/annotation_col_anova_PCP_final.txt', delim = '\t') #adapt sample annotation sample_annotation_PanCancer = sample_anno...
6c5e802ec1cbda1b5468d440555e6ca3a0d3ad58e79bc9976c8d83cd91748b1d
R
1,674
43
## Summarizes data. ## Gives count, mean, standard deviation, standard error of the mean, and confidence interval (default 95%). ## data: a data frame. ## measurevar: the name of a column that contains the variable to be summariezed ## groupvars: a vector containing names of columns that contain grouping variable...
22c30c18276599b590324e6755155dbb98aae3a0473fae5f787acf9808a0fc00
R
1,675
45
#9 Macrophage # Setup--------------------------------------------------------------- rm(list = ls()) ; gc() ; gc() set.seed(1234) wdir <- 'set your working directory' setwd(wdir) save.path <- 'object folder path' # load library easypackages::libraries(c('Seurat','tidyverse','fgsea','msigdbr','escape','org.Hs.eg.db')...
f94816d68c4bca9575c431f4df3c299bb5ce832b34fcb27ff215003c604edb4e
R
1,679
63
## ## subjective arousal data ## library(ProjectTemplate) load.project() arousal.long <- arousal %>% gather(condition,arousal,-Participant) %>% separate(condition, into=c("condition","time"), sep="_") %>% mutate(condition=relevel(factor(condition), ref="BL"), time=relevel(factor(time), ref="before")) a...
f1f2dd6f9518eba0d4603530b595fff99e5ae5f872e16a58904de7c58acc804b
R
1,685
52
library(UpSetR) library(jsonlite) library(yaml) #library(ggplot2) #library(tidyverse) build_combinedModuleList<-function(stages){ #Parameters # stages:named list of modules containing filepath to model module json file containing gene/protein names/symbols combined_modules<-c() for (stage in names(stag...
6a0f1241352f6b128b0fa8c4f2101bd0866b889c036ebd33fe74c1b3d00b338f
R
1,688
47
# Load libraries ---------------------------------------------------------- library(tidyverse) library(here) # Load data --------------------------------------------------------------- df_lncRNA_genes_IDB_tidy <- readRDS( here::here("results", "intron_db", "prop_genes_IDB_threshold_5.rds")) # Main ---------...
ed6b6d64bc6ebc0ec6f9ea1d806433ac3a308d6b4c9147a05013642afcdf7200
R
1,688
41
#' @templateVar MODEL_FUNCTION ug_bayes #' @templateVar TASK_NAME Norm-Training Ultimatum Game #' @templateVar TASK_CODE ug #' @templateVar MODEL_NAME Ideal Observer Model #' @templateVar MODEL_CODE bayes #' @templateVar MODEL_CITE (Xiang et al., 2013) #' @templateVar MODEL_TYPE Hierarchical #' @templateVar DATA_COLUMN...
28ad519fdbf212154d59f569376f94e2dd8cda547e50f816f322d9986268f830
R
1,690
53
wiggle2Hilbert <- function(wiggleRle, image.dir, datName) { # Requires an rle object imported using rtracklayer::import.bw - v.slow and # lots of memory required for bp resolution bigwig files. # remove non-canonical contigs # generate hilbert curves and plot as png - save in image.dir suppressPackageS...
37bc3b2fe5696e3ca5fb39774e301e270d8875f1789f3f656b046ef3d88674b4
R
1,699
53
#3 Annotation # Setup--------------------------------------------------------------- rm(list = ls()) ; gc() ; gc() set.seed(1234) wdir <- 'set your working directory' setwd(wdir) save.path <- 'object folder path' # load library easypackages::libraries(c('Seurat','tidyverse')) # Annotation---------------------------...
34604b19dd84ce696c6c8bc8e857b6fa57ab680196b6e30126ce0429ba52f09c
R
1,701
26
#' Fit generalized linear model under the null hypothesis for unrelated samples. #' #' The \code{fit_null_glm} function is a wrapper of the \code{\link{glm}} function from the #' \code{\link{stats}} package that fits a regression model under the null hypothesis for #' unrelated samples, which provides the preliminary s...
e5cfbb4279c470e78740da81611006953fd21a813809de2ee84593a742c3fb9c
R
1,706
54
#' Datasets with various missing data patterns #' #' Four simple datasets with various missing data patterns #' #' Van Buuren (2012) uses these four artificial datasets to illustrate various #' missing data patterns. #' #' @name pattern #' @aliases pattern1 pattern2 pattern3 pattern4 #' @docType data #' @format \descri...
888e81375816bface3d67a4cedd172b69724994fe4d4bd9666dacb3d072e5966
R
1,711
47
data('factRsample') samples <- c("SampleA.Rep1", "SampleA.Rep2", "SampleB.Rep1", "SampleB.Rep2") # simulate library size set.seed(1987) lib.sizes <- sample(10000:14000, size = length(samples)) # get list of transcripts txsData <- featureData(factRsample[["transcript"]]) txs.length <- txsData$width txs.n...
32a3d98dbc07b3393602cf174de524367a91abfccc2cd5f556b70df974e62e4e
R
1,712
41
##' @title Filter out duplicated samples ##' @description Filter out samples that are sequenced for two or more times ##' @param metadata metadata parsed from \code{\link{gdcParseMetadata}} ##' @return A filtered dataframe of metadata without duplicated samples ##' @export ##' @author Ruidong Li and Han Qu ##' @example...
8693b677e93a05cc3796c7fb037248061e77d85b6287dfa9893bb62f7f7d1a99
R
1,715
57
#!/usr/bin/Rscript ## Import Libraries library("DESeq2") library("ggplot2") ## Import counts matrix cts <- as.matrix(read.csv("../../../data/bernardo/processed/04.deseq2/gene_counts_unfiltered.tsv", sep="\t", row.names="gene_id")) ## Import metadata coldata <- read.csv("../../../data/bernardo/processed/04.deseq2/e...
4f31d54aa026faded0b945cbba5bbc91c84e41bc5675ee74bb17db8ac0dbe3c0
R
1,717
51
args = commandArgs(TRUE) eta=as.numeric(args[1]) max_depth=as.numeric(args[2]) gamma=as.numeric(args[3]) min_child_weight=as.numeric(args[4]) nrounds=as.numeric(args[5]) data_folder=as.character(args[6]) sex_split=try(as.logical(args[7])) BrainAgeFull = function(eta, max_depth, gamma, min_child_weight, nrounds, data...
60959b975b9ee5adeef493301a207e37825ebe16955a5f7d198137a891fd4d8e
R
1,717
56
#' Expand axis limits #' @description Force to extend the coordinate range of the ggplot object. #' @param x,y NULL (default) or numeric vector. #' @rdname expand_axis #' @examples #' quickcor(mtcars) + geom_square() + expand_axis(x = -3) #' quickcor(mtcars) + geom_square() + expand_axis(y = 16) #' @author Houyun Huang...
62ef8eeb942ca7596c5d80e0b7b2d77c5e6ea8b46a8a383f70d12ecb795cfc44
R
1,718
49
--- title: "Transcript_profile" --- This section of the report details all of the profiles that have been collected and collapsed accross the transcript profile. ```{r Transcript_profile, comment=FALSE, echo=FALSE, cache=FALSE} library(knitr) library("RSQLite") library("DBI") library(stringr) library("rmarkdown") # ...
15b74c8d030971c130db1097b5febabab6bf170c67594c4b9a2be30c613cb39e
R
1,721
53
#### Functional enrichment analysis with g:Profiler library(dplyr) library(gprofiler2) save_ggplots <- function(fn, p, w, h){ for(ext in c('.pdf', '.png', '.svg')){ ggsave(paste0(fn, ext), plot=p, width=w, height=h) } } load_eqtl <- function(){ fn <- "../../_m/BrainSeq_sexGenotypes_4features_3reg...
3b2362b6a094bd9c08d72142056c284ae748fb1ee95ee5a4ef942be814781c1e
R
1,727
23
### DTS script to Initialize empty lists where data are collected grouped.PIprofiles <- list() #PIProfile data frames in a list of length NofGroups grouped.Categories <- list() #For saving categories within groups grouped.PIcombined <- list() #For categorical color coding of PIs grouped.periods <- list() #Pe...
79ac10734512787c9c13c16105524690c15b16e20580fb564ec12c974e14bb89
R
1,730
44
# this top-level script may be used to run (knit) the individual # Rmd files # set up output path for the reports config <- yaml::read_yaml("config.yaml") # # example 1: knit one specific file # rmarkdown::render(input = 'Rmd/example.Rmd', # output_dir = report_dir, # knit_root_dir...
0cd89e3da125e8b89aae814ae2db014a6e81f25f38ad9927d6cf91f839073bcd
R
1,731
36
## ## descriptive plots for paper ## library(ProjectTemplate) load.project() ## ACC learn %>% filter(ACC>=0) %>% group_by(Participant, condition, pair) %>% summarise(ACC=mean(ACC),RT=mean(RT)) %>% group_by(condition,pair) %>% summarize(mACC=mean(ACC),semACC=sem(ACC), mRT=mean(RT), semRT=sem(RT)) %>% ungroup %>%...
dabfbf48a267b6461f5795572f9aa9e37b0c4f46740bca1d5f4a5ecce1a9c6c2
R
1,731
71
# ---- D1 ---- imp <- mice(nhanes2, print = FALSE, m = 10, seed = 219) fit1 <- with( data = imp, expr = glm(hyp == "yes" ~ age + chl, family = binomial) ) fit0 <- with(data = imp, expr = glm(hyp == "yes" ~ 1, family = binomial)) empty <- with(data = imp, expr = glm(hyp == "yes" ~ 0, family = binomial)) # stat1 <-...
2a3a7b32d87279d403ae81f5b7050946ab6f429b93f8a97c69afc44fdee3bbc5
R
1,732
34
###DTS script to create superimposed histograms from the test periods of two groups if (NofGroups==2){ if('yt' %in% sequence$type || 'sw' %in% sequence$type) #for yt or sw experiments, collect fly data { if(x==1){ histo1 <- data.frame(pooled.data[[learningscore]][["fly"]]) histo1$v2 = groupnames[x]...
fa117e2fcec1a8830d965cfda3999df12e3114412bd21d76e839a3464ff513c6
R
1,735
54
## mean transition probabilities ## act_id_1 <- sc_5@active.ident act_id_2 <- sc_6@active.ident rv_1 <- nsc1_tp_5 #Step 3 result for control rv_2 <- nsc1_tp_6 #Step 3 result for TBI exp_1 <- "Control" exp_2 <- "TBI" int_cl_name = "NSC-stage1" #interested cluster name neighbours = c("NSC-stage1","NSC-stage2","RG-l...
a624a5866a149a078306923de7006dc1a0e289712d627d22cf923d0cd8dff7a1
R
1,736
52
test_that("QUICKPRED-001: returns square binary matrix", { predictorMatrix <- quickpred(nhanes) expect_true(is.matrix(predictorMatrix)) expect_equal(nrow(predictorMatrix), ncol(predictorMatrix)) expect_in(predictorMatrix, c(0, 1)) }) test_that("QUICKPRED-002: mincor supports scalar, vector, matrix", { n_col...
1016d955709e4e122ac0061a0cbb4b78f2334291cc5101a235ba74d0b5f25d44
R
1,742
59
#!/usr/bin/Rscript ## Import Libraries library("DESeq2") library("ggplot2") ## Import counts matrix cts <- as.matrix(read.csv("../../../data/bernardo/processed/04.deseq2/gene_counts_unfiltered.tsv", sep="\t", row.names="gene_id")) ## Import metadata coldata <- read.csv("../../../data/bernardo/processed/04.deseq2/e...
7be29b653fe476e1be8d1dd35b3285830fb60ec92783231397915ba22abd3b10
R
1,746
57
#!/usr/bin/Rscript ## Import Libraries library("DESeq2") library("ggplot2") ## Import counts matrix cts <- as.matrix(read.csv("../../../data/bernardo/processed/04.deseq2/gene_counts_unfiltered_no_introns.tsv", sep="\t", row.names="gene_id")) ## Import metadata coldata <- read.csv("../../../data/bernardo/processed/...
cf35e8195f4cae25cbd82e33d8014db827becb6cfceaba30588c096000fbe558
R
1,752
77
## Plot frequency of intersecting responses for timepoint by tissue library(UpSetR) library(tidyverse) library(magrittr) library(janitor) ALPHA = snakemake@params[["ALPHA"]] MIN_LOGFC = snakemake@params[["MIN_LOGFC"]] filtered_results <- snakemake@input[[1]] %>% # here::here("results/limma_maternal_lung/fold_c...
fcec54888bdd6037290bb98f97e3e416f5ac767f82700768c56f10109cb72284
R
1,752
44
## Download the supplementary table for Darbandi et al., bioRxiv (2023) and convert it to bed files ## https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE248876 library(tidyverse) d0 = readxl::read_excel('~/Dropbox/Resources/Human_5TF_20230829/TableS3_5TRa_Peaks_May23.xlsx', sheet = 'Human_5TRa_Wide') table(d0$pro...
9525c36a06e249068aefb0f1b1169fb1aeeada9a7a8918d6da3f92fbb1bc3fde
R
1,756
64
#' Corece to a graph_tbl object #' @description Functions to coerce a object to graph_tbl if possible. #' @param x \code{R} object. #' @param directed logical value, whether or not to create a directed graph. #' @param ... extra params. #' @return tbl_graph object. #' @importFrom tidygraph tbl_graph as_tbl_graph #' @r...
fc6bbae6a6c0f39dfcb9982e71dcafa5a7c8abef0199f5120e2861ff51cb7883
R
1,760
60
#' Complete case indicator #' #' #' The complete case indicator is useful for extracting the subset of complete cases. The function #' \code{cci(x)} calls \code{complete.cases(x)}. #' The companion function \code{ici()} selects the incomplete cases. #' #' @name cci #' @param x An \code{R} object. Currently supported ar...
32acd0e8c6478e551e1e2643446fb71f77b5326efeca50b82c6df08c48da2a8e
R
1,762
59
## caching single variables based on filename ## http://stackoverflow.com/a/15373917/972791 this.file.name <- function() { cmdArgs <- commandArgs(trailingOnly = FALSE) needle <- "--file=" match <- grep(needle, cmdArgs) if (length(match) > 0) { # Rscript return(normalizePath(sub(needle, "", cmdArgs[matc...
23866c3f288ac980c62c976ae7a2a5326a6daef210ab6bf4727c11a489635179
R
1,764
58
## This script generates plots for GSEA analysis. suppressPackageStartupMessages({ library(dplyr) library(ggplot2) }) save_plot <- function(p, fn, w, h){ for(ext in c('.svg', '.pdf')){ ggsave(file=paste0(fn,ext), plot=p, width=w, height=h) } } get_top_GO <- function(tissue){ new_tissue <-...
873ad4604f6edfbb32500b2745480196035fc92cd42ab40f6efe09bce0c3d470
R
1,766
67
#!/usr/bin/env Rscript source(here::here("src/shared/R-helpers/get_settings.R")) source(here::here("src/shared/R-helpers/cohort_to_factors.R")) source(here::here("src/shared/R-helpers/deseq2_analysis.R")) suppressPackageStartupMessages({ library("dplyr") library("readr") }) settings <- get_settings(omic = "rnas...
2e060caffce2858e23ebb154c69b43af76c38845ab03e9ae808bb99a2a9d557d
R
1,774
54
############################################################################# # #Updated by: Yiqin Wang #TODO #to add similiar functionalities in annot # ############################################################################## args <- commandArgs(trailingOnly = TRUE) var <- read.table(args[1], header = T, sep="...
40f2e3e650e54c194413c71ada7b473faef3a35d4f4ca281088f4fbdb7d3d0eb
R
1,780
42
library(scMarkerViz) library(ggplot2) library(dplyr) # Cell type colors (consistent with 07_plot.R) celltype_cols <- c("Oligodendrocytes" = "#E3EDC0", "Microglia" = "#F2CA8D", "Astrocytes" = "#C1E6F3") csv_pattern <- 'all_DEGs\\.csv$' fc_cutoff <- 0.25 # |log2FC| threshold pval_cutoff <- 0.05 # p-value threshold ...
ae9a2bcf065d6d8e532cb26b297f861fa2687ae6ebfd20dfc5f3dd145f84f6fc
R
1,786
48
library(dplyr) library(tibble) # Make sure R's working directory is in the correct spot to make relative paths resolve correctly if (rstudioapi::isAvailable()) { setwd(dirname(rstudioapi::getActiveDocumentContext()$path)) } else { # If running as a script, finding the file is harder # https://stackoverflow.com/a...
7fc05ff4fa344c980d5040230c27109e114c58e6e8ee4ab8eea7eb667ff0113f
R
1,787
68
set.seed(1) td <- matrix(rnorm(20), nrow = 5, ncol = 4) dimnames(td) <- list(1:5, LETTERS[1:4]) y <- td[, 1] ry <- rep(TRUE, 5) # data frame for storing the event log .mice.state <- list(it = 0, im = 0, dep = "y", meth = "test", log = FALSE) loggedEvents <- data.frame(it = 0, im = 0, dep = "", meth = "", out = "") f...
5045c060ef93bacbae9ffd4369671c8062c484f15ee24fce61af7d11f37b3e17
R
1,789
70
#' Creates a \code{visitSequence} argument #' #' This helper function creates a valid \code{visitSequence}. The #' \code{visitSequence} is an argument to the \code{mice} function that #' specifies the sequence in which blocks are imputed. #' @inheritParams mice #' @return Vector containing block names #' @seealso \code...
ccaac8a8a6ac018786c30026d2a2bca54303f04c44053008bab857e4f22d83d8
R
1,790
57
#!/usr/bin/env Rscript source(here::here("src/shared/R-helpers/get_settings.R")) source(here::here("src/shared/R-helpers/cohort_to_factors.R")) source(here::here("src/shared/R-helpers/deseq2_analysis.R")) suppressPackageStartupMessages({ library("readr") }) settings <- get_settings(omic = "srna", stage = "deg", da...
e7a0d037bb450d7dd680269b6d5112d5306640cfdaa258e28b33dfea5b8ceaf6
R
1,790
46
#' Plots the histogram of MCMC samples. #' #' @param sample MCMC samples #' @param title Character value containing the main title for the plot #' @param x_lab Character value containing the x label #' @param y_lab Character value containing the y label #' @param x_lim Vector containing the lower and upper x-bounds of ...
edfceecee0bdf56757e39c0db38ecc4ef6cd1538d82baf853dda6f576840aa12
R
1,790
65
#' Corece to a igraph object #' @description Functions to coerce a object to igraph if possible. #' @param x \code{R} object. #' @param directed logical value, whether or not to create a directed graph. #' @param ... extra params. #' @return igraph object. #' @importFrom igraph graph_from_data_frame as.igraph #' @rdna...
3da4a2f91ec7c277b155b1295654d8b6fb6d9b9c72c1ec898b7befcbda5b8e12
R
1,794
51
# Load libraries ---------------------------------------------------------- library(tidyverse) library(here) # Load data --------------------------------------------------------------- # Parent genes parentgenes <- readRDS(here::here("results", "pseudogenes", "parentgene_annotated.rds")) # Main --------------------...
96ec80c268d3ea464511a15495098092ae7219e69910fd44a2f045cf255c53cd
R
1,802
49
#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...
c3050b938a79adac98e2543f104db7af9cd85146d8905468e4fe0326166d5a4c
R
1,807
73
# # regression model with random intercepts per subject for RTs # library("ProjectTemplate") load.project() library(rstan) # enabls --force for stallo etc. options <- commandArgs(trailingOnly = TRUE) if( "--force" %in% options) uncache.all() bname<-tools::file_path_sans_ext(basename(this.file.name())) mod.fname=spr...
4b65c2b7fbfed43dc36759f67ca6a67c97c1ea399f77b5d184ce4d4acfc89af5
R
1,808
41
#' @templateVar MODEL_FUNCTION ug_delta #' @templateVar TASK_NAME Norm-Training Ultimatum Game #' @templateVar TASK_CODE ug #' @templateVar MODEL_NAME Rescorla-Wagner (Delta) Model #' @templateVar MODEL_CODE delta #' @templateVar MODEL_CITE (Gu et al., 2015) #' @templateVar MODEL_TYPE Hierarchical #' @templateVar DATA_...
3e01ae776231fdd158f3bfd1289e4815cc1568bdb3acc36b5215742c5f75219d
R
1,816
53
#2 Normalization, Dimention reduction, Batch correction # Setup--------------------------------------------------------------- rm(list = ls()) ; gc() ; gc() set.seed(1234) wdir <- 'set your working directory' setwd(wdir) save.path <- 'object folder path' # load library easypackages::libraries(c('Seurat','tidyverse',...
a1f1c152cfa1e63ee08f513cec6da3d350fae0229e782f8623a46d8b7844d2be
R
1,829
62
#' Compare several nested models #' #' @rdname anova #' @param object Two or more objects of class \code{mira} #' @param method Either \code{"D1"}, \code{"D2"} or \code{"D3"} #' @param use An character indicating the test statistic #' @param ... Other parameters passed down to \code{D1()}, \code{D2()}, #' \code{D3()} a...
d420b3a8542ec720f46a9926ebebaf4be300ffc1c935ff1fecf4e7e7d7aff12e
R
1,849
45
#' Function for extracting Rhat values from an hBayesDM object #' #' @description #' A convenience function for extracting Rhat values from an hBayesDM object. Can also #' check if all Rhat values are less than or equal to a specified value. #' If variational inference was used, an error message will be displayed. #' #...
b6d5b03eb4c783609aacbb6b57407529289c1fb1659640caca758dbd22cfa712
R
1,850
39
getwd() df = read.csv("df_exp1.csv") head(df) library(ggplot2) library(ggsignif) df$Model=factor(df$Model,level=c("NetTCR-1.0","NetTCR-2.0","ERGO_LSTM","ERGO_AE","DLpTCR","HeteroTCR")) p = ggplot(data=df,aes(x=Model,y=AUC,fill=factor(Score)))+ labs(x="",y="AUC",fill="VDJdb confidence score")+ stat_boxplot(g...
d5d8332d1da70b7d9d4aab36f17918f2fff90dff50cb03cd0bf7b828d9b7b659
R
1,852
50
## This script runs a specific chunk suppressPackageStartupMessages({ library(argparse) library(mashr) library(dplyr) }) save_results_chunk <- function(chunk_num, outdir){ ## Load data load("model_variables.RData") load(paste0(outdir,"/chunk_",chunk_num,"_bhat_shat.RData")) ## Run mash on c...
7696e46258512f704d12b1bfb8d2157c81b57397fb29f50f80c53d5a510f5e32
R
1,856
72
--- title: "Mapping quality" --- This page details the mapq results following running the tool bamstats. ```{r mapq_plot, echo=FALSE} library(knitr) library("RSQLite") library("DBI") library(stringr) library("rmarkdown") # Make cool dynamic documents library("knitr") # Run R Code Chunks library("ggplot2") # For plo...
55eb855ff00eb0bff0090f85845528bc679dd4185079c6eefeb57337dd0022a3
R
1,862
50
#1 Data preparation, Quality control # Setup--------------------------------------------------------------- rm(list = ls()) ; gc() ; gc() set.seed(1234) wdir <- 'set your working directory' setwd(wdir) save.path <- 'object folder path' # load library easypackages::libraries(c('Seurat','tidyverse')) # make seurat ob...
3ed3d8846aecd9d672361f50cf71bb6b9c88d9d78a54909c7a6b6d53cea406b7
R
1,865
65
--- title: "Bcell PHX postprocessing" author: "Jonas Fischer" date: '`r Sys.Date()`' output: html_document --- ```{r setup, include=FALSE} require(ggplot2) require(ggthemes) library(ggrepel) require(viridis) require(clusterProfiler) library(org.Hs.eg.db) library(enrichplot) library(pathview) ``` ## B cell GRN analysi...
cfbda91e9cc52af62b39cea85593062b7d4dd324842ab5ac924a4aeae6eb2b9a
R
1,867
63
get.dfcom <- function(model, dfcom = NULL) { # Input: a fitted model # residual degrees of freedom of model fitted on hypothetically complete data # assumed to be the same across imputations if (!is.null(dfcom)) { return(as.numeric(max(dfcom, 1))) } # first, try the standard df.residual() function d...
332b6b6278506a9aa5fcd5ccb562d659d6c17fddbbcffa0b3e9b370f70c1ef49
R
1,869
49
set.seed(66322) y <- popmis$texp y[rbinom(length(y), size = 1, prob = 0.5) == 1] <- NA x <- popmis[, c("pupil", "school", "sex")] ry <- !is.na(y) wy1 <- !ry wy2 <- rep(TRUE, length(y)) wy3 <- rep(FALSE, length(y)) wy4 <- rep(c(TRUE, FALSE), times = c(1, length(y) - 1)) type <- c(1, -2, 1) yn <- y test_that("MICE-IMPUT...
4022d84f0b61e1fef7936a1d01491821d125179e74f4a9ca5b8cfa307316e153
R
1,869
85
# Load libraries ---------------------------------------------------------- library(tidyverse) library(here) library(ggtranscript) library(plyranges) # Load data --------------------------------------------------------------- probes <- read_csv(here::here("data", "probe_design_final.csv")) ref <- rtracklayer::i...
d00e630e192c19ca34f6b6c1cf65f9c9f451d4df3f9a000f6a07b0dbcab3dd65
R
1,871
42
#' @templateVar MODEL_FUNCTION wcs_sql #' @templateVar CONTRIBUTOR \href{https://ccs-lab.github.io/team/dayeong-min/}{Dayeong Min} <\email{mindy2801@@snu.ac.kr}> #' @templateVar TASK_NAME Wisconsin Card Sorting Task #' @templateVar TASK_CODE wcs #' @templateVar MODEL_NAME Sequential Learning Model #' @templateVar MODEL...
aa53d73d4ddf2f8e60a1a69ce8db2bf58b3ef0e5f6f94d2ec667ea54a21155c5
R
1,878
43
library(biomaRt) library(tidyverse) library(here) library(diffloop) # Load data --------------------------------------------------------------- # take the mim2gene list mim2gene <- readr::read_delim("https://omim.org/static/omim/data/mim2gene.txt", delim = "\t", skip = 4) # Main ------------------------------------...
50b8647973ff8f9d0bdaecebf58ab3150630fab6be21278746b118545c701baf
R
1,888
26
#Note: #To make a brain cell type GMT, for each species (mouse, rat, human) I will need to combine together DropViz_HC, DropViz_STR, BrainInABlender, Zeisel, and any relevant cell types in C8, and regional patterns from CombinedHCspecific_mouse #Some of these things may be easier to do in Excel (e.g., adding Zeisel an...
f7ac83ff99f0739bcce5db8dbe77d459f9c703bd91b3cc913dc520fe85090669
R
1,903
70
#' Set the theme for the plotting Trellis functions #' #' The \code{mice.theme()} function sets default choices for #' Trellis plots that are built into \pkg{mice}. #' #' @aliases mice.theme #' @param transparent A logical indicating whether alpha-transparency is #' allowed. The default is \code{TRUE}. #' @param alpha....
c7194f957263f1f26ec7aacfd28fb01d5178ae0a761f2058dd6b86e320a10e2e
R
1,904
65
library(ggplot2) library(dplyr) if (rstudioapi::isAvailable()) { setwd(dirname(rstudioapi::getActiveDocumentContext()$path)) } else{ # If running as a script, finding the file is harder # https://stackoverflow.com/a/55322344/10930590 this_file <- commandArgs() %>% tibble::enframe(name = NULL) %>% tidyr...
4797f38bef4ffb1122912e0718e866dbd6688714c3cfd010634ba716ba73ccd3
R
1,905
43
#' @templateVar MODEL_FUNCTION bandit4arm_4par #' @templateVar TASK_NAME 4-Armed Bandit Task #' @templateVar TASK_CODE bandit4arm #' @templateVar MODEL_NAME 4 Parameter Model, without C (choice perseveration) #' @templateVar MODEL_CODE 4par #' @templateVar MODEL_CITE (Seymour et al., 2012) #' @templateVar MODEL_TYPE Hi...
27f1871c0bc13898c06fec17f26f3d343f0ad98627b7927ab1cd56265aecc7d6
R
1,907
47
library(data.table) library(stringr) ### clean otter tf names to align with desmedt otter_motif_prior <- fread("C:/STUDIES/RESEARCH/ODE_project_local_old/breast_cancer_data/cancer_breast_otter_motif.csv") otter_tf_names <- data.table(tf = setdiff(names(otter_motif_prior),"Row")) desmedt_gene_names <- fread("C:/STUDIE...
ad727a2923aeba1ae0787189445681d7abdb644841d44fb179bb9f19cd0896f4
R
1,907
49
library("ProjectTemplate") load.project() str(transfer) chooseA <- transfer %>% mutate(Atrial=ifelse(symb1=="A"|symb2=="A",1,0)) %>% filter(Atrial>0) %>% group_by(Participant,condition) %>% summarise(chooseA=sum(choice=="A", na.rm=T)/n()) %>% data.frame avoidB <- transfer %>% mutate(Btrial=ifelse(symb1=="B"|symb2...
3cf146ecf985054f24f6593791a7546ac51258bac941ba023b57b22b5f04f863
R
1,919
43
########################################################################### ## Author: Youtao Lu <luyoutao@sas.upenn.edu> ## ## Copyright (c) 2021-2023, Youtao Lu and Junhyong Kim, Department of Biology, University of Pennsylvania ## Copyright (c) 2021-2023, James Eberwine, Perelman School of Medicine, University of ...
3694d11dc0552d9a0f44a2f86ccddbad1ea23e508d1519277bd58b71937710de
R
1,922
73
source('~/scripts/single_cell/de.R') source('~/scripts/single_cell/atac.R') source('~/scripts/perturbator/de.R') source('~/scripts/perturbator/enrichment.R') library(Pando) library(doParallel) registerDoParallel(36) filter <- dplyr::filter select <- dplyr::select dist <- stats::dist Matrix <- Matrix::Matrix setwd('...
a8c1b1ca74acd8f3a9c53740cecee698b852a577ac4f199d93d52a65acaaee1f
R
1,922
66
## Generate supplemental material for colocalization results suppressPackageStartupMessages({ library(doParallel) library(foreach) library(dplyr) library(here) }) get_coloc_signal <- function(tissue){ cols = c("cluster_name", "N_SNPS", "eQTL_PIP", "GWAS_PIP", "GWAS_PIP_prior", "RCP") ...
5ce494b5d62a2b12a6863953b5a56234290f5394ce1101cc2b4bb467be331dbb
R
1,927
93
--- title: "Supplementary material: Principal component analysis" author: "Martin Dessart" date: "11/09/2023" output: html_document: toc: true theme: united pdf_document: default word_document: default --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE,fig.width=15,fig.height=8) ``` # Pre...
c66e6a678f84d940b19cdeafd16a065d28ed56a74c65b9dd9a33b5c743f059b5
R
1,928
56
library(lme4) library(multcomp) library(lmeresampler) library(readxl) # ----------------------------------------------------- # Load in the data # ----------------------------------------------------- data <- read_excel("/Users/jkosnoff/Library/CloudStorage/Box-Box/Joshua-Speller-Paper/Manuscript/nCommu/Source Data.xl...
5f73887b9524cfa54551311b9c7d73fa826d573ec7fc3208608a50b6d4518b88
R
1,929
44
#' @templateVar MODEL_FUNCTION bart_ewmv #' @templateVar CONTRIBUTOR \href{https://ccs-lab.github.io/team/harhim-park/}{Harhim Park} <\email{hrpark12@@gmail.com}>, \href{https://ccs-lab.github.io/team/jaeyeong-yang/}{Jaeyeong Yang} <\email{jaeyeong.yang1125@@gmail.com}> #' @templateVar TASK_NAME Balloon Analogue Risk T...
31921b0f204dcda36452a7e682a5768484fae17a5e9ca3787cbdfc8f926f0831
R
1,930
71
library(epitools) # Check HERV-K feature association # Replace with relevant values dd <- matrix (c(10,20,30,40), nrow=2, ncol=2, byrow=TRUE) outc <- c("herv_als", "other_als") herv <- c("down", "up") dimnames(dd) <- list("HERV feats" = herv, "Outcome" = outc) epitools::oddsratio.fisher(dd, rev = "c")...
5374dc7dd46dc44480600ecfd011e23b3ea2d50de69063f11cb4aa5159109778
R
1,930
40
#' Mammal sleep data #' #' Dataset from Allison and Cicchetti (1976) of 62 mammal species on the #' interrelationship between sleep, ecological, and constitutional variables. #' The dataset contains missing values on five variables. #' #' Allison and Cicchetti (1976) investigated the interrelationship between #' sleep,...
cf1738efae576bf6ae09b2caebd4067eceb059cd065b4431fea2de6d0b392944
R
1,931
57
library(lme4) library(multcomp) library(lmeresampler) library(readxl) # ----------------------------------------------------- # Load in the data # ----------------------------------------------------- data <- read_excel("/Users/jkosnoff/Library/CloudStorage/Box-Box/Joshua-Speller-Paper/Manuscript/nCommu/Source Data.xl...
aa3e51a21f71e71ac2d1c4c5bc9077605827ea664d59796708eea6fe2ffdb130
R
1,933
64
## code to prepare `OUTLIERS` dataset goes here library(data.table) library(sinew) library(MotrpacRatTraining6moData) OUTLIERS = fread("data-raw/outliers.tsv", sep='\t', header=T) OUTLIERS[,viallabel := as.character(viallabel)] # fix tissue OUTLIERS[,tissue_code := gsub(",.*","",tissue)] # remove MSSM outliers OUTLIE...
14345a35f0db86796593c758c203df3071459b6e1c54919be27b20fb0c37e582
R
1,935
51
library(data.table) library(stringr) ### clean otter tf names to align with miasedt otter_motif_prior <- fread("C:/STUDIES/RESEARCH/ODE_project_local_old/breast_cancer_data/cancer_breast_otter_motif.csv") otter_tf_names <- data.table(tf = setdiff(names(otter_motif_prior),"Row")) mias_gene_names <- fread("C:/STUDIES/R...
057d6c960c08c8f1d666ceeeda68ab2f6bec7e33ac40fbf1f241ca1c6497c015
R
1,942
52
#' Missing data pattern by variable pairs #' #' Number of observations per variable pair. #' #' The four components in the output value is have the following interpretation: #' \describe{ \item{list('rr')}{response-response, both variables are observed} #' \item{list('rm')}{response-missing, row observed, column missin...
86d16d44d3a67d7cd63c668d20c1993bc52783a44be9227499f3953b937b1d53
R
1,944
42
#' @templateVar MODEL_FUNCTION bandit2arm_delta #' @templateVar TASK_NAME 2-Armed Bandit Task #' @templateVar TASK_CODE bandit2arm #' @templateVar TASK_CITE (Erev et al., 2010; Hertwig et al., 2004) #' @templateVar MODEL_NAME Rescorla-Wagner (Delta) Model #' @templateVar MODEL_CODE delta #' @templateVar MODEL_TYPE Hier...
78de3b3ddec600eaac13c7c941ad2147bc6e009ee2bbd27934d807c6c9580fbf
R
1,948
38
library(rmeta) meta_sldsc <- function (myrow,dir,analysis,mytraits=traits,mysd=""){ nbtrait = length(mytraits) M = 5961159 res = NULL for (t in mytraits){ data = read.table(paste(dir,"/",t,".",analysis,"results",sep=""),h=T)[myrow,] log = read.table(paste(dir,"/",t,".",analysis,"log",sep="...
18f78e3bcb4d04219291ce87a8095b0bbe9a212fd4875ab705bbf5593ea74cae
R
1,956
66
#' filtering single cell data based on QC metrics #' #' WARNING: This script is work-in-progress #' #' Example usage: #' #' cgat sc-counts2counts --counts-filename=featurecounts.tsv --phenotypes-filename=phenodata.tsv --factor=group,mouse_id,collection_date,slice_depth,slice_number,pipette_visual,timepoint > filtered...
35078aec5c673fb9938fc7d67e9cb50cd39d88946d87cb0107fb53fe866384fe
R
1,958
72
## Preprocessing data of Herring et al., Cell (2022) library(GenomicRanges) library(data.table) library(dplyr) library(stringr) atac_dir <- '~/Dropbox/CWAS_paper_WD/Data/raw_annotations' peaks <- readRDS(paste0(atac_dir, "/Herring2022_cell_type_atac_peaks_filtered_anno_gr.rds")) cell_types <- names(peaks) stages <- ...
de2af96da4c68f643f1170f03d11c2e2eaf05153c41166b7672fe57432924de8
R
1,959
72
## Preprocessing data of Trevino et al., Cell (2021) library(GenomicRanges) library(data.table) library(dplyr) library(stringr) atac_dir <- '~/Dropbox/CWAS_paper_WD/Data/raw_annotations' peaks <- readRDS(paste0(atac_dir, "/Trevino2019_cell_type_atac_peaks_filtered_anno_gr2.rds")) cell_types <- names(peaks) stages <-...
3d20750990c8013d53952ebbff08a9ebb1b4a6467e072a14a608b0f6b78f08f3
R
1,960
44
#' Imputation by linear regression through prediction #' #' Imputes the "best value" according to the linear regression model, also #' known as \emph{regression imputation}. #' #' @aliases mice.impute.norm.predict norm.predict #' @inheritParams mice.impute.pmm #' @return Vector with imputed data, same type as \code{y},...
e17ea730668dcf27d7ac8d49ea8fc211754dda92da33324c31edf8e757cca5f4
R
1,966
61
#' Set axis labels on circular plot #' @title Set axis labels #' @param mapping NULL (default) or a list of aesthetic mappings to use for plot. #' @param bcols colours of branchs. #' @param ... extra parameters passing to \code{ggplot2::geom_text()}. #' @rdname set_axis #' @examples #' p <- quickcor(mtcars, circular = ...
0a15cee6e651d7423602bc29dcc21fc345bca589d85505171cf393a7d56999f3
R
1,967
91
#----SimulationGRN---- setValidity('SimulationGRN', validSimulationGRN) setMethod( f = 'initialize', signature = 'SimulationGRN', definition = initSimulationGRN ) setMethod( f = 'show', signature = 'SimulationGRN', definition = function(object) { mxp = 10 cat('Graph:', length(object@graph@nodeset), 'node...
80c3bfd79e92b703f5ff0bde82b23141e59135c8cd3390db577b19e059fa71a8
R
1,969
62
args = commandArgs(TRUE) eta=as.numeric(args[1]) max_depth=as.numeric(args[2]) gamma=as.numeric(args[3]) min_child_weight=as.numeric(args[4]) nrounds=as.numeric(args[5]) data_folder=as.character(args[6]) sex_split=try(as.logical(args[7])) BrainAgeCV = function(eta, max_depth, gamma, min_child_weight, nrounds, data_f...
edebf4a1e17179503a5d41c90f9b51c14a9687595a13b013e636a8576bd228c2
R
1,971
42
#' @templateVar MODEL_FUNCTION ra_noLA #' @templateVar TASK_NAME Risk Aversion Task #' @templateVar TASK_CODE ra #' @templateVar MODEL_NAME Prospect Theory, without loss aversion (LA) parameter #' @templateVar MODEL_CODE noLA #' @templateVar MODEL_CITE (Sokol-Hessner et al., 2009) #' @templateVar MODEL_TYPE Hierarchica...
d104af4d16aedb57abf911960c10df1997933ccadf8be4d051c9e1a9cb763a7b
R
1,972
42
#' @templateVar MODEL_FUNCTION bandit4arm_2par_lapse #' @templateVar TASK_NAME 4-Armed Bandit Task #' @templateVar TASK_CODE bandit4arm #' @templateVar MODEL_NAME 3 Parameter Model, without C (choice perseveration), R (reward sensitivity), and P (punishment sensitivity). But with xi (noise) #' @templateVar MODEL_CODE 2...
adbf81d7618cd487773396795a4731c442119ec47b40c0293758a6bff33f9e2b
R
1,973
44
#' @templateVar MODEL_FUNCTION bandit4arm_lapse #' @templateVar TASK_NAME 4-Armed Bandit Task #' @templateVar TASK_CODE bandit4arm #' @templateVar MODEL_NAME 5 Parameter Model, without C (choice perseveration) but with xi (noise) #' @templateVar MODEL_CODE lapse #' @templateVar MODEL_CITE (Seymour et al., 2012) #' @tem...
6956ecb5f394447423c8a09b102124f0ded77435581844f871d4ddbc303ac6a3
R
1,976
50
#' Fifth Dutch growth study 2009 #' #' Age, height, weight and region of 10030 children measured within the Fifth #' Dutch Growth Study 2009 #' #' The data set contains data from children of Dutch descent (biological parents #' are born in the Netherlands). Children with growth-related diseases were #' excluded. The da...
58a241c5408890db8cec5890ada55f8f7efa4336516000a6bc3167d21342a2f3
R
1,977
42
#' @templateVar MODEL_FUNCTION ra_noRA #' @templateVar TASK_NAME Risk Aversion Task #' @templateVar TASK_CODE ra #' @templateVar MODEL_NAME Prospect Theory, without risk aversion (RA) parameter #' @templateVar MODEL_CODE noRA #' @templateVar MODEL_CITE (Sokol-Hessner et al., 2009) #' @templateVar MODEL_TYPE Hierarchica...
bdc4f850d7e4562781226e1c5d94301019df9a0e204a471761899913cddbd2fe
R
1,999
43
#' @templateVar MODEL_FUNCTION bandit4arm_singleA_lapse #' @templateVar TASK_NAME 4-Armed Bandit Task #' @templateVar TASK_CODE bandit4arm #' @templateVar MODEL_NAME 4 Parameter Model, without C (choice perseveration) but with xi (noise). Single learning rate both for R and P. #' @templateVar MODEL_CODE singleA_lapse #...
82e8b0c9791a5fcbddbf03822d8307d772eb35b2acbe855fcbcd2435a4ba2c39
R
2,001
57
#Author: Jan Hirtz 2020 - 2023 # this code makes use of the Dynamic tree cut algorithm as pubslihed in Langfelder et al. (2008): Defining clusters from a hierarchical cluster tree: the Dynamic Tree Cut package for R. Bioinformatics 24:719-720.10.1093/bioinformatics/btm563 #install.packages("cluster") #install.pa...
4c39a18dcd65ddd2e4aac1246d2cdec8436367fb06154fc0fc2e526c789da14c
R
2,006
69
#!/usr/bin/Rscript ## Import Libraries library("DESeq2") ## Import counts matrix cts <- as.matrix(read.csv("../../../data/bernardo/processed/04.deseq2/gene_counts_unfiltered.tsv", sep="\t", row.names="gene_id")) ## Import metadata coldata <- read.csv("../../../data/bernardo/processed/04.deseq2/experimental_design...