sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
0f15791257a9d1d9ba601dcc1c021b74b14f8e4b821b477823974fb71c3bf9d0 | R | 2,901 | 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... |
8dc094d32c33141c9474b3e962e46d7f3e126083646f999499a1f149efc73a7a | R | 2,902 | 69 | #!/usr/bin/env Rscript
#### Loading libraries
library(Seurat)
library(ggplot2)
library(lme4)
library(MAST)
#### Set threshold and cluster set
cell.rate <- 0.1
cluster.list <- [cluster list]
ncluster <- length(cluster.list)
entrez_genes <- read.table("Ensemble110.GRCh38.p14.genename2entrezid.protein_coding.uniq.genel... |
7b562db11b63821460c8527e57f7ffb5ebccc233ca30e073b968b23642c37f3d | R | 2,904 | 69 | #' @export
pairwise_glm <- function (clr, y = "microbe", model = "~ microbe",
metadata, posthoc.method = "BH", family = gaussian(link = "identity"),
features.as.rownames = FALSE, CI = TRUE, verbose = TRUE)
{
if(verbose){print(family)}
out_df = rbind()
if(y == "m... |
32b88043af34cf521a487562cd2684e82ed1cec29b185479be7bf5f134ee707a | R | 2,909 | 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 hippocampus_sham_threat_df_wide, hippocampus_sham_safety_df_wide, etc. for extinction
# --- Define outp... |
dced022e5a17b2d0ff75b101baf34b57bf7cb59595d0bd844928145030b8945a | R | 2,911 | 72 | rm(list=ls(all=TRUE))
library(data.table);library(dplyr)
##
load_nonsig_gtex_gwas=function(chri=1,usetissues='all',verbose=TRUE) {
bim=fread('/home/lorincn/beegfs/lorincn/data/reference_panels/1kg.v3/TRANS.bim') %>% select(chr=V1,rsid=V2,a1=V5) %>% filter(chr==chri) %>% select(-chr)
setwd('/home/lorincn/beegfs/lori... |
e90b46d3a1b5343ce64b78186a81d9b4021cf8c14ddb7e0cb39fd87596129c94 | R | 2,915 | 83 | #' Perform pairwise t-tests
#' @export
#'
pairwise_DA_tester = function (clr, groups, comparisons,
verbose = TRUE, parametric = T,
ignore.posthoc = F,
posthoc.method = "BH",
paired.test = FALSE){
... |
e9791b5f4599fc390c5d9c3a8d467d8039e32966e983fd3a8491fc882788a0a9 | R | 2,918 | 101 | #'---
#' title: Sample Annotation Overview
#' author:
#' wb:
#' log:
#' - snakemake: '`sm str(tmp_dir / "SampleAnnotation.Rds")`'
#' params:
#' - hpoFile: '`sm cfg.get("hpoFile")`'
#' input:
#' - sampleAnnotation: '`sm sa.file`'
#' output:
#' - hpoOverlap: '`sm touch(cfg.getProcessedDataDir() + "/sample_an... |
01e743bb53a95beec871f9fbadc71cc0a381f845f39786499d3bf3a3571d7300 | R | 2,919 | 77 | #'---
#' title: Merge the counts for all samples
#' author: Michaela Müller
#' wb:
#' log:
#' - snakemake: '`sm str(tmp_dir / "AE" / "{annotation}" / "{dataset}" / "merge.Rds")`'
#' params:
#' - exCountIDs: '`sm lambda w: sa.getIDsByGroup(w.dataset, assay="GENE_COUNT")`'
#' input:
#' - counts: '`sm lambda w: ... |
a2796c617a6cdc9bcf1f5372af324330523d3c6585dc37607575ce5a012d586e | R | 2,921 | 99 | .sigmoid <- function(x) {
1.0 / (1.0 + exp(-x))
}
.logit <- function(x) {
log(x / (1.0 - x))
}
test_that("lgb.plot.interpretation works as expected for binary classification", {
data(agaricus.train, package = "lightgbm")
train <- agaricus.train
dtrain <- lgb.Dataset(train$data, label = train$label)... |
492eb0c669695d2603891a95db46b9fc0882890f291b7578fd6757d8ae414c74 | R | 2,922 | 66 | library(pROC)
data(aSAH)
context("ci.thresholds")
# Only test whether ci.thresholds runs and returns without error.
# Uses a very small number of iterations for speed
# Doesn't test whether the results are correct.
for (stratified in c(TRUE, FALSE)) {
test_that("ci.threshold accepts thresholds=best", {
n <- ro... |
087d90841a3f9bc029ded65b8c95b0f31b26b07ed7ff55eae033bfe2e2ebe63e | R | 2,950 | 97 | # Load related function
dir.base <- "."
script <- list.files(
path = file.path(dir.base,"function"),
pattern = "[.]R$",
full.names = T,
recursive = T
)
for (f in script) source(f)
set.seed(0)
n_reps <- 50
num_signal <- 7
doParallel::registerDoParallel(10)
all_metrics <- plyr::llply(
seq_len(n_reps),
... |
dc6b9174e827d4f6aeb9202945824196312827ddd360a5abb27899cc26e9cbb3 | R | 2,952 | 105 | if (!requireNamespace("here", quietly = TRUE)) install.packages("here")
source(here::here("stats","permutation_tests","palm_code","_setup.R"))
# Load the RE-EXTINCTION matrices into the environment:
palm_load("reext") # loads amygdala_sham_threat_df_wide, amygdala_sham_safety_df_wide, etc. for re-ext
# --- Define ou... |
2520667105f4c2b289a83407b286b5b5a56f1c51a9b2c14b16ef6bd526df3d49 | R | 2,964 | 105 | if (!requireNamespace("here", quietly = TRUE)) install.packages("here")
source(here::here("stats","permutation_tests","palm_code","_setup.R"))
# Load the RE-EXTINCTION matrices into the environment:
palm_load("reext") # loads hippocampus_sham_threat_df_wide, hippocampus_sham_safety_df_wide, etc. for re-ext
# --- Def... |
d1da48cddf8fc243989270a24af32b9b78f8c980c7bac4654c11f031c9ab8633 | R | 2,971 | 92 | #!/usr/bin/env Rscript
# Plot PCA based on readcounts in UTRs
# Copyright (c) 2015 Tobias Neumann, Philipp Rescheneder.
#
# This file is part of Slamdunk.
#
# Slamdunk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Softw... |
dbf8702b6d9ab4cd767c00b83d2d646287165333edee1e5149a16075c0906c31 | R | 2,972 | 81 | # Author: Komal S. Rathi
# Function: Script to filter MB samples and/or batch correct
# load libraries
suppressPackageStartupMessages(library(optparse))
suppressPackageStartupMessages(library(tidyverse))
suppressPackageStartupMessages(library(sva))
option_list <- list(
make_option(c("--batch_col"), type = "characte... |
2f1f457a416ac8445e055fbcb934d271b808170360f7ba8462da1cf8bc98ab77 | R | 2,974 | 80 | #COMPARISON OF GLOMERULI NUMBER PER TREATMENT
#BRAIN PAPER, DION ET AL.
#Packages loading and folder set up
library(ggplot2)
library(rcompanion)
library(car)
library(Rmisc)
library(dplyr)
library(coin) #for a wilcoxon for small sample size
setwd("C:/Users/molen/Desktop")
#Reading the data an... |
d587398d43afdb642a28143147350bd3f0cab4c5a2e7165ac4694ef23aba745a | R | 2,977 | 87 | #'---
#' title: Estimating the optimal latent dimension
#' author: Christian Mertes
#' wb:
#' log:
#' - snakemake: '`sm str(tmp_dir / "AS" / "{dataset}" / "04_hyper.Rds")`'
#' params:
#' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`'
#' - workingDir: '`sm cfg.getProcessedDataDir() + "/aberrant_splicing/data... |
b6f2e10d8a6a60f0e2fc06f5de19927ebbb9a5b182538435c15994586f8d0a32 | R | 2,978 | 75 | library(ComplexHeatmap)
library(stringr)
library(ggplot2)
library(ggrepel)
library(data.table)
library(cowplot)
source("../Plot_theme.R")
# Load color scheme
colors <- fread("../Plotting/colors.csv", strip.white = F)
color_v <- colors$Color
names(color_v) <- colors$ID
# Define tissues
Tissues <- c("BAT","Brain", "Dia... |
cb93eaa8ccd82015625c37353def43451bdad0dd965f096fb0184ae1ff973076 | R | 2,982 | 98 | ar1=function(n,rho=0.9) rho^toeplitz(0:(n-1))
pos=function(x) ifelse(x<0,0,x)
# penalized estimation of number of nonzero means
penfun=function(Z,LD,ngwas) {
m=nrow(Z);p=ncol(Z)
counter=0
Ip=diag(p)
pens=c()
ds=list()
for(k in 0:p) {
cs=combn(1:p,k)
for(j in 1:ncol(cs)) {
counter=counter+1
... |
d6f96b067962e65182233e6e5cc3f68c657aa88fa1aef6a4498c79df93cd0c5f | R | 2,983 | 82 | args <- commandArgs(TRUE)
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 ... |
ad79aea779b88900b5c9be51fe68372d3aca36f8dffcb39e056d992091d18f62 | R | 2,986 | 90 | packages <- c("gprofiler2", "ggplot2", "Cairo")
for (pkg in packages) {
if (!requireNamespace(pkg, quietly = TRUE)) {
install.packages(pkg, repos = "https://cloud.r-project.org")
}
suppressPackageStartupMessages(library(pkg, character.only = TRUE))
}
# Process command-line arguments
args <- commandArgs(trail... |
b72aa6db110ae5b5b799ad496ce77a90c1ca2a258e514878a50cafb951c28854 | R | 2,987 | 63 | #Author: Terra Lee Checked:Kim-Kundert Obando
#The purpose of this code is to generate the histogram figures in Supplementary Figure 3 in the manuscript.
#load data
df_543_net_corr_data <-read.csv("GlobalComponents_Corr_GlobalComponents_Fin.csv")
df_240_net_corr_data <- na.omit(df_543_net_corr_data)
# Now, combine y... |
9b1049b7143a966c2954450432b6fddc28f3e2772fcfa783bab883314bf58797 | R | 2,997 | 62 |
#######################################################
## Functions to perform imputation of missing values ##
#######################################################
#' @title Impute missing values from a fitted MOFA
#' @name impute
#' @description This function uses the latent factors and the loadings to impute mi... |
fe8cb73b5e569921ceaba056d1961ec380ce7d0c874d692f2d104e72326dd712 | R | 3,006 | 82 | # Take in oncoprint-goi-lists-OpenPedCan-gencode-v39.csv and create a goi file for each
# column with associated genes of interest for each specified broad histology.
# Also creates a table for mapping between cancer_group and the appropriate GOI
# list.
#
#
# Chante Bethell for CCDL 2021
#
# USAGE:
#
# Rscript --vani... |
b6bd8d9edcbe329d152a99f74e8580bd5bcf5ae9c15ab37ea23cf85f5af91e9d | R | 3,009 | 98 | # [description]
# Create a definition file (.def) from a .dll file, using objdump.
#
# [usage]
#
# Rscript make-r-def.R something.dll something.def
#
# [references]
# * https://www.cs.colorado.edu/~main/cs1300/doc/mingwfaq.html
args <- commandArgs(trailingOnly = TRUE)
IN_DLL_FILE <- args[[1L]]
OUT_DEF_FILE... |
47a7b2a996a7a040f08ad5ddba230ddd4084b61662f8f1a509d78726c899df17 | R | 3,014 | 108 | ---
title: "Plotting"
author: "AF"
date: "`r Sys.Date()`"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r}
library(readxl)
library(ggplot2)
library(reshape2)
library(dplyr)
library(RColorBrewer)
library(rstudioapi)
```
```{r}
plot_save_as_svg <- function(plot, file... |
e41462b78877c569126f68d333abcfdeb0d5ddc8f83d47074edce18b2945a17c | R | 3,016 | 76 | #' Compare two cell type prioritizations as a scatterplot
#'
#' Compare two sets of cell type prioritization results, calculated for the
#' same cell types, by comparing them in a scatterplot, with the AUCs
#' from the first set of Augur results on the x-axis and the second set on the
#' y-axis. This function can be u... |
ae37b9ef2e4a2051fa397244ca60ba30f3554d55e7fc4b783a038aafc270b5f3 | R | 3,017 | 61 | # this code computes the growth effect of MFC
# use the "install.packages()" function to add the required packages before running this code
# Please set "YourPath" before running this code
library(mgcv)
library(R.matlab)
library(gratia)
MFC <- readMat("MFC.mat") #MFC:Vertex-level gMFC/sMFC/MFC (8589 vertice... |
238a5b19d9bca3a14afa302e612c1613b78bff2c6a9f213eb57e0f8148f8e3a7 | R | 3,018 | 73 | ### This script does z-transformation of correlation coefficients for comparison
### of group-results across resolutions (vertex, desikan, yeo)
### Christina Stier, 2025
## R version 4.2.2 (2022-10-31)
## RStudio 2023.3.0.386 for macOS
rm(list = ls())
setwd("~/Projects/Channels/R/files")
# get correlation coefficie... |
4f1c4af20781b57cf7bea96dcfeb693acc8802d05f27ffa57720df7cdcd6739d | R | 3,018 | 73 | ##### Sourcing scripts, libraries and data #####
setwd("D:/valentin/main/")
source("./scripts/utils.R")
source("./scripts/Clustering/analyze_models.R")
source("./scripts/Clustering/model.R")
load("betas/ROSMAP_final_set_27-11-23.Rdata")
load("betas/UKBBN_final_set_27-9-2023.Rdata")
load("betas/PITT_final_s... |
370d9c98a19e2e93329fd6790d402b7fc771705f11a08d7d755debe9fd505020 | R | 3,027 | 69 | #SPLIT CELLPROFILER VARIABLES INTO GROUPS
#AREASHAPE
#TEXTURE
#GRANULARITY
areaShape <- colnames(scObj)[grep('AreaShape', colnames(scObj))]
areaShape2 <- c('AreaShape_Center_X', 'AreaShape_Center_Y') ### Re-arrange Area, Center_X and CEnter_Y - these parameters will not be used in analysis
areaShape <- c(areaShape2, se... |
1e73f35c023e7f80e92cde2b76f3e813d507633bac18da379fafce06976701e2 | R | 3,028 | 87 | test_that("richResult class can be instantiated", {
res_df <- data.frame(Annot = "GO:001", Term = "test", Annotated = 100,
Significant = 10, Pvalue = 0.01, Padj = 0.05,
GeneID = "A,B,C")
obj <- new("richResult",
result = res_df,
detail = data.frame(),
pvalue... |
756b664262cd6d1ed6e9826453fa4e3cd75ebf7b4620314e5dc1017a6569536c | R | 3,029 | 66 | ################################# ED.Fig.13a and b
library(data.table)
library(survival)
library(survminer)
library(ggpubr)
library(TCGAbiolinks)
library(EDASeq)
library(tidyverse)
#survival plot####
#load clinical data which was downloaded from TCGA
load('Customized directory/Manuscript.Wei.et.al/TCGA/clin.luad.RData... |
824ef831c1670e0ce8168b64809cd8659afce83d533178992ba93f84b6b8af84 | R | 3,030 | 87 | dir.base <- "."
dir.data <- file.path(dir.base, "$data path$")
dir.data.processed <- file.path(dir.data, "processed")
dir.results <- file.path(dir.base, "data_results/PAN")
# --------------------------------------------------------------------------------------------------------------------------
# library(multiRF)
lib... |
96238c27e2f01ab3cb6027fa1ce8d2c26048b7af6bfc4dd63683cca8a992a42e | R | 3,032 | 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... |
b191ce1a61bc99226538fb6c6e73234c646fb9b1749e7a4396a94abb1e694af1 | R | 3,032 | 103 | library(dplyr)
library(readr)
library(openxlsx)
## Load helper functions
source("path/to/function_definition.R")
############################################
## 1. Generic FET function
############################################
run_fet_sets <- function(gene_set_list, disease_gene_dict, bg, padj_method = "BH") {
... |
7331017fbc05f14cd0cea7bd21e8bba03668177c124e0d93eef8dd846706beed | R | 3,037 | 85 | data(agaricus.train, package = "lightgbm")
data(agaricus.test, package = "lightgbm")
dtrain <- lgb.Dataset(agaricus.train$data, label = agaricus.train$label)
dtest <- lgb.Dataset(agaricus.test$data, label = agaricus.test$label)
watchlist <- list(eval = dtest, train = dtrain)
logregobj <- function(preds, dtrain) {
la... |
795132946af64da91524292267be24d78c7031908531e5fd5214fdaf87d9712f | R | 3,037 | 87 | #' Count and collapse genes overlapping a key vector
#'
#' For each requested column of separated gene strings, uncollapses the values,
#' keeps only the genes present in \code{genes_vec}, then re-collapses them per
#' row and reports the overlap count. Useful for intersecting enrichment
#' outputs with a gene set of i... |
a0c2449f506ae19603be3a52f73d3baee7346728fd0cd67a12d750062d989470 | R | 3,043 | 93 | # using devtools to create package
# nice elementary tutorial
# https://uoftcoders.github.io/studyGroup/lessons/r/packages/lesson/
# adds documentaion to package as a whole
# use_package_doc()
# in caase of problems delete namespace file
# than do load_all()
# and than document()
# storing data in R package
# https:... |
bd93e7bdb11508b53464261ecd4098d1b69296258ead365d3f897ac21753e39b | R | 3,044 | 84 | #!/usr/bin/env Rscript
# Prepare DAVID input gene lists (Entrez IDs) from DESeq2 results.
#
# DAVID (https://david.ncifcrf.gov/) typically accepts a list of gene identifiers.
# This script outputs two files:
# - david_up_entrez.txt
# - david_down_entrez.txt
#
# Mapping is performed using org.Hs.eg.db (offline anno... |
36d01c58d8a714a9e3c0aa52f287fc78311468d05b1ffbba8a4bcb1125d2be01 | R | 3,045 | 98 | if (!requireNamespace("here", quietly = TRUE)) install.packages("here")
source(here::here("stats","permutation_tests","palm_code","_setup.R"))
# Load the ACQ matrices into the environment:
palm_load("acq")
# --- Define output folder (project-relative)
out_dir <- here::here(
"stats","permutation_tests","palm_files",... |
f9b4c1addfde7131fc05e0bc66e555f8c0c84b049513c87a4f6be5c6a8526c35 | R | 3,051 | 98 | if (!requireNamespace("here", quietly = TRUE)) install.packages("here")
source(here::here("stats","permutation_tests","palm_code","_setup.R"))
# Load the ACQ matrices into the environment:
palm_load("acq")
# --- Define output folder (project-relative)
out_dir <- here::here(
"stats","permutation_tests","palm_files",... |
4fd8099181d30ee50cc25f7548573331003413e9f7dc229ae8b932f1816bf04e | R | 3,059 | 85 | ############################################################################
#
# Collecting fMRI metrics
#
# This script is used to generated the metrics for the sequential analysis,
# including:
# 1. Global to SMN time delay: time delay projection map averaging SMN RIOs
# 2. Local SMN time delay: time delay... |
05867e36250921ce4e8e40aca0bfc443da4e803cc1f61623be778cd955fda467 | R | 3,073 | 74 | #'---
#' title: Annotate introns with gene symbols
#' author: Ines Scheller
#' wb:
#' log:
#' - snakemake: '`sm str(tmp_dir / "AS" / "{dataset}--{annotation}" / "06_geneAnnotation.Rds")`'
#' params:
#' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`'
#' - workingDir: '`sm cfg.getProcessedDataDir() + "/aberran... |
11aaaff5f54d8d99b3cde9942943bf8dcecbe9882b2f0e71984644247a8e55b4 | R | 3,073 | 100 |
---
title: "Summary of Ensembl identifiers for RNA-seq matrices"
output: html_notebook
params:
annot.table:
value: 'results/kfnbl-gene-expression-rsem-fpkm-collapsed_table.stranded.rds'
strategy:
value: 'stranded'
---
```{r include = FALSE}
knitr::opts_chunk$set(comment = NA)
getOption(x = 'DT.warn.size',... |
5e0fd51a3928f93780b365a2be4e45dba9bc4c13bd651a279596e66248e22ad3 | R | 3,074 | 94 | context("Testing PCA projection onto new samples")
tol <- 1e-5
data(hm3.chr1)
bedf <- gsub("\\.bed", "",
system.file("extdata", "data_chr1.bed", package="flashpcaR"))
ndim <- 10
test_that("Testing projection", {
# PCA on all the data
X1 <- scale2(hm3.chr1$bed, type="2")
f <- flashpca(X1, ndim=ndim, st... |
882174d99b1a45f018a39356daa41214b453dba7c2d7fa62d5dc8673226b7d41 | R | 3,074 | 54 | expected_roc_utils_calc_coords <-
structure(c(
-1, -2, -3, -4, 1, 0.5, 0.10000000000000001, 0, 0,
0.5, 0.90000000000000002, 1, 0.36283185840707965, 0.5, 0.60973451327433625,
0.63716814159292035, 0, 36, 64.799999999999997, 72, 41, 20.5,
4.1000000000000005, 0, 0, 20.5, 36.899999999999999, 41, 72, 36,
... |
e966cb4bc8d92cb6560c6f1bd4bfa09edabcced02c40d8180729a8958e6eb73c | R | 3,074 | 70 | # GET AND SET STUDY DEFAULTS ----
# THIS SCRIPT GETS AND SETS STUDY-WIDE CONSTANTS AND WRITES THEM TO A JSON
# FOR USE BY OTHER SCRIPTS, including in other languages
# this script is not tar_source()-d but regular source()-d bc it's used for target construction
# but not within any targets
# hence we do need to load li... |
d55779ec2289748170f9feab2754c47b014a779236e32fa38936be402374bca3 | R | 3,078 | 72 | #' @title Compile datasets
#' @description This function takes completed LQT files and compiles analysis-ready datasets
#' @param cfg a pre-made cfg structure (as list object).
#' @param cores an integer value that indicates how many parallel cores the function should be run on.
#'
#' @importFrom neurobase readnii writ... |
9fc589989211e9aebeaabc20532238e8bfc1a3217dd8fdcb3be9dcee7edf48c2 | R | 3,083 | 78 | #' @title Visualize Spatial Patterns
#' @description Generates spatial heatmaps for identified patterns.
#' Uses dynamic alpha blending to highlight high-expression regions.
#' @param pattern Object containing pattern matrix (Patterns x Spots).
#' @param location Data frame of coordinates (x, y).
#' @param max.cut... |
66eaec25e5f359aba2e86838f1cf32d990c697e60f0b78963e41e092e3ea2c34 | R | 3,085 | 92 | ##' Class "richResult"
##' This class represents the result of enrichment analysis.
##'
##'
##' @name richResult-class
##' @aliases richResult-class plot,richResult-method
##'
##' @docType class
##' @slot result enrichment analysis results
##' @slot detail genes included in significant terms and original information
##... |
7c20dcec511b37395136a30e4b66ea11b056aeef6ea6723b53fc02ebe5b8772f | R | 3,095 | 136 | #' Prints class type output from read_npx* functions.
#'
#' @author
#' Klev Diamanti
#'
#' @keywords internal
#'
#' @return A scalar character vector with the class type of outputs from
#' read_npx* functions.
#'
get_df_output_print <- function() {
x <- stringr::str_replace_all(
string = read_npx_df_output,
... |
9455087232d541eb74c8868848a05df96070c1bdef3711305b7a936f27d5077d | R | 3,098 | 78 | ## =========================
## Experiment I vs. II: CS x TUS × EXPERIMENT
## =========================
if (!requireNamespace("here", quietly = TRUE)) install.packages("here")
source(here::here("stats","lme_models","_setup.R"))
## -------- acquisition: CS * TUS * TRIAL * EXPERIMENT --------
res_acq_4way <- run_lmer_t... |
add47f4e45c9ac9b0b24fb7842e22cbd091c32aab516894e1ffcb53c40f10899 | R | 3,103 | 103 | # 1. Sensitivity & Specificity analysis
# Compares clinical and pathological diagnoses to assess diagnostic accuracy (sensitivity, specificity, PPV, NPV).
# Project: Clinical features, genetics, and pathology in a large series of movement disorder cases: a retrospective multi-ancestry brain bank cohort study
# Last u... |
c2a2bd9bcc14bd16eef76af7a8fa9ba97baed272ba1a2fffd63fee536545fca4 | R | 3,104 | 96 | ##-------------------------------------##
## DOUBLETS ##
##-------------------------------------##
#sce <- SingleCellExperiment(list(counts=mat))
#doublets <- cxds(sce,retRes = TRUE)
#doublets$cxds_score
calculate_doublets <- function(mat, sample){
set.seed(2024)
sample <- as.charac... |
e14aed08608d24a3d1ddba219aab210e68e17083155f3b3fe93ea2a6a287d4ca | R | 3,107 | 112 | # to perform statistical tests on the beta values obtained from the localizers
# one sample and paired t-tests
#MT-MST Localizer
install.packages("readxl")
library(readxl)
setwd("/Volumes/IqraMacFmri/visTac/fMRI_analysis/code/betaExtraction/stats_R")
myData<-read_excel(path = "betaVal_clusterRoi_Tml.xlsx")
View(myDa... |
308a1c8a39db0f10e68469ced6b61f8ac5c30971a75c2a56d7cea1c92a107d0a | R | 3,108 | 87 | #' Simulate an unrealistic spatial omics dataset.
#'
#' @details
#' This function generates an unrealistic spatial omics dataset based on a
#' user-specified number of cells and genes. The number of clusters is defined
#' by \code{n_rings}, while counts follow a Poisson distribution with a
#' user-specified rate \c... |
d6a7186da61a7f56ae4b6acac654cb88b0b5793ae386aa24d4f3266c1de489c9 | R | 3,110 | 112 | ---
title: "Barplot of UP and DOWN genes across Neu Diff"
author: "AF"
date: "`r Sys.Date()`"
output: html_document
---
```{r setup, include=FALSE, message=FALSE, warning=FALSE}
knitr::opts_chunk$set(echo = TRUE, comment = '#>')
```
```{r, message=FALSE, warning=FALSE}
library(ggplot2)
library(dplyr)
```
```{r param... |
0543eeaacbd2a5cb47ce708e77dec2d50189e42d9497fc35952d87f39b2b0c8c | R | 3,115 | 71 | library(pROC)
data(aSAH)
context("roc.utils")
test_that("roc_utils_thr_idx finds correc thresholds with direction=<", {
obtained <- pROC:::roc_utils_thr_idx(r.s100b, c(-Inf, 0.205, 0.055, Inf))
expect_equal(obtained, c(1, 18, 4, 51))
})
test_that("roc_utils_thr_idx finds correc thresholds with direction=>", {
... |
f6a71cc514fde993de0479d7a8aead771cc3b99dbb3772a358fb63da1c247622 | R | 3,115 | 64 |
# ==============================================================================
# U5_cell.R
# UI definition for the "Cell Annotation" sub-tab (Step 3.3).
#
# Purpose:
# Provides the interface for assigning cell types to spatial spots/cells.
#
# Key Features:
# - Annotation Methods:
# - SingleR: Au... |
1a894e4d44404105f19586369678ab44385fb8be714c6fccb53ad2a3ba37ff05 | R | 3,117 | 70 | # Author: Komal S. Rathi
# Date: 11/11/2019
# Function: Publication quality ggplot2 themes
# load libraries
suppressPackageStartupMessages(library(grid))
suppressPackageStartupMessages(library(ggthemes))
theme_Publication <- function(base_size=12, base_family="Helvetica") {
(theme_foundation(base_size=base_size... |
b458c4517e737da80376ad1fb674e58a385b9d7b237f643467f44f22b0bc2a4c | R | 3,120 | 94 | ########################### View screening data generation process ##########################
#
# Objective: Script to look at model and screening results
########################### <<<<<>>>>> #########################################
rm(list = ls()) # Clean environment
options(scipen = 999) # View data without sc... |
89d5f546fafcbf4d2c5aa0c459ef29c4745265ac88835556128390b1766e1bd6 | R | 3,128 | 83 | ##-------------------------------------##
## DIMRED TAB ##
##-------------------------------------##
tab_FEATURE_SELECTION <- tabItem(
tabName = "Feature Selection",
textOutput(outputId = "session_id"),
sidebarLayout(
sidebarPanel(width = 3,
selectInput(inputId... |
6c4867cacf9ec2e37eea24f54bec0e38bd54fa312e24a44aeb29bb6793f2db35 | R | 3,135 | 98 | # This script subsets the focal copy number, RNA expression, histologies`
# files to include only Chordoma samples.
# Written originally Chante Bethell 2019
# (Adapted for this module by Candace Savonen 2020)
#
# #### USAGE
# This script is intended to be run via the command line from the top directory
# of the reposi... |
6fd1016e666408130083a8a77baf597e62cc77b0975940e4855844496101988e | R | 3,139 | 39 | # Post hoc, locally specified follow-up. Existing ranks only; original outputs unchanged.
.libPaths(c(normalizePath('.Rlib'), .libPaths()))
suppressPackageStartupMessages({library(fgsea);library(jsonlite);library(digest)})
source('src/transcriptomics/helpers.R')
for(record in c('provenance/analysis_freeze.json','proven... |
9e62778ae0935d5d5400a130abe9e5b675123b34990e3842d162c5acd09d0930 | R | 3,142 | 94 | library(VIM)
library(missForest)
library(data.table)
###############################################################################
# Based on https://github.com/selbouhaddani/OmicsPLS/blob/master/vignettes/OmicsPLS_vignette.pdf
#
# Download the gene expression data from ArrayExpress, if hasn't been already
f <- "~/... |
e2db755aa8039277ab6bdc4b22396b31ca09373df266c82c78eeca41b75340df | R | 3,144 | 89 | #' Calculates and transforms cell type proportions
#'
#' Calculates cell types proportions based on clusters/cell types and sample
#' information and performs a variance stabilising transformation on the
#' proportions.
#'
#' This function is called by the \code{propeller} function and calculates cell
#' type proportio... |
1c9cfac5066d3a8909d8e9b9fad828be26651485de1b1206c0f2499415b827db | R | 3,145 | 123 | ---
title: "packages for OpenPedCan"
author: "zzgeng"
date: "2024-05-30"
output:
html_document:
df_print: paged
---
```{r}
library(tidyverse)
library(openxlsx)
```
## generate `software/packages` table
### R packages
```{r}
# Sheet 1: R packages in Docker image
r_packages <- data.frame(installed.packages()[, c(... |
12b6319d36a646dada66a79d5721ccb04e14529a4c12d3707366e3abea0e241f | R | 3,147 | 103 | ######### required R packages ############
packages <- c("dirichletprocess")
if (length(setdiff(packages, rownames(installed.packages()))) > 0) {
install.packages(
setdiff(packages, rownames(installed.packages())),
repos = "http://cran.us.r-project.org")
}
library("dirichletprocess")
##########... |
75ef90c516b9ea7b66a7bca8e1ac9fecd616858dfe758a7439fdaef62cc93e71 | R | 3,149 | 73 | library(ggplotify)
library(data.table)
library(ggplot2)
library(stringr)
library(dplyr)
library(cowplot)
source("../Plot_theme.R")
# Load color scheme
colors <- fread("../Plotting/colors.csv", strip.white = F)
color_v <- colors$Color
names(color_v) <- toupper(names(color_v))
# Load LAR age comparison DEGs
miRNA_age <... |
c88414f287a3e95c65f9e2c325701bda08ffef69067bd9711d7ccc423a7a1319 | R | 3,154 | 61 | #!/usr/bin/env Rscript
args = commandArgs(trailingOnly=TRUE)
nr_jobs <- as.numeric(args[1]) # total number of jobs
dir <- as.character(args[2]) # path to tmp work directory
out_path <- getwd() # path to output directory
setwd(paste0("./", dir)) # move to temp working directory
input_parameters <- readRDS("input_param... |
0663a17f1484c5fdaf7150b86cf40dcd1e77003390eda180507c62991c1b5988 | R | 3,155 | 92 | setwd("/data/nas1/liuyiding_OD/project/01_project_147/08_ANN")
library(neuralnet)
library(NeuralNetTools)
library(ggpol)
library(dplyr)
library(ggplot2)
library(caret)
gene_data =fread("log2TPM.txt",header=T,data.table=F)
gene_data =column_to_rownames(gene_data ,"V1")
gene_data =as.data.frame(t(gene_data ))
gene=c( "PA... |
7f957cef6d222b8f2d3c8bd5f503b250189be74b50bc6bac1d163264c86450f5 | R | 3,159 | 128 | library(tidyverse)
library(data.table)
library(scales)
library(ggforce)
library(cowplot)
library(dplyr)
library(ggrepel)
library(glue)
library(patchwork)
library(ggpubr)
FONT_SIZE=6
my_grid = function(...){
theme_minimal_grid(font_size=FONT_SIZE, ...)
}
my_hgrid = function(...){
theme_minimal_hgrid(font_size... |
0fcfc89a80a2432fc4bf0b12b6aa8e8eda33ddb2a8012bbd829a662925eed50a | R | 3,162 | 84 | get_parcel_conjunctions <- function (path_parcels_1,
path_parcels_2,
threshold_p = .05,
p_adjust_method = "BH") {
tvals1 <- path_parcels_1 %>%
get_parcel_tvals_long() %>%
label_parcel_pvals_long(... |
e6b7c7d2e1de107f15574fcd3ca6bdf63ebe8f5d3dba6fef02d0fa369a9590bd | R | 3,171 | 99 | #' @name lgb.plot.importance
#' @title Plot feature importance as a bar graph
#' @description Plot previously calculated feature importance: Gain, Cover and Frequency, as a bar graph.
#' @param tree_imp a \code{data.table} returned by \code{\link{lgb.importance}}.
#' @param top_n maximal number of top features to inclu... |
67c605e67e5aab34308f669acba78d2e788c73fd25047d273e9ef0bce07d000e | R | 3,180 | 78 |
######################################
## Functions to perform predictions ##
######################################
#' @title Do predictions using a fitted MOFA
#' @name predict
#' @description This function uses the latent factors and the weights to do data predictions.
#' @param object a \code{\link{MOFA}} object.... |
9639313cf2390d535d4b877220cc0654f8efe27e01e60847a7a1c3972a9faf95 | R | 3,180 | 84 | normCounts <- read.csv("normalized_data.csv", row.names = 1)
info <- read.csv("info.csv")
colnames(normCounts) <- info$PN
# Define the groups and the genes in each group
groups <- list(
"Neural stem cells" = c('PAX6', 'SOX2', 'SOX1', 'NES', 'DLL1', 'HES5', 'NOTCH1', 'FABP7'),
"Differentiated" = c("L1CAM", "MAP2... |
a2e06a6478da54e9f125debec3f5d13e8383c3211a76241be306d0c5dabb24c5 | R | 3,180 | 71 | #' Mask FASTA sequence at defined regions.
#'
#' @param fasta.file A path to a FASTA file to be masked.
#' @param mask.ranges A \code{\link{IRanges-class}} object of coordinates to be masked in input FASTA.
#' @param invert If set \code{TRUE} ranges defined in 'mask.ranges' will be kept while the rest of the FASTA will... |
2aa72407adce445ee0f14f6c77a475b149dbf94b0917b100dd085ba380c6d27a | R | 3,187 | 78 | #'---
#' title: Merge Split Counts
#' author: Luise Schuller
#' wb:
#' log:
#' - snakemake: '`sm str(tmp_dir / "AS" / "{dataset}" / "01_2_splitReadsMerge.Rds")`'
#' params:
#' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`'
#' - workingDir: '`sm cfg.getProcessedDataDir() + "/aberrant_splicing/datasets"`'
#' ... |
c3bc040d8d96ec3dd1e760de19c1d80ca4d41170a18dfbc2189e9882c4803cec | R | 3,187 | 81 | ---
title: "R Notebook"
output: html_notebook
---
This is an [R Markdown](http://rmarkdown.rstudio.com) Notebook. When you execute code within the notebook, the results appear beneath the code.
Try executing this chunk by clicking the *Run* button within the chunk or by placing your cursor inside it and pressing *Cm... |
b16d03dbcf9e3fed30713fcf37a87ce0639b15d3385dc688c5b2256025c6fae8 | R | 3,189 | 75 | library(tibble)
library(dplyr)
library(readr)
# ---- Configuration ----
# Define directories for data input and results output.
# Please update these paths to match your project structure.
data_dir <- '/imaging/hauk/rl05/fake_diamond/data/logs'
analysis_dir <- '/imaging/hauk/rl05/fake_diamond/scripts/analysis/behaviou... |
cb8c8cd589659faf54c2b86748f3f4c6e686639baee7107843b4f430dce16720 | R | 3,189 | 53 | #!/usr/bin/env Rscript
# Loading libraries
library(Seurat)
library(patchwork)
library(ggplot2)
library(GeneNMF)
library(remotes)
library(UCell)
library(Matrix)
library(RcppML)
library(viridis)
library(msigdbr)
library(fgsea)
# Loading data
seu <- readRDS("thalamus.merge.QC.harmony.rename.major.downsampled.rds")
# Co... |
cebe7a7c96bd65fc30c25aa7fb7deaf1ce9d467b24f2cb74fd2ba9580a65ca5f | R | 3,195 | 105 | library(ggplot2)
library(directlabels)
library(plyr)
require(gridExtra)
require(scales)
library(RColorBrewer)
library(reshape2)
library(data.table)
library(dplyr)
library(tidyr)
library(zoo)
###change the working directory (2nd line) and saved file name (last line) before running###
#clear variables
rm(list=ls(all=... |
bde94243268fbb424fdc5698c077ea934917ef44a6cc06b4deabf14843af3a47 | R | 3,196 | 86 | #' @title Get parcel damage
#' @description This function uses an MNI-registered lesion file and an MNI-registered brain parcellation
#' to estimate the amount of damage sustained by each brain region.
#' @param cfg a pre-made cfg structure (as list object).
#' @param cores an integer value that indicates how many para... |
dec60221c3ae98ca511b81ddd92c1553c1c3c4d72903824ca8476604dffa502a | R | 3,197 | 96 | #' @importFrom OneR bin
#' @export
clusterizer_oneR<-function(inputDF, landmark_col, cols_to_cluster){
inputDF<-as.data.frame(inputDF)
inputDF<-NoNA.df(inputDF)
invisible(utils::capture.output(inputDF[,landmark_col]<-as.character(inputDF[,landmark_col])))
a=1
b=1
output<-inputDF
top_rec<-vector()
a=1
... |
3d0599a3f37e59787ff94c09ebd4a7e246457f8d76bb57c7c8a46aa8c221aac5 | R | 3,199 | 72 | args <- commandArgs(TRUE)
run_SingleR<-function(DataPath,LabelsPath,CV_RDataPath,OutputDir,GeneOrderPath = NULL,NumGenes = NULL){
"
run SingleR
Wrapper script to run SingleR on a benchmark dataset with 5-fold cross validation,
outputs lists of true and predicted cell labels as csv files, as well as compu... |
1dcdcd90d51e90bf5c43a14a05506de7ca74e2e4fcb264c5ace606747c7d8e74 | R | 3,201 | 108 | ---
title: "Identify samples for patients with both methylation and RNA-Seq data"
output: html_notebook
author: Eric Wafula for Pedaitric Open Target
date: 2023
---
To run and fully test the upstream `post array preprocessing` modules in continuous integration, we must ensure that there are examples of samples for pat... |
6fa4ec3d3d25622cb3d6703758d3976322e685bd49d1208436fbc89b8268b92c | R | 3,208 | 61 | library(Seurat)
library(rhdf5)
library(Matrix)
lapply(c("dplyr","Seurat","patchwork","ggplot2","tidyr","openxlsx","harmony", "miloR", "SingleCellExperiment", "scater","SeuratWrappers"), library, character.only = T)
pathToFolder <- "downloads/datasetsToIntegrate/Linnearson/"
h5ls(paste0(pathToFolder, "HumanFetalBrain... |
8c9f15b1b0eb0e79dadd7753130812985247e8519adfde3fa2478c2254b7bfc7 | R | 3,215 | 92 | ---
title: "Misc Functions"
date: 'Compiled: `r format(Sys.Date(), "%B %d, %Y")`'
output: rmarkdown::html_vignette
theme: united
df_print: kable
vignette: >
%\VignetteIndexEntry{Misc Functions}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
***
<style>
p.caption {
font-size: 0.9em;
}
</style>... |
0289c124c35c8fa98fe0b6b663298dec65477dd9c0458a497964d7cd38080114 | R | 3,217 | 112 | library(rstan)
library(dplyr)
library(ggplot2)
rstan_options(auto_write = TRUE)
options(mc.cores = parallel::detectCores(), stanc.allow_optimizations = TRUE,
stanc.auto_format = TRUE
)
#load data
pk_data <- read.csv("preprocessed_mPBPK_data.csv")
time <- pk_data$TIME
mean_Cplasma <- pk_data$MEAN
... |
1d68b0747b825ebc2c0a75f229d78001ac62ffce6b1a870e90a75a7be73c3ee8 | R | 3,219 | 77 | ---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
# Please put your title here to include it in the file below.
Title <- "An R project compendium for the Jokur... |
332acf640787f1eb0bbc99b8799e64a74e6d3e67833e7349f9941a6309a04eb1 | R | 3,219 | 104 | # This demo R code is to provide a demonstration of hyperparameter adjustment
# when scaling weights for appropriate learning
# As with any optimizers, bad parameters can impair performance
# Load library
library(lightgbm)
# We will train a model with the following scenarii:
# - Run 1: sum of weights equal to 6513 (x... |
6479b24225020a5fbe85405d96040a7077b6c24f140d5d35caa2151e8a60208c | R | 3,219 | 93 | # plot_enrichment_bubbles.R
library(ggplot2)
library(readr)
library(dplyr)
# Load final filtered file
df <- read_csv("results/enrichment_tables/Comprehensive_Grouped_Pathways.csv")
# Clean pathway labels
df$PathwayShort <- gsub("KEGG_|Reactome_|Pathway_|Drosophila_", "", df$Description)
df$PathwayShort <- substr(df$... |
c883bac90c27640e37e53f196aac157fe334a5cf90ff28001bf9efa6775ac141 | R | 3,220 | 76 | library(ComplexHeatmap)
library(stringr)
library(ggplot2)
library(ggrepel)
library(cowplot)
library(data.table)
source("../Plot_theme.R")
# Load color scheme
colors <- fread("../Plotting/colors.csv", strip.white = F)
color_v <- colors$Color
names(color_v) <- colors$ID
# Load LAR dataset DEGs
degs_lar <- read.csv("res... |
701d66a41b00bac7bed043ba30ab7d1b2196ca735943e981c3c67d648e36bf56 | R | 3,230 | 70 | # Documentation
#' Summarizing Node Predictability
#'
#' @param predict_function_output output from a predictability analysis function.
#'
#' @return A tibble summarizing node predictability.
#'
#' @docType methods
#'
#' @format An object of class \code{"tibble"}.
#'
#' @keywords predictability, network analysis
#' @de... |
2d4fb2f7e72c6463a229bdb5fa3c70829d30d27908cae4bda6328c63f7fff5f7 | R | 3,235 | 91 | args <- commandArgs(TRUE)
TrueLabelsPath <- args[1]
PredLabelsPath <- args[2]
OutputDir <- args[3]
ToolName <- args[4]
evaluate <- function(TrueLabelsPath, PredLabelsPath, Indices = NULL){
"
Script to evaluate the performance of the classifier.
It returns multiple evaluation measures: the confusion ma... |
204231385de3a55e7b17f8c96ae17b7b3ebf01edc2e24bf4f404949e6747a805 | R | 3,243 | 95 | #!/usr/bin/env Rscript
args = commandArgs(trailingOnly=TRUE)
# path_sc = "/home/ubuntu/simulation_LN/sc_simu.h5ad"
# path_st = "/home/ubuntu/simulation_LN/st_simu.h5ad"
# params are
# ID clustering
# path in
# path out
path_in <- args[1]
dir_out <- args[2]
index_key = args[3]
path_sc <- paste(path_in, "/sc_simu.h5a... |
3a62a1d57322a250fd40882747a963e8ffa1ccc101ee0ae80df5f9d0e2253c5c | R | 3,249 | 62 | #' 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... |
c0b2231442e2454f2f925129d7076d8d757c12a4fb5c005a3206727a5a462cab | R | 3,254 | 78 | # Author: Komal S. Rathi
# Date: 11/09/2019
# Function:
# merges all RSEM files into two RDS objects corresponding to polya and stranded data
# Example run
# Rscript 00-create-rsem-files.R \
# -i ~/Projects/OpenPBTA-analysis/data/raw \ # collection of rsem.genes.results.gz files
# -c ~/Projects/OpenPBTA-analysis/data... |
0f3b8d58fa1b08b549d86d62f448e245aa246444b463c62e44c6c3bb90a345f9 | R | 3,257 | 160 | # Backward-compatible aliases for rich* plotting functions
# Users can call either rich* or gg* versions
#
# roxygen silently drops @export for aliases pointing to S4 generics,
# so we force NAMESPACE exports via @rawNamespace.
#' @rawNamespace export(ggbar)
#' @rawNamespace export(ggdot)
#' @rawNamespace export(ggnetp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.