sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
63fb6f875b4aed20dc610bb1ce910b2452f1cfd796db414928b169c8eee7e786 | R | 2,451 | 53 |
##########################################################
## Functions to cluster samples based on latent factors ##
##########################################################
#' @title K-means clustering on samples based on latent factors
#' @name cluster_samples
#' @description MOFA factors are continuous in natur... |
f3484a1abdcdf6236f69ec733e8746e21fab516e073f1a06d146e9a1736395ee | R | 2,465 | 43 | # Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
flashpca_internal <- function(X, stand, ndim, divisor, maxiter, tol, seed, verbose, do_loadings, return_scale) {
.Call('_flashpcaR_flashpca_internal', PACKAGE = 'flashpcaR', X, stand, ndim,... |
7376affeee59c78cea2574d1129e180ad96bb69364d21ea190bfd9d77fab7150 | R | 2,475 | 73 | # cluster entire protein network
# Load libraries ----
library(igraph)
# Create PPI network ----
# load open targets interaction network (IntAct, Reactome, SIGNOR, STRING)
intAll <- read.csv('./Datasets/interaction/interactionAll.csv') #data from open targets (https://ftp.ebi.ac.uk/pub/databases/IntAct/various/ot_g... |
02f84b7b650e7a99a1d95ba72bdaab23c38b6bfde72115517ad537689ec330f0 | R | 2,482 | 63 | #' @title Prepare Differential Count Data for Bar Plot
#' @description Summarizes the number of Up/Down regulated features per comparison group.
#' Formats data for stacked bar plot visualization.
#' @param data Data frame of differential results (with 'State' and 'Sample' columns).
#' @param group Vector. Comparis... |
2cc80378974dce02552968a5043bac0b7ddaaf5ce5d47a0c0273ba28c9e93792 | R | 2,496 | 104 | args <- commandArgs(TRUE)
name <- as.character(args[1])
params <- yaml::read_yaml("../Config/bd_sim.yaml")
if (!dir.exists(name)) {
dir.create(name)
}
setwd(name)
dists <- params$dists
within_ranges <- params$within_ranges
nrep <- params$nrep
age <- params$age
proportion <- params$proportion
nworkers_sim <- para... |
a898873242d654f925cf61229959e7473d90234c3daffa9041be1a538c30d9f9 | R | 2,502 | 102 | suppressPackageStartupMessages({
library(readxl)
library(dplyr)
library(ggplot2)
library(ggseg)
})
# =============================
# 1) Get script directory
# =============================
get_script_path <- function() {
cmd_args <- commandArgs(trailingOnly = FALSE)
file_arg <- "--file="
idx <- grep(file_... |
cca683b6640e8c3aab3f030cc65eea3b222e17695bde1ffe6c8ab2f1c8965700 | R | 2,505 | 119 | # Test check_file_exists ----
test_that(
"check_file_exists - works - file present",
{
withr::with_tempfile(
new = "tfile_test",
pattern = "text-file-test",
fileext = ".csv",
code = {
# write soemthing to file
writeLines("foo", tfile_test)
# check if file exists... |
acac1611d0a4b3ce2a243b5fc5e98d4635e7d3a6111e66d16b2aa9f09c69120d | R | 2,507 | 62 | library(ggplot2)
library(ggrepel)
library(data.table)
library(dplyr)
library(cowplot)
setwd("/local/s8frgran/Space_MIce_SNC/Plots_For_Paper/")
# Load color scheme and theme
colors <- fread("../Plotting/colors.csv", strip.white = F)
color_v <- colors$Color
names(color_v) <- colors$ID
source("../Plot_theme.R")
# Load ... |
7070f59282e46f5127b438fd8d566a059fc8ef2090cffb7954b5a2d892dc6f7f | R | 2,508 | 73 | ---
title: "Prep data for NEST"
author: "Audrey Luo"
output: html_document
---
```{r setup, include=FALSE}
library(cowplot)
library(data.table)
library(dplyr)
library(ggplot2)
library(ggpubr)
library(grid)
library(gridExtra)
library(gratia)
library(kableExtra)
library(mgcv)
library(RColorBrewer)
library(stringr)
libr... |
b6fa873da4d8221061472c4eacc7084face2ea6b5503315b5708fed79d4e1865 | R | 2,508 | 57 | # 01_analysis.R — primary and sensitivity analyses (reproducible)
set.seed(20250824)
suppressPackageStartupMessages({
library(tidyverse)
library(lme4)
library(lmerTest)
library(broom.mixed)
})
# Read data
g <- readr::read_csv('data/processed/DFT_glucose.csv', show_col_types = FALSE) %>%
mutate(
Treatmen... |
4286ab1178aa259757082e18862a07c0f742eb93c4e3af88759d9289a066fe48 | R | 2,509 | 58 | # Define a function to process each file
process_dnn_predictions_growth_rate <- function(file, timestep) {
dat <- read_feather(file) %>% data.table()
focal_state <- unique(dat$state)
scen <- ifelse(grepl("ICHEC-EC-EARTH", file), "ichec",
ifelse(grepl("MPI-M-MPI-ESM-LR", file), "mpi", "ncc")... |
63c04c7ffc2c4b28bf9f4b6ba6e9ef92d1047ee62b87a15d8c27f6c72e12459a | R | 2,522 | 55 | # The working directory is the directory that contains this test R file, if this
# file is executed by test_dir
#
# testthat package is loaded, if this file is executed by test_dir
context("tests/test_get_cohort_set_value.R")
# import_function is defined in tests/helper_import_function.R and tested in
# annotator/tests... |
2c304fe2f7e8b51d16510511fac4c165454734d24513f8ea15845ecc25bbba87 | R | 2,530 | 56 | rm(list = ls())
setwd('H:/Bioinformatics/proteomics/RYGB_proteomics_v9.3/')
library(openxlsx)
library(ggplot2)
library(ggrepel)
venn_DEP <- read.xlsx('H:/Bioinformatics/proteomics/RYGB_proteomics_v9.3/vennlist_DEP.xlsx')
venn_meta <- venn_DEP$proteins[2]
venn_meta <- unlist(strsplit(venn_meta, ','))
venn_meta <... |
9b545afb926ce69fb061aa33b4bb10165f3c1e2b3d12c4db42c434bc645aeb69 | R | 2,530 | 110 | context("Testing UCCA")
n <- 500
p <- 100
k <- 15
m <- 10
M <- matrix(rnorm(n * m), n, m)
Bx <- matrix(rnorm(m * p), m, p)
By <- matrix(rnorm(m * k), m, k)
X0 <- scale(M %*% Bx + rnorm(n * p))
Y0 <- scale(M %*% By + rnorm(n * k))
data(hm3.chr1)
bedf <- gsub("\\.bed", "",
system.file("extdata", "data_chr1.bed", pa... |
87484c5ae5398f836e7ba1edd5a0071b2f7bfa58d9b3cacf576de7e08b5f5424 | R | 2,531 | 79 | ##-------------------------------------##
##### SETUP OPTIONS #####
##-------------------------------------##
options(warn = -1)
set.seed(08071993)
options(shiny.maxRequestSize=900000*1024^2)
options(spinner.color="#E7F5F6",
spinner.color.background="#ffffff",
spinner.size=0.5)
#ht... |
9ac717332340f22fc3225694b89703bac294c310893864e9097de9c5d3bc4d91 | R | 2,531 | 66 | #'---
#' title: Calculate P values
#' author: Christian Mertes
#' wb:
#' log:
#' - snakemake: '`sm str(tmp_dir / "AS" / "{dataset}--{annotation}" / "07_stats.Rds")`'
#' params:
#' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`'
#' - workingDir: '`sm cfg.getProcessedResultsDir() + "/aberrant_splicing/datasets... |
fbd69f8a4d3603593151806856c07ec0a850fa4cc675401082e81d436ea79057 | R | 2,532 | 35 | # FAQs
If you encounter any issues using Osprey, we encourage you to check the following frequently asked questions. If you are still having difficulty, please reach out to us at [MRSHub](https://forum.mrshub.org/c/mrs-software/osprey/) or on [GitHub](https://github.com/schorschinho/osprey/issues/).
**Osprey crashes ... |
3623cf3b833652307afd7f31d53d73ab2e42f8768517276d4ae8bc6377ebcf71 | R | 2,544 | 43 | # Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
banksy_forward_cpp <- function(gcm_i_list, gcm_p_list, gcm_x_list, gcm_nrow, n_cells, W_i_list, W_p_list, W_x_list, W_ncol_vec, group_idx_list, x, split_scale, mu_own_mat, sd_own_mat, mu_h0_mat... |
2520613a895a8f62303cd6e1d3821b576fa3ed7857ce50a9c07f3c72a6343687 | R | 2,551 | 64 | # volcano_plot.R
# Generate volcano plots for differential expression analysis
# Use different input files for OSNs or Fatbody as needed
library(readr)
library(ggplot2)
library(scales)
library(dplyr)
library(ggrepel)
# Input file
# Replace with either "InR_Fatbody_All.csv" or "InR_OSNs_All.csv"
data <- read_csv("InR... |
9105e3f1d718af6ffd615893590810b23e1ecb94b5e955d8df239acd06191f78 | R | 2,556 | 74 | #' NPX Data in Long format.
#'
#' @description
#' This is a synthetic dataset aiming to use-cases of functions from this
#' package.
#'
#' @details
#' A tibble with 29,440 rows and 17 columns.
#'
#' \var{npx_data1} is an Olink NPX data file (tibble) in long format with 158
#' unique Sample identifiers (including 2 repe... |
e7d4f3449022f793f548728c6ebd906e3eeaa7c03bfdcde00bd97f84d882b24f | R | 2,560 | 70 | ##-------------------------------------##
##### SETUP OPTIONS #####
##-------------------------------------##
options(warn = -1)
set.seed(08071993)
options(shiny.maxRequestSize=900000*1024^2)
options(spinner.color="#E7F5F6",
spinner.color.background="#ffffff",
spinner.size=0.5)
#ht... |
cb7df6355d8b0b112572242249300f2586480a616b20b4a7959d61239b2a875d | R | 2,564 | 76 |
# -------------------------------------------------------------------------
# Unit Test 02: Clustering Analysis Logic
# -------------------------------------------------------------------------
# Purpose:
# Verify that the clustering function ('run_clusterplot') correctly assigns
# clusters to the Seurat objects.
... |
b7b73f501117f0a77d5d4ffeb78a065611b22b288ba9d444558e862612287647 | R | 2,566 | 79 | #' Post-process custom OneR clustering columns
#'
#' Cleans up the \code{clusNR} clustering columns produced upstream: recodes
#' zero/NA cluster values and counts cluster membership per row.
#'
#' @param input A \code{data.frame} containing the \code{clusNR}/\code{clus_}
#' clustering columns.
#' @param col_rank Int... |
158c48bb4a07d609bd7ab10f3244639daf8fed0436ea7f48d216d4c223ae45c0 | R | 2,568 | 61 | library(ggplot2)
library(ggpubr)
library(ggridges)
library(scales)
library(R.matlab)
library(MatchIt)
library(xtable)
library(dplyr)
# modified script based on https://github.com/LenaDorfschmidt/sex_differences_adolescence
# adult cell types
lake <- read.csv("C:\\Users\\lihon\\Desktop\\abcd_study\\pnc\\gene_... |
c011b56823fa2b09b76c5592d56eede64cdf3713c98352fd572aaab8de45f274 | R | 2,574 | 83 | test_that(
"olink_pathway_visualization - works",
{
# Load pe reference results - skipped if files are absent
pe_results <- get_example_data(filename = "pathway_enrichment_results.rds")
skip_on_cran()
skip_if_not_installed("vdiffr")
# Errors ----
expect_error(
object = olink_pathway... |
edbd2f146b404d7cee62ab2be2b70e287d79cb738a13bf12b98fe7bb49704687 | R | 2,575 | 79 | # --------------------
# title: FigureS5 Code
# author: Hu Zheng
# date: 2026-01-01
# --------------------
library(Seurat)
library(tidyverse)
library(viridis)
source('bin/Palettes.R')
sp.all <- readRDS('../data/rds/sp.all.rds')
sp.PFC <- readRDS('../data/rds/sp.PFC.rds')
seu <- sp.PFC
seu$SubType <- factor(
seu$... |
d69bcc19f45f2aba0e21c29a0a28a04d335a5920665ba79c2c9247341c28ed2f | R | 2,576 | 85 | args <- commandArgs(TRUE)
i <- as.numeric(args[1])
name <- as.character(args[2])
data <- readRDS(file.path(name, "DDD_MLE_TES/MLE_DATA/ddd_mle.rds"))
setwd(name)
setwd("DDD_MLE_TES")
# Maximize the ML, let the MLE run in the best way possible
tryCatch(
R.utils::withTimeout({
ml <- DDD::dd_ML(
brts = dat... |
14eec20a150bbacca7973f36f20eb46d69b0002c27f6acd80a64c5a876b6e6f8 | R | 2,579 | 58 | # Reformat GENCODE gene features and Illumina infinium methylation array CpG
# probe coordinates Human Build 38 (GRCh38/hg38) liftover bedtools intersect
# Eric Wafula for Pediatric OpenTargets
# 06/26/2023
# Load libraries
suppressPackageStartupMessages(library(optparse))
suppressPackageStartupMessages(library(tid... |
34f2bb1f4c1b01006db868644792c6d999c2b6fc0271300801b04a711e495d70 | R | 2,579 | 92 | #!/usr/bin/env Rscript
# Generate beta and M values from EPIC iDAT files using minfi.
# Steps:
# - detection P-values
# - sample filtering
# - quantile normalization
# - probe filtering
# - drop loci with SNPs
# - export beta/M matrices
#
# Usage:
# Rscript methylation_minfi.R <idat_folder> <out_prefix>
#
# Example:
... |
33c7576d9e14e4fad7865e305edec1391c3ee472a019bb9d09eae1bf03373006 | R | 2,580 | 68 | rfcv <- function(trainx, trainy, cv.fold=5, scale="log", step=0.5,
mtry=function(p) max(1, floor(sqrt(p))), recursive=FALSE,
...) {
classRF <- is.factor(trainy)
n <- nrow(trainx)
p <- ncol(trainx)
if (scale == "log") {
k <- floor(log(p, base=1/step))
n.v... |
ed3cbf0c51c4e3d39f3599378847c4829d2327825b7f35c7f2f8c83d1147edfe | R | 2,587 | 99 | ## =========================
## Experiment I : sham (amygdala)
## =========================
if (!requireNamespace("here", quietly = TRUE)) install.packages("here")
source(here::here("stats","lme_models","_setup.R"))
# acquisition: CS
run_lmer_test(
data_name = "scr_df_amy_acq_sham_CS",
formula = SCR_sqrt ~ CS +... |
b383a98fc22929f0ab2d0728e48813aaa62fb9e184f223ecd8de8af9d51214c2 | R | 2,589 | 66 | #'---
#' title: OUTRIDER Results
#' author: mumichae
#' wb:
#' log:
#' - snakemake: '`sm str(tmp_dir / "AE" / "{annotation}" / "{dataset}" / "OUTRIDER_results.Rds")`'
#' params:
#' - padjCutoff: '`sm cfg.AE.get("padjCutoff")`'
#' - zScoreCutoff: '`sm cfg.AE.get("zScoreCutoff")`'
#' - hpoFile: '`sm cfg.get("hp... |
f1350bb97ec9814cd21beb0fcd1fedaac6ad8b989765ef14b95d347808b815f5 | R | 2,590 | 99 | ## =========================
## Experiment I : sham (hippocampus)
## =========================
if (!requireNamespace("here", quietly = TRUE)) install.packages("here")
source(here::here("stats","lme_models","_setup.R"))
# acquisition: CS
run_lmer_test(
data_name = "scr_df_hip_acq_sham_CS",
formula = SCR_sqrt ~ C... |
38b2b1235438dc03ba8b00b89891cace6c2fc2f0f6558f66a2fe84d60e324e73 | R | 2,594 | 69 | #'---
#' title: Collect all counts from FRASER Object
#' author: mumichae, vyepez, c-mertes
#' wb:
#' log:
#' - snakemake: '`sm str(tmp_dir / "AS" / "{dataset}" / "{genomeAssembly}--{annotation}_export.Rds")`'
#' params:
#' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`'
#' input:
#' - annotation: '`sm cfg... |
b590c399f870bff9c59767264f79880319510a1f40d14da7587e2d288d519877 | R | 2,597 | 91 | ---
title: "Atypical choroid plexus papilloma"
output:
html_notebook:
toc: true
toc_float: true
author: JN Taroni for ALSF CCDL (code)
date: 2021
---
_Background adapted from [#997](https://github.com/AlexsLemonade/OpenPBTA-analysis/issues/997)_
Atypical choroid plexus papilloma is in the WHO 2016 CNS subt... |
35435797d1d5822167e72504f4d69a95114cb991a6e879439bdc4e8367ec3bc0 | R | 2,603 | 53 | ##################################
#
# This function is used to add the
# network score to the TDp
#
# Net_annotation is the dataframe obtained
# from ObtainNetID
#
AddNetworkScore_Schaefer <- function(dat_TDp, net_anna){
dat_tmp <- dat_TDp
net_annotation <- net_anna
network_name <- unique(net_annot... |
78a4e782941395cb4dbcd6dd2d516151b8b1ad837f11a029357528b6819dc44e | R | 2,614 | 65 | #' Plot the results of a differential prioritization analysis
#'
#' After performing a statistical test for differential prioritization using
#' \code{\link{calculate_differential_prioritization}}, plot the results
#' in a scatterplot, highlighting cell types with significant differences
#' between conditions.
#'
#' @... |
e03a7dfefb120b615be69cee660cda8d5b4476212671f7383ec860aedbaef7d2 | R | 2,618 | 89 | ---
title: "Waterfall_plots"
output: html_document
---
## `r PID`
### sDSS_asym
```{r}
MRA_sdss_list <- list()
data_n <- readxl::read_xlsx(file.path(output_dir, paste0(PID, "_mono.xlsx")))
combo_data <- data_n[grepl("^combo_", data_n$Drug.Name), ]
if (nrow(combo_data) == 0) {
mono_data <- data_n
} else {
mono_d... |
8deea66e00f6f9890644f3e16b9c9a7cc8c153580f6e98f3f96d87d732c87a93 | R | 2,633 | 84 | # Intended for import only
# Chante Bethell and Jaclyn Taroni for CCDL 2019
#
# Function to generate a multipanel plot
generate_multipanel_plot <- function(plot_list,
plot_title,
output_directory,
output_filen... |
9d59661b3e54b7eedfc4a49d003ee862d5451290cda4ea326edead529e44cadc | R | 2,634 | 78 | #' Plot cell type proportions versus variances
#'
#' This function returns a plot of the log10(proportion) versus log10(variance)
#' given a matrix of cell type counts. The rows are the clusters/cell types and
#' the columns are the samples.
#'
#' The expected variance under a binomial distribution is shown in the so... |
d00279d157d108b8c786f91577327de446cbc1f76a19cc0318b76cb6393649f3 | R | 2,641 | 92 | ---
title: "01_S1_cell_composition"
output: html_document
date: "2025-04-01"
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r}
# Load required libraries
library(Seurat)
library(tidyverse)
```
```{r}
# Load custom ggplot theme functions
source("~/Rfunction/scTheme.R")
scThemes <- scThemes(... |
66f279b1aef7fa4d0ad1d1fe315c41963be84293ccee8613bb98a0a512af1ba8 | R | 2,643 | 84 | library(MOFA2)
library(data.table)
# (Optional) set up reticulate connection with Python
# library(reticulate)
# reticulate::use_python("/Users/ricard/anaconda3/envs/base_new/bin/python", required = T)
###############
## Load data ##
###############
# Multiple formats are allowed for the input data:
## -- Option 1 ... |
8297959bb995c607ddf07251695b11acc8333b6dab74365bbc5d3a562fdb5f70 | R | 2,661 | 57 | rm(list=ls(all=T))
library(mvnfast);library(mvtnorm)
m=30
rhos=c(0.5,0.75,0.9)
taus=exp(seq(log(1/1000000),log(1/10),length.out=20))
niter=1000
ACTUAL=EST1=EST2=EST3=matrix(nr=length(rhos),nc=length(taus))
for(i in 1:length(rhos)) {
LD=ar1(m,rhos[i]) # AR(1)
# LD=matrix(rhos[i],m,m);diag(LD)=1 # compound symmetry
... |
6d8608b3d8d5ed2f25c2a771e66705b7d3dd3a3b45b83d83be4abac671e74d5f | R | 2,664 | 61 | library(ggplotify)
library(data.table)
library(ggplot2)
library(cowplot)
source("../Plot_theme.R")
# Function to color facet strip backgrounds
fill_title <- function(p, palette){
g <- ggplot_gtable(ggplot_build(p))
strips <- which(grepl('strip-', g$layout$name))
for (i in seq_along(strips)) {
k <- which(g... |
787d187e4a2b6886fdc5438b3c165a1726bb510f5c41fa0287e8720d6f311a48 | R | 2,670 | 76 | #' Unify gene symbols across several gene lists
#'
#' Takes a data frame whose columns are separate gene lists and maps every
#' symbol to its official NCBI symbol, then returns the unified lists bound side
#' by side. Column names encode the number of unique genes retained. The
#' annotation engine is selectable: the ... |
17e4ed934ada462f4fd0ff09cbe2285249d7aaae1f497d43bf5060de0ef0460b | R | 2,671 | 73 | #!/usr/bin/env Rscript
# Batch effect correction on RNA-seq counts using ComBat-Seq.
#
# Input:
# - counts: TSV with first column 'gene_id' and remaining columns as samples
# - meta: samplesheet TSV containing sample, batch, and group columns
#
# Output:
# - corrected counts TSV (gene_id + corrected sample col... |
bce40cb3afb03e7d52050d24829d0523a797b3150a200f5e1d5695e3260008d1 | R | 2,671 | 77 | evaluate <- function(TrueLabelsPath, PredLabelsPath, Indices = NULL){
"
Script to evaluate the performance of the classifier.
It returns multiple evaluation measures: the confusion matrix, median F1-score, F1-score for each class, accuracy, percentage of unlabeled, population size.
The percentage of un... |
36017fdd62c69d12647be0839a724564ff179ff6777f9633b3f99b9c238ee50f | R | 2,673 | 110 | # 5. Ancestry analysis
# Ancestry analysis examining associations between genetically defined ancestry and pathology
# Project: Clinical features, genetics, and pathology in a large series of movement disorder cases: a retrospective multi-ancestry brain bank cohort study
# Last updated in November 2025
# Read ancestr... |
4251f5113ed17bbe26a59041cd4366bb526dd87a3d528f9466d375e256932a28 | R | 2,673 | 54 |
col_sample <- c('Adult1' = "#1e76b2", 'Adult2' = "#fd7e0c", 'Adult3' = "#2a9c67")
col_Glu_GABA <- c('Excitatory' = "#7570B3FF", 'Inhibitory' = "#E7298AFF",
'Non-neuron' = "#66A61EFF")
col_MainType <- c('Excitatory' = "#7570B3FF", 'Inhibitory' = "#E7298AFF",
'Astro' = "#d08fbe", 'E... |
4ccbff83b6aec24ba01c440d85b3aa97876b5fe5c2a2a85ed0f069fc3bdeb61b | R | 2,674 | 75 | #' Collapse over-sized collapsed columns to a summary label
#'
#' Scans a data frame for collapsed columns (\code{*_coll*}) and replaces their
#' content with a \code{"more than <cutoff>"} label wherever the paired count
#' column (\code{*_COUNT*}), or the number of \code{";"}-separated items in
#' enrichment mode, exc... |
11ede34eb0f162df2c20f8c4d5bc28ba27b0e065abd72b878a572512a64f582f | R | 2,677 | 96 | # to perform statistical tests on the beta values obtained from the localizers
# one sample and paired t-tests
install.packages("readxl")
library(readxl)
setwd("/Volumes/IqraMacFmri/visTac/fMRI_analysis/code/betaExtraction/stats_R")
myData<-read_excel(path = "betaVal_sphereRoi_Tml.xlsx")
View(myData)
#checking assu... |
e8dc8824ecb8a7968cecf41f9b0edd2785c8a05f50b337b7ce6bba846f04bc35 | R | 2,681 | 82 | ---
title: "Installation Instructions for scCustomize"
date: 'Compiled: `r format(Sys.Date(), "%B %d, %Y")`'
output: rmarkdown::html_vignette
theme: united
df_print: kable
vignette: >
%\VignetteIndexEntry{Installation Instructions for scCustomize}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
*... |
d8b4d538382d7cf416f952153feeaf6f35f94b911dd67b33862bec4039c12494 | R | 2,685 | 63 | # In this script we will be gathering pathology diagnosis
# and pathology free text diagnosis terms to select HGG
# samples for downstream HGG subtyping analysis and save
# the json file in hgg-subset folder
library(tidyverse)
# Detect the ".git" folder -- this will in the project root directory.
# Use this as the r... |
350ca2a8069399aafc388796d85a6872720ede88e2ca03e979896b216c81f3ba | R | 2,686 | 74 |
library(tidyverse)
library(bruceR)
library(ggstatsplot)
library(ggridges)
library(psych)
library(RColorBrewer)
library(emmeans)
library(ggeasy)
library(ggsci)
library(patchwork)
library(cowplot)
library(scales)
library(ggsignif)
library(patchwork)
library(sjPlot)
source("scripts/function_PvalueForTable... |
8cd897a758f2ea9ffadf2da154b2f0511c97c8d2ec774ab62daef9f69b8793d6 | R | 2,695 | 100 | ---
title: "Schmidt et al. - Data preparation"
author: "Anne Hoffrichter"
date: "2024/05/16"
output:
bookdown::html_document2:
code_folding: hide
fig_caption: true
toc: yes
toc_depth: 4
toc_float:
collapsed: yes
link-citations: yes
---
```{r loadLibraries, message=FALSE, warning=FALSE}
lib... |
c584f7408efbe335207e5a3fef437ee51afe0586ae716dbc0e1c60f4248a6bfa | R | 2,701 | 74 |
#
rm(list=ls(all=TRUE))
font_size = 15
scaleFUN <- function(x) sprintf("%.2f", x)
library(ggplot2)
library(ggpubr)
library(pracma)
library(fourierin)
library(seewave)
num_sample=90
x_text = seq(1, length(seq(0, 345, 15))/2, length.out =num_sample/2)
freq_pool = seq(1, 12, 1)
target_freq_index_pool = c()
for (cur_fr... |
e86ef9daeba0136a9413e973444549a1d87f9e3fc41fe5d521eb71bf754ddbe1 | R | 2,708 | 68 | #' @title Shows the legends for single-cell metadata
#' @description Shows the legends for single-cell metadata based on the shinycell config
#' data.table. This allows user to visualise the different metadata to be
#' plotted and make any modifications if necessary. Note that the display name
#' is shown here inste... |
6f8fe4308f8f1fdd957dbd0bd922ac001a5f2eb0616735aa498f964e07173467 | R | 2,712 | 64 |
GOenrichmentAndReport <- function(geneIds, universeGeneIds,
minSize=3, maxSize=300, minCount=3,
minOddsRatio=1.5, p.value=0.05, highlightGenes=NULL, highlightStr="*%s*",
label="allDE"){
GOparams <- new("GOHyp... |
9df1130b87123cc348c756d75b1f54af34ffd6938ed25851ea914167815f29c7 | R | 2,712 | 77 | library(pROC)
data(aSAH)
context("ci.auc")
expected.ci.auc <- c(0.501244999271703, 0.611957994579946, 0.722670989888189)
test_that("ci.auc with delong works", {
test.ci <- ci.auc(r.ndka)
expect_is(test.ci, "ci.auc")
expect_equal(as.numeric(test.ci), expected.ci.auc)
})
test_that("ci.auc with delong and perce... |
db68380603a377232576d0025db70d0248ec7108f5b1deceb63249d3f8da9299 | R | 2,716 | 59 | #----Ext_2C-F.R-----------------------------------------------------------------
#-------------------------------------------------------------------------------
# This is code to summarise the input network to SELK in Extended data figure 2c
# and synapse counts for figures d-f in Savas et al. 2025.
#
# 'input_1HU_byN... |
54e19703cc1c58643df1d20f3a41a32bb03702307d8348b4f6fc99b59bfb0c62 | R | 2,731 | 92 | library(wateRmelon)
library(sva)
library(matrixStats)
library(CETYGO)
library(nlme)
library(foreach)
library(doParallel)
library(pbapply)
setwd("/lustre/projects/Research_Project-191391/valentin/Subtyping/FACS-Celltype/")
load("Celltype_study.rdata")
args<-commandArgs(TRUE)
celltype <- args[1]
cores=det... |
1536dbe8e0392419282ba10a398688671c27ad2d6934d1c980d837b81458a961 | R | 2,734 | 107 | args <- commandArgs(TRUE)
name <- as.character(args[1])
params <- yaml::read_yaml("../Config/ddd_sim.yaml")
if (!dir.exists(name)) {
dir.create(name)
}
setwd(name)
dists <- params$dists
cap_range <- params$cap_range
max_mu <- params$max_mu
within_ranges <- params$within_ranges
nrep <- params$nrep
age <- params$a... |
1c7fb2b8cfdd0fc4cff0227d5a516360c4e81719b95929593609892e65c8548a | R | 2,734 | 85 | # This script defines custom functions to be sourced in the
# `01-plot-oncoprint.R` script of this module.
#
# Chante Bethell for CCDL 2020
#
# # #### USAGE
# This script is intended to be sourced in the script as follows:
#
# source(file.path("util", "oncoplot-functions.R"))
prepare_maf_object <- function(maf_df,
... |
54609070d7d3b39fb9a83e528ba958e72bae62f63dc41ea3f87b3a23e81f2332 | R | 2,737 | 85 | # Bethell and Taroni for CCDL 2019
# This script creates multipanel plots from plot lists saved as RDS files, the
# output of get-plot-list.R.
#
# Command line usage:
#
# Rscript scripts/generate-multipanel-plot.R \
# --plot_rds plots/plot_data/rsem_all_broad_histology_multiplot_list.RDS \
# --plot_directory plots
... |
660c557cb0448a082f8b80ce34b2af30ff9b2edbdc836304adcd62d4d2881f20 | R | 2,737 | 65 | ---
title: "Resource usage"
author: "Roy Francis"
date: "`r format(Sys.time(), '%d-%b-%Y')`"
output:
html_document:
theme: flatly
highlight: tango
number_sections: true
template:
bootstrap:5
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, eval = FALSE)
```
**easyshiny** is intended ... |
7f163a33b4377144a1291a4216691d1f4a113368d895094dfeb2fd4c2f4b0504 | R | 2,750 | 85 | ##-------------------------------------##
## PCA TAB ##
##-------------------------------------##
getPCA <- function(mat, ncomponents, subset_row, do_scaling, token, session_obj, ID){
mat <- as.matrix(mat)
if(subset_row == "All"){subset_row <- rownames(mat)}
pca <- BiocSingular... |
2ec368381a8548b06cdebc40288b79240a67f041e1c6d68b967b9aa90372b1b6 | R | 2,756 | 53 | #' Rank sequences based on fold-change (FC) score
#' @description Function to rank sequences based on FC-score, which is calculated as the difference between the expression of a sequence/gene and the median expression across all samples/cells.
#'
#' @param exp numerical gene expression (or other relevant measure) matri... |
6aff3d3c57c1188bded462780c0e3a9253102bed47d4975f422539a95b65bca9 | R | 2,760 | 91 | library(torch)
library(pROC)
library(SummarizedExperiment)
# --------------------------
# 1. Charger validation set
# --------------------------
val_ds <- readRDS("AUC_classifier/Arlotta_val_ds.rds")
val_ds <- se_dataset(val_ds,"y_true")
# Charger modèle
net <- torch_load("AUC_classifier/cell_type_Bandler_Arlotta_fin... |
6208894ff67fdf9be008a451be422832880840b8eaa2464ae414d4739bc6e58f | R | 2,762 | 89 | # read out current directory and set parent directory of "R scripts" folder(scr_dir) as
# main working directory; warn if R Scripts is not current working directory
getwd()
basename(getwd())
if (basename(getwd()) == "00_scripts"){
scr_dir = getwd()
setwd("./..")
main_dir = getwd()
} else {readline("Check... |
84ee77165b8940322e4664efa06c3418f22c232fe7638ccb0aa66a2f532762d7 | R | 2,766 | 80 | # calculate overall scores ciliopathies
library(tidyverse)
library(org.Hs.eg.db)
'%notin%' = Negate('%in%')
pageRankPvalue = read.csv('data/pvaluesPropagation.csv', row.names = 1)
rankMP = read.csv('data/rankMP.csv')
expressionScore = read.csv('data/HPAExpressionLocalization.csv', row.names = 1)
allGenes = Reduce(i... |
83b2e1d0003506193aa506484c65329610f5511da41bb5b22e63359aeccf5ff9 | R | 2,772 | 94 | DataProcessor <- R6::R6Class(
classname = "lgb.DataProcessor",
public = list(
factor_levels = NULL,
process_label = function(label, objective, params) {
if (is.character(label)) {
label <- factor(label)
}
if (is.factor(label)) {
self$factor_levels <- levels(label)
... |
1be6bd41af9b7fed6b4ddd86af32793f56ef5d1a5e0da5f339e0a4d119d731be | R | 2,773 | 76 | #' Shows the legends for single-cell metadata
#'
#' Shows the legends for single-cell metadata based on the shinycell config
#' data.table. This allows user to visualise the different metadata to be
#' plotted and make any modifications if necessary. Note that the display name
#' is shown here instead of the actual ... |
6914642880cfa560b6e561e35d39ed190dc193f3df8487cd45a48ae40967668c | R | 2,781 | 85 | context("S4 class construction and show methods")
test_that("richResult can be constructed and displayed", {
res <- new("richResult",
result = data.frame(
Annot = "GO:0001", Term = "test term", Annotated = 100,
Significant = 10, RichFactor = 0.1, FoldEnrichment = 2.0,
zscore = 3.0, Pvalue = 0.0... |
999b2f25cf646a8ce460c352d843ce37629e591e2bf1ccf5330bac291f42c308 | R | 2,783 | 78 | #' Normalise a counts matrix to the median library size
#'
#' This function takes a \code{DGEList} object or matrix of counts and
#' normalises the counts to the median library size. This puts the normalised
#' counts on a similar scale to the original counts.
#'
#' If the input is a DGEList object, the normalisation f... |
a643fb31f1b0595c7cab581e407e1b594f6e5dde57f2a8c3ae8ecc40b945c26b | R | 2,783 | 76 | #' Batch enrichment analysis across multiple gene lists
#'
#' Runs enrichment analysis on a named list of gene vectors and returns
#' combined results ready for \code{richCompareDot()} visualization.
#'
#' @param gene_lists Named list of character vectors (gene IDs per group)
#' @param annot Annot object or annotation ... |
17ef640aefcc96c1e15987d9ceb744f5d56325beeec6805cb5c8cdc2326d86ce | R | 2,791 | 84 | #This code will run manova on network corr with gs
library(dplyr)
library(tidyr)
library(ggplot2)
df<-read.csv("Networks_Corr_Global_Components_last_mo_corr.csv")
df$A_ddmn<-df$A_ddmn*-1
df$A_vdmn<-df$A_vdmn*-1
df$A_lcen<-df$A_lcen*-1
df$A_rcen<-df$A_rcen*-1
df$A_sal<-df$A_sal*-1
df_long <- df %>%
mutate(id=... |
2068e616ab6c249c801634360fdd8d7232768abfa62d9dbf0f5a8348ceaeda57 | R | 2,796 | 82 | # Load the list of data frames saved earlier
dfs <- readRDS(here::here("data", "lme_model_data_list.rds"))
ctrl_nlopt <- lmerControl(
optCtrl = list(algorithm = "NLOPT_LN_BOBYQA"),
calc.derivs = FALSE,
optimizer = "nloptwrap",
check.conv.singular = "ignore"
)
# Helper to fetch a df from the list safely
get_df... |
6d9468b6b7ea8743ed89902a2247613f2dcd84d46f3149244ff882b254b9efb1 | R | 2,801 | 48 | library(tidyverse)
library(writexl)
library(readxl)
target_indication_highest_status_after_2000 <- read_xlsx("./../input_sources/target_indication_highest_status_after_2000.xlsx")
target_indication_current_status_after_2000 <- read_xlsx("./../input_sources/target_indication_current_status_after_2000.xlsx")
target_indi... |
7f94aef333a6c601e8bc95fdaadc089a298e57925781e6e0a7d66b6c370bfde3 | R | 2,805 | 106 | setwd("/media/user/disk21/completeAnalysis/")
data = read.table("cellbrowser/scRNA-Seq/l3.coords.tsv",
row.names = 1, header = T)
meta = read.table("cellbrowser/scRNA-Seq/meta1.tsv",
row.names = 1, header = T, sep = '\t')
identical(rownames(meta), rownames(data))
library(ggplot2... |
edbe0287b7b50d63dc50870a6dbf393a71242a24afd6a1ef65c5919a42583aa6 | R | 2,807 | 78 | #' Feature selection based on variance
#'
#' Perform feature selection on a single-cell feature matrix (e.g., gene
#' expression) by first removing constant features, then removing features with
#' lower than expected variance, as quantified by the residuals from a loess
#' regression of feature (gene) coefficient of v... |
3659bc5fe552b920a9f716b29bd5d429c5137b28bb151744e1def9746b035bd4 | R | 2,808 | 95 | #'---
#' title: OUTRIDER pipeline
#' author: Michaela Mueller
#' wb:
#' log:
#' - snakemake: '`sm str(tmp_dir / "AE" / "{annotation}" / "{dataset}" / "runOUTRIDER.Rds")`'
#' input:
#' - ods: '`sm cfg.getProcessedResultsDir() +
#' "/aberrant_expression/{annotation}/outrider/{dataset}/ods_unfitted.Rds"`'... |
46397d1543a8ccf60cab9038152c8b491262412bcfb66d0aa6e97edfef1baa8f | R | 2,814 | 43 | #' @keywords internal
download_templates=function(){
extdata=system.file("extdata",package="LQT")
cat("Template files have not yet been installed. Downloading them now from Figshare.\nThis may take a few minutes, but will only happen once...\n")
download.file("https://ndownloader.figshare.com/files/27368315?priv... |
2ca1c792757563da3e8f92c8018c93e1cf8e067adcc74ff55c3a93e339b191df | R | 2,816 | 119 | ---
title: "Lineage Assign"
output: html_notebook
---
```{r}
library(readr)
library(philentropy)
library(dendextend)
```
```{r}
sparse_matrix <-readr::read_csv("/data/mayerlab/mayho/TrackerSeq_demo/MUC28072_sparse_matrix_UMI6.csv")
sparse_matrix <- as.data.frame(sparse_matrix)
head(sparse_matrix)
```
```{r}
sparse_... |
6d937b360db84c5f7b9fa2073e41fcc15c898b273eb2c7efcc366df16eb0b815 | R | 2,828 | 81 | # Author: Ryan Corbett
# Function: compare MB molecular subtypes defined by RNA and DNA methylation data modalities
# load libraries
library(tidyverse)
library(data.table)
library(knitr)
# Set up directories
root_dir <- rprojroot::find_root(rprojroot::has_dir(".git"))
data_dir <- file.path(root_dir, "data")
analysi... |
244db2ccc70527ae2d0616e0292d4193059cc92890fc595abdea39784d537cde | R | 2,837 | 77 | ##-------------------------------------##
## BEC TAB ##
##-------------------------------------##
tab_BEC <- tabItem(
tabName = "Batch Effect Correction",
sidebarLayout(
sidebarPanel(width = 3,
selectInput(inputId = "select_matrix_bec", label = "Select count matrix... |
941fea4582798150de77128c4db862b590f3f4ffe403a69ad4b100b7723cd63a | R | 2,838 | 91 | # pROC: Tools Receiver operating characteristic (ROC curves) with
# (partial) area under the curve, confidence intervals and comparison.
# Copyright (C) 2010-2014 Xavier Robin, Alexandre Hainard, Natacha Turck,
# Natalia Tiberti, Frédérique Lisacek, Jean-Charles Sanchez
# and Markus Müller
#
# This program is free soft... |
2a2268174a7a46a73f7776dc4d52c8e01b4ec9d9e374278a090e4bb9572bb2cc | R | 2,840 | 83 | run_Garnett_Pretrained <- function(DataPath, LabelsPath, GenesPath, CV_RDataPath, ClassifierPath, OutputDir, Human){
"
run Garnett
Wrapper script to run Garnett on a benchmark dataset with a pretrained classifier,
outputs lists of true and predicted cell labels as csv files, as well as computation time.
... |
789411552a56e01596bdef69b931acea40822f26dc64e0b6e0a2f7d8ad9607ec | R | 2,850 | 94 | # Create sample lists by disease type
#
# JA Shapiro for ALSF - CCDL
#
# 2019
#
# Generates a table of sample lists for disease type analysis
# Option descriptions
#
# --metadata : Relative file path to metadata with sample information.
# File path is given from top directory of 'OpenPBTA-analysis'.
# --specimen_l... |
e13b98024ede516282712fb06b9b6d57b8ab30cb77b27a9a505f2a0dd66852c8 | R | 2,859 | 82 | #' Create Dataset of Validated CNVs
#'
#' This function is used to create the dataset of PNG images for training.
#' At the moment not all options for plot_cnv() are available here.
#'
#' @param root root folder for the dataset. Must not exists.
#' @param cnvs cnv data.table in the usual format plus the column 'vo'
#' ... |
e8a7f82b18a07276fa40087de7d8105181374a5fc3872d01fe69d03029deff15 | R | 2,863 | 75 | args <- commandArgs(TRUE)
name <- as.character(args[1])
setwd(name)
future::plan("multicore", workers = 4)
bd_poly_list_1 <- future.apply::future_replicate(1000,
eveGNN::bd_fixed_age(0.6, 0.1, age = 10),
simplify = FALSE)
... |
34403439aafdc623059a82dd94f749a1305a47f4f58f3b37c73419d391b1ad1d | R | 2,872 | 99 | ###############################################################
# Example script illustrating how to generate a volcano plot.
# This script uses only simulated data for demonstration purposes.
# It does NOT contain real data or analysis from the published study.
#####################################################... |
fcd0cc15c40140bd8693aaeb592966ca4726b4f7587d3788891532d6907546d9 | R | 2,872 | 86 | ##
## Set up variables across 3xx-scripts
##
##
## Libraries (needed by functions in this file)
##
##
library("gamlss") ## need gamlss.family objects in all scripts
##
## Global random seed
##
set.seed( seed = 12345 ) ## Ensure reproducible code blocks
warning("Have set a fixed random seed, all runs will be identica... |
04c7be3698df6bce9f2a5ca486a8c9a130b9caa2e46f59b00d78785154a18ae3 | R | 2,875 | 88 | context("Testing standardisation and mean-imputation")
test_that("Testing standardisation", {
n <- 50
m <- 10
X <- matrix(rbinom(n * m, size=2, prob=0.3), n, m)
storage.mode(X) <- "numeric"
################################################################################
# No missing values
# N... |
119d86741017a5ae94a94b1439733114594b46e5fa206e11ca2358dc09e4da15 | R | 2,880 | 80 | #' General function to query a distribution's density, cumulative distribution
#' function, quantile function, or random generation function following the
#' format in the R stats package
#'
#' \code{query_distr} is a flexible method to generate values from an inputted
#' distribution
#'
#' @param target Type of out... |
6971ae0922f3305735ecfa7c1824f76b09c27e87317851aa49584d9fb09f2bec | R | 2,880 | 113 | #' Help function to read long or wide format
#' `r ansi_collapse_quot(x = get_olink_data_types(), sep = "or")` data from
#' Microsoft
#' `r ansi_collapse_quot(x = get_file_ext(name_sub = "excel"), sep = "or")`
#' files exported from Olink software in R.
#'
#' @author
#' Klev Diamanti
#' Christoffer Cambronero
#' ... |
15414294d151a9e71f3226d57ebe6cda976dc682f97e07739ecd339cb4eda312 | R | 2,882 | 104 | getwd()
setwd("/data/nas1/liuyiding_OD/project/01_project_147/09_boxplot")
library(ggpubr)
library(pROC)
library(ggpubr)
library(pROC)
library(ggpubr)
library(pROC)
exp=fread("log2TPM.txt",header=T,data.table=F)
exp=column_to_rownames(exp,"V1")
exp=as.data.frame(t(exp))
gene=c( "PATZ1","SIN3B" ,"NTN4" , "BLK... |
8b385d3a9b6b0376f75ba3c9b4919f4e072bb627a53c41a4ddf06343f31bdece | R | 2,885 | 83 | #————— 0) Load required packages —————
library(data.table)
library(R.matlab)
#————— 1) Define file paths —————
zs_path <- "/path/to/unphased.vcor1.zst" #SNP correlation matrix
vars_path <- "/path/to/unphased.vcor1.vars" #SNP correlation matrix SNP ids
out_dir <- "/path/to/out_dir"
mvgwas_path <- "/path/to/sumst... |
afcb4e61c5d761031bb7d4acc772d23646cbeb4ead0e37ea75491f740c501fbc | R | 2,887 | 91 | ---
title: "03_Fig5_volcano"
output: html_document
date: "2025-04-01"
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r}
# Load required libraries
library(Seurat)
library(tidyverse)
library(cowplot)
library(patchwork)
library(ggrepel)
# Load preprocessed Seurat object of neural cells
Neural... |
4062c2b060a97a8d21e73bbbd07b96a5543136f661cd099634ce02261a0874ae | R | 2,897 | 105 | if (!requireNamespace("here", quietly = TRUE)) install.packages("here")
source(here::here("stats","permutation_tests","palm_code","_setup.R"))
# Load the EXT matrices into the environment:
palm_load("ext") # loads amygdala_sham_threat_df_wide, amygdala_sham_safety_df_wide, etc. for extinction
# --- Define output fol... |
7485bfed220f8dce4238fe409913658a54e4e4b39e0fdeff89393b36cfa153c4 | R | 2,899 | 77 | ---
title: "Prep data for NEST"
author: "Audrey Luo"
output: html_document
---
```{r setup, include=FALSE}
library(cowplot)
library(data.table)
library(dplyr)
library(ggplot2)
library(ggpubr)
library(grid)
library(gridExtra)
library(gratia)
library(kableExtra)
library(mgcv)
library(RColorBrewer)
library(stringr)
libr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.