sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
0eed421a87cc4676965259f93b4869e154249ef6982cde771fb40c73776bcc90 | R | 4,054 | 125 | test_that("mofa2 wrapper correctly initializes MOFAobject", {
#check that manually setting the parameters creates the same model as the mofa2() wrapper
# 1. get sample data
skip_if_not_installed("MultiAssayExperiment")
library(MultiAssayExperiment)
library(SummarizedExperiment)
# Import and preprocess the miniA... |
dc68f369b3907f7c8ae80334e8071b52fba3399f439d8bc7a352f22a6dac70cc | R | 4,054 | 79 | #' @title Make a shiny app
#' @description Make a shiny app based on the shinycell config data.table and single-cell
#' data object.
#' @param obj input single-cell object for Seurat (v3+) / SingleCellExperiment
#' data or input file path for h5ad / loom files
#' @param scConf shinycell config data.table
#' @param ge... |
8f3b673ec734760de7109a9655e79745cba1f68693ecfeeab08548aa0ec19100 | R | 4,058 | 122 | ---
title: "01-molecular-subtype-pineoblastoma"
author: "Zhuangzhuang Geng"
date: "2023-12-06"
output: html_document
---
## load library
```{r}
library(tidyverse)
```
## set directories
```{r}
root_dir <- rprojroot::find_root(rprojroot::has_dir(".git"))
data_dir <- file.path(root_dir, "data")
analysis_dir <- file.p... |
10ad32a248199918f29ad360f8eee8a5cb873077baa48c2410e833d854a3b5f0 | R | 4,062 | 116 | ---
title: "04-qc-checks"
author: "Aditya Lahiri, Eric Wafula, Jo Lynne Rokita"
date: "11/14/2022"
output: html_notebook
---
This notebook performs QC check for `TARGET WXS` and `GMKF WGS` biospecimen with
with identical patients and samples IDs. Results and display as well as written
to `results/qc_table.tsv` file.
... |
335fff3e54db011914a424fbd63d8c5dc4aa0237ae35a5ebda242fa0facad7bf | R | 4,077 | 108 | #'---
#' title: "RNA Variant Calling Data Table"
#' author: nickhsmith
#' wb:
#' log:
#' - snakemake: '`sm str(tmp_dir / "RVC" / "{dataset}" / "{annotation}_RVC_data_table.Rds")`'
#' input:
#' - configParams: '`sm os.path.join(
#' cfg.processedDataDir,
#' "rnaVariant... |
87eadb532d7d23b025b69de7eda3ac3e0c1d1631f2ec7113ba5f1c6dd82f267c | R | 4,078 | 93 |
#' @title Simulate a data set using the generative model of MOFA
#' @name make_example_data
#' @description Function to simulate an example multi-view multi-group data set according to the generative model of MOFA2.
#' @param n_views number of views
#' @param n_features number of features in each view
#' @param n_sam... |
ec3dc1418de04831444bdcc8b1632489ffecd65fd695d86086269deeecdf2fac | R | 4,083 | 130 | #'---
#' title: "FRASER Summary: `r paste(snakemake@wildcards$dataset, snakemake@wildcards$annotation, sep = '--')`"
#' author: mumichae, vyepez, ischeller
#' wb:
#' log:
#' - snakemake: '`sm str(tmp_dir / "AS" / "{dataset}--{annotation}" / "FRASER_summary.Rds")`'
#' params:
#' - setup: '`sm cfg.AS.getWorkdir() ... |
ea42bb1d9e932e867008755a54349e270dc76da4dbe966cb3b9d57435d8d8f59 | R | 4,084 | 111 | # Bethell and Taroni for CCDL 2019
# This script generates a list of scatter plots, saved as an RDS. This plot
# list can be used downstream for multigrid plots.
#
# Command line usage:
#
# Rscript --vanilla scripts/get-plot-list.R \
# --input_directory results \
# --filename_lead rsem_all \
# --output_directory... |
b1e9c5fc1910e7825845c94a90b1781b2d92b76fad12be98d9b81000f20f3a5c | R | 4,086 | 78 | # ==============================================================================
# U6_ROI_select.R
# UI definition for the "Differential Analysis - ROI Selection" tab (Step 4 Part 1).
#
# Purpose:
# Provides the interface for defining Treatment and Control groups for differential analysis.
#
# Key Features:
#... |
87aaf1c994619218c4fe133e5d2cc302c9e71d05835912eb45a41df3770acc77 | R | 4,087 | 106 | # Script to generate tumor vs tumor and tumor vs normal boxplots
# load libraries
suppressPackageStartupMessages(library(optparse))
suppressPackageStartupMessages(library(data.table))
suppressPackageStartupMessages(library(tidyverse))
option_list <- list(
make_option(c("--expr_mat"), type = "character",
... |
c7ee8bcc538a5736d7b08858e94ebb494f5a9ebb3e9fcd84361741432128fe9e | R | 4,087 | 125 | #' @export
frob=function(X){ sum(X^2,na.rm=T) }
#' @export
sigma.rmt=function(X){ estim_sigma(X,method="MAD") }
#' @export
softSVD=function(X, lambda){
svdX=svd(X)
nuc=pmax(svdX$d-lambda,0)
out=tcrossprod(svdX$u, tcrossprod( svdX$v,diag(nuc) ))
return(list(out=out, nuc=sum(nuc)))
}
#' @export
relief=function... |
b89907990006b20bc365229b4725b8e9273f6207d5d152de5fa1eaaf6d65f3b9 | R | 4,091 | 145 | #' OSI distribution plot
#'
#' @description
#' Generates a density plot showing the distribution of the selected
#' OSI score among dataset samples using ggplot2. OSI score can be one of
#' "OSITimeToCentrifugation", "OSIPreparationTemperature", or "OSISummary".
#' Olink external controls are excluded from this visuali... |
9135c3a7b5fc4b42862fd3a2646ff18fa35618201cc82b856bff11902fc226c4 | R | 4,098 | 112 | #' @title Add a metadata to be included in the shiny app
#' @description Add a metadata to be included in the shiny app.
#' @param scConf shinycell config data.table
#' @param meta metadata to add from the single-cell metadata.
#' Must match one of the following:
#' \itemize{
#' \item{Seurat objects}: column ... |
7e3256c79f69334f1406c2513ff2df58b747892bfa67e3988f5b87440d8c11d5 | R | 4,108 | 125 | ---
title: "Using WHO 2016 CNS subtypes to improve Juvenile xanthogranuloma harmonized diagnosis"
output:
html_notebook:
toc: true
toc_float: true
author: JN Taroni for ALSF CCDL (code) ; K Gaonkar updated for JXG
date: 2021
---
Juvenile xanthogranuloma have subtypes per the [WHO 2016 CNS subtypes](https:/... |
cdc19866a3ffd2517e7859642099bf63a49ae50dc048dd239a1c5f3093582d37 | R | 4,108 | 105 | #### libraries
# required for linear mixed effects models
library(lme4);
# required for significance testing in LMMs
library(lmerTest);
# required for pretty plotting
library(ggplot2);
# required for colour-blind friendly palettes
library(viridis);
# required for estimating marginal means
library(emmeans);
# requi... |
bee818902fa0dc092ca79cc8287543896a5592a0a088a988afef8b82ed3c5107 | R | 4,114 | 96 | library(ggplotify)
library(data.table)
library(cowplot)
library(ggplot2)
library(dplyr)
library(aplot)
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 DEG data
degs <- read.csv("results_LAR/deregulated_... |
e333f9713f95ac03fc3432ad1d0e4f089b04b07f198e133e6d691189377cf19f | R | 4,128 | 138 | #' Fit random forest model and create model lists
#'
#' @param X A data frame that consider as predictor set
#' @param Y A data frame that consider as response set. If Y = NULL, an unsupervised RF is conducted
#' @param type Select the type of RF model. The default is regression. Can select from "regression", "classifi... |
d7660977a2d36ea28fd3b967a31bd49c79fd4174d8a4b5cf482e9f1c3d8d3a48 | R | 4,129 | 103 |
rm(list=ls(all=TRUE))
font_size = 15
scaleFUN <- function(x) sprintf("%.2f", x)
bar_width=0.5
library(ggplot2)
library(ggpubr)
library(pracma)
library(fourierin)
library(seewave)
angle_list <- seq(0, 350, 10)
x_text = seq(1, length(angle_list)/2, length.out = 50)
freq_index_pool = seq(1, length(angle_list)/2, leng... |
7122edd017750d465e0221d483deb9ce1d9b0ee11b5c84d9fd4ed7facfb18f4d | R | 4,131 | 142 | # Set CRAN mirror
options(repos = c(CRAN = "https://cloud.r-project.org"))
packages <- c("ggplot2", "qqman" )
for (pkg in packages) {
if (!require(pkg, character.only = TRUE, quietly = TRUE)) {
install.packages(pkg)
library(pkg, character.only = TRUE)
}
}
# Process command-line arguments
args <- commandArg... |
b49683152a9a8981711cfdc27699767263e71373ce2e653d54d58504e86989f6 | R | 4,139 | 101 | library(rio)
library(tidyverse)
library(ggridges)
library(plotly)
library(RColorBrewer)
library(ggsci)
library(ggeasy)
library(patchwork)
library(bruceR)
library(ggstatsplot)
library(ggseg)
library(ggsegSchaefer)
# load the function for surface plot
source("scripts/function_DrawSurfPlot.R")
############... |
a03de96a75aacb383c8d2e4c18db05aa4f2f07ec07cdb245622e1a8f071cadb0 | R | 4,141 | 143 | ---
title: "QC ensg-hugo-pmtl-mapping.tsv"
output: html_notebook
---
## Load libraries
```{r load_libraries}
suppressPackageStartupMessages({
library(tidyverse)
})
```
## Read ensg-hugo-pmtl-mapping.tsv and OpenPedCan SNV, CNV, TPM, and fusion data
```{r read_open_ped_can_data}
open_ped_can_data_path <- '../../da... |
1d24b9fde72bfcef792cb2a84d1500e4bea9f40bf7151d8e94799f6f1dde49fe | R | 4,147 | 162 | ### analysis 2 channels nuclear intensities by cell
# go to main directory (parent directory of scripts)
if (basename(getwd())== "00_scripts"){setwd("../.")}
#load packages
library("tidyverse")
library(colorRamps)
#define working directories
in_dir = "./03_R input/"
out_dir = "./04b_intens_distrib_2C... |
2b1022f4f13267302fed48df213603af49de1efab3ec2c8ef088b2e874d278a5 | R | 4,147 | 162 | ### analysis 2 channels nuclear intensities by cell
# go to main directory (parent directory of scripts)
if (basename(getwd())== "00_scripts"){setwd("../.")}
#load packages
library("tidyverse")
library(colorRamps)
#define working directories
in_dir = "./03_R input/"
out_dir = "./04b_intens_distrib_2C... |
cd1d5453a86edc4ca8b3dda6cc1f01c05b99a3c94edac10e7820c7e2f98773e6 | R | 4,147 | 142 | ### This script plots effects of spatial downsampling (channel reductions) on
### group-results in the theta frequency bands
### (correlation analyses between 256 channel map and others)
### Christina Stier, 2025
## R version 4.2.2 (2022-10-31)
## RStudio 2023.3.0.386 for macOS
rm(list = ls())
install.packages("cor... |
a9bfcc275d06f5eae8ff00044ef33629c17a3401d160648b2dd48f42cf8a8962 | R | 4,149 | 103 |
# -------------------------------------------------------------------------
# Unit Test 01: Preprocessing and Data Integration Logic
# -------------------------------------------------------------------------
# Purpose:
# Verify that raw Seurat objects (Metabolomics & Transcriptomics) can be
# correctly normalized... |
26b55acdc7d057c63a460dd19429f79e780972d476b3984f399207eb482cc91d | R | 4,155 | 85 | #' @title Helper Function to Create SpatialImage Object
#' @description Internal helper to create a VisiumV1 object for Seurat.
#' @param image Matrix representing the tissue image.
#' @param scale.factors List of scale factors.
#' @param tissue.positions Data frame of tissue positions.
#' @param filter.matrix Log... |
22d7dedce318fbb1b9b943eba70e2a630242d7da7af16fa19faf748298112859 | R | 4,156 | 151 | #------------------ Librairies ------------------
library(rjson)
#------------------ Ontology handling ------------------
get.id.from.acronym <- function(acronym){
rec.func <- function(acronym, json){
if(is.null(json))
return()
if(acronym == json$acronym)
return(json$id)
... |
fecdc285759a5ccb29af1ff64c2a0bb5bf2b039784788fea6f4f859aff7c1df6 | R | 4,163 | 102 | #' A 'ggplot2' geom to draw genomic alignments in a miropeats style.
#'
#' `geom_miropeats()` draws miropeat style polygons between query to target genomic alignments.
#'
#' This geom draws polygons between query to target alignments defined in PAF format.
#' Such alignments are first loaded using \code{\link{readPaf}}... |
79af3cf090d043c10f3672fba586a0ee9a1f84b81f069fb534c2b52795c83ced | R | 4,168 | 105 | ##-------------------------------------##
## DIMRED TAB ##
##-------------------------------------##
tab_DIMRED <- tabItem(
tabName = "Dimensionality reduction plots",
textOutput(outputId = "session_id"),
sidebarLayout(
sidebarPanel(width = 3,
se... |
cc0514d8651dc21412871db702551f5a1d57615f01caea18fc9e1585cf251881 | R | 4,184 | 153 |
##################
## Factor Names ##
##################
#' @title factors_names: set and retrieve factor names
#' @name factors_names
#' @rdname factors_names
#' @export
setGeneric("factors_names", function(object) { standardGeneric("factors_names") })
#' @name factors_names
#' @rdname factors_names
#' @aliases fac... |
c922032387e27d6ff4b7e18d6c87fdecaff72f0cfa57e6170b8afe43828649b8 | R | 4,195 | 87 | args <- commandArgs(TRUE)
run_singleCellNet<-function(DataPath,LabelsPath,CV_RDataPath,OutputDir,GeneOrderPath = NULL,NumGenes = NULL){
"
run singleCellNet
Wrapper script to run singleCellNet on a benchmark dataset with 5-fold cross validation,
outputs lists of true and predicted cell labels as csv files... |
34e504563dca68a235c3e0a229eb8a493dd31e65f1f4edd130f9582ecae73953 | R | 4,208 | 138 | #' Check the accuracy of Principal Component Analysis
#'
#' @param X A numeric matrix to project onto the PCs, or a
#' character string pointing to a PLINK dataset.
#'
#' @param evec A numeric matrix of eigenvectors (samples on rows,
#' ndim dimensions on columns).
#'
#' @param eval A numeric vector of eigenvalues.... |
5e4f2cc0bc0ce32f16519dedaeccdb6fd14dd798a866850aa37a2e2d623fe604 | R | 4,216 | 119 | library(tidyverse)
# Define enrichment function using fisher's test
gene_enrichment<-function(sig_genes, background, test_gene_list){
sig_in<-length(sig_genes[sig_genes %in% test_gene_list])
sig_out<-length(sig_genes[!sig_genes %in% test_gene_list])
back_in<-length(background[background %in% test_gene_list])
... |
df12b0fce91d8efa715ba362158b2c367640e7407ec3bf752142822a9c9a3753 | R | 4,218 | 121 | # Test equivalence between sparse matmul and legacy data.table implementations
library(SummarizedExperiment)
library(SpatialExperiment)
data(rings)
spe <- rings
# Precompute neighbors once for reuse across tests
knn_median <- Banksy:::computeNeighbors(
spatialCoords(spe),
spatial_mode = "kNN_median", k_geom ... |
6c891fa0557e9709b36c8bc7af363c253fb315ceab260df414fa8dd99bf3bb5b | R | 4,219 | 141 | #!/usr/bin/env Rscript
# Script to plot pairwise correlations and PCA
#
# 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 F... |
331689c07998e74a6cf920792e2b829c8ebdb17b613fd213e9dc020cdb6bcd67 | R | 4,224 | 90 | library(matrixStats)
library(ComplexHeatmap)
library(circlize)
obj = readRDS('finalObj_citeseq.rds')
meta = read.csv('meta_13Oct.csv', row.names = 1)
identical(rownames(obj@meta.data), rownames(meta))
adt = obj@assays$ADT@data
identical(colnames(adt), rownames(meta))
num = which(is.na(meta$celltypes))
meta = meta[-... |
6947e4d296378bd6a7d537296b80750180899067ab9d479c1cf1e7b3174725b2 | R | 4,224 | 109 | ---
title: "Subset the data for MYCN-NBL"
author: "Aditya Lahiri, Eric Wafula, Jo Lynne Rokita"
date: "10/13/2022"
output: html_notebook
---
Objective: This notebook loads the `histologies.tsv` file and selects NBL biospecimen
by filtering the following columns for specific values:
`sample_type`: `Tumor`
`experimental_... |
d3efac10b7c9021b393f895e1b016133a3763b761613503e6ef9ae9699929bf7 | R | 4,226 | 121 | ---
title: "Object Format Conversion"
date: 'Compiled: `r format(Sys.Date(), "%B %d, %Y")`'
output: rmarkdown::html_vignette
theme: united
df_print: kable
vignette: >
%\VignetteIndexEntry{Object Format Conversion}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
***
<style>
p.caption {
font-siz... |
2783816acd9f367e6b469f78e37b016144418e00c6cc691bf14df7ac31d92a87 | R | 4,232 | 135 | # S. Spielman for ALSF CCDL 2023
#
# This script creates a panel for Figure S7 of UMAP for
# samples derived from _both_ polyA and stranded RNA-Seq library strategies.
# This script follows the approach in:
# https://github.com/AlexsLemonade/OpenPBTA-analysis/blob/627ec427ad0a8d9d913e614c9db50546c56d8283/analyses/sele... |
6baa685c4c0396fa3a9954279188079eb53a0a5a37918ad0249abb668bb5c24c | R | 4,237 | 140 | ---
title: "Recoding adamantinomatous craniopharyngiomas"
output:
html_notebook:
toc: true
toc_float: true
author: JN Taroni for ALSF CCDL (code)
date: 2021
---
_Background adapted from [#994](https://github.com/AlexsLemonade/OpenPBTA-analysis/issues/994)_
There are Craniopharyngioma samples which may have... |
5c24d5e92419f7f66985df28d546c90b20d314331bc3fcd7780b040ee035d11a | R | 4,239 | 112 | #!/usr/bin/env Rscript
#### For thalamic excitatory neurons
#### Loading libraries
library(Seurat)
library(tidyverse)
library(cowplot)
library(patchwork)
library(WGCNA)
library(hdWGCNA)
#### Loading data
seurat_obj <- readRDS("thalamus.merge.QC.harmony.rename.major.rds")
Idents(seurat_obj) <- seurat_obj$major_cellt... |
c48d85b732c12e19b85d2d0d59459fb5a9647ab42ed19bc6c05a7f74d0e37721 | R | 4,258 | 85 | # targets-compatible helper functions for pulling ANN-predicted categories for stimulus videos
# n_top determines top-n accuracy. it will always return top 1, but you can also return a higher top n alongside
get_alexnet_guesses <- function (path_alexnet_activations, stim_labels, path_imagenet_categories, n_top = 1) {
... |
1540587dd43fd196dff61ec9bc7d7f4d49567336665250e3dc4f640d44dfd4b6 | R | 4,260 | 112 | # load libraries
library(magrittr)
library(dplyr)
# base directories
root_dir <- rprojroot::find_root(rprojroot::has_dir(".git"))
analysis_dir <- file.path(root_dir, "analyses", "independent-samples")
# create input_dir if doesn't exist
input_dir <- file.path(analysis_dir, "inputs")
if (!dir.exists(input_dir)) {
di... |
b1a5cb7f0832d36ea84bbdb00bb42c0ce7d9edfd1a0c873e1a1b7c0cb9d0df24 | R | 4,268 | 121 | # ===== Libraries =====
library(tidyverse)
library(forcats)
library(ggtext)
# ===== Load your GSEA results =====
gsea <- read_csv("~/Desktop/Lab/celloracle/scortch/gsea_results_reactome_astrocyte/gseapy.gene_set.prerank.report.csv")
# Filter significant rows and handle Gene %
gsea_sig <- gsea %>%
mutate(Gene_percen... |
4efe961ff61546e7dd30ef5126cadf2c83224bc6426d4dcb5019ada73fdf64d0 | R | 4,278 | 112 | pairwise_DA_wrapper <- function(reads, groups, comparisons,
mc.samples = 1000, denom = "all",
verbose = TRUE, useMC = F,
parametric = F , ignore.posthoc = F,
paired... |
494103f9abf705e102aab7b5cd3b831bdef158eea12f2faf385d248476304e36 | R | 4,289 | 111 | # 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... |
6703f75ac3cb6f1c5e11e353c3b72e57afb0c0e21f26b0197a6d059a890c9ef3 | R | 4,292 | 128 | #Author Kim Kundert-Obando to contact for any information please email k.rogge.obando@gmail.com
#This code will generate the violin plots for Fig 2 in the paper.
#Redundant comment
#load needed packages may need to install before running library.
library(tidyr)
library(dplyr)
library(ggplot2)
#Load data
df<-read.csv... |
bec2c7be1917bf46d785d02a7f479f5c2ba256dfe30c4c26f5bae498418d5443 | R | 4,293 | 129 | ---
title: "Waterfall_plots"
output: html_document
---
## `r PID`
### DSS_asym
```{r}
MRA_dss_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_data... |
9203eed37d7bcc38b2aab6f92ad8b8808462fea48541cdfa62515303e4bd863c | R | 4,294 | 108 | library(tidyverse)
# leafcutter_dir<-"~/nextflow_pd/output/leafcutter/"
# sample_names <- data.table::fread(
# str_c(leafcutter_dir, "leafcutter_perind_numers.counts.gz")
# ) %>%
# dplyr::select(-V1) %>%
# colnames()
# need to find a way to make sure group column heading isn't hard coded! / need to use opto... |
92a7a7c8fdc9c5cceeaa1ffe287d0263a8ad0f058fb968321cfc31e673b1b16c | R | 4,300 | 129 | #' Function to plot a heatmap of the NPX data
#'
#' @description
#' Generates a heatmap using \code{pheatmap::pheatmap} of all samples from NPX
#' data.
#'
#' @details
#' The values are by default scaled across and centered in the heatmap. Columns
#' and rows are by default sorted by by dendrogram.
#' Unique sample nam... |
a7730ec0380b30d9ef265fa114e5971fcae73f95b4a273ca244fe6257bfe84e7 | R | 4,307 | 129 | library(readr)
library(dplyr)
library(clusterProfiler)
library(ReactomePA)
library(org.Dm.eg.db)
library(stringdist)
# Define input and output
fat_file <- "C:/Gene_Analysis/InR_Fatbody_All.csv"
osn_file <- "C:/Gene_Analysis/InR_OSNs_All.csv"
output_dir <- "C:/Gene_Analysis/Pathway_Enrichment"
final_summary_file <- fil... |
1fbe0c00870bff7b73fd5faff7a8113e7fcefb23e259911cbf3ef2cafc63808c | R | 4,325 | 119 |
rm(list=ls(all=TRUE))
library(REdaS)
para=6
ori_baseline <- read.table(paste("/Users/bo/Documents/data_liujia_lab/analysis_liuP1_greeble/MRI_result_sinusoid/mean_orientation_para",para,"_subj_sub1_35_Vector_Mean.txt", sep = ""), stringsAsFactors = FALSE)
for (ith in c(1:28,30, 32:35)) {
result_raw_table <- rea... |
9ac66284a0d7f706440853d996eb98b2ae96bc79b9104c851b0848bdee2e0a20 | R | 4,326 | 140 | ---
title: "Comparison of Expected and Observed MB Subtype Classification"
output:
html_document:
df_print: paged
params:
expected_input:
value: input/pbta-mb-pathology-subtypes.tsv
observed_input:
value: results/mb-classified.rds
---
```{r include = FALSE}
knitr::opts_chunk$set(comment = NA)
getOp... |
7f2284a649e195496440d97d1f8141c12b6338adf48be300cf521f7b74fc1ae2 | R | 4,337 | 134 | library(DBI)
library(dplyr)
library(readr)
library(ggplot2)
path <- "/.../"
### load data from the sim database to get the state frequency
## precalculated - see folder dnn_data
# simulation_db <- DBI::dbConnect(RSQLite::SQLite(), paste0("/.../simulation_data/simulation_db_users_v6.sqlite"))
#
# examples_final <-... |
f76f81a807b14315a8cd81010df18c06a0d777129ce1a8b4e0410f57d24aceb3 | R | 4,346 | 143 | ---
title: "Creating a TSV of author information for OpenPedCan-manuscript"
output:
html_notebook:
toc: true
toc_float: true
author: Stephanie Spielman for ALSF CCDL
date: 2022
---
```{r setup}
library(magrittr) # load for piping
library(tidyverse) # load for piping
```
This notebook parses the `metadata.... |
906c0126d94f077446f4babdf708871d6827276ebed71477ee85849a743d7013 | R | 4,359 | 171 | ---
title: "GO-term Analysis MSLc primed genes"
author: "AF"
date: "`r Sys.Date()`"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r}
library(dplyr)
library(clusterProfiler)
```
GO term analysis of neuronal MSLc primed genes.
```{r}
MSlc_primed <- as.data.frame(r... |
c82a6d1af23e5b57a070ea88f67f11bdb97e4327f7c0f4ec8651390d0e1c47fa | R | 4,359 | 162 | test_that(
"olink_summarize_qc_warning - works - summarizes by group (QC_Warning)",
{
df <- tibble::tibble(
SampleID = c("S1", "S1", "S2", "S2", "S3", "S3"),
QC_Warning = c("Pass", "Warning", "pass", "FAIL", "PASS", NA)
)
expect_no_warning(
object = df_summary <- olink_summarize_qc_wa... |
00c89e7788ebff7781eb7e8e06f65450969bffd52cb6ea7e1b6747588b4c26f9 | R | 4,362 | 115 | #' Updates shinycell config to recognize a metadata as a discrete one
#'
#' Updates shinycell config to recognize a metadata as a discrete one. This
#' function is useful when a discrete metadata only contains integers, e.g.
#' unspervised cluster labels starting from 0 to (n-1) clusters. If these
#' metadata are no... |
68dcf73f9088ed2a98f99a04d8c3e52a96c8caab3ef5016565f08feeceba7457 | R | 4,362 | 88 | ---
title: "Plotting #4: Iterative Plotting Functions"
date: 'Compiled: `r format(Sys.Date(), "%B %d, %Y")`'
output: rmarkdown::html_vignette
theme: united
df_print: kable
vignette: >
%\VignetteIndexEntry{Plotting #4: Iterative Plotting Functions}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
*... |
a211de639edcc744b340444fc1a8a0eaa0334dd0a681cda749e4af7303ff5ddc | R | 4,367 | 116 | # gaussian (parametric) mixture of N(0,1) and N(0,sigma2)
pcausalsnp=function(stats,nullvar=1,mu1=0,sd1=1.0001,niter=30,verbose=T) {
if(verbose) cat('Assuming `stats` are Z-statistics')
m=length(stats)
nullsd=sqrt(nullvar)
d0=dnorm(stats,0,nullsd,log=T)
d1=dnorm(stats,mu1,sd1,log=T)
g=rep(0,m)
g[d1>d0]=1
... |
12dfb6e7df9bb0658ae50839dfc9745c034f35040336b56238bc6dec1bdfaed7 | R | 4,371 | 94 | ---
title: "explorative_mediation"
output: html_document
date: "2023-11-24"
author: A. Klimesch
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
Load packages
```{r}
library(dplyr)
library(haven)
library(foreign)
library(ggplot2)
library(readxl)
library(Hmisc)
```
Load main analysis dataset
```... |
3792b068c2d2e634e08751b4d6a2cfac6e25e0d54bcc806ebb13d441b23c8661 | R | 4,379 | 92 | library(ggplot2)
library(ggpattern)
library(stringr)
library(dplyr)
library(cowplot)
library(ggplotify)
library(aplot)
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
# Define RNA types and ... |
de24eb6a7fb6605bd1a5186c5a15fe1ff0c7319bdb3eb576b8ee7327489bef02 | R | 4,386 | 134 | library(LAVA)
library(readxl)
library(tidyverse)
library(writexl)
library(parallel)
library(foreach)
library(doParallel)
library(data.table)
# Read in locus info file
loci = read.loci("/path")
process_locus_complete <- function(i, loci, input) {
tryCatch({
locus <- LAVA::process.locus(loci[i,], in... |
c55a53d318b029c837919abd4cdd17a9f178bf6259b25da7247d9cb097341b32 | R | 4,388 | 128 | # -------------------------------------------------------------------------
# Unit Test 04: Functional Association Analysis Logic
# -------------------------------------------------------------------------
# Purpose:
# Verify that the pathway analysis module correctly maps differential
# features to KEGG pathways ... |
adadca016fe0c01998cc24eec1ee85cc7317906795c8963a3ba18792b4c7657f | R | 4,391 | 157 | # This script is designed to be regular-sourced in the targets pipelines
# to make all of the variables available in the tar_make environment
targets_scripts <- list(
tar_target(
name = weights_flynet,
command = here::here("ignore", "MegaFlyNet256.pt"),
format = "file"
),
tar_target(
name = py_ma... |
3528de086a8f46fefd37393565b9dfdb70fec043ec6af1d1851f79eda35f1233 | R | 4,394 | 90 | #' @title Plot correlation of factors with external covariates
#' @name correlate_factors_with_covariates
#' @description Function to correlate factor values with external covariates.
#' @param object a trained \code{\link{MOFA}} object.
#' @param covariates
#' \itemize{
#' \item{\strong{data.frame}:}{a data.frame w... |
bf32032a5afc3320f6d76bf4355beb15a501ef257c810c68d12b50ea4866b5ec | R | 4,397 | 84 | # ==============================================================================
# U8_network.R
# UI definition for the "Differential Analysis - Group-Specific Network" tab (Step 4 Part 3).
#
# Purpose:
# Provides the interface for constructing and visualizing correlation networks
# specifically for the Trea... |
d5cdce5632724c4707b3203b69d11a8c6bd28d8838496f12eb3844a935365b0e | R | 4,404 | 94 | #This script assigns ATRT into three known subtypes using methylation result.
#Subtypiong esults is saved as ATRT-molecular-subtypes.tsv
# Set up library
library(tidyverse)
# Detect the ".git" folder -- this will in the project root directory.
# Use this as the root directory to ensure proper sourcing of functions no... |
56dd0b930373951515d201838f3e9efcacd23adbac1924c822850d1f807d1ade | R | 4,410 | 154 |
##-------------------------------------##
## SCORES TAB ##
##-------------------------------------##
get_score <- function(mat, gene_set, name){
gene_set <- unlist(strsplit(gene_set, ' '))
mat <- as.matrix(mat)
mat <- t(mat[gene_set,])
mat <- scale(mat, center = colMedian... |
d79dc7a1be0e3a614d0f03c33efaaa2c6326d65d74169a75aabc5f7c17bfe46a | R | 4,411 | 136 | # TODO: Add comment
#
# Author: fec
###############################################################################
library(R6)
MelanomeSettings <- R6Class("MelanomeSettings",
public = list(
outerStartFold = 1,
outerEndFold = 30,
innerStartFold = 1,
innerEndFold = 30,
maxFeaturesI... |
ebee837faf5dd52662c89ffec3220dd202d111eedacbb48481e9229366f4c07c | R | 4,414 | 103 |
## run example:
## /opt/R-3.4.3/lib64/R/bin/Rscript MAPS_regression.r /home/jurici/work/PLACseq/MAPS2/results/bing_mESC_intersect_subsamples/
## MY_113.MY_115 19 RH_129-130.uniq.paired.sorted.nodup.nsrt.5k.MAPS2_filter
##
## arguments:
## INFDIR - dir with reg files
## SET - dataset name
## chroms - number of chromos... |
a87afb85af225a2664d6f593164cced7d081e73e5525120fc7e3114aab0d884c | R | 4,442 | 140 | rm(list = ls(all.names = TRUE)) #will clear all objects includes hidden objects.
gc() #free up memory and report the memory usage.
#package list
pkgs = c(
"catmaid", "plyr", "tidyverse",
"cowplot", "png", "igraph",
"networkD3", "visNetwork","webshot2",
"patchwork", "RColorBrewer", "tidygraph",
"av", "jpeg... |
fe16f626dd9e826107e804f863d8239b84593ec0d7d79e4f2acfeb9a47c32730 | R | 4,448 | 150 | if (!requireNamespace("here", quietly = TRUE)) install.packages("here")
source(here::here("stats", "permutation_tests", "palm_code", "_setup.R"))
# Load the ACQUISITION matrices into the environment
palm_load("acq")
# --- Define output folder (project-relative)
out_dir <- here::here(
"stats", "permutation_tests", "... |
89c8643942195089a3db1551c391d926962167e3bc91d0241bfb66d7c1015467 | R | 4,449 | 114 | library(wateRmelon)
library(sva)
library(matrixStats)
library(CETYGO)
setwd("D:/valentin/main/")
load("betas/ROSMAP_betas_only.Rdata")
pheno_ADC = read.table("pheno_ROSMAP_full.txt", sep = "\t", header = T)
#Doublecheck outliers
outliers <- outlyx(mSet, plot=FALSE)
print(outliers) # Keep this
#Filter f... |
b9c0e0de7fbd578e758549064b435e46b53393efc4ca709cb8de3790e1aa9f74 | R | 4,453 | 143 | #' Find optimal connections among multi-omics data
#'
#' @param dat.list A list containing multi-omics datasets with samples in columns and features in rows.
#' Samples should be matched across all datasets.
#' @param var_prop Proportion of variance explained by PC datasets when finding optimal connections. Default is ... |
ec91e6166db4193394e8ff973518f39bd275e20b8c5f6d4e75d9d57e9312479e | R | 4,457 | 185 | #Video2 of the Jokura et al ctenophore AO paper
#Gaspar Jekely
# source packages and functions ------------------------------------------------
source("analysis/scripts/packages_and_functions.R")
# load cell types to plot individually -------------------------------------
balancer <- read_smooth_neuron("celltype:bal... |
5ff50a3a1898baf47188265a1998d5c53cb53bead4e274275d8b53a0b16ba46a | R | 4,461 | 155 | setwd("/data/nas1/liuyiding_OD/project/01_project_147/01_diffanalysis")
library(data.table)
library(tidyverse)
library(ggsignif)
library(RColorBrewer)
library(limma)
library(ggplot2)
library(ggpubr)
library(beepr)
library(gplots)
library(pheatmap)
library(DESeq2)
library(GEOquery)
library(GEOquery)
gse <- getGEO("GSE1... |
460fe6334cce63aee6c656e7209f921fa971e5d6de702157e560ca0b169cd785 | R | 4,463 | 144 | #' A 'ggplot2' geom to draw genomic ranges as arrowheads.
#'
#' `geom_arrowhead()` draws ranges defined by `xmin` and `xmax` as triangular polygon.
#' draws genomic ranges as arrowheads, allowing to draw for instance segmental
#' duplication maps.
#'
#' This geom draws triangular polygons as arrowheads between defined ... |
5a8a59981c58db83355dcfc878efef34bfe106f84a042ff5840d6c8b5e5442ae | R | 4,463 | 164 | context("Testing PCA")
n <- 500
p <- 1000
ndim <- 50
tol <- 1e-4
data(hm3.chr1)
bedf <- gsub("\\.bed", "",
system.file("extdata", "data_chr1.bed", package="flashpcaR"))
compare_scales <- function(S, ...)
{
l <- list(...)
for(i in 1:length(l)) {
expect_equal(attr(S, "scaled:center"),
l[[i]]$center, ... |
5b37b6e400b59f097f708e91d75522e63580f494355f47765a85e4f66c588fd6 | R | 4,463 | 152 | if (!requireNamespace("here", quietly = TRUE)) install.packages("here")
source(here::here("stats", "permutation_tests", "palm_code", "_setup.R"))
# Load the EXTINCTION matrices into the environment
palm_load("ext")
# --- Define output folder (project-relative)
out_dir <- here::here(
"stats", "permutation_tests", "p... |
3e63760e5dfff4bf49b19d4398365d02ab04c63bc51662babb7adcd89d48145d | R | 4,477 | 152 | if (!requireNamespace("here", quietly = TRUE)) install.packages("here")
source(here::here("stats", "permutation_tests", "palm_code", "_setup.R"))
# Load the REEXTINCTION matrices into the environment
palm_load("reext")
# --- Define output folder (project-relative)
out_dir <- here::here(
"stats", "permutation_tests"... |
7b43577719c0f17ef3fd89a897874589084a225782122fb3160ebad083b91f27 | R | 4,478 | 100 | #' Map gene symbols to official NCBI annotation (2023 workflow)
#'
#' Matches user gene symbols (including aliases) against an NCBI
#' \code{gene_info} annotation table and returns the official symbol, Entrez ID
#' and Ensembl gene ID. This is the 2023 variant of \code{\link{NCBI_synonyms}}.
#' The original version rea... |
1912682932e468a97b6a54f84c4de61b190b4022724142ce92429f1597e31f4a | R | 4,482 | 136 | # 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 case of problems delete namespace file
# than do devtools::load_all()
# and than devtools::document()
# storing data in... |
927f28d4f29e82e716ac8c5abb7b0094c6959240de99f3607fb24c846d3969de | R | 4,486 | 120 | ##-------------------------------------##
## PCA TAB ##
##-------------------------------------##
tab_PCA <- tabItem(
tabName = "PCA",
sidebarLayout(
sidebarPanel(width = 3,
selectInput(inputId = "select_matrix_PCA",
label = "Select... |
860fa16a1b7afd90376bf14025a0273577f51bad9cdae92bf029a2ddaf2b4246 | R | 4,498 | 96 | #' Make a shiny app
#'
#' Make a shiny app based on the shinycell config data.table and single-cell
#' data object.
#'
#' @param obj input single-cell object for Seurat (v3+) / SingleCellExperiment
#' data or input file path for h5ad / loom files
#' @param scConf shinycell config data.table
#' @param gex.assay assa... |
f2417fc80dcc574b4d2e6052b6b1276eb06924c928a145b6d363715daab72b36 | R | 4,499 | 147 | #' Generate a Venn diagram for DMRs based on shared probes
#'
#' This function builds a Venn diagram comparing DMRs
#' identified by different tools, based on shared probe membership.
#' Two DMRs are considered linked if they share at least one probe.
#'
#' @param dt A data.frame or tibble containing at least these... |
72195db122c32e74a54dfd738821530dcdfc4ca9d591fd8076b3f5db978de06f | R | 4,503 | 129 | #'---
#' title: Count reads
#' author: Michaela Mueller
#' wb:
#' log:
#' snakemake: '`sm str(tmp_dir / "AE" / "{annotation}" / "counts" / "{sampleID}.Rds")`'
#' params:
#' - COUNT_PARAMS: '`sm lambda w: cfg.AE.getCountParams(w.sampleID)`'
#' input:
#' - sample_bam: '`sm lambda w: sa.getFilePath(w.sampleID, f... |
600cfc75b3fa6e002137780a80b3cfb1a3ed4046aa81214198c40ad817805c4b | R | 4,518 | 113 | ########################################
#
# Figure 4 plot
#
#
# Liang Qunjun 2023-12-20
library(tidyverse)
library(bruceR)
library(ggstatsplot)
library(ggridges)
library(psych)
library(RColorBrewer)
library(emmeans)
library(ggeasy)
library(ggsci)
library(patchwork)
library(cowplot)
library(scales)
li... |
f888531fedfb99edbb82d3656e157da0c00dbe7ac9e6f30764d12324cbde3420 | R | 4,522 | 114 |
##-------------------------------------##
## SELECTDATA TAB ##
##-------------------------------------##
get_dataset_names <- function(){
files <- list.dirs("./public_datasets")
files <- gsub("./public_datasets/", "", files)
files <- files[-1]
return(files)
}
tab_SELECTDATA<- tabItem(
... |
5f41f1f4a7a1a85368ef4216aef3e4f41585226cce227a222058e23453ae0eb4 | R | 4,531 | 136 | ########################### Generate IMABC outputs ##########################
#
# Objective: Script to generate decision outputs for IMABC calibrated
# parameters
########################### <<<<<>>>>> #########################################
rm(list = ls()) # Clean environment
options(scipen = 999) # View data ... |
3d54f636378af4819cac5ba2f26683bf72ec10d2ba952d4c3a31561805a55a9d | R | 4,533 | 153 | #' Function to plot the NPX distribution by panel
#'
#' Generates boxplots of NPX vs. SampleID colored by QC_Warning (default)
#' or any other grouping variable
#' and faceted by Panel using ggplot and ggplot2::geom_boxplot.
#'
#' @param df NPX data frame in long format. Must have columns SampleID, NPX and
#' Panel
#' ... |
ac04823ca398d34f46d27dbc81ceedf5d4d97b722025a771bb6674041010d5aa | R | 4,540 | 176 | # Mutational Landscape Figure
#
# 2020
# C. Savonen for ALSF - CCDL
#
# Purpose Run steps needed to create mutational-landscape Figure.
#
# Magrittr pipe
`%>%` <- dplyr::`%>%`
# Establish base dir
root_dir <- rprojroot::find_root(rprojroot::has_dir(".git"))
# Declare output directory
output_dir <- file.path(root_dir... |
5c0db2b94d008bb087146c114dd4df469f453a3f728e3e71802ab15581664ac6 | R | 4,542 | 112 | #'---
#' title: Filter and clean dataset
#' author: Christian Mertes
#' wb:
#' log:
#' - snakemake: '`sm str(tmp_dir / "AS" / "{dataset}" / "03_filter.Rds")`'
#' params:
#' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`'
#' - workingDir: '`sm cfg.getProcessedDataDir() + "/aberrant_splicing/datasets/"`'
#' ... |
d55c54b7585ff6fc814ab0104765c806837bc7ed40251267c263f40946ddb8c1 | R | 4,550 | 90 | run_singleCellNet<-function(DataPath,LabelsPath,CV_RDataPath,OutputDir,GeneOrderPath = NULL,NumGenes = NULL){
"
run singleCellNet
Wrapper script to run singleCellNet on a benchmark dataset with 5-fold cross validation,
outputs lists of true and predicted cell labels as csv files, as well as computation time... |
e7f914627835f040c736f1ee70280fa1898249978171a8d25e59355760b66d55 | R | 4,557 | 93 | #---------------------------------------------------------------------------------------------
# R (version 4.2.1) code for calculate coincidences of simulated PNVs
# This analysis for the following paper:
# 'Predicting dominant terrestrial biomes at a global scale:
# Assessments of machine learning algorithms, cl... |
99c265e36b9562cbb7e512a1f89fd7ce9a65bf576902b84a60d582131165fe54 | R | 4,558 | 153 | # Code and functions to create the lists of ensembl IDs and gene symbols for lncRNA
# Functions -----------------------------------------------------------------------------------
library(tidyverse)
library(AnnotationHub)
Create_Ensembl_lncRNA_List <- function(
) {
refreshHub(hubClass="AnnotationHub")
species_... |
475dda765d0169fb5ff9f2da1f99527b3044a4a58231a24b19bdd4f0c92f2a1d | R | 4,560 | 127 | # --- Packages
library(readr)
library(dplyr)
library(tidyr)
library(lme4)
library(lmerTest)
library(emmeans)
library(sjPlot)
library(broom.mixed)
library(performance)
library(tibble)
# --- Load data
path <- "//nas.ads.mwn.de/ra38lap/MWN-PC/Downloads/pupil_stim_data_final.csv"
df <- suppressMessages(read_... |
ed4bce9774e780fd6190947ea80bbb964ac052b0f80880922d5d4554c83ede41 | R | 4,570 | 122 |
rm(list=ls(all=TRUE))
library(REdaS)
para=12
#ori_baseline <- read.table(paste("/Users/bo/Documents/data_liujia_lab/manuscript_gridcell3hz/analysis_liuP1_greeble/MRI_result_sinusoid/mean_orientation_para",para,"_subj_sub1_35_Vector_Mean.txt", sep = ""), stringsAsFactors = FALSE)
for (ith in c(1:28,30, 32:35)) {
... |
842d3b54b436b275d74e11d3b4db745fc64f8a377c6477f935d3611d3d3a6b22 | R | 4,575 | 80 | #' @export compute_accuracy_pbd_ml_free
compute_accuracy_pbd_ml_free <- function(data, strategy = "sequential", workers = 1) {
eve:::check_parallel_arguments(strategy, workers)
diffs <- furrr::future_map(.x = seq_along(data$brts),
.f = function(i) {
ml <- ... |
567b7e4acdc6e75509dfed411ae0faed7900706b3b63a085a76438af5c010bfd | R | 4,579 | 146 | #!/usr/bin/env Rscript
# Paired t-test for a single gene of interest using ggpubr.
#
# Input:
# - expr: TSV TPM matrix (gene_id + sample columns)
# - meta: samplesheet TSV with sample/condition/subject columns
#
# Output:
# - PDF plot
# - TSV stats
suppressPackageStartupMessages({
library(argparse)
librar... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.