sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
336a4ce16a581798336472da189f45a6fb93ff9375a479199aabfd5d3d4823cf | R | 2,046 | 45 |
library(optparse)
library(gtools)
option_list = list(
make_option(c("-i", "--input"), type="character", default=NULL, help="Input VCF file", metavar="character"),
make_option(c("-o", "--output"), type="character", default=NULL, help="Output VCF file", metavar="character")
)
opt_parser = OptionParser(option_list=... |
8d55966328c3aa123fb238affff8a0dd76386e3ac357931250998fdc9e2c17e9 | R | 2,046 | 49 | library(catmaid)
library(tidyverse)
source("~/R/conn.R")
get_half_links <- function(connector_list) {
for (i in (1:length(connector_list$partners))) {
if ( length(connector_list$partners[[i]]) < 2 ) {
# connectors with less than 2 partners
# return treenode, not connector, because the connectors at ... |
b7bfb7ec62dc4379a62a2dd2500d56141de95ed5a80fb4f37ce06559f260cb65 | R | 2,055 | 73 |
# JULIA Debug according to https://github.com/palday/JellyMe4.jl/issues/51
library(JuliaCall)
options(JULIA_HOME = "/Users/roman/.julia/juliaup/julia-1.10.2+0.aarch64.apple.darwin14/bin/")
julia_install_package("StatsModels")
julia_library("MixedModels")
julia_library("RCall")
julia_library("DataFrames")
julia_libra... |
ef67e12e396921704d2a9a15bc38b974ddfd33087476486dd0a1358ecf209a49 | R | 2,065 | 80 |
IN_DIR <- "/home/burkhart/Software/reticula/data/aim2/input/"
set.seed(999999999)
#https://arxiv.org/pdf/1202.3473.pdf "the results in Sec. 3.1 furnish a workable estimate of N, if one uses <10−5."
# Reaction Network
edges.df <- read.table(paste(IN_DIR,"edges.txt",sep=""),sep = " ")
EPSILON <- 10^-7
E <- nrow(edg... |
5215c54b9b521454b140b96caeadeb29a896c12bc9e3fec63c4d67a9d34f2ade | R | 2,068 | 59 | # Run 'analysis/04_deseq2_e13-vs-e17.R' if you haven't already
#source("analysis/04_deseq2_e13-vs-e17.R")
# Run 'tables/scripts/tableS8.R' if you haven't already
# source("tables/scripts/tableS8.R")
# DEFINE FILES AND OUTPUT DIRS: ------------------------------------------------
# input deseq2 results rds file
rds_de... |
46a7003796f01fd8ba8067f7eba34f2385efe15fa8e29bcf37fc86c779eb0c9d | R | 2,069 | 61 | # RUN DESEQ2 ANALYSIS SCRIPT: --------------------------------------------------
# Run 'analysis/01_deseq2_e16.R' if you have not already
# source("analysis/01_deseq2_e16.R")
# DEFINE FILES AND PATHS: ------------------------------------------------------
# input deseq2 results rds file
rds_deseq2_results <- "data/pro... |
cfcd459b9c81562c34086a64974850a006f9c16317d351ff4807293260de95c2 | R | 2,090 | 74 | context("Test model IO.")
data(agaricus.train, package = "xgboost")
data(agaricus.test, package = "xgboost")
train <- agaricus.train
test <- agaricus.test
test_that("load/save raw works", {
nrounds <- 8
booster <- xgb.train(
data = xgb.DMatrix(train$data, label = train$label, nthread = 1),
nrounds = nroun... |
9dbadf2694baf4287359b6f3c202b9b2e35f940a58d955a3f1bb75b50fd2ea48 | R | 2,093 | 34 | library(qs)
library(sf)
setwd("/media/desk16/luomeng/data/STEREO/AnalysisPlot/")
qsFiles <- list.files("~/data/STEREO/AnalysisPlot/","qs$",full.names = T) %>% str_subset("cut")
subclass_color <- c(AST = "#665C47", ENDO = "#604B47", ET = "#CEC823", `L2-L3 IT LINC00507` = "#07D8D8",
`L3-L4 IT RORB`... |
37985cb3effbd0b1ae4cf0b02fbeed079871b9ee9a3e2b1bd7045cf025c238ff | R | 2,103 | 59 | # Run 'analysis/02_diffbind_e16.R' and 'tables/scripts/tableS3.R' if you haven't already
# source("analysis/02_diffbind_e16.R")
# source("tables/scripts/tableS3.R")
# For tss enrichmentplot:
# Run scripts in 'preprocess/atacseq_e16_compute_matrix/'
# and put the matrix files in 'processed_data/atacseq_e16/deeptools_ou... |
ee48d1771556f3a7f56758d80038ad0a67fa64f6d684723ef6d2c11eefc070c5 | R | 2,129 | 46 | summarizeResults.DESeq2 <- function (out.DESeq2, group, independentFiltering = TRUE, cooksCutoff = TRUE,
alpha = 0.05, col = c("lightblue", "orange", "MediumVioletRed",
"SpringGreen"),fdrtool.group=NULL)
{
if (!I("figur... |
281b182657527c474a2d9aa1ca424b8ed3dfc49964cd422fa00cdf7f0f2de5d2 | R | 2,139 | 34 | #' Load target file
#'
#' Load the target file containing sample information
#'
#' @param targetFile path to the target file
#' @param varInt variable on which sorting the target
#' @param condRef reference condition of \code{varInt}
#' @param batch batch effect to take into account
#' @return A \code{data.frame} conta... |
daf22dff4d1fa1946cc45b30da79a3d5b955f7df8ba8405fcdc211c4aa0fa1e8 | R | 2,142 | 34 | library(tidyverse)
library(magrittr)
library(Seurat)
library(harmony)
setwd("~/cortex/fig3")
subclass_color <-c(AST = "#665C47", ENDO = "#604B47", ET = "#CEC823", CHANDELIER = "#E25691",
`L2-L3 IT LINC00507` = "#07D8D8", `L3-L4 IT RORB` = "#09B2B2",
`L4-L5 IT RORB` = "#69B199", ... |
22163d5c874bbb52675b37675e508db3dac485c74b14b2383c70f6be721b5c10 | R | 2,145 | 47 | library(DESeq2)
library(magrittr)
library(SummarizedExperiment)
start_time <- Sys.time()
IN_DIR <- "/home/jgburk/PycharmProjects/reticula/data/SRP042228/input/"
OUT_DIR <- "/home/jgburk/PycharmProjects/reticula/data/SRP042228/output/"
SRP042228_DATA_FIL <- "rse_gene.Rdata"
ensembl2rxns.df <- read.table(paste(IN_DIR... |
6938ff8c5505e8521770b7b56ad59f703ddb22db81b1f24771e2a5fddab56218 | R | 2,145 | 72 | ######read files
suppressPackageStartupMessages({
library(MatrixGenerics)
library(Seurat)
library(dplyr)
library(SingleCellExperiment)
library(aricode)
library(mclust)
})
memory.limit(1e5)
############################## Run seurat ###################################
run_Seurat <- function(sce){
dt.s... |
32d15f5dde90860b387888d8cabba97efa9b7baeaf0e78a5fced2a9573d5b1ca | R | 2,150 | 102 | suppressPackageStartupMessages({
library(cidr)
library(aricode)
library(SingleCellExperiment)
})
memory.limit(1e+10)
################################ Drop out ####################################
#drop out function
dropout_sampling <- function(sce, drop_rate = 0, seed){
#set seed
set.seed(seed)
#dropout ... |
061e29b3ea693efe1d6e3c09b8f0184997017eb601361f44a06806c2ee35a258 | R | 2,155 | 47 | ---
title: "Size measurements for L1-CRISPRi organoids"
output: html_notebook
---
# Organoid size measurement between L1-CRISPRi and Control day 15 organoids
## Read data
```{r}
library(openxlsx)
library(ggpubr)
library(tidyverse)
library(ggplot2)
size_hips6 <- read.xlsx("/Volumes/MyPassport/CRISPRi_L1s/bulk/size_... |
f095490b9a018cd5b566584528e0998c07f733a6bc6cb8b0621d8b75b3ddbdb2 | R | 2,156 | 45 | library(Seurat)
library(magrittr)
library(ggplot2)
library(harmony)
setwd("~/cortex/figS1-6/")
seu <- qs::qread("../STEREO/Seu_merge_31_slides.qs")
seu %<>% NormalizeData() %>%
FindVariableFeatures(selection.method = "vst", nfeatures = 2000) %>%
ScaleData() %>% RunPCA()
seu %<>% RunUMAP(dims = 1:40)
seu %<>% RunH... |
040ab623cd68a1d9b32eeca6ae64467047217f3c8b08cad0e521fc35debcae18 | R | 2,164 | 78 | require(xgboost)
context("interaction constraints")
n_threads <- 2
set.seed(1024)
x1 <- rnorm(1000, 1)
x2 <- rnorm(1000, 1)
x3 <- sample(c(1, 2, 3), size = 1000, replace = TRUE)
y <- x1 + x2 + x3 + x1 * x2 * x3 + rnorm(1000, 0.001) + 3 * sin(x1)
train <- matrix(c(x1, x2, x3), ncol = 3)
test_that("interaction constr... |
f041e171b67dc835a1a6b4c301464ab7386bc8b4d292aed29ee25163d1d8cd0c | R | 2,165 | 88 | #load library#########
source("~/utils/ANA_SOURCE_SHORT.R", echo=FALSE)
#Figure S2g#####
#each sample: GO terms by c(S, pval, padj) matrix
load('/home/clustor2/ma/w/wt215/PROJECT_ST/AUC_GOBP/LIST_MK_M.RData')
keepgo<-Reduce(union,lapply(LIST_MK,function(x){rownames(x)[which(x$pval<0.1)]}))
#matrix of S values
Shea... |
207209cafa5c3a6e28993134a1cba3512e304c2ccf69bed7dac2b79fd1c853c2 | R | 2,173 | 63 | require(rphast)
require(ape)
require(dplyr)
require(parallel)
require(Biostrings)
require(ggpubr)
require(Seurat)
require(reshape2)
require(pheatmap)
source('SCRIPTS/Functions.R')
args = commandArgs(trailingOnly = TRUE)
for (arg in args) {
split_arg <- strsplit(arg, "=")[[1]]
var_name <- split_arg[1]... |
276d099f273d6094398f498aecc1c2225602c5047fd1faf317224ae805e53251 | R | 2,193 | 56 | ---
output:
github_document:
html_preview: false
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
[](https://cran.r-pr... |
8f0d9991bb66bf8f02214ac118751452af1dd368370c34d7eb68b9819dfc18fa | R | 2,193 | 72 | check_and_install <- function(pkgs, bioc=FALSE) {
for (pkg in pkgs) {
if (!requireNamespace(pkg, quietly = TRUE)) {
message("Installing missing package: ", pkg)
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager", repos = "https://cran.r-project.org")
if ... |
ce1e859dde2cc339551610d6f05286703e96a8242ef970fc7b5ac79f8fce99c8 | R | 2,200 | 65 | #################################################################################################################################################
############ Simulate neutral trees
source("./Simulated_data/Simulate_trees.R")
source("./Simulated_data/Post_processing.R")
library(doParallel)
library(foreach)
library(p... |
46c44cef48adfa3cca5a6be43326ec4342622f339867ce924a51b2bc7d68e866 | R | 2,215 | 81 | library(lmerTest)
library(dplyr)
library(targets)
library(tarchetypes)
## simulations
data = tar_read(data_eegnet) %>% filter(experiment=="N170")
# first one real HLM
model_true <- lmer(formula="accuracy ~ hpf + lpf + emc + mac + base + det + ar + (1 | subject)", #experiment + RFX SlOPES
control = lme... |
e6a69278197bebbe2ac6285f8324f7d80b84090aef70f8e07268f1c054976cc2 | R | 2,219 | 79 | #' Early blood development: single cell binary gene expression data
#'
#' Binarized expression data of 33 transcription factors involved
#' in early differentiation of primitive erythroid and endothelial
#' cells (3934 cells).
#'
#' @docType data
#' @name hematoData
#' @usage data(hematoData)
#' @format A data.frame ob... |
2d6d35e4b8a5bb3b27ed5dea8b35b5844d374cde29aea8fee6463006ba0972a3 | R | 2,220 | 57 | # Run 'analysis/03_deseq2_e17.R' and 'tables/scripts/tableS6.R' if you haven't already
#source("analysis/03_deseq2_e17.R")
#source("tables/scripts/tableS6.R")
# DEFINE FILES AND OUTPUT DIRS: ------------------------------------------------
# input rds file containing deseq2 results
rds_deseq2_results <- "data/processe... |
fdf9406dde2d7fdbe68c56348bf24ec41ab8f15a51d1c093156571c06b69a8ec | R | 2,225 | 59 | # Fig 2: Pseudo-bulk DEG and pathway enrichment analysis
# Load libraries
library(Seurat)
library(SingleCellExperiment)
library(scater)
library(Matrix.utils)
library(DESeq2)
library(tidyverse)
library(pheatmap)
library(clusterProfiler)
library(org.Hs.eg.db)
library(apeglm)
# Prepare input
counts <- cancer@assays$RNA@... |
901c8d1b262586da092a073f0e6224d6d2e2543042ffdc8b4c3cbd0448920310 | R | 2,228 | 90 | # Change directory to script dir
getScriptPath <- function(){
cmd.args <- commandArgs()
m <- regexpr("(?<=^--file=).+", cmd.args, perl=TRUE)
script.dir <- dirname(regmatches(cmd.args, m))
if(length(script.dir) == 0) stop("can't determine script dir: please call the script with Rscript")
if... |
4fdbb8c6241ba22743aec4b92f017c9c7e4338e3d0293eff6bffb02ea909514e | R | 2,242 | 43 | library(qs)
library(tidyverse)
library(Seurat)
library(magrittr)
library(treeio)
library(ggtree)
library(ape)
library(scRNAtoolVis)
setwd("~/cortex/fig4/")
merge_seu <- qs::qread("merge_seu.qs",nthreads = 10)
geneId_Name <-read_csv("../SnRNA/1_SnRNA_preprocessing/gene_kept.csv") %>% {setNames(object = .$gene_uni,nm = ... |
68d12ef78e81bbc97dd27bb97dfd9c92559d8e9533b9b05612a8907896cfcc9c | R | 2,261 | 50 | library(igraph)
library(ggraph)
library(tidyverse)
library(magrittr)
library(tidygraph)
library(sf)
library(ggforce)
library(patchwork)
library(qs)
setwd("~/DATA/BRAIN/STEREO/frequentGraph/plot/")
# fig2b heatmap ==========================================
project = "../soma15nn15.network"
resTxt_all <- readLines(str_... |
de25429e6d31b3eeb154f2c9b076825006d93150bb9f3f60e5cc0f0563dd9d5d | R | 2,271 | 44 | library(DESeq2)
library(magrittr)
library(SummarizedExperiment)
start_time <- Sys.time()
IN_DIR <- "/home/jgburk/PycharmProjects/reticula/data/gtex/input/"
OUT_DIR <- "/home/jgburk/PycharmProjects/reticula/data/gtex/output/"
#GTEx_DATA_DIR <- "/home/users/burkhajo/WuLab/WuLabLustreDir/reticula/input/recount2/recount... |
b0c3497f5e4e20b5764ea1688267ab50b060af2548a3741647554248cf1f30b5 | R | 2,297 | 69 | source("./Settings.R")
######################### ######################### ######################### ######################### #########################
## Design the simulation study for the ROC curve. To this end, use the VAFs from the simulated trees. Overall, this will generate a snvs-object, storing all snvs and ... |
c160016cd861e1f7137b1c712f4bbfbdbac0a5bdb01ed863b5da99cbd638e8ce | R | 2,297 | 72 | # Load required libraries
library(ggplot2)
library(reshape2)
library(dplyr)
# Define input files by order name
data_files <- list(
primates = "cors_primates.csv", # files from ratematrix
rodentia = "cors_rodentia.csv",
bats = "bats.csv",
artiodactyla = "cors_artiodactyla.csv",
eulipotyph... |
162ab1d9de34c9bb3deb2bef6aa5a42c9356cf0d2fe65b56df6223d59495c7af | R | 2,301 | 60 | # DEFINE FILES AND PATHS: ------------------------------------------------------
# Path to the gene raw counts matrix
input_file <- "data/meta_data/atacseq_e16/SampleSheet.csv"
# Path to output directory for r_objects
output_dir_robj <- "data/processed_data/atacseq_e16/r_objects"
# filename for RDS file containing no... |
60f2edb78cfbd4cbc7cf8801144e77b5b507d8a20c937c670ef99b942a7c192f | R | 2,301 | 69 | source("~/ANA_SOURCE_SHORT.R", echo=FALSE)
#HEATMAP Fig2g##########
#quantified nuclei area from H&E images
load('~/RData/Fig2g_RaviST/LIST_RAVI_NUCLEI.RData')
#binning of Ravi spots based on tumor density inferred from nuclei area
load('~/RData/Fig2g_RaviST/LIST_RAVI_SPOTS.RData')
#AUCell data
load('~/RData/Fig2g_Ravi... |
2404f75a8affa2b0ea05dac9378171663b04a6ed32567e3e4f50d2d6cd1a63e4 | R | 2,324 | 68 | #################################################################################################################################################
############ Simulate selected trees
source("./Simulated_data/Simulate_trees.R")
source("./Simulated_data/Post_processing.R")
library(doParallel)
library(foreach)
library(... |
7aab1289a60c4172621f269b475376c3edbc92ec55897be53ceeb0a1828d3e68 | R | 2,342 | 88 | ######read files
suppressPackageStartupMessages({
library(MatrixGenerics)
library(Seurat)
library(dplyr)
library(SingleCellExperiment)
library(aricode)
library(mclust)
})
################################ Drop out ####################################
#drop out function
dropout_sampling <- function(sce, dro... |
44da8681ea4ae90ad45aad435b292b8499fe57e9937132de9df0a6a7a8676b5d | R | 2,351 | 63 | ---
title: "BrainPower-vignette"
author:
name: Emma Walker
affiliation: University of Exeter
email: E.M.Walker@exeter.ac.uk
abstract: >
A tutorial for using the Brain Power package for power calculations of cell type specific array data
output:
BiocStyle::html_document:
toc_float: true
vignette: >
%\Vi... |
f5de115674e4cfa73d525155f11bcc91a626757adceb5700a0afc9c90ce763ca | R | 2,357 | 72 | library(ggtern)
library(gridExtra)
library(dplyr)
library(tidyr)
library(patchwork)
data <- read.csv("all_performance_metrics.csv")
create_ternary_data <- function(data, metric_col) {
histone_marks <- c("H3K27ac", "H3K4me3", "H3K27me3")
# Normalize the data for ternary plot
normalized_data <- data %>%
fil... |
69366dbe74ecd8b97a11e536f4255f0d7691aa98c1edbd5bf8f4f5d447158ab4 | R | 2,359 | 41 | ##################################################################
# Getting DEG result for motif gene expression in AD case study
# Reproducibility for Figure.4IJ
##################################################################
library(Matrix)
library(DESeq2)
motif <- c('cccm')
month <- c(8,13)
for (mtf in motif){
... |
a78e60fc044602b548ed794f34b8483b603c9ff695beaf7d58d82749b7130c79 | R | 2,360 | 76 |
# significance testing
data <- tar_read(marginal_means)
library(dplyr)
library(broom)
library(purrr)
library(lmerTest)
df_grouped <- data %>%
group_by(variable)
# Perform paired t-test for each factor within each variable
#t_test_results <- df_grouped %>%
# do(tidy(pairwise.t.test(.$accuracy, .$factor, p.adjus... |
6b511a3748c10a3a285cfb4d0de955ea00ff208b27e4ec8d89fa6fe1ff8e72ae | R | 2,376 | 66 | library(qs)
library(tidyverse)
library(magrittr)
setwd("~/cortex/STEREO/3_domainClustering/")
Slides <- read.delim("../cortex")
annoFiles <- list.files("~/cortex/STEREO/3_domainClustering/","*r.csv",full.names = T) # %>% str_subset(selectedSlides$chip %>% str_c(collapse = "|"))
bin200SeuFiles <- list.files(".","20... |
4c083a3d89963919613d9717dc3637851596ed7ea755bb852e92a802ee615a2d | R | 2,381 | 98 | ---
title: "Comparison of DE results from Microglia"
author: "Arpy"
date: '2024-11-12'
output: html_document
---
```{r}
library(tidyverse)
library(Seurat)
library(Libra)
```
#0. Load Data
```{r}
main.path <- "~/OHSU\ Dropbox/Saunders\ Lab\'s\ shared\ workspace/arpy/manuscripts/2023_Thai2P4M_FeigeYoung/ms_analyses/2_g... |
fbb60aca3080419f19e53130cdc135afbce8bc762940c6e3ee10b50efeb132ed | R | 2,382 | 44 | rawpHist <- function (complete, outfile = TRUE,fdrtool.group=NULL,out.DESeq2=NULL)
{
ncol <- ifelse(length(complete) <= 4, ceiling(sqrt(length(complete))),
3)
nrow <- ceiling(length(complete)/ncol)
if (outfile & is.null(fdrtool.group))
png(filename = "figures/rawpHist.png", width = cairoS... |
d2ed40cfc0d19b00a9d6e1585561ee9d8df7c9405fafcb0bcc66dc49edcf1ec8 | R | 2,401 | 77 | #
# Minimum detectable effect size sensitivity power analysis
#
# mTBI vs uninjured control comparison calculation
#
library(pwr)
# Define parameters
N_mTBI <- 450
N_uninjured <- 9809
# Calculate total and proportion
total_n <- N_mTBI + N_uninjured
proportion_A <- N_mTBI / total_n # Proportion of subjects in group ... |
ff4a429c74f4729cfdd631cc8c6796ef62aadd8ae42badd54e8a0c50ffd216f3 | R | 2,409 | 62 |
# find bad muscles analysis
#ICA = c("EOG", "EMG")
# debug
ICA = "EOG"
subjects = c("sub-001", "sub-002", "sub-003", "sub-004", "sub-005", "sub-006", "sub-007", "sub-008", "sub-009", "sub-010", "sub-011", "sub-012", "sub-013", "sub-014", "sub-015", "sub-016", "sub-017", "sub-018", "sub-019", "sub-020", "sub-021", "... |
579b48e7e2a637375f4244fad4dcb778605a81af155c788295ea9e5b5fd7ea80 | R | 2,411 | 77 | library(pwr)
#
# Minimum detectable effect size sensitivity power analysis
#
# mTBI vs orthopaedic control comparison calculation
#
# Define parameters
N_mTBI <- 450
N_orthoinjured <- 1604
# Calculate total and proportion
total_n <- N_mTBI + N_orthoinjured
proportion_A <- N_mTBI / total_n # Proportion of subjects i... |
7d38c88d5754366a971631b5bc0eb873765f38f5cd5b60d3c700936d5b9f10d2 | R | 2,421 | 103 |
infile = "tmp/binfiltering_MKbt1d8.txt"
infile = "tmp/binfiltering_soeoGeo.txt"
infile = "tmp/binfiltering__QD2XUM.txt"
if(use.loess!=TRUE){
load.success = library(mgcv,logical.return=TRUE)
if(!load.success){
q(save="no",status=1)
}
}
load.success = library(mclust,logical.return=TRUE)
if(!load.success){
... |
6186641405b3e342857dbe063de0f587f4da6f3a5565124518b05948e5bbbd18 | R | 2,427 | 65 | #!/usr/bin/env R
# MagellanMapper R stats Command-Line Interface
# Author: David Young, 2020
# Usage:
# 1) From a shell: Rscript --verbose <path-to-clrstats>/run.R [options]
# 2) From an R session: source("<path-to-clrstats>/run.R")
#
# Run with `-h` flag to see options. To set options when running from an
# R ses... |
0a1ff57ad3822bb7a939b245708afe731494390194c878230ffdd4b8f1322dfc | R | 2,454 | 68 | # Run 'analysis/01_deseq2_e16.R' if you haven't already
#source("analysis/01_deseq2_e16.R")
# DEFINE FILES AND PATHS: ------------------------------------------------------
# input deseq2 results rds file
rds_deseq2_results <- "data/processed_data/rnaseq_e16/r_objects/deseq2_dds_e16.rds"
# output directory for supple... |
bd5683d165427889992f83712fd9a438852d328336d808524058f3182d2fffe9 | R | 2,460 | 61 | #' @title QuickRecipe
#' @description Quick clustering pipeline for single cell data using Seurat.
#' @param counts Raw counts matrix or Seurat object.
#' @param meta.data Optional meta data.
#' @param min.cells Minimum cells for feature filtering.
#' @param min.features Minimum features for cell filtering.
#' @param n... |
c3a96c910f4ea34c9d834ce8261b228fdbd909488b42eece3ea341bdb31cf3db | R | 2,463 | 60 | # statistics for paper - to be sourced and inserted into the text
# Gaspar Jekely 2023
library(tidygraph)
library(dplyr)
library(tibble)
library(igraph)
library(catmaid)
source("code/CATMAID_connection.R")
# statistics from CATMAID ------------
frag_all_annot <- as_tibble(catmaid_get_annotations_for_skeletons(
"^f... |
e4869af4448bde6a0c512517f968edad47a8c57a689a6d3be0da4b50cd66cb3d | R | 2,471 | 66 | # Get a list of all installed packages with their versions
installed_pkgs <- installed.packages()
# Extract only the package names and versions
pkg_versions <- installed_pkgs[, c("Package", "Version")]
# Convert to data frame for easier filtering and readability
pkg_versions_df <- as.data.frame(pkg_versions)
# List ... |
157845011a1da116fa6b4574a1c8009b354cd84e455e13f0dc9ec4af1d90b2d2 | R | 2,478 | 100 | ---
title: Tables
output:
rmarkdown::html_vignette:
toc_float: true
vignette: >
%\VignetteIndexEntry{Tables}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r setup, include = FALSE}
Sys.setenv(LANGUAGE = "en")
library("sbcdata")
sbcdata
```
**Authors**: `r paste0(format(e... |
bc12d2d04c52daa61e4d0bf67f54c7bf3dd71e1250780be1acb227d64ba0585b | R | 2,479 | 60 |
# R1: changed fdr correction to unc in F-tests
# Create a custom function to perform replacements within strings (eg emc:mac)
replace_with_list <- function(string, replacements) {
for (pattern in names(replacements)) {
string <- str_replace_all(string, pattern, replacements[[pattern]])
}
return(string)
}
#... |
e77b88d3b6dbb34afc78e67d2e76bff803dd02915e6b48a068ed507890a0c923 | R | 2,487 | 51 | ## ----setup, include=FALSE-----------------------------------------------------
knitr::opts_chunk$set(echo = TRUE)
## ----library, include=TRUE----------------------------------------------------
library(TockyPrep)
library(TockyRandomForest)
## ----files, include=TRUE-------------------------------------------------... |
c885c2a0634b961dbfe5d0eb857c996ab3b0b92289bb8b5b8a58c0acba66b940 | R | 2,508 | 37 | library(tidyverse)
library(ggplot2)
library(ggpubr)
library(ggsignif)
setwd("~/cortex/figS1-6/")
spatialCellMeta <- read_csv("../STEREO/spatialCellMeta.csv")
ast_distribution <- spatialCellMeta %>% filter(subclass == "AST")
countByRegion <- ast_distribution %>% filter(str_detect(cluster,"5|4") )%>% group_by(chip,re... |
87b99cbbcb17e4607feaaa89d03197331016a18e44c22535b3193bde8d62120e | R | 2,509 | 64 |
####################################################################################################################
# R script to perform single electrode analysis of hippocampal neuronal cultures
# AGONIST CHALLENGE: 10 mM KCl
# 90K cells seeded per well
##############################################################... |
3332bf51dd6d9a8d007d0112c1f436840289e7ca262247aef2c71c13542957cb | R | 2,531 | 81 | #load source data####
source("~/ANA_SOURCE_SHORT.R", echo=FALSE)
load('~/Fig2d_time_L24E2.RData')
#select important GO terms####
terms<-Reduce(union,lapply(fglist,function(x){return(x$pathway[which(x$padj<0.1)])}))
datNES<-Reduce(cbind,lapply(fglist,function(x){return(x[terms,'NES'])}))
rownames(datNES)<-terms
colname... |
d013e59a78f80f9ad53068fad3c7b42015029a01411ccf7b840f00fa544d6623 | R | 2,531 | 64 | ----------------------
Setup / Generate Astro Subclusters
----------------------
```{r libraries and functions, message=FALSE}
library(tidyverse)
library(Seurat)
library(Matrix)
source("~/OHSU Dropbox/Saunders Lab's shared workspace/arpy/manuscripts/2023_Thai2P4M_FeigeYoung/ms_analyses/1_karl_analysis/r_functions_pa... |
41a5a8fd8c5b3402141b0cc32fd6f75c4e97af0d5c3752cd0a0194c9336e8192 | R | 2,535 | 81 | #' Function to create a data frame (with three columns) from a (sparse) matrix
#'
#' \code{oSM2DF} is supposed to create a data frame (with three columns) from a (sparse) matrix. Only nonzero/nonna entries from the matrix will be kept in the resulting data frame.
#'
#' @param data a matrix or an object of the dgCMatrix... |
0c53b91aead0a8c8b468694bdbf84904169bcf3e63342403c1b7116ea9e9e669 | R | 2,544 | 87 |
check_convergence <- function(model){
if (class(model) == "list"){model <- model[[1]]}
models <- summary(model)
## correlations between fixed effects should be not exactly 0, -1 or 1
corrs <-
{if (class(model) %in% c("lmerMod","lmerModLmerTest")) as.matrix(models$vcov) else
if (class(model) == "... |
218ef6111aa1cd8fa31b984e4c03bddb7c2e72d2b0e0ef84234cb499b84ff028 | R | 2,549 | 76 | # Documents > mouse_retina > GSE148063
library(dplyr)
library(Seurat)
set.seed(0)
whole.data <- ReadMtx(mtx = "GSE148063_matrix.mtx.gz",
features = "GSE148063_genes.tsv.gz",
cells = "GSE148063_barcodes.tsv.gz")
whole <- CreateSeuratObject(counts = whole.data, project = "GS... |
3741a40cd60fe82b148f67c155cb4be0788000b17851df775f1a6baddd2067c1 | R | 2,559 | 61 | #### load packages ####
targetPackages <- c('tidyverse','data.table','arrow')
newPackages <- targetPackages[!(targetPackages %in% installed.packages()[,"Package"])]
if(length(newPackages)) install.packages(newPackages, repos = "http://cran.us.r-project.org")
for(package in targetPackages) library(package, character.onl... |
0873857a19f293cd0c7ff22aa97961bac05dce004e3d75395b292f80ade65e2d | R | 2,574 | 65 | # Run 'analysis/03_deseq2_e17.R' and 'tables/scripts/tableS6.R' if you haven't already
#source("analysis/03_deseq2_e17.R")
#source("tables/scripts/tableS6.R")
# Run 'analysis/01_deseq2_e16.R' if you haven't already
#source("analysis/01_deseq2_e16.R")
# DEFINE FILES AND PATHS: -----------------------------------------... |
cd11b6ad964e87a3604261bb3122de48400781a318e2509e8d0bbbec080a3632 | R | 2,589 | 87 | #' @importFrom magrittr %>%
#' @export
magrittr::`%>%`
#' @title Meta
#' @description Access the meta feature table of a Seurat assay.
#' @param object Seurat object.
#' @param assay Assay name. If NULL, uses the default assay.
#' @return A data.frame of meta features.
#' @export
Meta <- function(object, assay = NULL)... |
62acf94a95d735f825153cfe4c4b8828d4ed1f87c379277152bb4fadf2207d90 | R | 2,593 | 80 | res <- tar_read(reults_sliding)
library(ggplot2)
ggplot(data = res, aes(x=level, y=tsum)) +
geom_bar(stat="identity") +
facet_wrap(. ~variable, scales="free_x")
res <- tar_read(reults_sliding_experiment)
ggplot(data = res, aes(x=level, y=tsum)) + #, fill=experiment
geom_bar(stat="identity", position=positio... |
34dad0138b79e8a9ef169e65d835c52992c3dd79856e41d19c15a4c602a880a7 | R | 2,599 | 74 | library(VariantAnnotation)
#' Parses BRASS SV calls into a dataframe with a line for each SV and two columns: chromosome and position
parse_brass_svs = function(vcffile, outfile, ref_genome="hg19") {
svs = parse_svs_1(vcffile, ref_genome=ref_genome)
write_svs(svs, outfile)
return(svs)
}
#' Parses ICGC consensus... |
e54c3ccfe99383414d024605ed7eca3d6c1757772ae0a280cc996c434e11c7bd | R | 2,607 | 70 | # Fig2_mg4_score.R: MG4 Meta-Module Score Calculation using ssGSEA
# Load libraries
suppressPackageStartupMessages({
library(escape)
library(SingleCellExperiment)
library(Seurat)
library(dittoSeq)
library(GSEABase)
library(ggplot2)
})
# Load preprocessed Seurat object with normalized data and metadata
# R... |
b68c83fe46451d16455a0cb9dfe2b91acea60ff403e9a177c8e3ef8636b4ee67 | R | 2,611 | 64 | # ==============================================================================
# SCRIPT 03: COUNT CATEGORICAL VARIABLE FREQUENCIES
# (originally distributed as count_vars.R)
# ==============================================================================
#
# PURPOSE:
# Counts the frequency of Yes/No (1/0) v... |
d62e0ca5a3bd6f06c4f02fa25b04f53e4aada2dd1f7b2ed54506f3d4bb4263a9 | R | 2,612 | 72 | # Run 'analysis/02_diffbind_e16.R' if you haven't already
# source("analysis/02_diffbind_e16.R")
# DEFINE FILES AND OUTPUT DIRS: ------------------------------------------------
rds_dbObj <- "data/processed_data/atacseq_e16/r_objects/diffbind_dbObj.rds"
output_dir_tables <- "tables"
filename <- "table_S3_atacseq_e16... |
06c298d7200841d6db3e2c0439aa7ae88cd3ef0b04a553a8c916f5069e02c317 | R | 2,615 | 83 | library(qs)
library(tidyverse)
library(sf)
library(magrittr)
library(Seurat)
devtools::load_all("~/spacexr-master/")
setwd("~/cortex/STEREO/2_Deconvolution_and_QC/")
STEREO <- list.files("./","*.rds",full.names = T)
selectedFiles <- read.delim("./")
refFiles <- list.files("~/DATA/NeoCortex_EdLein_Sten/EdLein/","qs... |
0d52bfa0b1abb7d682aa0063075b30ba6f07b55d8ed0f9a61b4c230629552bfa | R | 2,627 | 115 | library(tidyverse)
set("~/cortex/figS1-6/")
devtools::load_all("~/scrattch.bigcat/")
library(scrattch.hicat)
region <-
c(
'FPPFC',
'DLPFC',
'VLPFC',
'M1',
'S1',
'S1E',
'PoCG',
'SPL',
'SMG',
'AG',
'V1',
'ITG',
'STG',
'ACC'
)
region_color <-
c(
'#3F4587'... |
eff5b6c0ab48990f65c27050d253ea8a407be7822185ebccea657af9246bb90c | R | 2,644 | 129 | #' Plot platemap
#'
#' \code{plot_plate} plots platemaps
#'
#' @param plate
#' @param variable
#' @param well_position
#'
#' @return
#' @export
#'
#' @examples
plot_plate <- function(plate,
variable,
well_position = "well_position") {
variable <- rlang::sym(variable)
w... |
004c7ccb37e3bbadf1a74d56c17b434850596af373a8687a599e926bc2cda9cd | R | 2,658 | 85 | load('~/RData/PSEDUOBULK_MYELINHIGH.RData')
load('~/RData/MYELIN_PDX_LATE.RData')
load('~/RData/MYELIN_PDX_EARLY.RData')
RAW<-cbind(RAW_NSG_HIGH,RAW_PDX_HIGH_E,RAW_PDX_HIGH)
stats=log2(rowMeans(RAW))
RAW_SUB<-RAW[names(stats)[which(stats>0)],]
colData_SUB<-data.frame(
sample=colnames(RAW_SUB),
stage=rep(c('NSG','Ea... |
d481ee9656ed26a05fc4fefbb9f45edd97dd2a1ef8eee8ed83c92098285727ba | R | 2,658 | 83 | library(magrittr)
OUT_DIR <- "/home/burkhart/Software/reticula/data/aim1/output/"
IN_DIR <- "/home/burkhart/Software/reticula/data/aim2/input/"
X <- readRDS(paste(OUT_DIR, "rxn_pca_nls.Rds", sep = ""))
Y <- readRDS(paste(OUT_DIR,"gtex_tissue_detail_vec_train.Rds",sep=""))
E <- read.table(paste(IN_DIR,"pathway_reactio... |
92ec7bbdddf97b4e9f6cce787e48a66f66a6dd421cb3c766b94cd8640cbac1a2 | R | 2,665 | 79 | # FIG 5: MiloR Differential Abundance and Marker Analysis
suppressPackageStartupMessages({
library(Seurat)
library(SingleCellExperiment)
library(scater)
library(scran)
library(miloR)
library(tidyverse)
library(patchwork)
library(ggrastr)
})
# Convert Seurat to SCE
sce <- as.SingleCellExperiment(lympho... |
44e36e5fd3053455f87c30eb202f1c94741e6760a9e768b275e961507bd523eb | R | 2,694 | 67 | #' Function to convert an igraph from one or two tibbles
#'
#' \code{oTB2IG} is supposed to convert an igraph from one or two tibbles.
#'
#' @param edges a tibble or data frame for edge attributes
#' @param nodes a tibble or data frame for node attributes. It can be NULL
#' @param directed a logic specifying whether to... |
0f9d20d28b4851b19e5b9c51406c2199506c2fc5e82115e2ec8e120748e48e6c | R | 2,715 | 36 | library(tidyverse)
setwd("~/cortex/fig1/")
library(data.table)
library(magrittr)
library(Seurat)
library(harmony)
merge_seu <- readRDS("../SnRNA/SnRNA_seurat.RDS")
subclass_color <-c(AST = "#665C47", ENDO = "#604B47", ET = "#CEC823", CHANDELIER = "#E25691",
`L2-L3 IT LINC00507` = "#07D8D8", `L3-L4... |
a70e6b433876791b1c5449e766c0660ccd07e7ccf5b3011f027a22fc489f5345 | R | 2,731 | 73 | #!/staging/biology/ls807terra/0_Programs/anaconda3/envs/RNAseq_quantTERRA/bin/Rscript
## Options
pacman::p_load("optparse")
option_list = list(
make_option(c("-c", "--counts"), type="character", default=NULL,
help="Enter a directory that contains count files.", metavar="COUNTS"),
make_option(c("-o",... |
ddf0cb8b7310ba6226f03e7e90e9d24fadc52c4fed5b65f57acfe6d0dc983b38 | R | 2,741 | 94 | # app to select a folder, display folder size and delete with confirmation
library(shiny)
library(shinyFiles)
# Function to calculate directory size and return in human-readable format
get_dir_size <- function(path) {
if (dir.exists(path)) {
size <- sum(file.info(list.files(path, full.names = TRUE, recursive = TRU... |
2a47b480d772bd39677776384b2a9006cfe9cdf5891bffbf79eb614321adcbfc | R | 2,759 | 65 | args = commandArgs(trailingOnly=TRUE)
### Author - Amarinder Singh Thind - # https://github.com/amarinderthind/RNA-seq-tutorial-for-gene-differential-expression-analysis
# modifications by Kerr Wall to get to work with Dec2 dataset
# Rscript --vanilla r_arguments.r arg1 arg2
library(DESeq2)
###################### lo... |
f798021400641da73693ff3a6ed83884b50d31e65ffc2284f885379ba03ce28b | R | 2,789 | 82 | library(ggrepel)
library(ggplot2)
library(dplyr)
library(cowplot)
###################
#doublet analysis
###################
merged.Seurat.obj <- subset(merged.Seurat.obj, subset=origin=='OurData')
merged.Seurat.obj <- subset(merged.Seurat.obj,subset=status=='case')
merged.Seurat.obj@meta.data$is_doublet_class <- ifel... |
126c420ad8f3ad96edbf60c1e861a4e842d6f85551fe8cb78eaa5669d9507b6f | R | 2,796 | 57 | #' Function to visualise effect-by-removal using a upset plot
#'
#' \code{oVisAttack} is supposed to visualise effect-by-removal using a upset plot. The top is the kite plot, and visualised below is the combination matrix for nodes removed. It returns an object of class "ggplot".
#'
#' @param data a data frame. It cont... |
560d5dce7aa5d4406225e98156a1f1bef9c096524482e1079755e3e9cb4d3f5b | R | 2,796 | 75 |
# sandbox: vary one step at a time
library(dplyr)
library(emmeans)
library(ggplot2)
data <- tar_read(data_eegnet)
# mean of accuracy, averaged over participants, but for each other column kept
data <- data %>%
# group by everything but subject and accuracy
group_by(across(-c(subject, accuracy))) %>%
# calcula... |
abf123b19a39b7b5035e4f13ba93e2275aa9f638956fa5ff66957fc740940e63 | R | 2,806 | 78 | ##################################################################
# Performing go and pathway analysis
# Reproducibility for Figure.4IJ
##################################################################
library(ggplot2)
library(scales)
library(ggpubr)
library(clusterProfiler)
library(openxlsx)
library(org.Hs.eg.db)
l... |
bce317bb2ca48e70329ceec66948698a3dbb4bd8843cce5b4fa621f1e294775f | R | 2,807 | 73 | library(DESeq2)
library(magrittr)
library(SummarizedExperiment)
start_time <- Sys.time()
IN_DIR <- "/home/jgburk/PycharmProjects/reticula/data/gtex/input/"
GTEX_OUT_DIR <- "/home/jgburk/PycharmProjects/reticula/data/gtex/output/"
TCGA_OUT_DIR <- "/home/jgburk/PycharmProjects/reticula/data/tcga/output/"
DISP_FUNC_SAVE... |
3259ca145c04c2766dede4794367249c39f334bfb924f92ae134be95e1a18941 | R | 2,811 | 83 | # READ DDS OBJECT FOLLOWING DESEQ2 ANALYSIS FROM RDS FILE: --------------------
dds <- readRDS(rds_deseq2_results_e17)
# Store results in res
res <- results(dds)
# ANNOTATE DESEQ2 RESULTS WITH GENE SYMBOLS AND ENTREZ IDS: --------------------
ensembl_ids <- rownames(res)
# annotate with gene symobols using org.Mm.eg.... |
6c8836d225457a535b977023e1b919398c0e04f5bd30cb00c7bda43fbf9e07f2 | R | 2,812 | 84 | # READ DDS OBJECT FOLLOWING DESEQ2 ANALYSIS FROM RDS FILE: --------------------
dds <- readRDS(rds_deseq2_results_e16)
# Store results in res
res <- results(dds)
# ANNOTATE DESEQ2 RESULTS WITH GENE SYMBOLS AND ENTREZ IDS: --------------------
ensembl_ids <- rownames(res)
# annotate with gene symobols using org.Mm.eg.... |
e7922eee814989a98f04cb1d6ea7d19a336d8eb75e5788c7d1901560eacb9680 | R | 2,824 | 58 | library(Seurat)
library(dplyr)
load("Processed_Objects/Inhibitory_datasets.Rdata")
################################################################################
## EDF1b
VlnPlot(Inhibitory_datasets, features = c("nFeature_RNA", "nCount_RNA", "percent.mt"), ncol = 3, group.by = "Dataset", pt.size = 0)
df <- data.... |
d2d7313fe180b0b5e48f7aa7b199c00ca34e57ca8294fba27daa456db32fe78f | R | 2,838 | 44 | library(tidyverse)
library(data.table)
library(magrittr)
library(Seurat)
library(harmony)
setwd("~/cortex/figS1-6/")
merge_seu <- readRDS("../SnRNA/SnRNA_seurat.RDS")
subclass_color <-c(AST = "#665C47", ENDO = "#604B47", ET = "#CEC823", CHANDELIER = "#E25691",
`L2-L3 IT LINC00507` = "#07D8D8", `L3-... |
a8351ee19b69784c0aa628f5c882362461a1ca68ee0114459fa87215f63fbaad | R | 2,847 | 90 | #### plot functions
highlightChrom <- function(adjustments, min, max){
for(index in 1:(length(adjustments)-1)){
if(index %% 2 == 1){
polygon(c(adjustments[index], adjustments[index + 1],
adjustments[index + 1], adjustments[index]),
c(min, min, max, max), col = "gray", border = ... |
5a1152678c916439eed70b3754bee4629ba750aebe45d31ca232a6952459dc17 | R | 2,848 | 67 | library(Battenberg)
library(optparse)
option_list = list(
make_option(c("-t", "--tumourname"), type="character", default=NULL, help="Samplename of the tumour", metavar="character"),
make_option(c("-n", "--normalname"), type="character", default=NULL, help="Samplename of the normal", metavar="character"),
make_op... |
52f9d2331b42f9c66bf93da4c214dfe601d960bdfa1b08904bd11d5cfdd6bd98 | R | 2,849 | 64 | #' Visualize Batches Over Time
#'
#' \code{batchTimeViz} is a simple function that will visualize batches over time for multi-batch longitudinal data. Data should be in "long" format.
#' @param batchvar character string that specifies name of the batch variable. Batch variable should be a factor.
#' @param timevar cha... |
922f66cf9340b9818b082898abc670c97be1368234543ac7d85fd3bca8354157 | R | 2,852 | 62 | #### load packages ####
targetPackages <- c('tidyverse','arrow','normentR','biomaRt')
newPackages <- targetPackages[!(targetPackages %in% installed.packages()[,"Package"])]
if(length(newPackages)) install.packages(newPackages, repos = "http://cran.us.r-project.org")
for(package in targetPackages) library(package, chara... |
a13005ea063eb0249c1a2dd9b1e2b07138f6d59956274383c2bd3987f13fdee3 | R | 2,852 | 76 | #' Function to extract enrichment results
#'
#' \code{oSEAextract} is supposed to extract results of enrichment analysis.
#'
#' @param obj an object of class "eSET" or "eSAD"
#' @param sortBy which statistics will be used for sorting and viewing gene sets (terms). It can be "adjp" for adjusted p value (FDR), "pvalue" ... |
ad75db990533eb5d3b8e12e1e820c2da934763cb11f814e84595f2731e98fbc5 | R | 2,883 | 96 | # [description]
# Create a definition file (.def) from a .dll file, using objdump. This
# is used by FindLibR.cmake when building the R package with MSVC.
#
# [usage]
#
# Rscript make-r-def.R something.dll something.def
#
# [references]
# * https://www.cs.colorado.edu/~main/cs1300/doc/mingwfaq.html
args... |
60b8ef65b2c77bc44f7cec3de275691a9b3000b9a3fd1ad22d0bcd612081b600 | R | 2,906 | 74 |
varyOneCalculation <- function(data){
# mean of accuracy, averaged over participants, but for each other column kept
# if accuracy in col names
if ("accuracy" %in% colnames(data)){
data <- data %>%
group_by(across(-c(subject, accuracy))) %>%
summarise(across(accuracy, ~ mean(.x, na.rm = TRUE)... |
0c8635b541112a13963897b20ea35efffa9b3dfac4f8ebb3ac5c47e1f787c50e | R | 2,907 | 83 | # READ DDS OBJECT FOLLOWING DESEQ2 ANALYSIS FROM RDS FILE: ---------------------
dds <- readRDS(rds_deseq2_results)
res <- results(dds)
# ANNOTATE RESULTS WITH GENE SYMBOLS AND ENTREZ IDS: ---------------------------
ensembl_ids <- rownames(res)
# annotate with gene symobols using org.Mm.eg.db package
res$symbol <- m... |
08e644cea354356d5527e40822c1873120f7efe96c2d45e59591773a91fe5214 | R | 2,908 | 84 | ---
title: "Set up a PRS project"
author: X Shen
date: "\n`r format(Sys.time(), '%d %B, %Y')`"
output: github_document
---
------------------------------------------------------------------------
## Summary
These need to be prepared:
- Summary statistics
- SNP list(s)
- A file to indicate... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.