sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
d7cf403b2ed0187b279f1d273e1788bcc3f3e91b4c1acde47b06b59be8f8faec
R
2,029
43
test_that("KEGG falls back to term IDs for missing or blank labels", { annotation <- data.frame( GeneID = c("A", "B", "C", "D"), PATH = c("99999", "99999", "10000", "10000") ) object <- new("Annot", species = "custom", anntype = "KEGG", keytype = "SYMBOL", annot = annotation) lookup_with...
c7df14afd0e51a5e43081cf2db7482d66a2f6c4031e1150e7d7c91cbd02eb88d
R
2,037
65
install_ez_packages <- function(answer = T) { if (answer == T) { if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager") BiocManager::install(pkgs = c("tidyverse", "R.matlab", "tidyr", "rlang", "flowCore", "ks", "flowVS", "flowViz", "RColorBrewer", "gtools", "gplots", ...
4c2193414006a8d35f39522261f6744d46e58eee8ab5f4e1d5f90bf84a922382
R
2,063
72
# Formulas used # # Contains functions `sigmoid`, `flipped_sig`, `calculate_group_variance`, `calculate_weighted_delta`, `confinterval` and `var_w_df`. # TODO Add documentation sigmoid <- function(x_from, factor, y_from, y_to, smooth = 5.5, n = 300) { x <- seq(-smooth, smooth, length = n) y <- exp(x) / (exp(x) + 1)...
3ab1a0d85e0ec64e4a1b70ef5660f1acd15fd0d17ca87457fad05dc8382f2eba
R
2,075
48
library('Seurat') exp_sc_mat=read.table('./Benchmark/Zeisel_exp_sc_mat.txt',header=T,row.names=1,sep='\t') exp_ref_mat=read.table('Reference_expression.txt',header=T,row.names=1,sep='\t') sc=CreateSeuratObject(raw.data = exp_sc_mat, min.cells = 0, min.genes = 0) ref=CreateSeuratObject(raw.data = exp_ref_mat, min.c...
5a6389192250670feea2c68087b9cd924e8a62c7367c20f5436e2975677d4bdc
R
2,079
68
# Libraries library(ggraph) library(igraph) library(tidyverse) library(RColorBrewer) ##data data <- read.csv("./mental_8_GatLogit_normLong_R1_norm.csv") dis_id <- data.frame(ids = unique(c(as.character(data$dis1), as.character(data$dis2)))) edges <- data.frame(from = "origin", to = dis_id) vertices ...
71f3fed649f70ceb7951edba0b6a81ef6aa3d8af184c8a449f27f5986c76413b
R
2,080
81
# Helper to create a test richResult make_test_result <- function() { new("richResult", result = data.frame( Annot = c("GO:0001", "GO:0002"), Term = c("apoptosis", "cell cycle"), Annotated = c(100, 200), Significant = c(10, 20), RichFactor = c(0.1, 0.1), FoldEnrichment = c(2.0,...
7990c8147fc433fb1d076894c21f1c7c7fad8a22ee657971f2f417ce00f693d8
R
2,099
67
#source("http://bioconductor.org/biocLite.R") #biocLite() #install.packages("devtools") #devtools::install_github("cole-trapnell-lab/monocle-release@develop") #biocLite(c("DDRTree", "pheatmap")) library(monocle) load('OligTumor.RData') COL=c() i=1 while(i <=length(pbmc@ident)){ this_col=which(colnames(pbmc@raw.da...
fa7f098a0216232989a35e69a05bb78b3b1dc6856581f8ff43fee90c7ff3f0f4
R
2,110
46
## data-raw/module.R -- rebuild data/module.rda (object `module`). ## ## Last run for richR 0.2.0 (SPEC-RICHR-003 M3.6). Running this script replaces ## data/module.rda with a fresh KEGG snapshot, so run it only when an ## annotation refresh is intended. The result depends on live KEGG on the day ## it runs and is not ...
b3899eef37370ccd35c82684c76e2bc6c452d85b93a60e59ab2e2467ccfcaf24
R
2,117
40
setwd("/public-supool/home/zhchen/XS/merge") rm(list = ls()) library(Seurat) library(patchwork) library(dplyr) ##### load data############ path_way <- c("/public-supool/home/zhchen/XS/data/Mouse_Hyp_male_Ctrl_0520_12_20-1", "/public-supool/home/zhchen/XS/data/Mouse_Hyp_male_Ctrl_0520_12_20-2", ...
e689a180669618cab29563a9ab0b8be785292772d5d64d5bf20e3f8bcdf4f4a0
R
2,118
57
skids_from_connector <- function(connector_id, pid) { cat_path = paste("", pid, "connectors", connector_id, sep="/") connectors_response = catmaid_fetch(cat_path) skid1 = connectors_response$partners[[1]]$skeleton_id connector1_type = connectors_response$partners[[1]]$relation_name if (length(connectors_respo...
c67b8e8d46010a657f83a95799bba6b6017f1ee3d59928559f303669aa51a8a1
R
2,119
66
library(Seurat) load('pbmc.RData') source('scRef.R') ######## current.cluster.ids <- c(0, 1, 2, 3, 4, 5, 6, 7) new.cluster.ids <- c("CD4 T cells", "CD14+ Monocytes", "B cells", "CD8 T cells", "FCGR3A+ Monocytes", "NK cells", "Dendritic cells", "Megakaryocytes") pbmc@ident <- plyr::mapvalues(x = pbmc@ident, from =...
e1b528ba4e4d67ab9875623c0ec9c6bd983f3ccbbaded70ec925ce75fc84309e
R
2,137
63
#' Construct A Batch of Keras Models #' #' @inheritParams modeling_and_fitting #' @param param_combination A parameter `matrix`/`data.frame` with each row representing the parameters #' for run Keras model once. Column names should indicate parameter names and should be same as in modeling function. #' [base::expand.gr...
3d891d6f29ef6d4bf1dc6505e8753402a7bbc2bd44295d26a15a305fa1c3bd96
R
2,144
57
library(devtools) library(RColorBrewer) library(plyr) source_url("https://raw.githubusercontent.com/obigriffith/biostar-tutorials/master/Heatmaps/heatmap.3.R") c = readme("all_HLs_human.txt.gz", gzip=T) c$external_gene_name=NULL code=as.factor(unlist(lapply(strsplit(colnames(c[,2:ncol(c)]),"\\_"),function(x) x[1])))...
97aa22482f5381115bcaa08f69e307ddd5542b31e81c4fb0c78d80044519822f
R
2,191
77
#' Non-proportional data for Estimation plots. #' #' Contains 3 Control Samples and 6 Test Samples. #' #' @keywords internal #' @format A data frame with 180 rows and 4 variables: #' \describe{ #' \item{Gender}{Gender of each observation} #' \item{ID}{Identity of each observation} #' \item{Group}{Whi...
6ca8ad34a1391a6afe2e918f2ca50925d0e85fd90ada130621f49e6554328461
R
2,199
52
# Function to generate a p-value for the spatial correlation between two parcellated cortical surface maps, # using a set of spherical permutations of regions of interest (which can be generated using the function "rotate_parcellation"). # The function performs the permutation in both directions; i.e.: by permute bo...
dcd00aaff33866e3f89f2ab91aeccdb4213eb826a68aab93b057bcc847fc111f
R
2,209
57
#! /usr/bin/Rscript library(conflicted) ### Opening file ### #' Make sure you are in the correct working directory (use getwd() and setwd() functions) #' #' enter your csv file name (e. g. "file.csv") #' @param skip = 11 : allows to skip the first eleven rows of the csv file (contain infos about your Biomark run) #'...
47fc70ab93230baa1dfb7561b320c01c6f4f9faf208da8cec47d244178274bc5
R
2,225
81
#This code extracts the data from a huge tsv file and saves it as a sparse matrix library(tidyverse) memory.limit(size = 100000) fig__dir = "D:/SingleCellModeling/MetAtlas/Figures/" #use the data.table package, it is better for reading large datasets #install.packages("data.table") library(data.table) Sys.setenv("VRO...
372611001b20c41de56e41d72ca715858e3d8d216e22ea4ea1f97678f12b885c
R
2,231
48
## data-raw/kegg.R -- rebuild data/kegg.rdata (object `kegg.db`). ## ## Last run for richR 0.2.0 (SPEC-RICHR-003 M3.6). Running this script replaces ## data/kegg.rdata with a fresh KEGG snapshot, so run it only when an ## annotation refresh is intended. The result depends on live KEGG on the day ## it runs and is not b...
daf5fd3b2a19a95e81de18993deabbf4760b6d77f771a93ca48794a598158c11
R
2,237
67
# Load libraries -------------------------------------------------------------- # Assuming these packages are already locally installed library(here) library(dplyr) library(stringr) library(tidyr) library(labelled) library(VIM) library(mice) library(ggstatsplot) library(lavaan) library(multicon) library...
49e66a6e58e1c62c8b79ad785bd2c179188ff33eab33e8f917dadb3d0d71de2b
R
2,238
52
### ### Process the annotation data of the Infinium probes. ### All data was downloaded from: ### Wanding Zhou, Peter W Laird & Hui Shen ### Comprehensive characterization, annotation and innovative use of Infinium DNA ### methylation BeadChip probes ### Nucleic Acids Research 45, e22 (2016) ### https://academic.oup.co...
39b66e593fc9a40ae31b716ab6075ebf1f79bd30844f5e7f2623cefd0e2564bb
R
2,244
56
## BART: Bayesian Additive Regression Trees ## Copyright (C) 2020 Robert McCulloch and Rodney Sparapani ## write.trees.R ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of ...
4eb1cb99e34f1107440dbc09c48f642ae5138f0a31e8274d5d63e6e7920310b7
R
2,261
76
library(rhdf5) library(ggplot2) library(LSD) file = args[1] getvals <- function(dir, pattern, filter){ files = list.files(path=dir, pattern=pattern, full.names=T, recursive=T) files = files[grep(filter, files)] table <- as.data.frame(do.call("rbind", lapply(files, FUN=function(file){ if (grepl("preds", file))...
357e704576aebfaf0e9f877b11a490259656e94ec76b8f914daa3f628b2ae35e
R
2,267
78
# Feature Correlation Analysis source("src/load_packages.R") source("src/miscellaneous_funcs.R") source("src/metadata_prep_funcs.R") base::load("files/Phyloseq_objects_Woltka.RData") #_______________________________________________________________________________ ##### Correlation Analysis ...
69779d4978760ea30b417b0e33482a34f996baacb409a7dfdc65d5570b7b34d5
R
2,276
47
# Live providers (SPEC-RICHR-003 REQ-022): the default suite mocks KEGG REST and # msigdbr; these tests run the real services, so a change in what they return # (and so a drift of the mocks) is caught. They reach the network and run only # with RICHR_LIVE_TESTS=true. skip_unless_live <- function() { skip_if_not(iden...
2fb49d478c105d38205b0f5b54b028ae92520b349645fee29bc4f32bf1779c52
R
2,286
73
test_that("empty gene input raises error", { expect_error( richR:::.validateGeneInput(character(0), func_name = "test"), "input gene list is empty" ) expect_error( richR:::.validateGeneInput(c(NA, NA), func_name = "test"), "input gene list is empty" ) }) test_that("NAs and duplicates are remove...
980a95dcc8bfd25fd9cd991c54ecf6561bc7b6a472c5e89bbec4b6b19c96a0a9
R
2,292
56
### ### Process the genomic annotation data. These include: ### - CpG islands (source: UCSC genome browser) ### - non-coding RNA (source: UCSC genome browser) ### - gene, transcript and exon (source: Ensembl) ### All genomic features have been mapped to the human genome version ### GRCh38/hg38. ### ### The following as...
ede1191868f4e9bce471f5e19da1edccf83266489ea061087dfb1b193241f0c3
R
2,297
124
#' sumo_palette #' #' #' @name sumo_palette #' #' @param x number of colour to display, by default 6 #' @param diverging if TRUE, creates a purple to yellow diverging palette #' @param reverse to change direction #' #' #' @description create a palette of colours based on Hokusai wave #' #' #' @examples #' ...
f5f8cddbb1ed867ed1fb269504317f79d45842971afe905e632d0a5a6d9d5d4e
R
2,305
63
library(here) library(tidyverse) library(scales) genes <- c("Nr2f2","Isl1","Prkcd") # c("Sst","Prkcd","Nr2f2","Isl1") # Genes for connectivity vis_colors <- c("#FF0000","#00FF00","#0000FF") #c("#223f99","#8bc53f","#ec1c24","#ECEA13") quant_cluster <- read.csv(here("Hiplex_QuantificationTable_with_clusters.csv")) animal...
518eb1d7d3333baea31a748cef88a02520e2e28073c4b1ff9c4c3c522527ff66
R
2,314
59
## Suppress R CMD check NOTEs for non-standard evaluation variables ## used in dplyr pipelines and ggplot2 aes() calls utils::globalVariables(c( # ggplot2 aes variables "x", "y", "xend", "yend", "label", "Group", "NES", "x_start", "y_start", "x_end", "y_end", "x_group", "y_level2", "neg_log10_Padj", "annotateTe...
98a7b2b21093eb526664ff22fde2cc188bb0e442a8529506f9d09d4d4078e690
R
2,319
71
## BART: Bayesian Additive Regression Trees ## Copyright (C) 2017-2020 Robert McCulloch and Rodney Sparapani ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License,...
a92e96a176915a499f8de712ce4dcb54730393f8aa65453470e7e6e74a409fc3
R
2,354
55
#### create data.frame containing neighborhood data from csv files - for each run #### cytomap_files_path <- "/Volumes/BryJC_Stanford/paper1_analysis/Fig6/single_object_pipeline/cytomap_files/Analysis_FSOM3_v3" setwd(cytomap_files_path) conditions <- c('Ctrl', 'MedAD', 'HiAD') master_neighborhood <- data.frame() for ...
d3fd9cd46df7d44c4932c169b4412a32469a8658770c4bfd73a0d9e1bf888aab
R
2,354
63
library(ggplot2) library(tidyr) getvals <- function(dir, pattern, filter){ files = list.files(path=dir, pattern=paste0('^',pattern), full.names=T, recursive=T) files = files[grep(filter, files)] say(files) table <- as.data.frame(do.call("rbind", lapply(files, FUN=function(file){ vals=readme(file,...
46481710219e1b858b47af3b4166338d534d93d95558a3d2a3709933889e292c
R
2,370
67
## BART: Bayesian Additive Regression Trees ## Copyright (C) 2020 Robert McCulloch and Rodney Sparapani ## read.forest.R ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of ...
f0086b22e24c8d5e90521d859a35b2d5383cf12a731b98a3a2b9403e6dd9f48d
R
2,375
62
# Characterization baseline (REQ-001, REQ-002): the full ORA result surface of # enrich(), richGO() and richKEGG() on small committed fixtures, as produced by # richR 0.1.5. Every test asserts a non-empty result before snapshotting so an # empty sweep can never pass as a pin. ora_query <- function() .char_read("ora_qu...
759a6369c800774233be8992525e7be1160c85544a1325c2300f8025a5a827b0
R
2,386
83
## BART: Bayesian Additive Regression Trees ## Copyright (C) 2017-2020 Rodney Sparapani ## stratrs ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at...
8271f0e6e36b9f26f70c107ab9404fad6cdf9bbc5d5a64d285b28b4240300ff0
R
2,436
67
# Shared fixtures of the tested-table tests (SPEC-RICHR-004), built with the # public API and no network. # # F-ORA: a 20-gene universe and five gene sets in four roles under the # reference call (.fora_reference(): pvalue = 0.05, padj = NULL, # minSize = 2, minGSSize = 3, keepRich = FALSE): # T1 reported (overlap 5 ...
6d393c5ea6c89f24b2c964d36c4f9dac7ed06c4a4f323874bf69932942cacfe7
R
2,482
66
test_that("ORA treats repeated vector genes as one input gene", { annot <- data.frame( GeneID = c("A", "B", "C", "D", "E", "F"), Term = c("T1", "T1", "T2", "T2", "T3", "T3") ) unique_result <- suppressMessages(richR::enrich( c("A", "B"), annot, pvalue = 1, minSize = 1, minGSSize = 1, keepRich = F...
78b33a064b59e7a62ec9d6a50882725cea32572aff4cd48b58962621cdfc0b09
R
2,483
64
### ### Process the TCGA variant data. ### ### The sample names need to be normalised: ### The DNA methylation data uses this sample name format: ### TCGA-D1-A0ZV-01, while all other data types use TCGA-2E-A9G8-01A, ### indicating that sample repeats have already been aggregated for ### the DNA methylation data...
d56eeafc13653db3f463f3e5f2205e36e760387bfac186c42817ea350dba6b69
R
2,492
76
#' @include internal.R #' NULL #' Run CoGAPs on a Seurat object #' #' @param object Seurat object #' @param assay Assay to pull data from #' @param slot Slot to pull data from. #' @param params \code{\link[CoGAPS]{CogapsParams}} object for specifying parameter settings #' @param temp.file Name of temporary data matrix...
f968e8ba442206dfd8c35d54925147489907f2a7a77a6b44e266d6b5a12cf53c
R
2,508
67
library(topGO) loadings2go<-function(W, gene_2_GO, numtopgenes=100, min_genescore=1.0, rowmean_divide=TRUE){ #This blog was helpful: https://datacatz.wordpress.com/2018/01/19/gene-set-enrichment-analysis-with-topgo-part-1/ #divide each gene by its rowmean to adjust for constant high expressio...
32707c4279ccb3f19b14840a71137dd9fc21ebbf9223cb458581a0a42fcbb687
R
2,513
95
# library library(igraph) data <- read.csv("./cal_glu_pathway300_unique.csv") class_go <- read.csv("./scz_logits_300_annot_bp_class.csv") colorr <- c() # create data: links <- data.frame( source=data$node1, target=data$node2, #importance=log(data$importance,10) importance=data$importance,10 #i...
7a5d3a136f6de9796d9eb5ad422224f0226f0272ef5e40a83758b3f047c48b0f
R
2,515
95
# library library(igraph) data <- read.csv("./scz_300_unique_pair.csv") class_go <- read.csv("../fig4-e/scz_logits_300_annot_bp_class.csv") colorr <- c() # create data: links <- data.frame( source=data$node1, target=data$node2, #importance=log(data$importance,10) importance=data$importance,10 ...
51c8af45d3fcc1f82681e2c1b2d9b91d28b0d3a985bfa13beb86cae26da3170a
R
2,521
65
#' @include internal.R #' NULL #' Load alevin quantification data #' #' A wrapper around tximport to create a \code{SeuratObject} #' from alevin quantification data. #' #' @param file path to \code{quants_mat.gz} file within #' alevin directory #' @param getMeta logical, option to use \code{tximeta} to #' programmatic...
21ebac9668f496ef91c4efe486db298005f5909bd6e382ae8e6e9014e291ea4a
R
2,527
54
# Load data source(here::here("code","01_load_data.R")) # Check assumptions shapiro.test(PWAWM$ScreeLing_1_tot) shapiro.test(PWAWM$ScreeLing_1_fon) shapiro.test(PWAWM$ScreeLing_1_sem) shapiro.test(PWAWM$ScreeLing_2_tot) shapiro.test(PWAWM$ScreeLing_2_fon) shapiro.test(PWAWM$ScreeLing_2_sem) shapiro...
8ab313d9fcc455392fca571fcf9f1766dfccd26741915aee8ee1b1df7bc17a3d
R
2,566
65
--- title: "Benchmarking Visualization" author: "Will Townes" output: html_document --- ```{r} library(tidyverse) theme_set(theme_bw()) fp<-file.path pth<-"simulations/bm_mixed" plt_pth<-fp(pth,"results/plots") if(!dir.exists(plt_pth)){ dir.create(plt_pth,recursive=TRUE) } ``` ```{r} d<-read.csv(fp(pth,"results/b...
9bf7284888e464462ff67debb1ed9ffde61e92b6ec830b20830dcf2c83744b75
R
2,569
92
#' graphsumo #' #' #' @name graphsumo #' #' @param dataset dataset organised as col = c(condition, value) and 1 row = 1 sample #' @param abs parameter to be plotted in x ex : genotype #' @param ord parameter to be plotted in y ex : value #' @param MFV can be vir for viridis scale, male for b&w or female for red...
b5c824a2a083f9cf7802c11d025c0aa9dc181dc81aef36505225fff4de2e6be3
R
2,577
91
--- title: "Running GLM-PCA on a Seurat Object" date: 'Compiled: `r format(Sys.Date(), "%B %d, %Y")`' output: github_document: html_preview: false toc: false html_document: df_print: kable theme: united --- This vignette demonstrates how to run GLM-PCA, which implements a generalized version of ...
32e3a26068effde5dfc285d50c65f310f1a8f6abde22b3ddf337520575cf2650
R
2,586
69
--- title: "Exploring Permutation P-values" author: "Jean Fan" date: "7/15/2020" output: rmarkdown::html_document vignette: > %\VignetteIndexEntry{Exploring Permutation P-values} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` I...
fd86c90d5a60a22b8bb7d04368b9a8b8f7b73635856b34dba2f82576ee4a2917
R
2,593
77
#' Plot cell type proportions versus variances #' #' This function returns a plot of the log10(proportion) versus log10(variance) #' given a matrix of cell type counts. The rows are the clusters/cell types and #' the columns are the samples. #' #' The expected variance under a binomial distribution is shown in the so...
48ca205edc0f568ed7d8c5328817a58ebca97d6d973690a0995f556169973ac9
R
2,608
53
#' @include internal.R #' NULL #' Run estimate_cycle_position on a Seurat object #' #' This function run estimate_cycle_position function on Seurat object. It uses #' the tricycle internal reference projection matrix. #' #' @param object Seurat object #' @param assay Assay to use, defaults to the default assay #' @par...
dbf7927e20cb3af7262b17f4cded24e37aa6b119fbf779610ccaf0b42930c165
R
2,619
77
#' Normalise a counts matrix to the median library size #' #' This function takes a \code{DGEList} object or matrix of counts and #' normalises the counts to the median library size. This puts the normalised #' counts on a similar scale to the original counts. #' #' If the input is a DGEList object, the normalisation f...
1f44c3868e70f92cf75be7be7aec1821ef137907c651c39bb1a5762a3375a6c5
R
2,648
64
# Helper functions that deal with assignment of colour palettes for the overall plots # # Contains function `apply_palette`. # Applies palettes to <ggplot> objects # TODO add proper documentation. apply_palette <- function(ggplot_object, palette_name) { ggplot_object <- switch(palette_name, "npg" = ggplot_...
7704b18898af11ac94077235f3c26a4b2a20d6e63b02f2a1ad4c6a36490ada7c
R
2,660
90
## BART: Bayesian Additive Regression Trees ## Copyright (C) 2018 Robert McCulloch and Rodney Sparapani ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or #...
ab8c4deff6cd89ca60c907b537cb852fa7977110ee78e4ee6063828441ff9390
R
2,664
76
#' @include internal.R #' NULL #' Run GLMPCA #' #' @param object A Seurat object #' @param L The number of dimensions to return (defaults to 5) #' @param assay Assay to use, defaults to the default assay #' @param features A list of features to use when performing GLM-PCA. If null, defaults to variable features. #' @p...
a5b4d7906f3e58806ec5f7a68a19959bae6d03614d5a9adac61eccabd9e2b1c0
R
2,708
47
--- output: github_document --- <!-- README.md is generated from README.Rmd. Please edit that file --> ```{r, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" ) ``` # Background This repository contains scripts used to perform a col...
0fc2e816c30d19ebb1ed9757e59f145003544f7bcdf0fec5c8b7e0d0fed520a1
R
2,719
81
--- title: "Estimating RNA Velocity using Seurat" date: 'Compiled: `r format(Sys.Date(), "%B %d, %Y")`' output: github_document: html_preview: true toc: false html_document: df_print: kable theme: united --- This vignette demonstrates analysing RNA Velocity quantifications stored in a Seurat objec...
ddb549dda07e87515641efb833e062b57563ea70b73063b29d3018d95aab9100
R
2,719
90
--- title: "DLB.EPIC.neuronalPropotionEstimation.Rmd" author: "Xiaojian Shao" date: "02/10/2020" output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` ```{r load packages} # load packages required for analysis library(knitr) library(limma) library(minfi) library(IlluminaHumanMet...
ac40cdad91c9b3c33672618c8e0e774f96caa8e8f156e7813113bdec798405dc
R
2,730
83
test_that("richResult can be constructed and displayed", { res <- new("richResult", result = data.frame( Annot = "GO:0001", Term = "test term", Annotated = 100, Significant = 10, RichFactor = 0.1, FoldEnrichment = 2.0, zscore = 3.0, Pvalue = 0.001, Padj = 0.01, GeneID = "A,B,C", stringsAsF...
b614aa0368724713cb4f5e86fca221bf72d652e0320e6d45a9df2b5139f886b9
R
2,735
87
#' Build a similarity matrix #' #' @description #' `buildSimilarityMatrix` computes the similarity between inputs x1 and x2 #' #' @details #' #' #' @param x1 A matrix or data tree containing values to use to calculate similarity. #' @param x2 A matrix or data tree containing values to use to calculate similarity. #' @...
0a733468e96b446e0fec37330daf63e155e5ae28716c23c43af3941aee57985a
R
2,761
54
describe("Testing add_scaling_component_to_delta_plot function", { test_that("Returns a list with correct components for valid inputs", { # Test case: Valid inputs with float_contrast = TRUE delta_plot <- ggplot2::ggplot() # Dummy plot object float_contrast <- FALSE boot_result <- list(difference = 0....
ddd69b8de26f1240df5091fdfdbb5125caa3d8e6bb8992d97cdd9ea91ac82fb7
R
2,811
68
--- title: "Benchmarking Visualization" author: "Will Townes" output: html_document --- ```{r} library(tidyverse) theme_set(theme_bw()) fp<-file.path pth<-"simulations/bm_sp" plt_pth<-fp(pth,"results/plots") if(!dir.exists(plt_pth)){ dir.create(plt_pth,recursive=TRUE) } ``` ```{r} d<-read.csv(fp(pth,"results/benc...
35c969820c0f05420114bdec64d16819107cb4596bdcbed0625412f2c0bb4989
R
2,854
89
## BART: Bayesian Additive Regression Trees ## Copyright (C) 2017-2018 Robert McCulloch and Rodney Sparapani ## mc.pwbart ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of...
db625e3c40d843a8bb973d9b08a8417c76c93c91b6b69abe69e6965cd464d6a5
R
2,854
89
library(missMDA) library(RColorBrewer) library(plyr) library(preprocessCore) library(ggplot2) c=readme("all_HLs_mouse.txt.gz",gzip=T) numassays = apply(c[,3:ncol(c)],1,function(x) length(x)-sum(is.na(x)) ) nrow(c) c=c[numassays >= 5,] "Genes with >=5 measurements:" nrow(c) b=c[,1:2] c=c[,3:ncol(c)] c = scale(c) ncom...
f293c6445d828cafb126b6dfb842eb5dbb4fe4483aa8f82c1b81df2385b54219
R
2,863
135
# @DESCRIPTION: all data # Library ----------------------------------------------------------------- library(magrittr) library(ggplot2) library(patchwork) library(rlang) # src --------------------------------------------------------------------- source(file = "analysis/2022-07-20/script/utils.R") # Load data ----...
13110570ee4cebbb30c0d7f12a17b189e37d9e16b991e34349b40f2c55616f4f
R
2,882
74
# REQUIREMENTS: # Setwd() to specific animal and section. # Sub_folder: Name of folder nested within your animal/section folder where you ROI coordinates are (e.g., subdivision_analysis) # Within sub_folder, use the following naming convention: "{SUBDIVISION}_XY_coords.csv" (e.g., {SUBDIVISION} could be medial in the c...
3b8e455eb03ca88d0eaaf0804a4dc272e6219a5009d5abbe59a8519d86acafd2
R
2,923
82
setwd( "~/Dropbox (ASU)/Placenta/BATCH2_PLACENTA_DECIDUA_ANALYSIS/HISAT_FeatureCounts/batch1_and_batch2/" ) library(reshape) library(ggpubr) library("gridExtra") df_merged_pisarska <- read.delim ("genelists/pisarska/vfit_placenta_df_genes.txt") df_merged_pisarska$group <- "late first trimester" df_merged_placenta ...
c7f2140a31c10efa695f6fef5cbca4268ce88312b3f68f56261b072927920923
R
2,935
48
# Load Phyloseq Objects load_all_cohorts <- function(){ #### Taxa load("files/Phyloseq_objects/Species_PhyloseqObj.RData") cat("Loading: Species \n"); assign("dat.species", dat.species, envir = .GlobalEnv) load("files/Phyloseq_objects/Genus_PhyloseqObj.RData") cat("Loading: Genera \n"); assign("dat.genus", d...
04923836b919c10b3501b7ad50511cb97a69ee660ad3648f6b259ede934bc8aa
R
2,969
74
# PERMANOVA PLOTS source("src/load_packages.R") source("src/miscellaneous_funcs.R") source("src/load_phyloseq_obj.R") source("src/metadata_prep_funcs.R") permdf <- read.csv(file = "files/permanova_analysis_2021-04-12.csv", header= TRUE) #---------------------------------------------------------------------------...
8f181940e380b0d0084ab00143860747927c639ac403bcc958ffb99510589f74
R
2,979
82
#!/home/zhangfeng/bin/bin/Rscript ####################################################################################### # Description: Run pagoda2 for single cell expression data # Date: 2018-10-24 22:20 # douyaguang # package required: # pagoda2: basic pagoda2 algorithm package # NMI: calc...
7fff798e21bc1d0f76997363ed465d4ffad1cbe5fa898a01d086178481364abb
R
2,988
94
# Metadata_Prep_Functions #---------------------------------------------------------------------------- ##-------------- Metadata lists -------------- #---------------------------------------------------------------------------- motortest_vars <- c( "pole_test_s", "sticker_test_s", "x_of_...
fc6fe3d149d041319a3bd771cba2221c150ee9d63d7dac55ffdb33deea98c552
R
2,996
73
library(Seurat) library(patchwork) library(dplyr) options(future.globals.maxSize= 891289600000) rm(list = ls()) load("/public-supool/home/zhchen/Lab_share/public_source/cellcycle_gene/mouse_cell_circle_gene.Rdata") setwd("/public-supool/home/zhchen/XS/5_subset_neuron") Tbx3_neuron <- readRDS("/public-supool/home/zhche...
d889ef4d3f7d5a68218c6d394d6ec3a5c00a0bdf2bf5b2e6ca5e5db79933dba2
R
3,031
137
#devtools::install_github(repo = "mojaveazure/loomR", ref = "develop") #library(loomR) #BiocManager::install("rhdf5") #lfile <- connect(filename = "D:/SingleCellModeling/L4/tissue-stability-human-lung-10XV2.loom", mode = "r+") library(rhdf5) library(tidyverse) setwd("C:/Work/MatlabCode/projects/SingleCellModeling/Si...
caaa044362237d7a6357dd43949d8cdf2f8900b21c7a1932f954dd592911678b
R
3,064
91
# INPUT CONFIGURATION MANAGEMENT ------------------------------------------ args = commandArgs(trailingOnly=TRUE) ############################################################################ #USAGE: Rscript createKinship.R do_kinship.conf.R FOLDER SNP_FILE.csv HEADER[True|False] #Rscript createKinship.R do_kinship.c...
94c2b1a8784dec5fc0ecbb5f4e29273704756250c8a5f03d17abd2bf24b8f392
R
3,076
85
library(ggplot2) getvals <- function(dir, pattern, filter){ files = list.files(path=dir, pattern=paste0('^',pattern), full.names=T, recursive=T) files = files[grep(filter, files)] say(files) table <- as.data.frame(do.call("rbind", lapply(files, FUN=function(file){ vals=readme(file,skip=95,header=...
b8a93b4256cf04df51be4be52e1927e42e35683c1bc1fdf0e5febeed2177083b
R
3,095
88
#' Calculates and transforms cell type proportions #' #' Calculates cell types proportions based on clusters/cell types and sample #' information and performs a variance stabilising transformation on the #' proportions. #' #' This function is called by the \code{propeller} function and calculates cell #' type proportio...
a04bb323d2944107a019fa02cc2a6fd4fc3ee57968eeed9dd3699758aba0d805
R
3,097
85
setwd( "~/Dropbox (ASU)/Placenta/BATCH2_PLACENTA_DECIDUA_ANALYSIS/HISAT_FeatureCounts/batch1_and_batch2/" ) library(reshape) library(ggpubr) library("gridExtra") df_merged_pisarska <- read.delim ("genelists/pisarska/cpm_placenta_df_genes.txt") df_merged_pisarska$group <- "late first trimester" df_merged_placenta <...
b536327aee3ae381164953ea80119c6c7f0f1f0b616207fc457faacab7172d51
R
3,150
84
require(qgam) require(itsadug) require(brms) options(show.signif.stars=FALSE) load('sd_data.rda') ############# ### QGAMM ### ############# qgam.model.simple <- mqgam(rollSD ~ Type + Condition + TrialOrder.z + s(Item, bs='re') + s(TrialOrder.z, Participant, bs='fs', m=1), data=sd_data, qu=0.5, ...
05f433a0ecfaaf0e7b1dc944eb99496b5423bfc3f1bbdf7a6b565424d18bbd7e
R
3,168
79
#' make annotation database using bioAnno results #' @importFrom AnnotationDbi keys #' @importFrom dplyr distinct #' @param dbname database name from bioAnno #' @param anntype GO or KEGG #' @param OP BP,CC,MF default use all #' @param species species name #' @param keytype gene ID type (e.g. "ENTREZID", "SYMBOL") #' @e...
870e3160ae91d2fd21807c58635c2469c542cfbb53fbd7b48be3c298c94d4cef
R
3,173
95
--- title: "Integration of datasets using Harmony" date: 'Compiled: `r format(Sys.Date(), "%B %d, %Y")`' output: github_document: html_preview: true toc: true toc_depth: 3 fig_width: 16 html_document: df_print: kable theme: united fig_height: 5 fig_width: 16 out_height: 4 --- Th...
1536877eee4738bde25d0b00aae75c5f22b8b00608d6ff892168e7a847fd8318
R
3,174
110
--- title: "Running fastMNN on Seurat Objects" date: 'Compiled: `r format(Sys.Date(), "%B %d, %Y")`' output: github_document: html_preview: true toc: true toc_depth: 3 fig_width: 16 html_document: df_print: kable theme: united fig_height: 5 fig_width: 16 out_height: 4 --- This ...
3caae2cf993905d34c1eb55f267aaf656f07c4c2ac1510b3ce5f17ef93fcec5a
R
3,185
90
# Load necessary libraries library(rrBLUP) # for GBLUP analysis library(data.table) # for data manipulation library(BGLR) ############################################################################ #USAGE: Rscript RunGBLUPDaniele.R ../data/kinshipMatrices/kinship_additive_minMAF0.01_maxMAF0.5.csv ../data/simulated_...
e8b8d198ab7817970409c38a31fef9e905334fac72c8ea1ff9040306f7800362
R
3,202
75
library(DoubletFinder) library(Seurat) library(patchwork) library(dplyr) rm(list = ls()) load("/public-supool/home/zhchen/Lab_share/public_source/cellcycle_gene/mouse_cell_circle_gene.Rdata") text <- readRDS("/public-supool/home/zhchen/XS/4_rm_doublet/seurat_filterDouble_0911.rds") doublet_cell_id <- colnames(text)...
d007bf827e1e88595550df62c4d584058b54646c417d4d8c0768480b46ce61a2
R
3,221
109
#### correlation wt_10x <- as.data.frame(tbx3_10x_WT_ave$RNA) colnames(wt_10x) <- c("x3","x12","x13","x14","x16","x18") wt_10x$gene <- rownames(wt_10x) head(wt_10x) wt_BGI <- as.data.frame(tbx3_BGI_WT_ave$RNA) colnames(wt_BGI) <- rev(c("d9","d14","d17","d41","d42","d46","d53","d58","d60","d65","d66","d67"))...
c2cda08e0a6bf42d0f2a9d5c5cc98a2c8af007bc7f3f7e1d7e0e8727009fc506
R
3,225
92
#' Plot cell type counts means versus variances #' #' This function returns a plot of the log10(mean) versus log10(variance) of #' the cell type counts. The function takes a matrix of cell type counts as #' input. The rows are the clusters/cell types and the columns are the samples. #' #' The expected variance unde...
ca2f17a38e63a74aa83ac1ad6d76a698000ed4a9e9f41d8d3165108d4807c813
R
3,227
101
library(rhdf5) library(ggplot2) library(abind) files = args getdata = function(track){ do.call(abind, lapply(files, function(x){ h5read(x,track) })) } values = getdata("ism") #(1, 4, 12288, nseqs) coding = getdata("coding") #(12288, nseqs) seqs = getdata("seqs") #(12288, nseqs) preds = getdata("ref") #(12...
c0630735c24380f637de9f76f507c32947c7484b8161d02b45046560038431b3
R
3,252
50
#### Neighborhood Analysis #### #Heatmaps # prepare quantile normalized neighborhood data (note: neighborhood counts are summed from each object within each neighborhood) master_neighborhood_c <- master_neighborhood nu_panel <- c(panel,"Area","Circularity","Eccentricity","MajorAxisLength","MinorAxisLength...
da7ae6cb7d1186904e468fd1738b140c282d0bc17af4e6108c0b90bcf5967525
R
3,265
105
library(natverse) source("~/R/conn.R") # get info about all desmo connectors in the Naomi project all_desmo_connectors <- catmaid_fetch(path = "11/connectors/", body = list(relation_type="desmosome_with", with_partners="true")) # extract ids of desmo connectors all_desmo_ids <- sapply(all_desmo_connectors$connector...
32dadb9d331df79faf352f6267063c8f710168ff50243eeda470f27bce1ff957
R
3,279
75
#' Tested terms of an enrichment result #' #' Returns the tested table of an enrichment result: every term the analysis #' tested, not only the terms it reported in \code{result(x)}. #' #' For an ORA result (\code{richResult}) the table holds one row for every #' term of the tested family whose overlap with the query i...
5af0e353342002cdecff7f5337dc57125e2164f7cf7967f69e5ab64656a8c600
R
3,300
77
# Regenerates the legacy fixtures used by test-tested-legacy.R and # test-rich-io.R: result objects serialized by a richR build that predates the # `tested` slot (richR 0.2.0 before M4, commit fca5276), plus the outputs that # build computed from them. No network. # # Run from tests/testthat/fixtures/ against an instal...
be107201e5d34600afa7d5fbd1998f907f8260b7913b97a57cec8f00485faf3c
R
3,304
121
library(Seurat) source('scRef.R') load('CASE.RObj') TSNE_VEC=pbmc@dr$tsne@cell.embeddings IDENT=as.character(pbmc@ident) COL=c() i=1 while(i <=length(pbmc@ident)){ this_col=which(colnames(pbmc@raw.data)==names(pbmc@ident)[i]) COL=c(COL,this_col) i=i+1 } tag=cbind(names(pbmc@ident),as.character(p...
0a2e04d1715d0bb9f97db209bd493f5d2c477e54bb78580b48f42f9531748246
R
3,324
109
rm(list = ls()) # Define working directory and source ImageLMMR.R script setwd("/path/to/base/folder") source('/path/to/base/folder/ImageLMMR.R') # Define tests to perform source('/path/to/base/folder/mytests.R') NCLUSTERS = 12 ############################################################### # Prepare the data prev...
ac2e1b9c3dfed6160c3f12f35366c5aad993cf5298aa488ef86b2815f64cf5a8
R
3,340
83
--- title: "06_interpretation_genes" author: "Will Townes" output: html_document --- ```{r} library(biomaRt) source("./scrna/utils/interpret_genes.R") fp<-file.path pth<-"scrna/sshippo" ``` loadings from NSFH ```{r} W<-read.csv(fp(pth,"results/sshippo_nsfh20_spde_loadings.csv"),header=TRUE,row.names=1) rownames(W)<-t...
955846fa4c6a8cc6e7498799b244a88181cbfeefb545eb95c04c63870d82bb34
R
3,355
81
#!/home/zhangfeng/bin/bin/Rscript ####################################################################################### # Description: Run SAFE and all the methods compared in SAFE for single cell data # Date: 2018-10-22 14:40 # douyaguang # package required: # SAFEclustering: for SAFEclustering algorithm # N...
f2a8e0dbcd149ef352d96782543f73e107e584f70eaa363ca25ed6caacbaef64
R
3,355
89
# compareGSEA() per-group value tables. # # compareGSEA() must key its NES / adjusted-p / raw-p rows by group and pathway # identifier, so groups whose retained pathway sets or orders differ still get # each value from the matching (group, pathway) row of their own result. # # Fixtures are built inline; expectations ar...
057a4e1423686c96c001a249f5c72f5342e472d4bf9b17e40724939d3d6c5865
R
3,371
77
--- title: "Interpreting `liger` results" author: "Jean Fan" date: "8/23/2018" output: rmarkdown::html_document vignette: > %\VignetteIndexEntry{Interpreting liger results} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- We will use a simulation to help us interpret the results of `liger`. ```{...
a1239f11174a69a3b0b2c8600b0b0f85e04a0259bc2a40d340c6541dabceecb1
R
3,378
86
--- title: "05_interpretation_genes" author: "Will Townes" output: html_document --- ```{r} # library(tidyverse) library(biomaRt) # library(rPanglaoDB) source("./scrna/utils/interpret_genes.R") fp<-file.path pth<-"scrna/xyzeq_liver" ``` loadings from NSFH ```{r} W<-read.csv(fp(pth,"results/xyz_liv_nsfh6_spde_loadings...
7e3bbaee01db57f21f6ce9cb394244593f40ffa8c4ef6ddf10b140ab4c4206de
R
3,382
94
library(Seurat) load('TSNE.RData') TAG=read.table('Zeisel_semi.txt',header=T,sep='\t') TAG[,2]=as.character(TAG[,2]) TAG[which(TAG[,2]=='Myelinating.Oligodendrocytes'),2]='Oligodendrocytes' TAG[which(TAG[,2]=='Newly.Formed.Oligodendrocyte'),2]='Oligodendrocytes' pbmc@meta.data$zhang2014 = TAG[,2]#as.character(pbmc@ide...
5d6e68c29d6a052aa9db00b78525bfc3a0291d05992334ddbd94880df4f8a2a9
R
3,385
118
get_gender_column <- function(N) { return(c(rep("Male", N / 2), rep("Female", N / 2))) } get_genotype_column <- function(N) { return(c(rep("M", N / 2), rep("W", N / 2))) } # TODO Add documentation generate_non_proportional_dataset <- function(N = 40, seed = 12345) { set.seed(seed) # Fix the seed so the results ...
a7ba4d60834a13b397b2fd99fc2a40abffe65010465989e4281c4c0ee429dd28
R
3,403
91
#' Plot cell type proportions for each sample #' #' This is a plotting function that shows the cell type composition for each #' sample as a stacked barplot. The \code{plotCellTypeProps} returns a #' \code{ggplot2} object enabling the user to make style changes as required. #' #' @param x object of class \code{SingleCe...
4088e330498696b8a402c81ffb80c5b89e7d98b565fccba46db4d8acdbed45d5
R
3,404
87
--- title: "Gene Set Enrichment Analysis with LIGER" author: "Jean Fan" date: "September 27, 2015" output: rmarkdown::html_document vignette: > %\VignetteIndexEntry{Gene Set Enrichment Analysis with LIGER} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- Gene Set Enrichment Analysis (GSEA) is a c...