sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
19ecf0f59e31ab1c50c3d1e36db7bc57a83f3eea08fdb953283bbcd78bb0e184 | R | 3,935 | 129 |
#' archstabms_coupling_heatmap
#'
#' Coupling scatterplots.
#'
#' @param input_file path to MoCHI thermo model fit results (required)
#' @param trait trait name (default:"Folding")
#' @param outpath output path for plots and saved objects (required)
#'
#' @return Nothing
#' @export
#' @import data.table
archstabms_cou... |
4a787e4cceefbe353f93cf2b9e32848d23966766d98542df3077b9cca3f55816 | R | 3,938 | 70 | library(data.table)
library(dplyr)
library(coloc)
library(foreach)
library(doParallel)
coloc_abf <- function(i){
Phe1_coloc_dat <- Phe1_dat %>% filter(Phenotype == coloc_pairs[i,exposure])
Phe2_coloc_dat <- Phe2_dat %>% filter(Phenotype == coloc_pairs[i,outcome])
coloc_dat <- inner_join(Phe1_coloc_dat, Phe2_colo... |
da7d0bf9944560e6bda22c1e1924a8929643f62a381af610fc846b50729767df | R | 3,938 | 107 | #! /usr/bin/env Rscript
# Wrapper for WGD R companion library (WGDR) function
# WGD.sample.summaryplots.R to generate WGD summary plots
# for a set of libraries in a given coverage matrix
#installs optparse if not already installed
if("optparse" %in% rownames(installed.packages()) == FALSE)
{install.packages("optpars... |
a42b14ff3074bba78afa2a88ddc00b69160537f245296c14e4fae8856c7c7738 | R | 3,942 | 146 | # Set generic ----------------------------------------------------------------
.rmmvnorm <- function(n, mean, sigma) {
if (!requireNamespace("mvtnorm")) {
stop("package 'mvtnorm' needed to generate multivariate normal random data.")
}
.group <- rep.int(seq_along(n), n)
## make indices so that pooled or i... |
8a7936408c81d1874e31984d8da1ad290982765fc14f5a9e04cf170de7c48978 | R | 3,956 | 99 | # used in monit_replication.R and staar_replication.R
aggPvalsToGene = function(df, combine_pvals, grouping_cols) {
if (tolower(combine_pvals) == "cct") {
print("Combining pvals for gene-trait combi using CCT")
df = df %>%
drop_na(pval) %>%
group_by(across(all_of(grouping_col... |
abce979ef564882da1768fe09fa12f4e9e6aa62dbe87dcaee7816605345f01e4 | R | 3,958 | 78 |
#' archstabms__ggpairs_binhex
#'
#' GGpairs plot for all variables in input data table with correlation in upper triangle and 2d binned hexagons in lower triangle.
#'
#' @param input_dt input data table (required)
#' @param output_file plot output path (required)
#' @param width plot width (default: 12)
#' @param heig... |
b5c38d12a68b9bb1226f4e588bd4be6e617381905b5b2fb6403064728f6a4575 | R | 3,958 | 140 |
#### Find features colocalized with a reference ####
## ------------------------------------------------
setMethod("colocalized", "MSImagingExperiment",
function(object, mz, ...)
{
if ( missing(mz) || is.null(mz) ) {
callNextMethod()
} else {
i <- features(object, mz=mz)
if ( length(i) < length(mz) )
.Err... |
6119ece4becead4bca7ad1a913730be2621d880f962f8facb24239beeaf5788f | R | 3,959 | 99 | library(readxl)
library(ggplot2)
library(data.table)
library(reshape)
library(jtools)
library(MASS)
library(BayesFactor)
model.input <- read_xlsx("complete-input.xlsx")
model.input <- as.data.frame(model.input)
colnames(model.input) <- make.names(colnames(model.input))
model.input <- subset(model.input, (... |
5b4a108ba52dd4c699781e186b82fc0d2e5f194fbaa4179ee544d7f8da49adc9 | R | 3,973 | 67 | library(stringr)
library(readr)
library(dplyr)
library(glue)
options(stringsAsFactors=FALSE)
args = list()
#args$specificity_scores = "/net/trapnell/vol1/ajh24/proj/2018three_level_sciatac/results/ahill/2019_05_06_snapatac_exploratory_analysis/differential_tests/all_tissues/peak_specificity_scores.annotation.txt"
#args... |
fd7f3712736a40cca87c58cef4b1054b39c83cde1fec92a3fecf71fc55533ff3 | R | 3,975 | 68 | ## ----------Script-----------------
##
## Purpose: Generate plots for annotation of target genes after running FICLE
##
## Author: Szi Kay Leung (S.K.Leung@exeter.ac.uk)
##
## ---------------------------------
suppressMessages(library("cowplot"))
## ---------- Source function and config files -----------------
# so... |
da7cae3c4e97d5a6bef3c08e5b8af1a29b95e6477097e90e623cdefc1603a127 | R | 3,976 | 143 | # libraries
library(readxl)
library(tidyverse)
library(ggpubr)
library(rstatix)
library(emmeans)
library(sjstats)
library(lme4)
library(lmerTest)
library(MuMIn)
library(multcomp)
library(nlme)
library(r2glmm)
library(ggplot2)
library(ggthemes)
library(svglite)
library(sjPlot)
library(mixedpower)
# prepare -------------... |
0f8533f9649461b3f9e7da615a125327483d09647e96d534ce6a9b74fed7291b | R | 3,980 | 70 | library(Seurat)
library(dplyr)
library(tidyverse)
library(magrittr)
library(liana)
setwd("F:/Brain_region_project/Brain_region_final_12TB/Data_for_Connectome")
pbmc=readRDS("EC_merge_major_cell_type.rds")
Idents(pbmc)<-"cell_type_high_resolution"
pbmc=subset(pbmc,idents=c("Ast DPP10","Ast GRM3","Ast DCLK1",... |
6a6b8fe412beaa8bb15dd59cbead45115f71ca8344550befb55d5c78fb7f0661 | R | 3,981 | 126 | #!/usr/bin/R
# ---------------------------------------------------------
# Replot the DEG enrichment table from the modules package:
# Updated 11/27/2021
# ---------------------------------------------------------
library(cbrbase)
set_proj('DEVTRAJ', 'multiRegion')
if (!exists("cellmeta")){
source(paste0(sbindir, '... |
f4a6a7f804b42f091986ab4c612f275c5ab2dae8d9b3260a3d4c8d06f17bbdcd | R | 3,982 | 107 | library(minfiData)
library(data.table)
baseDir <- system.file("extdata", package = "minfiData")
sample_sheet <- minfi::read.metharray.sheet(baseDir)
#Testing reading iDATs
rgset = read_idats(sample_sheet)
test_that("iDAT reading",{
expect_is(rgset, "RGChannelSet")
expect_equal(length(minfi::featureNames(rgset)),... |
a4f241ea81c378029d53b7e8f128fb8229ecbc731a741d76bfcd892fcaa76460 | R | 3,988 | 102 | library(MEGENA)
library(Matrix)
library(rstatix)
library(dnapath)
library(Seurat)
source("init_required_packages_and_files.R")
method = "spearman"
FDR.cutoff = 0.05
nodes_cor<-read.csv(file="all.nodes.cor.txt",sep="",header=F)
colnames(nodes_cor)=c("var1","var2","rho") ... |
4da98ff27ed6da51fd0dd75fc861e4cb76f878e27fae3bdcaf9009f10c6c1b70 | R | 4,001 | 127 | #!/usr/bin/R
# --------------------------------------------------
# Calculate the gene overlap and overlap enrichment:
# for pairs of modules across two cell types.
# NOTE: Mainly for OPC / Oli
# Updated 03/26/2022
# --------------------------------------------------
library(cbrbase)
set_proj('DEVTRAJ', 'multiRegion')
... |
7429c091567a7462f66bcf693b0b94e77b8e51e632e21f2481ae14aa1600d0f5 | R | 4,002 | 125 | #!/usr/bin/R
# --------------------------------------------------
# Enrichments + plots for the cross-module clusters:
# Updated 03/27/2022
# --------------------------------------------------
library(cbrbase)
set_proj('DEVTRAJ', 'multiRegion')
if (!exists("cellmeta")){
source(paste0(sbindir, 'load_metadata.R'))
}
... |
dbb4067dbbec0e6ced58de0a0ca9dcddf9f0522b2a67d3918a99866f4eec9caf | R | 4,010 | 102 | #########################
########Licensing########
#########################
# Breathe Easy - an automated waveform analysis pipeline
# Copyright (C) 2022
# Savannah Lusk, Andersen Chang,
# Avery Twitchell-Heyne, Shaun Fattig,
# Christopher Scott Ward, Russell Ray.
#
# This program is free software: you can redis... |
7095e0cafdead83e7d74d3cd70c63c4298541bc016eabb8bcc9289e74d932f3f | R | 4,011 | 150 | #' Evaluate function on wavelengths of `hyperSpec` object
#'
#' This is useful for generating certain types of baseline "reference spectra".
#'
#' @param x either `hyperSpec` object or numeric vector.
#' @param ... expressions to be evaluated.
#' @param normalize.wl function to transform the wavelengths before evaluati... |
c50fc43d3bcb4a4a4350bfe27ed8a17b57ddc7866dc90d518228927481d7278b | R | 4,012 | 111 | # input:
# data/05_DS2_seuratTL.Rdata
#
# output:
# data/07_DS2_pseudot_umap.Rdata: pseudotime assignment
options(bitmapType = 'cairo')
library(SingleCellExperiment)
library(igraph)
library(scater)
library(slingshot)
bsave <- TRUE # save intermediate and final results
# (1) Load data ----
(load("data/05_DS2_seu... |
4fa3080e60ec98fb3e256a281a6ef17812639dd9280d2118f19ef699e56055ee | R | 4,017 | 62 | library(tidyverse)
library(ggpubr)
# Read in DESeq2 normalized counts containing all 3 NEPC samples
norm_counts <- read_csv("~/nepc_normalized_counts.csv")
# Calculate manual log2FC and other statisics for each comparison
stats_tn22_vs_tn21 <- norm_counts %>%
mutate(FC = TN22/TN21,
log2FC = log2(FC),
... |
ca83fcf932311eeb722d44a90958873639a659f2dbe28fa910cdc20723b38868 | R | 4,018 | 125 | #' Bring argument to a conventional name
#'
#' @description
#' Fix a string with unit name (for wavelength axis) into a sting that
#' can be used as a standardized argument value for other \pkg{hyperSpec}
#' functions, e.g., [wl_convert_units()].
#'
#' **Note:** This function is only intended to be used internally in
#... |
a0c1f588b852061d131135b0d68057ae2f6a39a86fd64e86f57e36b8bdf5f547 | R | 4,023 | 88 | rm(list=ls())
library(Seurat)
library(rliger)
library(SeuratWrappers)
library(dplyr)
library(RColorBrewer)
library(patchwork)
library(ggplot2)
setwd("Couturier_scRNA/filtered")
dir <- dir("./")
samples_name <- gsub(".filtered_gene_matrices","",dir)
samples_name <- gsub("_.*","",samples_name)
samples_name <- gsub("BT322... |
421179f4c61d5483e1c51aea5e4b4e9c287cf2feb966e48ab0db372cafc8bbdb | R | 4,029 | 113 | #!/usr/bin/R
# --------------------------------------------------------
# Plot the aggregated DE results across different methods:
# Raw counts of degs
# Overlap between conditions
# Updated: 03/22/22
# --------------------------------------------------------
library(cbrbase)
set_proj('DEVTRAJ', 'multiRegion')
source(p... |
5d8a39cabf6bda0d62b914cb31eb6072fa8880e7365fc08f0bc6c8f40d914b3f | R | 4,034 | 84 | remap_celltypes <- function(cell_dict_file, cell_ident) {
cell_type_dict <- read.csv(file=cell_dict_file, header=TRUE, sep=",")
cell_type_dict$Name <- factor(cell_type_dict$Name)
rownames(cell_type_dict) = cell_type_dict[,'Cluster']
true_type_names = lapply(cell_ident, function(x) cell_type_dict[as.character(x)... |
971b69478625430ed92ee750ac267c25bfcc352b111e8d284cc03a66996282fa | R | 4,036 | 90 | #' Extract the outline from pdf toc, and output as Markdown
#'
#' @param input_toc Character. The table of contents (TOC) of a pdf file, extracted by \code{pdftools::pdf_toc()}.
#' @return Character, showing the TOC in Markdown.
#' @export
#' @examples
#' input <- file.path(R.home(), 'doc/manual/R-intro.pdf')
#' input_... |
b5e8257518960f9954df0677b7ad99210c4cd9b5a7c7ca32310baf291b102f37 | R | 4,040 | 139 | #!/usr/bin/R
# --------------------------------------------------------------------------
# Follow up on cognitive impairment + CDK5R1/R2 as likely compositional DEGs
# for Exc TOX3 TTC6 and other EC neuronal subtypes
# Updated: 09/14/21
# --------------------------------------------------------------------------
libra... |
7539edc6bb1fb1b65d852145c784e49a0ea18722f6e9f1b882e3354c4e1bd16a | R | 4,041 | 110 | source("src/init_required_packages_and_files.R")
source("src/scripts_neuroblastoma/plot_network_diff.R")
dir_output <- "./output/neuroblastoma/"
filtered_counts_name <- "zeroes0.8"
dir_filtered <- paste0(dir_output, filtered_counts_name, "/")
measure <- "pcor"
lp <- 2
dir_output <- dir_filtered
signif <- 0.01
monoto... |
40b2f496be828c5102a90f6a8c87570f9fb043cf0557d10be7a569438e4d0a93 | R | 4,042 | 100 | ## Paired pre-fits: `my_estimate_with_variance` (association on) vs
## `my_estimate_exclude_mean_variability_association` (association off in the
## prior) — same composition and variability formulas. Defined in `test-plot.R`
## when CmdStan is available.
test_that("exclude_mean_variability_association is stored and p... |
59921569eb624f0bf6ff87b2544dd34aba4d6aed862af87c2f0384bca2cfb6ac | R | 4,042 | 130 |
### models the A-T- to A+(T-) conversion ###
# run analysis_clean.R before!
############################################
print_figures <- F
sensitivity <- F
##extract participants with A-T- profile
tmp <- unique(subset(longATN, ATN=="A-T-")$RID)
longAmTm <- subset(longATN, is.element(RID, tmp))
#build data for surv... |
56b4a9f36228ede3ecf2891a8b896be10494e78c58ed02ed365bdc66080e16f8 | R | 4,044 | 167 | options(bitmapType='cairo')
ks.boot <- function(x, y, ...,
alternative = c("two.sided", "less", "greater"),
exact = NULL, nboots = 50) {
# create progress bar
pb <- txtProgressBar(min = 0, max = nboots, title="ks.boot", style = 3)
alt <- match.arg(alternative)
n <- length(x)
D <- numeric(nboot... |
1f9b1f1fb0371a73841f31fdb092e4edd55685618b9f4008a97b5c4fe15cf748 | R | 4,049 | 70 | library(Seurat)
library(dplyr)
library(tidyverse)
library(magrittr)
library(liana)
setwd("F:/Brain_region_project/Brain_region_final_12TB/Data_for_Connectome")
pbmc=readRDS("AG_merge_major_cell_type.rds")
Idents(pbmc)<-"cell_type_high_resolution"
pbmc=subset(pbmc,idents=c("Ast DPP10","Ast GRM3","Ast DCLK1",... |
13a69d784ea86db46b01481de89f798f6ceb801ce1a69abb8c22ba1523f0ef7d | R | 4,050 | 89 | Responses_Analyser = setRefClass(
"Responses_Analyser",
contains = "Analyser",
methods = list(initialize = function()
{
callSuper(
description = "Within a user defined peak search window, the highest value
for each time point (stimulus) is found.
The resulting plot is a boxplot where the ... |
450952e0cfdb9cdd3b5fe8aeccc84b5b377222f63ed847bc05bf5fc90bf03a7b | R | 4,054 | 82 | #This script integrate human embryo CS7 dataset (Tyser et al., 2021) and human gastruloid at 24hr
#Link to human embryo CS7 dataset is provided in https://shendure-web.gs.washington.edu/content/members/hGastruloid_website/public/
#Human gastrloid datasets from this paper are provided at National Center for Biotechnolog... |
c924d036cf43c173241dbd3731540965f1efcaf79820eadbb46d3e0c39cc8f9a | R | 4,057 | 149 | #' @title Find an evenly spaced grid for x
#' @description
#' `raster_make()` fits the data to the specified raster.
#'
#' `raster_fit()` tries different raster parameter and returns the raster that
#' covers most of the `x` values: The differences between the values of `x` are
#' calculated (possible step sizes). For ... |
6b1e09cdb78a0dda634b99db1ea912ef1d37b9d80e31bcfc1b8367b5f7afeb92 | R | 4,063 | 106 | #' This function generates syntax for FSL Feat .fsf files for the contrasts tab of an fMRI analysis.
#' It accepts a numeric contrast matrix whose rownames correspond to the name of the contrast.
#'
#' This allows you to generate contrast syntax dynamically based on a given subject's data
#' using tools such as lm() an... |
a907397455dc430ffa9a6ec687d17f60c3dbbbb59973ca5f695703e55fbe7e6d | R | 4,065 | 70 | library(Seurat)
library(dplyr)
library(tidyverse)
library(magrittr)
library(liana)
setwd("F:/Brain_region_project/Brain_region_final_12TB/Data_for_Connectome")
pbmc=readRDS("MT_merge_major_cell_type.rds")
Idents(pbmc)<-"cell_type_high_resolution"
pbmc=subset(pbmc,idents=c("Ast DPP10","Ast GRM3","Exc L2-3 CB... |
550e73c41bbaae2051f8d5ccd9d991bee4a732a5a647ab2b8b0904a81c652c49 | R | 4,078 | 70 | library(Seurat)
library(dplyr)
library(tidyverse)
library(magrittr)
library(liana)
setwd("F:/Brain_region_project/Brain_region_final_12TB/Data_for_Connectome")
pbmc=readRDS("PFC_merge_major_cell_type.rds")
Idents(pbmc)<-"cell_type_high_resolution"
pbmc=subset(pbmc,idents=c("Ast DPP10","Ast GRM3","Ast DCLK1"... |
f52e51a4f0a39cfb30271a98d36f3d7c0229a014506127c89fbc3716ba2b46b0 | R | 4,081 | 127 | library(jsonlite)
library(rstudioapi)
library(dplyr)
library(tidyr)
library(tools)
# ----------------------------------------------------------------------
# Configuration and data loading
setwd(dirname(rstudioapi::getActiveDocumentContext()$path))
config <- fromJSON("config.json")
source("helpers.R")
dataframes_di... |
341fc7d58c87fbedd32085238816dc2da2f1e7e8a14b1c78a2d729e1cc85f176 | R | 4,090 | 137 | require(testthat)
require(Cardinal)
context("MSImagingExperiment")
test_that("MSImagingExperiment accessors", {
mse <- MSImagingExperiment()
expect_true(validObject(mse))
mse <- MSImagingExperiment(matrix(nrow=0, ncol=0))
expect_true(validObject(mse))
set.seed(1)
nr <- 20
nc <- 10
a <- matrix(rlnorm(nr *... |
c01b549b63910e1a08af1923af4ec1c6be62a62c14c9bf6844d89b6540d154af | R | 4,101 | 118 | parse.pheno.covar <- function(pheno, covar, parsed, trace=0) {
#' @keywords internal
fam <- parsed[['fam']]
keep <- parsed$keep
# keep <- NULL
pheno.df <- NULL
update.keep <- function(old, new) {
if(all(new)) {
return(old)
} else {
if(is.null(old)) return(new) else {
if(is.nul... |
84e3865055bb8726af4ec8a9b841a9b87fc6ae98860508509770ee06ed7e951c | R | 4,105 | 92 | combat_from_train <- function (dat, batch, mod = NULL, estimates = NULL,
verbose = FALSE) {
dat <- as.matrix(dat)
batch <- as.factor(batch)
n.array <- length(batch)
n.batch <- nlevels(batch)
batches <- lapply(levels(batch), function(x) which(batch == x))
n.batches <- sapply(b... |
973793aada9bd65339190320745c137df2ec4ced486556411104ec473756c688 | R | 4,115 | 120 | library(readr)
library(dplyr)
library(tidyr)
library(data.table)
source("/proj/mnhallqlab/users/michael/fmri.pipeline/R/fmri_ts.R")
trial_df <- readRDS("/proj/mnhallqlab/projects/clock_analysis/fmri/fsl_pipeline/mmy3_trial_df_selective_groupfixed.rds") %>%
mutate(rt_time=clock_onset + rt_csv/1000, #should be pretty r... |
74ba755b10ac7566ebb52737c513123f0eaeb6cef7e9761ac9b3f02cc2a395ff | R | 4,117 | 125 |
library("ggplot2")
library("dplyr")
# Read in the csv files
geneGroupHere = "Markers_Only"
arterialMarks = c("SEMA3G", "EFNB2", "DLL4")
venousMarks = c("NR2F2", "ACKR1")
endocardMarks = c("SMOC1", "NPR3")
lymphatMarks = c("PROX1", "TBX1", "PDPN")
markerList = list(arterialMarks, venousMarks, endocardMar... |
483eafff1af1a8d7090bf39baeb9df924acef8d7ab5eb7a11d2fc3cc04dd80b3 | R | 4,121 | 95 | library(SoupX)
sample_name <- "M"
samples_dir <- "C:/Users/mauri/Desktop/scRNAseqR/data/samples/sakshi NGN2 microglia"
data.data <- Seurat::Read10X(data.dir = file.path(samples_dir, sample_name, "filtered_feature_bc_matrix"))
data <- Seurat::CreateSeuratObject(counts = data.data, project = sample_name, min.cells = 3,... |
3a6f423a345dad3383b45d6083fb3119951ef11ebb05c66e2a44854f9f4ecbc3 | R | 4,135 | 107 | test_that("mixed_by rstanarm engine adds pd and posterior p-values", {
testthat::skip_if_not_installed("rstanarm")
testthat::skip_if_not_installed("bayestestR")
set.seed(202)
df <- data.frame(
id = factor(rep(rep(1:4, each = 3), times = 2)),
split = rep(c("a", "b"), each = 12),
x = rnorm(24)
)
... |
a356cce6f816a35e48a9bcce24520a8547438a9761975c654b9157c72cbeb924 | R | 4,143 | 84 | library(knitr)
library(tidyverse)
save_fig = function(file_name, width=6.5) {
ggsave(paste0("Figures/", file_name, ".png"), width=width)
ggsave(paste0("Figures/", file_name, ".pdf"), width=width)
}
dir.create("Figures", showWarnings = FALSE, recursive = TRUE)
dir.create("Tables", showWarnings = FALSE, recursive =... |
d0a9e7201c4e311001c664346a3ed8396770b27dde8f4884d4f344ced800a934 | R | 4,146 | 129 |
#' Load and attach `hyperSpec` and all installed *R hyperSpec* family (`hySpc.*`) packages
#'
#' This function loads and attaches **hyperSpec** and all installed
#' [*R hyperSpec*](https://r-hyperspec.github.io/) family packages, which
#' share common **`hySpc.`_something_** package name pattern.
#'
#' @param exclude ... |
f79a958309ad7ffdb77ad61979640ea969f421550670bb0f043fc05418c9e87e | R | 4,149 | 161 | # Set generic ----------------------------------------------------------------
#' Functions `colSums()`, `colMeans()`, `rowSums()`, and `rowMeans()` for
#' `hyperSpec` objects
#'
#' `hyperSpec` objects can use the base functions [base::colMeans()],
#' [base::colSums()], [base::rowMeans()] and [base::rowSums()].
#'
#' ... |
26e7dd2222607dfe1a07a20cfe6ca8c384f02313ac657ec685e26c3bd6a04a3c | R | 4,150 | 138 | # For the specified k, generate scatter and QQ plots for every bivariate comparison
# between sFC and dFC and do multiple normality tests.
# Output:
# ccomp,'_scatter.jpg' Scatter plot for a bivariate comparison.
# ccomp,'_qq.jpg' QQ plot for a bivariate comparison.
# binormtest_p.csv P-values from multiple normality ... |
16c8159454f69a9bad270e1e8a4b7410400ba40ffbe041f1fc1b5624583042a1 | R | 4,151 | 83 | library(tidyverse)
library(dplyr)
args <- commandArgs(trailingOnly = TRUE)
all<-read.csv(file="../data_S.NOMIS1.csv")
all$cluster<-paste(all$cluster_annotated,all$da0,sep="_")
AD<-subset(all, da0=="0" & updatedDX=="AD")
CN<-subset(all, da0=="0" & updatedDX=="Control")
da<-subset(all, da0!="0") ... |
a97ee7a0a5ff08516ca5bd363e3de0c2775398e3b8df84352df4f038f74be51c | R | 4,160 | 115 | library(dplyr)
library(logger)
library(purrr)
library(stringr)
library(yardstick)
## params to specify #####
phenotypes = snakemake@params[["phenotypes"]]
logistic_model_res_path = snakemake@params[["input_res_path"]]
phenotype_suffix = snakemake@params[["phenotype_suffix"]]
top_bottom_q_vals = snakemake@params[["to... |
b93855639f2fd1754eadf1659536c99bcef6b957f401bfd3917997a9573b80a0 | R | 4,162 | 118 | library(ArchR)
setwd('~/multiome')
inputFiles <- c('~/multiome/multiome_R1_CN347SMN_e115/outs/atac_fragments.tsv.gz',
'~/multiome/multiome_R2_CN347SMN_e115/outs/atac_fragments.tsv.gz')
names(inputFiles) <- c('multiome_R1',
'multiome_R2')
ArrowFiles <- createArrowFiles(
inputFil... |
5fbeee748070fdf83039866c5cfdbbfd19b23162c4c29b8a70a80b27c39e2c89 | R | 4,163 | 134 | #!/usr/bin/R
# ----------------------------------
# Prelim plots scDRS
# Updated 10/26/2022
# ----------------------------------
library(cbrbase)
set_proj('DEVTRAJ', 'multiRegion')
if (!exists("cellmeta")){
source(paste0(sbindir, 'load_metadata.R'))
}
source(paste0(sbindir, 'auxiliary_pseudobulk_loading_fns.R'))
... |
603324f194e9e0badfffc3ddaba72ad852bf79c9fcc8b25af42c2d3a12a6a612 | R | 4,166 | 153 |
library(ggplot2)
library(dplyr)
library("optparse")
library(stringr)
print("Libraries loaded, starting now")
# Get the passed parameters
option_list = list(
make_option(c("-m", "--modelNotes"), type="character",
# default="_fix_Anatomical_Site_rand_Donor_HM10UMI=100_mito=10Scrub=0.2noPackerMNN=sampleNameK=4... |
d76472a29a2ec59d649313206ca9f6354b28fb08fb5cbbc1b0243c79894c5b14 | R | 4,172 | 133 | #!/usr/bin/R
# --------------------------------------------------------
# Explore AD diagnosis vs. scores from different modules:
# Do different modules explain different parts of AD diag?
# Updated 12/19/2021
# --------------------------------------------------------
library(cbrbase)
set_proj('DEVTRAJ', 'multiRegion')... |
f87133f7f40c27adede97b943a3cd65a8f2df6db5d8da9ab544ee9eda3b9a832 | R | 4,175 | 104 | #####INTEGRATE Seurat objects
##################################################
##########to increase the capacity###############
library(future)
# check the current active plan
plan()
# change the current plan to access parallelization
plan("multiprocess", workers = 12)
options(future.globals.maxSize = 12000 * 2048^... |
0f459348d851c657c4b929cc54cfaf3d15e4b66f4e057e682975b9825a14225e | R | 4,179 | 126 | #!/usr/bin/env Rscript
#read in command line arguments.
args <- commandArgs(trailingOnly = FALSE)
scriptpath <- dirname(sub("--file=", "", grep("--file=", args, fixed=TRUE, value=TRUE), fixed=TRUE))
argpos <- grep("--args", args, fixed=TRUE)
if (length(argpos) > 0L) {
args <- args[(argpos+1):length(args)]
} else {
... |
0572cb09dd38c4eb9a2c35a1ad8df7a05fd91eb2cf388438f25d9a452160a1d0 | R | 4,187 | 123 |
# Get functions
library(monocle3)
source("/net/trapnell/vol1/home/readdf/trapLabDir/sharedProjectCode/utility/singleCellUtilFuncs.R")
# modStatus <- loadMonoclePackages()
library(tidyr)
# Note: Need to load bedtools prior to running this script!
# library("bedr")
# module load bedtools/2.29.2
library("optparse")
# G... |
6af2c5efbed5635656c3537870a448fb83df22e2bb993c8ede76e339a090449f | R | 4,188 | 113 | #!/usr/bin/R
# ------------------------------------------------------------------
# Compare the proportions across regions for the main paper figures:
# Updated 12/01/2021
# ------------------------------------------------------------------
library(cbrbase)
set_proj('DEVTRAJ', 'multiRegion')
source(paste0(sbindir, 'lo... |
8a8f12c8ab52acda7146e7ba01bbb225c5a0c8cd0029dfd6760dad24816b2018 | R | 4,205 | 110 | #### Single parcel ARI comparison between chimp and human 17-factor solutions ####
## creates Fig. 2B volume nifti ##
wd <- "~/projects/chimp_human_opnmf/"
setwd(wd)
if (!require("pacman")) install.packages("pacman")
pacman::p_load(oro.nifti, fs, neurobase, aricode, reshape2, ggplot2, dplyr)
# Helper script with usef... |
68a5a1f0db627f7961d16ccddd1300c9963a72202bfb6d8207b6d55df30048d9 | R | 4,219 | 136 | # Function -------------------------------------------------------------------
.all.equal <- function(target, current, ..., check.attributes = FALSE,
check.names = FALSE, check.column.order = FALSE,
check.label = FALSE,
tolerance = hy_get_option("tol... |
d71bde0146650e51ec1a6c3d9050a635dd55be086da05abf4003699c3ed5f4ab | R | 4,225 | 125 | ### utility script for OPNMF post-hoc analysis ####
# Contains functions for commonly used processes #
# S.Vickery 08.2021 #
# FUNCTION 1: Use a parcellation to take the mean of the values of another
# image/s at each parcel/component #
parcel_avg <- function(parc, img, img_vol = TRUE) {
require("neurobase")
req... |
a670c7215e395d36d3132e2c2df4293cbc2d94e96836fabcafb6f4514de09175 | R | 4,228 | 120 | library(httr)
library(tidyverse)
library(xml2)
out_file_path = "all_eLife_articles.tsv"
if (file.exists(out_file_path)) {
print(paste0(out_file_path, " already exists, so the GitHub repository does not need to be parsed."))
} else {
if (!dir.exists("elife-article-xml")) {
# NOTE: The git command-line tool m... |
d5899d79dbaa7a7c46df5e513d8f60644cfaf7ba76dd4d4d26112def7a283e84 | R | 4,238 | 152 | # Greg Booth 2021
# This script creates an ArchR project by combining all arrow files from HEART
# It then filters cells based on the filtered cds objects previously created
# for each sample
cds_p_path = "/net/trapnell/vol1/home/readdf/trapLabDir/hubmap/results/2021_07_15_Greg_ATAC_Code_nobackup/"
basepath = "/ne... |
19b8dc19f389190290a2dee52020fc5afaf21148cd6e03adfd20d9e532b3f1e5 | R | 4,264 | 191 | require(testthat)
require(Cardinal)
context("SpectraArrays")
test_that("SpectraArrays 1-D", {
expect_true(validObject(SpectraArrays()))
s <- SpectraArrays(1:10)
expect_true(validObject(s))
expect_equal(s[[1L]], 1:10)
a0 <- 1:10
a1 <- 11:20
a2 <- 21:30
al <- list(a0=a0, a1=a1, a2=a2)
s <- SpectraArrays(al)... |
4e90abf9ec9c9332daa6b1fbcea92e7a501612cfb0d8c7c71e1c28aae3eeb00b | R | 4,268 | 130 | #!/usr/bin/R
# ---------------------------------------------------------
# Plot basic marker differences between astrocyte subtypes:
# Updated 11/26/2021
# ---------------------------------------------------------
library(cbrbase)
set_proj('DEVTRAJ', 'multiRegion')
source(paste0(bindir, 'multiRegion/load_metadata.R'))
... |
83dc6189138b2920ea89679fd9f24d45562f5f6773f0643a2e60b47e5b4e321f | R | 4,275 | 145 | #' Interactively select a polygon (grid graphics) and highlight points
#'
#' Click the points that should be connected as polygon. Input ends with right click (see
#' [grid::grid.locator()]). Polygon will be drawn closed.
#'
#' `map.sel.poly` is a convenience wrapper for [plot_map()], `sel.poly`,
#' and [sp::point.in.p... |
6d525b598bdb6aa4496d9c281d0204733d72c560fa0b4d9cfb911c17e61d74ce | R | 4,278 | 86 | setwd("F:\\RNA_20221101\\02_ModifiedGenome\\C_POEgeneSelection\\figures_tables\\03_POE基因热图展示\\data")
library(dplyr)
library(ggplot2)
library(basicTrendline)
library(customLayout)
library(magrittr)
library(pheatmap)
data_filter <- read.csv("AutosomeGeneCount_filtered.csv", header = T, row.names = 1)
POE <- r... |
3aac3a29a3346beeef20b7bc781dc9989a2038c625317f9193d49f8d8f172b38 | R | 4,279 | 117 | #################################################################################
###
### plot_map - plot spectral maps
###
### plots intensity or extra data column over 2 extra data columns
## TODO: check whether function should be applied or not
#' Plot a map and identify/select spectra in the map
#'
#' [lattic... |
1243e0b30deaccbe58eb6823c91403a81bbd6070d0957934d9804200808cc1b7 | R | 4,287 | 169 |
# Function -------------------------------------------------------------------
#' @importFrom utils modifyList
.labels <- function(object, which = bquote(), drop = TRUE, ..., use.colnames = TRUE) {
validObject(object)
if (!missing(which) & !is.character(which)) {
warning(
"labels are not guaranteed to ... |
c05fe34b67ddfae05686d0c5b02aeb4b100ea839a15eaafff60f97134c94ca28 | R | 4,297 | 156 | #!/usr/bin/R
# --------------------------------------------------------
# Score the pseudobulks by modules, plot against pathology
# Updated 01/18/2023
# --------------------------------------------------------
library(cbrbase)
set_proj('DEVTRAJ', 'multiRegion')
if (!exists("cellmeta")){
source(paste0(sbindir, 'loa... |
85cfa8387564afb1b943e1fdfd2cc40fbe2ecd824addc136579b86ba0fbda52b | R | 4,307 | 120 |
library(ggplot2)
library(ggrepel)
monocle_theme_opts <- function()
{
theme(strip.background = element_rect(colour = 'white', fill = 'white')) +
theme(panel.border = element_blank()) +
theme(axis.line.x = element_line(size=0.25, color="black")) +
theme(axis.line.y = element_line(size=0.25, color="black")... |
f2345543bc8ac4a892e983c7c1dbbca4675a8bb1f70d4b3670c4668d3f04c8af | R | 4,310 | 152 | #' @title Rubberband baseline correction
#'
#' @description
#' Baseline with support points determined from a convex hull of the spectrum.
#'
#' Use `debuglevel >= 1` to obtain debug plots, either directly via function
#' argument or by setting hyperSpec's `debuglevel` option.
#' @param spc `hyperSpec` object
#' @param... |
818392cbc8ed3c94c6a8aa960503187d16a306eec89e65b7998f5d4e3165a505 | R | 4,313 | 113 | library("batchtools")
# prepare for the list of directory for data import
DirList <- list()
for (i in 1:8){
DirList[[i]] <- paste0("./mrnaseq/221006-T3-NZ/", i, "/")
}
DirList <- unlist(DirList)
## use the bath tools for RNA contamination detection and doublet removal
setwd("./Step1.DataIntegration")
reg <- make... |
8419e46996d11dc1b04e1436375d214087f28e7867235c4b181f1521a7e654da | R | 4,317 | 166 | test_that("get_l1_confounds exposes motion-derived framewise_displacement to exclude_run", {
skip_if_not_installed("data.table")
tmp_dir <- tempfile("get_l1_confounds_motion_fd_")
dir.create(tmp_dir, recursive = TRUE)
confound_file <- file.path(tmp_dir, "confounds.tsv")
motion_file <- file.path(tmp_dir, "mo... |
9bee65e5ab55fde01950c07dcdc99eb76bb71fbb1856a43437a38164a50c2d23 | R | 4,317 | 133 | #!/usr/bin/R
# ---------------------------------------------------------
# Calculate the cross-ct module correlation from residuals:
# Updated 11/30/2021
# ---------------------------------------------------------
library(cbrbase)
set_proj('DEVTRAJ', 'multiRegion')
if (!exists("cellmeta")){
source(paste0(sbindir, '... |
c1f5fb9660f4c12dad44fa54f4cbbee340be5692ba95b5bdcac43cc99b609a95 | R | 4,320 | 142 | #!/usr/bin/env Rscript
# evenSplitter: helper script for splitting tab-delimited files
####################################
#####Set parameters & load libraries
####################################
options(scipen=1000,stringsAsFactors=F)
require(optparse)
##########################################
#####Read comma... |
aa299f68ce72d08760102603a7b7c1f4910817f1bb6930d3c91035f88339625a | R | 4,322 | 93 | library(SeqArray)
library(SeqVarTools)
library(SNPRelate)
library(Biobase)
library(GENESIS)
#### Inputs #####
vcffile <- paste0("gcad.qc.r3.wgs.16905.GATK.2021.08.24.biallelic.genotypes.chr", 1:22, ".ALL.vcf.gz")
convert vcf to gds
seqVCF2GDS(vcffile, 'biallelic.gds', fmt.import="GT", storage.option="LZMA_RA", paralle... |
71be71b505aaf42ff993ad6895094f6c99efda5bf10d1b07108c3790f8f9fc96 | R | 4,323 | 146 | rm(list=ls())
data<-read.delim("/Users/cazaledl-admin/Library/CloudStorage/OneDrive-UniversityofBirmingham/Post_doc/XP/data/courtscape/screen/text/.txt",h=T,sep="\t",na.strings = "NA", stringsAsFactors=T)
#install.packages("beeswarm")
#install.packages("conover.test")
#install.packages("rstatix")
library(bee... |
63180d2409584714dd4ee4d4a2b99681480be752836d41c55c797608c262b2ee | R | 4,334 | 174 | ---
title: "Chat Analysis"
author: "Shahzad Khan"
date: '2023-11-01'
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r}
library(dplyr)
library(Seurat)
library(patchwork)
```
```{r}
#Create chat object for subcluster anaylsis
chat <- (subset(gswt, idents =c("Chat_IN"))... |
f7eeee80540c2a23b4cc4a9fc51b3ec8cccd39536c018ff89e80a78b16bd9b53 | R | 4,343 | 131 | # Helper function ------------------------------------------------------------
#' Search if machine has IP
#'
#' This function searches for IP address in IP config.
#' If there is IP, it is assumed that the machine has Internet connection.
#' Otherwise it is assumed that machine is offline.
#'
#' @return `TRUE` if IP ... |
42b25758a9b63ad6423975537738de3fc7aef8e6b1fd1863bc1fe070ba48114a | R | 4,345 | 126 | gretna_heritability<-function(Data){
# ==================================================================================
# This function is used to calculate the narrow sense of heritability using
# ACE model based on OpenMx package (https://github.com/OpenMx/OpenMx).
#
# Syntax: gretna_heritability <-funct... |
d317308ad9d6fdb91a9aab2f388cb8025aec456d95f78536aece05e192c90e1b | R | 4,351 | 151 | #!R
## Compare CNVs
#!/usr/bin/env Rscript
library("optparse")
option_list = list(
make_option(c("-i", "--inputbed"), type="character", default=NULL,
help="input bed from bedtools closest", metavar="character"),
make_option(c("-o", "--outputbed"), type="character", default=NULL,
... |
e1b66b63e999968c9c48d9973322761713639d2d119f7efe5d536d122ac76503 | R | 4,365 | 124 | #!/usr/bin/R
# ---------------------------------------------------
# Calculate enrichments for the final aggregated DEGs
# vs. the final modules (+ save resources for plots).
# Updated 02/18/2021
# ---------------------------------------------------
library(cbrbase)
set_proj('DEVTRAJ', 'multiRegion')
if (!exists("cellm... |
36c910356d79bc1702b4afa45f218eff14434d473fe1861451625677ed891cf6 | R | 4,370 | 90 | # Find Markers for round two clusters
source('Analysis/util.r')
library(Seurat)
library(presto)
library(magrittr)
library(dplyr)
library(ggplot2)
# x <- load_integrated()
DefaultAssay(x) <- 'SCT'
Idents(x) <- x$cell.broadtype
x$cngeneson <- scale(x$nFeature_RNA)
x <- PrepSCTFindMarkers(x)
sct.markers <- FindAllMarkers... |
222cb0a9303b393eba2da34e12e1bf56c1780923a3ef30a48929d9ca3fda1619 | R | 4,377 | 162 |
# Generate spectroscopic data for testing and exploration --------------------
#' @name generate_test_data
#'
#' @title Generate spectroscopic data
#'
#' @description
#' These functions generate hyper-spectral datasets that are mainly used for
#' exploring and testing functionality of \pkg{hyperSpec}.
#'
#' - `genera... |
d6837503831fd9a80305a68ffcffd5b3b3dd954f871de65afc476bc42fba3ebf | R | 4,394 | 162 | # Set generic ----------------------------------------------------------------
# make generic functions without default
#' @noRd
setGeneric("mean_sd", function(x, na.rm = TRUE, ...) standardGeneric("mean_sd"))
#' @noRd
setGeneric("mean_pm_sd", function(x, na.rm = TRUE, ...) standardGeneric("mean_pm_sd"))
# Function... |
553be741d4c1807db59b613a95a99a98404427c2cc74bda92c704361c130e194 | R | 4,415 | 85 | library(data.table)
library(dplyr)
library(TwoSampleMR)
library(ieugwasr)
library(plinkbinr)
library(foreach)
library(doParallel)
perform_mr <- function(i){
Phe2_out_dat <- Phe2_dat %>% filter(Phenotype == mr_pairs[i,Phe2])
Phe1_exp_dat <- Phe1_dat %>% filter(Phenotype == mr_pairs[i,Phe1]) %>% filter(SNP %in% Phe2_o... |
76bf69e4d1b68334340c4a792b125238ba794d51e2ad70b09e486bb5de6d43b3 | R | 4,415 | 198 | library(BPCells)
library(Seurat)
library(SeuratObject)
library(SeuratDisk)
library(Azimuth)
library(dplyr)
file.dir <- getwd()
files.set <- c("/SEA-AD.h5ad")
data.list <- c()
metadata.list <- c()
path <- paste0(file.dir, files.set)
data <- open_matrix_anndata_hdf5(path)
write_matrix_dir(
mat = data,
dir = p... |
9fd26651e5fcd41fbb3a6416c7bde0327ee4987eb587aa92dadc0c8270402d93 | R | 4,427 | 146 | # Note: This only runs if you get the right resources upon qlogin/qsub. Run:
# qlogin -q trapnell-login.q -l mfree=4G -pe serial 16
# to start up
# Trying:
# qlogin -l mfree=20G -q trapnell-login.q -pe serial 16 -l centos=7
# Trying this on 7-20-21. (Didn't work, going back to 20g)
# qlogin -l mfree=40G -q trapnell-... |
864f2b7a9e69f159eff7657b6fb0e2e80f9ce2bd172d1b754e6b977b5401f5b6 | R | 4,441 | 148 | ---
title: "Rod Train Event Density analysis"
author: "Jenn Kim"
date: "06/11/2023"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
# load packages and set seed
```{r}
library(tidyverse)
library(cowplot)
library(ggplot2)
theme_set(theme_cowplot())
library(nlme)
library(lsm... |
5068dfafe23dd75e03c412199b8260a66fad6a537845448bcbda0f088636e2d8 | R | 4,456 | 152 | test_that("sccomp_test_smooth() errors on a fit without smooth terms", {
skip_if_not_installed("mgcv")
skip_cmdstan()
data("counts_obj")
fit <- sccomp_estimate(
counts_obj,
formula_composition = ~ type,
formula_variability = ~ 1,
sample = "sample",
cell_group = "cell_g... |
bf8054dfcde78c8bd853e48643de5f60001b950c116d5935ddb1a66a70fb950d | R | 4,456 | 138 | library(dplyr)
celltype_list = c("Exc","Inh","Ast","Oli","OPC","Mic")
region_list = c("AG","EC","HC","MT","PFC")
#Select variables
variable_list=list("plaq_n","nft","nrad","cogdxad")
for (k in 1:length(variable_list)) {
variable=variable_list[[k]]
#########################################################... |
2a8e1d6e40e07f14dd63aa532b6e3f22883c84f6687e64d1a68315bef6736b08 | R | 4,462 | 86 | library(data.table)
library(dplyr)
library(TwoSampleMR)
library(ieugwasr)
library(plinkbinr)
library(foreach)
library(doParallel)
perform_mr <- function(i){
Phe2_out_dat <- Phe2_dat %>% filter(Phenotype == mr_pairs[i,Phe2])
Phe1_exp_dat <- Phe1_dat %>% filter(Phenotype == mr_pairs[i,Phe1]) %>% filter(SNP %in% Phe2_o... |
e16f04f07bc9731c577207391b9671e82ebb8f429d127144a38e07a0f2b385b2 | R | 4,481 | 112 | # match OPNMF component numbers across two parcellations
# for easier plotting #
wd <- "~/projects/chimp_human_opnmf/" # Working Directory
setwd(wd)
# use neuroconductor to install neurobase as install.packahes("neurobase") fails
# Neurobase just makes it a bit easier to work with nifti's #
source("https://neurocondu... |
c33429e83857467dd686d275f3ce0b35fe928ab0350c26eab76d1d229b0560da | R | 4,484 | 113 |
library(tidyverse)
library(readxl)
library(doParallel)
library(foreach)
library(oro.nifti)
mm <- "/Users/hallquist/Data_Analysis/clock_analysis/fmri/pfc_entropy/original_masks/Schaefer2018_200Parcels_7Networks_order_fonov_1mm_ants.nii.gz"
# img <- oro.nifti::readNIfTI(mm, reorient = FALSE)
# sort(unique(as.vector(im... |
b7d2579342dfe7dd8d2631d310bb943f3c5338f65637d04fc4b37d00ede25d5f | R | 4,487 | 140 | # For the specified k, average for the specific set of selected network reconfiguration metrics.
# Output:
# cset,'_values.csv' Average values for the reconfiguration metrics in this set.
#Set libraries.
library(tidyverse)
#Catches arguments.
k <- args[1]
#Set base path and output path.
subgroup <- 'full'
basepath <... |
831b6ccd8335867d21d3fa22b54082e94f184d5fb327c6532176b47b1f50eec9 | R | 4,488 | 112 | #!/usr/bin/env Rscript
# Talkowski SV pipeline downstream analysis helper script
# Make list of all nonredundant pairs of batches from an input list of batches
###Set global parameters
options(stringsAsFactors=F,scipen=1000)
allpops <- c("AFR","ASN","EUR","HSP")
svtypes <- c("DEL","DUP","MCNV","INS","INV","CPX")
... |
76090d415847d675824640965fb0a77e1c4de45e10790015b7a05439a969af97 | R | 4,499 | 149 | #!/usr/bin/R
# -----------------------
# Load differential data:
# -----------------------
library(cbrbase)
library(Matrix)
set_proj('DEVTRAJ', 'multiRegion')
if (!exists("cellmeta")){
source(paste0(sbindir, 'load_metadata.R'))
}
# Arguments:
args=(commandArgs(TRUE))
if (length(args)==0) {
stop("No arguments s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.