sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 17k | content stringlengths 1 200k |
|---|---|---|---|---|
6b0d78dbd8e20ed5ab4cddb899925e677b938049ce41258452d4962ec44e5abc | R | 282 | 11 | # anova.code.r
options(echo=F)
# Code to do 2-way anova
data <- matrix( scan("anova.input", quiet=T), ncol=3, byrow=T,
dimnames=list(NULL, c("stack", "class", "spikes")))
Aov <- aov(spikes ~ stack * class, data.frame(data))
cat(round(summary(Aov)[[1]][1:3,5], dig=3), "\n")
|
27112b1887485461990f357f3386835d9f15b61ad48e8ac9e8a6cb2be6f3acb8 | R | 283 | 12 | library(cowplot)
plot_grid(spontaneous_gi, MPTP_gi, pff_gi,aso_gi, nrow=1,
rel_widths = c(1,1,1,1))
spontaneous_gi <- spontaneous_gi +
theme(legend.position = "none")
aso_gi <- aso_gi +
theme(legend.position = "none")
spontaneous_gi+theme(legend.position="right") |
4a335f569285516bb1449c8d0d6f19546ee6159fe6a87e72ab90e3872c72d3ce | R | 284 | 6 | mutate_cond <- function(.data, condition, ..., envir = parent.frame()) {
# this function is like mutate but only acts on the rows satisfying the condition #
condition <- eval(substitute(condition), .data, envir)
.data[condition, ] <- .data[condition, ] %>% mutate(...)
.data
} |
b59576b249801863df138fee2cc32031b0537ca1fb2b08d2081583f5ad18c601 | R | 285 | 8 | # Setup the directory structure and timing file
res_dir <- "results/03.gaussian_kernel"
time_file <- "timings.csv"
if (!dir.exists(res_dir)) dir.create(res_dir)
if (!file.exists(paste0(res_dir, "/", time_file))) {
write_lines("Name,Process,Time", paste0(res_dir, "/", time_file))
}
|
0959789ac1e69a3fcfeec9d1a2544b16775c8efbbb40e389fc2e0b0b0b7eb238 | R | 286 | 8 | # Setup the directory structure and timing file
res_dir <- "results/01.replicate_daniel"
time_file <- "timings.csv"
if (!dir.exists(res_dir)) dir.create(res_dir)
if (!file.exists(paste0(res_dir, "/", time_file))) {
write_lines("Name,Process,Time", paste0(res_dir, "/", time_file))
}
|
c8eeaca3939b8bec7f0d77e1e58203ce7046cd9dba65c2544bddfead1859507d | R | 288 | 8 | # Setup the directory structure and timing file
res_dir <- "results/05.deep_kernel"
time_file <- "timings.csv"
if (!dir.exists(res_dir)) dir.create(res_dir)
if (!file.exists(paste0(res_dir, "/", time_file))) {
readr::write_lines("Name,Process,Time", paste0(res_dir, "/", time_file))
}
|
f96d2efff68f529e4f8f93d48c1d296689750bb35deeeaf06f778e4bccd1b162 | R | 292 | 8 | # Setup the directory structure and timing file
res_dir <- "results/07.genomic_kernels"
time_file <- "timings.csv"
if (!dir.exists(res_dir)) dir.create(res_dir)
if (!file.exists(paste0(res_dir, "/", time_file))) {
readr::write_lines("Name,Process,Time", paste0(res_dir, "/", time_file))
}
|
66379fce596a8fa1f927ee1a14169a0fdffd7aac2de990026ee79b8f70f32e84 | R | 343 | 11 | #' miloR
#'
#' Milo performs single-cell differential abundance testing. Cell states are modelled
#' as representative neighbourhoods on a nearest neighbour graph. Hypothesis testing is performed using a
#' negative bionomial generalized linear model.
#'
#' @docType package
#' @importFrom Rcpp evalCpp
#' @useDynLib mil... |
6245d775a82781600b33b8fa9393b6f2206a244c96eadc5548f5bbb2f0edfd33 | R | 357 | 12 | #' miloR
#'
#' Milo performs single-cell differential abundance testing. Cell states are modelled
#' as representative neighbourhoods on a nearest neighbour graph. Hypothesis testing is performed using a
#' negative bionomial generalized linear model.
#'
#' @aliases miloR
#' @return NULL
#' @importFrom Rcpp evalCpp
#' ... |
42944a8e74eb4dc53ab7909877fd1720ac20bd9e98a7a4aea8d449bf81ff0860 | R | 390 | 12 | # This file is part of the standard setup for testthat.
# It is recommended that you do not modify it.
#
# Where should you do additional test configuration?
# Learn more about the roles of various files in:
# * https://r-pkgs.org/testing-design.html#sec-tests-files-overview
# * https://testthat.r-lib.org/articles/spec... |
177c513a89bc8f516fa93d9bad9801901896c61a0bcc817d3d5305c3732d2da3 | R | 412 | 17 | # Computes a linear kernel for large data matrices
# Normalizing by rows avoids an internal copy that may exceed available
# vector memory
bigLK <- function(X, normalize = TRUE) {
K <- tcrossprod(X)
if (normalize) {
dd <- mean(diag(K))
for (i in 1:nrow(K)) {
if (i %% 500 == 0) cat(i, "\r")
K... |
c681aa7e53796b96ffbfc0269b37d28f0592b849ba339ada04e440d51d65f974 | R | 412 | 13 | #' The miloR package
#'
#' The \pkg{miloR} package provides modular functions to perform differential
#' abundance testing on replicated single-cell experiments. For details please
#' see the vignettes \code{vignette("milo_demo", package="miloR")} and
#' \code{vignette("milo_gastrulation", package="miloR")}.
#'
#' @aut... |
05366257701506222bc5ab86fd0478f39d86bb703453dac56d09f0f59bb31b7b | R | 418 | 14 | library(Seurat)
counts <- read.csv('SCP1184/expression/expression_PertCortex.new.txt', sep='\t')
metadata <- read.csv('SCP1184/metadata/meta_PertCortex.txt', sep='\t')
metadata <- metadata[-1,]
counts <- counts[-1,]
genenames <- counts[,1]
counts <- counts[,-1]
rownames(counts) <- genenames
data <- CreateSeuratObje... |
ce065ae3f33997f6a0c50adc00b45e4a739887a385bbf1f4ba1d3ad6d2cc7f14 | R | 419 | 12 | # Load libraries
library(Seurat)
library(ggplot2)
## Function for UMAP plot with n = 3 columns and many markers without axes
plotMarker <- function(seu_obj, markers){
p <- FeaturePlot(seu_obj, features = markers, reduction = "umap", combine = FALSE, sort.cell = TRUE)
for(i in 1:length(p)) {
p[[i]] <- p[[i]] + ... |
bdd80425cafbb5342b1ed730eaeb2710975c54f8aba73d0b9b73a4cc628fff99 | R | 425 | 15 | fisher_test <- function(a, b, bg){
a = unlist(a); b = unlist(b)
x = length(intersect(a,b))
m = length(setdiff(a,b))
n = length(setdiff(b,a))
k = length(setdiff(bg, union(a,b)))
mat = matrix(c(x,m,n,k),2,2)
print(mat)
return(fisher.test(mat, alternative="greater")$p.value)
}
jaccard_index <- ... |
b12e970802285befa9fd18bbfdd77e96bb0507d123b2a1036ffb62ef4ccc8408 | R | 450 | 14 |
sc_model <- c("Sigmoid" = "#666666",
"Tanh" = "#f0027f",
"ReLU" = "#7fc97f",
"Linear" = "#beaed4",
"Gaussian" = "#fdc086",
"Arc-cosine" = "#386cb0")
sc_data <- c("gPCs" = "#1b9e77",
"hPCs" = "#8da0cb",
"SNPs" = "#d95... |
8a6747809938d4d40eaae40ca8647221aef9170be41148aa0a506663d8edbc36 | R | 471 | 17 | # R session information {-}
Details on the R version used for making this book. The source code is available at [`LieberInstitute/VisiumLIBD`](https://github.com/LieberInstitute/VisiumLIBD).
```{r session_packages, eval = TRUE, message = FALSE}
## Load the package at the top of your script
library("sessioninfo")
```
... |
c1d2d9f8a877bbe1af91bdf8d1d76393e5e7ccb32f5d3e31f98cc9bb83806051 | R | 496 | 14 |
## Wire Hang --
wire_hang <- readr::read_csv(here("Analysis_Files", "PFF", "PFF_Wire_Hang - Wire_Hang.csv"))
wire_hang <- wire_hang %>% filter(DPI!=90)
wire_hang$Genotype <- factor(wire_hang$Genotype,levels=c("WT","HET","MUT"))
wire_hang$DPI <- as.character(wire_hang$DPI)
wire_hang$DPI <- plyr::revalue(wire_hang$DPI,... |
b8f1dc605ffdc9df887721ffdf079e7b3b86d8bce629347effbe6af9d99b7b65 | R | 530 | 15 | uesthreads=33
projHeme1 <- ArchRProject(
ArrowFiles = arrow_path,
outputDirectory = "Save-projHeme-Raw-V20240710",
copyArrows = TRUE,
geneAnnotation = geneAnnotation,
genomeAnnotation = genomeAnnotation,
threads = getArchRThreads()
)
projHeme1 #2909835
output_directory=getOutputDirectory(projHe... |
193828651055265a6e6101752b448f9ec5b549443826da6b47d2ed61f5a9a145 | R | 538 | 20 | shinyUI(
fluidPage(
tags$head(
tags$link(rel = "stylesheet", type = "text/css", href = "styles.css")
),
#shinyjs::useShinyjs(),
navbarPage(title = strong("STEPN"),
windowTitle = "Multidimensional STEPN",
fluid = TRUE,
id = "nav",
... |
b7ea1fb4b2b769b8f5665cf1e3d5e8cd2bd475f9fc44a1e4a28bb3d3fe1f6d6e | R | 554 | 20 | # devtools::test()
## TODO
#
# if only 2 groups, within-group and between-group filtered intensity columns are the exact same
#
# make synthetic datasets, then apply filter_dataset() -->> assert filtering is correct
#
# unit tests with pass and fail assertions to QC the data structures integrity check functions;
# # c... |
85b8a22c0f28aa6d559893d0c447d026ac1d5edbd5c205617d0f59cc7329eefe | R | 596 | 30 | cli::cli_h2("┗ [Vasc-AoP] Setting project configs")
#----------------#
####🔺Options ####
#----------------#
options(
verbose = FALSE,
scipen = 999L,
digits = 4L,
na.action = "na.omit",
contrasts = c("contr.sum", "contr.poly"),
seed = 256,
dplyr.summarise.inform = FALSE
)
set.seed(getOpti... |
02c86222701e31cc927b6efe5ca29e8af9991cbec08b979cc72473ef9a638d5e | R | 644 | 28 |
#' Calculate variable genes
#' @param x an integer
#' @noRd
# If no variable genes are provided
calc.vargenes = function(se.sc, min.cells){
nonex = which(apply(se.sc@assays$RNA@counts, 1, function(x) length(which(x >0))) < min.cells)
# First get rid of non-expressed genes
se.sc = subset(se.sc, features = ro... |
aa6b6a5c99d3bef84a6559ef08282c462c0024dbaf7b50adc01790c0b423511c | R | 651 | 18 | source(here::here("src/renv/helpers.R"))
# See:
## - https://rstudio.github.io/renv/reference/config.html
## - https://rstudio.github.io/renv/reference/snapshot.html
options(
repos = c(PPM = "https://packagemanager.posit.co/cran/latest", CRAN = "https://cloud.r-project.org"),
renv.config.pak.enabled = FALSE,
... |
3191f78d3ce20eeada22a1b01d7aa66fc9a6a122dcc901612cb204c6d2f24324 | R | 663 | 15 | # code for main figure 2 panel c
# source the functions from FLXenium folder, which loads useful libraries and has
# a bunch of functions useful for general analysis of spatial data
miceadds::source.all('~/Multidimensional_STEPN/4.Xenium/resources/FLXenium/')
# source the ependymoma project specific functions
source... |
4331e79197cd152b26a8789383b77e3687d259d15b6ed09570d5ca89e656c589 | R | 670 | 18 | # code for main figure 1 panel c
# source the functions from FLXenium folder, which loads useful libraries and has
# a bunch of functions useful for general analysis of spatial data
miceadds::source.all('~/Multidimensional_STEPN/4.Xenium/resources/FLXenium/')
# source the ependymoma project specific functions
source... |
fa7811b7161c829b038f8ed5ac12f5c2abb9ab4d4c1ca0eb7b685330048ab570 | R | 671 | 27 | setwd("~/Documents/yu_lab/kernels_in_GP/Kick_data/")
library(tidyverse)
library(keras3)
library(kerastuneR)
source("src/weather_tuner_classes.R")
tuner <- CVTuner(
oracle = BayesianOptimization(
objective = Objective("loss", "min"),
max_trials = 40
),
hypermodel = HyperModel(),
directory = "resul... |
ff28cb8fd0b06abaf08a1b883c069b61bc40d000ab6c609068b0a984b97f5154 | R | 679 | 24 | #' sim_discrete
#'
#' Simulated discrete groups data
#'
#' Data are simulated single-cells in 4 distinct groups of cells. Cells in each
#' group are assigned to 1 of 2 conditions: \emph{A} or \emph{B}. Specifically,
#' the cells in block 1 are highly abundant in the \emph{A} condition, whilst
#' cells in block 4 are mo... |
9fa8e165a365ef719803af86df7e3e09ddd7f5f4507d114caa09a8cc98ca29e9 | R | 684 | 23 | #' Root mean square error (RMSE)
#'
#' Calculates the root mean squared error from two vectors of observed
#' and expected data.
#' Assumes the two vectors are of the same length and that the pairs are
#' the same order.
#' @param m A vector of expected values
#' @param o A vector sof observed values expected to be the... |
da8e01038096b4dc60ac483a564c0b8b6adf0f40fd6e0a3e4fffede40377c724 | R | 689 | 17 | library(GenomicRanges)
library(BSgenome.Mfascicularis.NCBI.5.0)
library(ArchR)
library(parallel)
library(tidyverse)
geneAnnotation <- readRDS('macaca_geneAnnotation.Rds')
seqnames(BSgenome.Mfascicularis.NCBI.5.0)=gsub("MFA","chr",seqnames(BSgenome.Mfascicularis.NCBI.5.0))
genomeAnnotation <- createGenomeAnnotation(g... |
54d8d82bae7bf27dfb672d2afd71fa48cb497fa3524719977c77e4f797995760 | R | 695 | 16 | #' MS-DAP: Mass Spectrometry Downstream Analysis Pipeline for label-free proteomics data.
#'
#' http://github.com/ftwkoopmans/msdap
#'
#' @keywords internal
#' @import ggplot2
#' @importFrom grDevices colorRampPalette dev.off graphics.off pdf rainbow
#' @importFrom graphics abline boxplot legend lines mtext par plot po... |
d468c3c915cdf7b8575bb71fdd02824082a22dcfd6e44d7933e58ed0bf72989f | R | 695 | 23 | #' Simulated linear trajectory data
#'
#' Data are simulated single-cells along a single linear trajectory. Cells are
#' simulated from 5 groups, and assigned to 1 of 2 conditions; \emph{A} or \emph{B}.
#' Data were generated using in the \code{simulate_linear_trajectory}
#' function in the \code{dyntoy} package.
#'
#'... |
1d7fcb3b2c7010beee77d2ba192f46c94b33229242ce4434023f65e7890b70d7 | R | 707 | 23 |
raw_data <- data.frame(
Genotype = paste0("G", 1:18),
Group = c(rep("A1", 4), rep("A2", 4), rep("A3", 5), rep("B1", 2), rep("B2", 3)),
BestTreatment = c(
rep("Q10", 0), rep("R55", 4), # Group A1
rep("Q10", 0), rep("R55", 4), # Group A2
rep("Q10", 4), rep("R55", 1), # Group A3
rep("Q... |
3567e6591098a1fda1141c3d6c7385b25e096647386517c18668d08aa3e17e6e | R | 716 | 23 | ##' Complete copy of nlpca net object
##' @param nlnet a nlnet
##' @return A copy of the input nlnet
##' @author Henning Redestig
forkNlpcaNet <- function(nlnet) {
res <- new("nlpcaNet")
res@net <- nlnet@net
res@hierarchic <- nlnet@hierarchic
res@fct <- nlnet@fct
res@fkt <- nlnet@fkt
res@weightDecay <- nlne... |
88c853e14d71817396c66f9429070dee23b35fafd1637642fb234bf276022026 | R | 725 | 36 | # Copyright (C) 2009,2010 Bernd Feige
# This file is part of avg_q and released under the GPL v3 (see avg_q/COPYING).
library(bfown)
# Test one-sample t test
r<-matrix(runif(100,min=-0.5,max=0.5)+0.1)
print(t.test(r))
write.avgq(r,"write_generic a.tmp float32
null_sink
-
read_generic -c a.tmp 0 1 float32
average -t
P... |
be2830bba2b26804e35ce1d4afd57652527c80f33961ec6d3dadcfa5f40995f1 | R | 751 | 31 |
#' Print the Epoch Object
#'
#' @family Epoch methods
#' @param object Epoch object
#' @return returns an invisible NULL
#' @export
setMethod("show", "Epoch",
function(object) {
tbl <- tblData(object)
rd <- rowData(object)
cd <- colData(object)
md <- metaData(object)
# -... |
ea576bc8a9235d7098c1da62eb80577be6794120c5ebb0ac20c4b77d6c5003c4 | R | 752 | 21 |
# SAVER combine output ----------------------------------------------------
.combine.saver <- function (saver.list)
{
est <- do.call(rbind, lapply(saver.list, `[[`, 1))
se <- do.call(rbind, lapply(saver.list, `[[`, 2))
info <- vector("list", 10)
names(info) <- c("size.factor", "maxcor", "lambda.max", "lambda.... |
bb6a40555fa90ff59b6472347caa84191c17c78197ffe7d8e8a9bf51ef4ff9d6 | R | 762 | 29 |
df<- read.table("mofa_residuals.tsv", header = TRUE, sep = "\t" )
rownames(df)<-df$ID
df<-df[,c(-2)]
df$asd_group<-as.numeric(df$asd_group)
llm<-lm(asd_group~Factor2,df)
y_predicted<-predict(llm,df)
y<-df$asd_group
sst <- sum((y - mean(y))^2)
sse <- sum((y_predicted - y)^2)
rsq <- 1 - sse/sst
cor(y_... |
44094d0a784dc761b0fd9e44f586b70f2082bf48fd2f356ad64ec57edc1b2659 | R | 777 | 30 | setwd("~/Documents/yu_lab/kernels_in_GP/Kick_data/")
library(tidyverse)
library(tensorflow)
tf$config$list_logical_devices()
library(keras3)
library(kerastuneR)
source(textConnection(readLines("09.pc_comparison/11a.weather_tuner.R")[7:103]))
tuner <- CVTuner(
oracle = BayesianOptimization(
objective = Object... |
cbd4482872e82665b69ff48f0989ef571b2c12f4f65ad019f9313a4466033eba | R | 788 | 19 | # code for extended figure 1 panel e
# source the functions from FLXenium folder, which loads useful libraries and has
# a bunch of functions useful for general analysis of spatial data
miceadds::source.all('~/Multidimensional_STEPN/4.Xenium/resources/FLXenium/')
# source the ependymoma project specific functions
so... |
18473d5236833a4fc334c510f4f31135a662a480258a59d9ca093cdabba4df46 | R | 808 | 30 | require(keras)
build_model <- function(hp) {
# The input shape comes from the concatenated outputs of the submodels
model <- keras_model_sequential(input_shape = c(15317L))
num_layers <- as.integer(hp[["layers"]])
for (i in 1:num_layers) {
model |> layer_dense(units = as.integer(hp[[paste("units_", i)]]... |
46c972c9566c88797796961fbb72281b4f1453112310f5db10cab870ca23c966 | R | 808 | 30 | require(keras)
build_model <- function(hp) {
# The input shape comes from the concatenated outputs of the submodels
model <- keras_model_sequential(input_shape = c(15503L))
num_layers <- as.integer(hp[["layers"]])
for (i in 1:num_layers) {
model |> layer_dense(units = as.integer(hp[[paste("units_", i)]]... |
8902f1b8ab6592da11f7e9c24a77b385a0258919867ae4b544c78fc8556d6c2f | R | 823 | 27 | seeds <- c(424367L, 106463L, 683735L, 486104L, 376453L, 268899L, 673572L,
637487L, 663369L, 301779L)
for (s in seeds) {
cat("#!/bin/bash",
"",
"#SBATCH --mem-per-cpu=25G",
"#SBATCH --time=24:00:00",
"#SBATCH --nodes=1",
"#SBATCH --tasks-per-node=16",
"",
p... |
a998c3e1e08ee403e704020d6a9f09d60d2d91f3a32f5db07196e2130a8d5aea | R | 842 | 19 | # Optional R template for DCA plotting from exported points
suppressPackageStartupMessages({
library(readr)
library(ggplot2)
})
m <- read_csv(file.path("output","intermediate","DCA_points_model_AD.csv"), show_col_types = FALSE)
a <- read_csv(file.path("output","intermediate","DCA_points_treatall_AD.csv"), show_col... |
73d01b843c4b5d801b3170b40978d6e3b4036803a9931b2d4fc662b7cdeae9d6 | R | 855 | 28 | rsqrd <- function(observe, model){
ss_res <- sum((observe-model)^2)
y_bar <- mean(observe)
ss_tot <- sum((observe-y_bar)^2)
return (1-ss_res/ss_tot)
}
################################
args <- commandArgs(trailingOnly=T)
encoded_file <- args[1]
test_index_file <- args[2]
model_file <- args[3]
outDirection <- a... |
e3ba1eec3606fc445c5c54e0a811c5165761dfb859ebe4ffa6f766f75936e667 | R | 860 | 28 | library(data.table)
library(dplyr)
data_dir <- '~/data/scTransform_by_celltype_afterAgg'
pos_dir <- '~/UKB_TWAS/WEIGHTS/'
ct = 'MonoNC'
PB_df = fread(sprintf('%s/Expression_matrices/%s_PB.tsv',data_dir,ct))[,1:4]
setwd(sprintf('%s/%s',pos_dir,ct))
t0 = sprintf('ls *scTWAS.wgt.RDat > ../%s_scTWAS.pos',ct)
system(t0... |
800ae9927bb5b830cf27c6fa2692ff01be5fcf6de8a29acfedbe9f3b1f2c4c09 | R | 863 | 31 | # R_code.r
# Tricky part: divide bins in 8ths, have to combine them here
options(echo=F)
options(warn=1) # Print them all!
# Code to do poisson on/off determination
# What p-value to use? (convert percent to fraction)
P.value <- scan("macro42_R_input", quiet=T, skip=0, nlines=1) / 100
# How many trials?
Trial... |
046936fee7ea6ac7b4fd7dcce16361ab0beaa4d7e514a522544ff7dd81c1a53d | R | 869 | 31 | require(keras)
build_model <- function(hp) {
# The input shape comes from the concatenated outputs of the submodels
model <- keras_model_sequential(input_shape = c(15340L))
num_layers <- as.integer(hp[["layers"]])
for (i in 1:num_layers) {
model |> layer_dense(units = as.integer(hp[[paste("units_", i)]]... |
af67098749692c433ecce8efc2f52a79125b7ff8b99cdbe03bd008a5aa18a058 | R | 869 | 31 | require(keras)
build_model <- function(hp) {
# The input shape comes from the concatenated outputs of the submodels
model <- keras_model_sequential(input_shape = c(15356L))
num_layers <- as.integer(hp[["layers"]])
for (i in 1:num_layers) {
model |> layer_dense(units = as.integer(hp[[paste("units_", i)]]... |
0c6ab74ce28154113985ab6dd0500f340c179b2cb357623a21c6181231354fa9 | R | 872 | 31 | require(keras)
build_model <- function(hp) {
# The input shape comes from the concatenated outputs of the submodels
model <- keras_model_sequential(input_shape = c(15384L))
num_layers <- as.integer(hp[["layers"]])
for (i in 1:num_layers) {
model |> layer_dense(units = as.integer(hp[[paste("units_", i)]]... |
ae4cea02baf7e4fdeadc177c6ef24f2c107925082b82dae61675b432a02f520d | R | 872 | 31 | require(keras)
build_model <- function(hp) {
# The input shape comes from the concatenated outputs of the submodels
model <- keras_model_sequential(input_shape = c(15498L))
num_layers <- as.integer(hp[["layers"]])
for (i in 1:num_layers) {
model |> layer_dense(units = as.integer(hp[[paste("units_", i)]]... |
ca33d289ec332f42a8289a9f5d125d818e969cbb7a997dd411185f42476521ad | R | 875 | 30 | models <- 1:4
folds <- 1:10
for (m in models) {
for (k in folds) {
cat("#!/bin/bash",
"",
"#SBATCH --mem-per-cpu=25G",
"#SBATCH --time=48:00:00",
"#SBATCH --nodes=1",
"#SBATCH --tasks-per-node=16",
"",
paste0("#SBATCH --output=tune_weather_", m, "_",... |
b6e21b224f5d3bacb7147b1e9d0e3795f7a33837f70728fec2ee33b42b9dbea7 | R | 884 | 28 | library(Seurat)
library(tidyverse)
library(glue)
library(readxl)
base_dir <- "/n/scratch/users/s/sad167/EPN/scRNAseq"
resources_dir <- file.path(base_dir, 'scripts/resources')
source(file.path(resources_dir, 'single_cell_preprocessing_helper_functions.R'))
## Dealing with counts for each sample
metadata <- read_exc... |
7ea0cf2f0d07ea4eca72ad87401c73ecd43c7d674a7a2250355e300b8465f14c | R | 890 | 28 | library(Seurat)
library(tidyverse)
library(glue)
library(readxl)
base_dir <- "/n/scratch/users/s/sad167/EPN/scRNAseq"
resources_dir <- file.path(base_dir, 'scripts/resources')
source(file.path(resources_dir, 'single_cell_preprocessing_helper_functions.R'))
## Dealing with counts for each sample
metadata <- read_exc... |
1c1aced44acbec10be186cfcc1e89cfab0d9c88313496974a1796a4bc48b3845 | R | 894 | 45 | library(sjPlot)
library(broom.mixed) # for tidy()
library(dplyr)
library(emmeans)
library(lme4)
library(lmerTest)
library(ggplot2)
library(moments)
library(ggeffects)
library(robustlmm)
library(glmmTMB)
library(patchwork)
library(forcats)
library(scales)
df <- read.csv("E:\\work\\q_backup_06_03_2025\\projects\\i... |
f141b8408d60043b987ba6316f2d2d97a0f19f8f4a0e7cbae3c7b7c1ae8923ce | R | 901 | 31 | library(rio)
library(sjPlot)
library(emmeans)
library(lme4)
df <- import("E:\\work\\q_backup_06_03_2025\\projects\\isttc\\results\\allen_mice\\dataset\\cut_30min\\summary_taus_plot_5methods_100_50_20_1_resampling_df_long.csv")
df$method <- factor(df$method, levels = c("isttc_full", "acf_full", "pearsonr", "sttc_avg", ... |
be33ea07dfd0bc9724242a6e821d4380e627ccfeff869f761d0639804ca96359 | R | 902 | 38 | setwd("~/Documents/yu_lab/kernels_in_GP/Kick_data/")
library(tidyverse)
library(keras3)
### Data preparation ----------------------------------------------------------
d <- read_rds("09.pc_comparison/input_data.rds")
x_test <- d$Test$X
y_test <- d$Test$y
rm(d); gc()
# Function for rmse
rmse <- function(y, yhat) ... |
9ad26bc35d0155b171a20853ba2dc3a4f44be44e4977fd6a27c55a220ccde74e | R | 905 | 26 | ##' Print a brief description of nniRes model
##' @title Print a nniRes model
##' @param x An \code{nniRes} object
##' @param ... Not used
##' @return Nothing, used for side-effect
##' @export
##' @author Henning Redestig
showNniRes <- function(x, ...) {
summary(x)
cat(dim(x)["nVar"], "\tVariables\n")
cat(dim(x)[... |
7435b86dbc8705ae42b0bf4957cd53e131027e74b70be8331f9ec1280e76f6d6 | R | 919 | 31 | setwd("~/Documents/yu_lab/kernels_in_GP/Kick_data/")
library(tidyverse)
library(keras3)
library(kerastuneR)
source("src/weather_tuner_classes.R")
cv_y <- read_rds("results/DNNs/cv_data/cv_y.rds")
### swap `overwrite = TRUE` to restart tuning from scratch
### `overwrite = FALSE` picks up from the existing informati... |
50dcc84ae0f0a85348709688f259c381eb3e8987c652c08edc2e9beb735983ae | R | 926 | 44 | rule intersect_mergepeak:
input:
f"{outd_sum_mergepeak}/mba.whole.union.peak.bed"
output:
touch(f"{fdir}/{{cl}}_unionpeak.done")
threads: 1
resources:
walltime = 1,
queue = "glean",
mail = "a",
email = "debug.pie@gmail.com"
conda: "sa22"
... |
387e4d93854299a4ae3a7db1deb113b4a6c681cbfc1430a124efa6ae2d656bbe | R | 942 | 21 | library(Seurat)
library(tidyverse)
library(harmony)
library(patchwork)
#subset E11 matching TW E11 data
cds <- readRDS("data/cds.rds")
Idents(cds) <- "cell_type"
dir.create("tables/E10_E15_majorcellTypes_stages")
for (i in levels(cds)) {
seu_temp <- subset(cds, idents = i)
Idents(seu_temp) <- "stage"
sig_genes <... |
725b78e96ad1b9506e54faa9d3b0adb2497030606c6b09670f5d3065e7f79dd9 | R | 943 | 39 | source("library.R")
library(parallel)
if(!file.exists("paths.txt")) {
stop("Please make a file called paths.txt with the format:
root,cache
path_to_root,path_to_cache")
}
paths <- read.table("paths.txt", header = TRUE, sep = ",")
ROOT <- as.character(paths$root)
ethoscope_cache <- as.character(paths$cache)
BAT... |
496485373c63d7e18959b399e6d40da33c85d6e27e09f32d91cf8450c18b21c5 | R | 951 | 38 | ##' Creates a large matrix B consisting of an M-by-N tiling of copies
##' of A
##' @title Replicate and tile an array.
##' @param mat numeric matrix
##' @param M number of copies in vertical direction
##' @param N number of copies in horizontal direction
##' @return Matrix consiting of M-by-N tiling copies of input mat... |
bd19eaba6001deed5c4edefd5a927ef0e811c83218a5651fb1028f76a193dc0c | R | 964 | 27 | # code for extended figure 1 panel c
# source the functions from FLXenium folder, which loads useful libraries and has
# a bunch of functions useful for general analysis of spatial data
miceadds::source.all('~/Multidimensional_STEPN/4.Xenium/resources/FLXenium/')
# source the ependymoma project specific functions
so... |
2adf94f1eedbf866e272f3ca9e1adeab24e3a2316fb6e41f2263586c301a7ed7 | R | 980 | 41 | #' @import TableContainer
#' @import osfr
#' @import methods
#' @importFrom ramify pprint
#' @importFrom glue glue
#' @importFrom jsonlite fromJSON
#' @importFrom stats sd
#' @importFrom rlang .data
#' @importFrom ggplot2 ggplot geom_line aes labs scale_y_continuous theme element_text
#' @importFrom ggtext element_mar... |
e0564f369682fa51990692e3dfc785d1d0b4b5e6f72a075fadb1721030a5dc8a | R | 994 | 23 | # code for extended figure 6 panel b
# source the functions from FLXenium folder, which loads useful libraries and has
# a bunch of functions useful for general analysis of spatial data
miceadds::source.all('~/Multidimensional_STEPN/4.Xenium/resources/FLXenium/')
# source the ependymoma project specific functions
so... |
9a4ad9ddd9d40599a19bf1406a6e903483a1617977ae993e2bf6518dbaf2a582 | R | 1,002 | 48 | #--------------#
####🔺infix ####
#--------------#
'%notin%' <- Negate('%in%')
`%ni%` <- `%notin%` # Alias
'%||%' <- function(x, y) if (is.null(x)) y else x
#-------------#
####🔺here ####
#-------------#
if (!"here" %in% as.data.frame(installed.packages())$Package) {
renv::install("here", prompt = FALSE)
}
#--... |
8013c00c8eeb491d84100c6514ddeb3f5027cf3b229360a235b1c6a620e4a176 | R | 1,004 | 32 | library(rio)
library(dabestr)
library(ggplot2)
df <- import("E:\\work\\q_backup_06_03_2025\\projects\\isttc\\results\\allen_mice\\dataset\\cut_30min\\summary_taus_plot_5methods_100_resampling_df_long.csv")
df$method <- factor(df$method, levels = c("acf_full", "isttc_full", "sttc_avg", "sttc_concat", "pearsonr"))
dabe... |
215f9cb86fda050e5591e5477f833cad271838ddd396f1dbd68684c0981d6410 | R | 1,016 | 31 | ### Jaccard similarity
### define groups based on sleep features:
behA <- c("Gdh", "Lrrk","VAC14", "vham89", "eIF4G", "Omi", "Vps13", "Vps35", "Synj", "Tango14", "Dj1aDj1b", "iPLA2VIA", "Rab39","GBA", "Punch", "Rme8")
behB <- c("CHCHD2", "Pink1", "Auxillin", "nutcracker", "anne", "Coq2", "Loqs", "park" )
### tr... |
d5273809ee380131e6636831a81e55e984575d46a3c7bdb6cf57eb4ea223d78b | R | 1,016 | 25 | # code for extended figure 4
# source the functions from FLXenium folder, which loads useful libraries and has
# a bunch of functions useful for general analysis of spatial data
miceadds::source.all('~/Multidimensional_STEPN/4.Xenium/resources/FLXenium/')
# source the ependymoma project specific functions
source('~/... |
daac7df6a35ac7087911d693f12ee066947b3205e648303cd2a5265d5a02e3da | R | 1,030 | 41 | require(keras)
build_model <- function(hp) {
num_layers <- as.integer(hp["layers"])
model <- keras_model_sequential()
for (i in 1:num_layers) {
if (i == 1) {
model |> layer_dense(units = hp[paste0("units_", i)],
activation = "tanh",
kernel_i... |
880d8f0b1a1748cfc9ef6d87a6b75ee4dbb5a4e57c86c30aeafec1e9eb86b119 | R | 1,036 | 41 | require(keras)
build_model <- function(hp) {
num_layers <- as.integer(hp["layers"])
model <- keras_model_sequential()
for (i in 1:num_layers) {
if (i == 1) {
model |> layer_dense(units = hp[paste0("units_", i)],
activation = "sigmoid",
kerne... |
ec353f441ddbdb9bcc99c37ca6e97df883159d72a639751777f8ac9a53e2699a | R | 1,037 | 38 | plot.fftfilter<-function(infile,add=F,...) {
fftsize<-NULL
freq.resolution<-NULL
factors<-NULL
while (TRUE) {
line <- readLines(infile, n = 1, ok = TRUE)
if (length(line)==0 || line == "End of script") break
#print(line)
r<-sub('^fftfilter: FFT size ([0-9]+) points, Frequency resolution ([.0-9]+)Hz$','\\1 \... |
86c783037d2696770129f5e162a45c3f8f17a8e5bda05a13915fa35547952aa5 | R | 1,041 | 36 | separate_mfg_sfg <- function(df) {
# load csv with mfg, sfg electrodes
regions_df <- read_csv(path(here(), "munge", "mni_coordinates_all_subs_with_detailed_regions.csv"))
# create mfg df
mfg_df <- regions_df %>%
filter(region == "mfg") %>%
mutate(elec_id = paste0(subject, "_", Electrode))
# cre... |
c98f244a051724a7331ce58bcfaece9bad775fe2a4b313fb932dc2eda8a47ad5 | R | 1,043 | 25 | # code for extended figure 4
# source the functions from FLXenium folder, which loads useful libraries and has
# a bunch of functions useful for general analysis of spatial data
miceadds::source.all('~/Multidimensional_STEPN/4.Xenium/resources/FLXenium/')
# source the ependymoma project specific functions
source('~/... |
4ec090ee1e55e233392cce35b39fb30eb70c7ac9b0679316a1324ad5c643a467 | R | 1,052 | 28 |
#' Create matrix of cellular composition profiles consisting of proportion
#' of noise and remaining compostion in the ratio of supplied cell types
#'
#' @param cellProp A vector of the required cellular proportions. Must be
#' named with cell labels.
#' @param noise A vector of the proportion of noise.
#' @return A ... |
fa1aeebe3999a09bab5dddc0628e56990ef08b3cf49baec84779655fd9e7a9b3 | R | 1,081 | 25 | # code for main figure 3 panel d
# source the functions from FLXenium folder, which loads useful libraries and has
# a bunch of functions useful for general analysis of spatial data
miceadds::source.all('~/Multidimensional_STEPN/4.Xenium/resources/FLXenium/')
# source the ependymoma project specific functions
source... |
0f3598d691a830681f415d07a07ed74d7fcc65076144320a1b268cfd053dc2fe | R | 1,093 | 24 | library(Seurat)
library(tidyverse)
library(harmony)
library(patchwork)
#loading E15 mouse and spatial data
cds <- readRDS("datacds.rds")
cds1 <- readRDS("/Users/naghamkhourifarah/Downloads/GSE245469_RAW/data/combined_HQ.rds")
cds2 <- subset(cds,cells = rownames(cds@meta.data[cds$stage == "E15",]))
Idents(cds2) <- cds2$... |
81f2872a88c4e1cf1ff05e162e2ae4feb46d415e70c45e8638ad58d0bb2aa38b | R | 1,097 | 36 | #!/usr/bin/env Rscript
source("plot_fftfilter.R")
plot.fftfilter.boundaries<-function(sfreq,boundaries) {
script<-paste("
null_source", sfreq, "1 1 1s 1s
fftfilter -V", boundaries,"
null_sink
")
library(bfown)
a <- open.avgq("avg_q_vogl")
cat(script,"\n-\n!echo -F stdout End of script\\n\nnull_sink\n-\n",
... |
37ef229a066e9bc4b71db8c72564912c9aa1831d5eb473b0e34f440e5b43a40c | R | 1,098 | 31 | library(Biostrings)
library(GenomicRanges)
# 1. 读取基因组 (示例:第一条染色体)
pf_genome <- readDNAStringSet("./PlasmoDB-9.0_Pfalciparum3D7_Genome.fasta")
names(pf_genome)
chr1_seq <- pf_genome[[1]] # 获取DNA序列
chr1_seq <- pf_genome[[14]]
chr1_seq <- pf_genome[[7]]
# 2. 定义计算函数 (滑动窗口)
calculate_cpg_density <- function(dna_seq, wind... |
7111977a7d4d5e852ce771856dcc97d458808080e4a2a0d29f05116b9b72c694 | R | 1,121 | 27 | # code for extended figure 4
# source the functions from FLXenium folder, which loads useful libraries and has
# a bunch of functions useful for general analysis of spatial data
miceadds::source.all('~/Multidimensional_STEPN/4.Xenium/resources/FLXenium/')
# source the ependymoma project specific functions
source('~/... |
ccb7f5f4bf7812a3af0a84fd3bd6eeea73c52ba66f838899a04e09ca42ae4fe5 | R | 1,121 | 26 | # code for extended figure 4
# source the functions from FLXenium folder, which loads useful libraries and has
# a bunch of functions useful for general analysis of spatial data
miceadds::source.all('~/Multidimensional_STEPN/4.Xenium/resources/FLXenium/')
# source the ependymoma project specific functions
source('~/... |
61b817d7379fd750a833c4eaa800f9c1f94f6e0afd97330120b8553e92fc6b7c | R | 1,135 | 29 | install.packages('e1071')
#if (!requireNamespace("BiocManager", quietly = TRUE))
# install.packages("BiocManager")
BiocManager::install("preprocessCore")
inputFile="merge.normalize.txt" #ÊäÈëÎļþ
setwd("C:\\Users\\wx197\\Desktop\\×ÔÑ§Íø113»úÆ÷ѧϰ\\205.geoML×ÊÁÏ\\205.geoML×ÊÁÏ\\24.CIBERSORT") #É... |
344b907772abd2bbc5f170bc6120ecfc4cc2b41178947c797d72e642d7bc594e | R | 1,139 | 25 | # code for main figure 3 panel c
# source the functions from FLXenium folder, which loads useful libraries and has
# a bunch of functions useful for general analysis of spatial data
miceadds::source.all('~/Multidimensional_STEPN/4.Xenium/resources/FLXenium/')
# source the ependymoma project specific functions
source... |
ef14598aa2764f255f7d8cb1383aeaae03227dca85c19d0e827f430f0394f171 | R | 1,147 | 39 | # setwd("~/Documents/yu_lab/kernels_in_GP/Kick_data/")
setwd("/homes/amkusmec/kernels_in_GP/")
library(tidyverse)
library(argparse)
source("src/BGGE2.R")
parser <- ArgumentParser()
parser$add_argument("--seed", "-s", type = "integer")
args <- parser$parse_args()
# The phenotypes have already been scaled and center... |
aded88b2f8c03191a00e35477e4b6621370fe382a3554d3a9e85896558dfe650 | R | 1,148 | 50 | # R_code43.r
# Fit a von Mises to synthesized data; compare to a flat line; show fits
options(echo=F)
options(warn=1) # Print them all!
data <- matrix(scan("macro43_R_input", quiet=T), ncol=2, byrow=T)
angle = data[,1]
rate = data[,2]
options(show.error.messages = F)
fit0 = try(nls(
formula = rate ~ base + p... |
cbcc7316af94d0a2c7449c885027e6a1c69627c95e2b540e9e9bd415d50527ff | R | 1,151 | 39 | # setwd("~/Documents/yu_lab/kernels_in_GP/Kick_data/")
setwd("/homes/amkusmec/kernels_in_GP/")
library(tidyverse)
library(argparse)
source("src/BGGE2.R")
parser <- ArgumentParser()
parser$add_argument("--seed", "-s", type = "integer")
args <- parser$parse_args()
# The phenotypes have already been scaled and center... |
29f09c38c907db6901d27de560440ed3ab8b4be9d9e3d99bac95e2029288bc13 | R | 1,156 | 29 | testthat::context("normalization reproducibility")
msdap::enable_log(FALSE)
datasets = prepare_test_datasets(5000)
datasets_as_matrix = datasets$as_matrix
for(lbl in names(datasets_as_matrix)) {
m_group_id = datasets_as_matrix[[lbl]]$groupid
m_log2 = datasets_as_matrix[[lbl]]$mat
m_log2[!is.finite(m_log2)] = NA
... |
cbc632f432bc7eed6021005309baebb3bf2962a7ef79a21ce8afda3008976eab | R | 1,156 | 39 | # setwd("~/Documents/yu_lab/kernels_in_GP/Kick_data/")
setwd("/homes/amkusmec/kernels_in_GP/")
library(tidyverse)
library(argparse)
source("src/BGGE2.R")
parser <- ArgumentParser()
parser$add_argument("--seed", "-s", type = "integer")
args <- parser$parse_args()
# The phenotypes have already been scaled and center... |
977a2f110ec8494542e29247229c0f3894777dfb4ac9cbee15a2972333b1a047 | R | 1,169 | 31 | #' A pre-computed scWGCNA list calculated from the Mouse limb data.
#'
#' A scWGCNA data list containing the different modules, statistics and calculations
#'
#' @format A scWGCNA list object, used as example
#' @source This package
"MmLimbE155.scWGCNA"
#' A pre-analyzed, sub-sampled Seurat object, of single cell RNA-... |
3a7036a2a7ca78a1b511f4c66ca9a1f1cfef27fce244288c7750d1238a84097f | R | 1,181 | 35 | #' sim_family
#'
#' Simulated counts data from a series of simulated family trees
#'
#' Data are simulated counts from 30 families and includes X and Z design matrices,
#' as well as a single large kinship matrix. Kinships between family members are
#' dictated by the simulated family, i.e. sibs=0.5, parent-sib=0.5, si... |
701611dfc5fe00e9fa95de39c1b788336207b26415339cd10c0fd02a2a3e6d4c | R | 1,187 | 44 | #' Benchmarking: Calculate of the AUC of different cases
#'
#' This function calculates the AUC of different cases
#'
#' @param out_list The list of prediction probability matrix of each case
#' @param cluster The ground-truth
#' @param cell_types Character vector of cell types of the data
#'
#' @import pROC
#' @import... |
920dccf73b53c7a653926de1e8408ab66fd9489c48b1a3cf77f9ea62afefb0c7 | R | 1,205 | 47 | # These functions do not have any meaningful implementation, just wrapping
#' Wrapper functions for calling TableContainer methods
#'
#' @param x An Epoch object
#'
#' @rdname Epoch-method
#' @examples
#'
#' # Create an Epoch object
#' epoch_data <- matrix(rnorm(1000), nrow = 10)
#' rownames(epoch_data) <- paste0("... |
b4b5c833554497f7ecff2379e6b7c202c432bd94e5ec0d773f0b66fe7d782081 | R | 1,207 | 35 | #' This function plots the importance of the features
#'
#' This function plots the n top importance features decreasing or increasing.
#'
#' @param data The output of `ds_feature_importance`.
#' @param n The number of features to be plotted (Default=30)
#' @param Decrease If the importance are plotted decreasing or in... |
30a6e20828a284a084a1da422a2a38c95680904628e7a346deed58d497aab041 | R | 1,211 | 37 | # ReadAllNear.r
# In case you have read in a different dataNearBase!
# Set basic/default parameters #
########################
if (NEAR==0)
return
cat("Reading in standard dataNearBase for 'Near'\n")
a = b = NULL
if (MONK=="zen" || MONK=="both") {
a = read.table("/data/coord/zen/zenunits",
header=T,c... |
8fe75525daeed72d14edb3cf5d8ed645048f3ed1fb23f881f74333215b95f267 | R | 1,221 | 32 |
# estimateUnwantedVariation -----------------------------------------------
# estimateCellType --------------------------------------------------------
estimateCellType <- function(countData,
readData = NULL,
annotData = NULL,
sp... |
72a51a4447b35276f3778378e63a8d1e61cc7a7628441853b94afe5bb84f073f | R | 1,224 | 40 | # setwd("~/Documents/yu_lab/kernels_in_GP/Kick_data/")
setwd("/homes/amkusmec/kernels_in_GP/")
library(tidyverse)
library(argparse)
source("src/BGGE2.R")
parser <- ArgumentParser()
parser$add_argument("--seed", "-s", type = "integer")
args <- parser$parse_args()
# The phenotypes have already been scaled and center... |
a43967d8ad5449e62fc0021b66ccbe5733b58f11f222fd5b7bd05f9346c048ba | R | 1,228 | 27 | library(dplyr)
library(Seurat)
library(ggplot2)
## Style plots
# Barplot function
theme_ggplot = theme(legend.position = "none",
plot.title = element_text(hjust=0.5, face="bold"),
panel.border = element_blank(),
plot.background = element_blank(),
panel.background = element_blank(),
axis.... |
f9eab0db572f659d14d36716d47f265b2a91706f42f3549b64108b6fe11f0a6b | R | 1,229 | 40 | # setwd("~/Documents/yu_lab/kernels_in_GP/Kick_data/")
setwd("/homes/amkusmec/kernels_in_GP/")
library(tidyverse)
library(argparse)
source("src/BGGE2.R")
parser <- ArgumentParser()
parser$add_argument("--seed", "-s", type = "integer")
args <- parser$parse_args()
# The phenotypes have already been scaled and center... |
b70126e2070d1a1addccf8c4ccd6f7c1da0f9e533547d6a770bd2999cdbc8d2b | R | 1,235 | 40 | # setwd("~/Documents/yu_lab/kernels_in_GP/Kick_data/")
setwd("/homes/amkusmec/kernels_in_GP/")
library(tidyverse)
library(argparse)
source("src/BGGE2.R")
parser <- ArgumentParser()
parser$add_argument("--seed", "-s", type = "integer")
args <- parser$parse_args()
# The phenotypes have already been scaled and center... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.