sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
9b202842fbcdace4af5d642d4057bac7c9d4d7855d09d764c3477e20315a9651 | R | 2,074 | 55 | ###########################################################
#
# This script is used to visualize the global to SMN time
# delay in four extreme groups.
#
# Low Anxiety - Low agitation
# Low Anxiety - High agitation
# High Anxiety - Low agitation
# High Anxiety - High Anxiety
#
# Liang Qunjun 2023-12-20
... |
efa47f81333f7a047a41cf54dea116df8c82d946d00d781feab40710da3ec448 | R | 2,080 | 66 | ## =========================
## Experiment I: active vs. sham TUS (hippocampus)
## =========================
if (!requireNamespace("here", quietly = TRUE)) install.packages("here")
source(here::here("stats","lme_models","_setup.R"))
## -------- acquisition: CS * TUS --------
run_lmer_test(
data_name = "scr_df_hip... |
79aad4545d45a8a3727844d3035d77ef88bfc405a0e21af38ad480cb3d542ac8 | R | 2,081 | 68 | #!/usr/bin/env Rscript
input_dir="/path/to/cellranger_count/"
out_dir="/path/to/DecontX_scDblFinder/"
#### Loading libraries
library(scDblFinder)
library(Seurat)
library(celda)
#### Data loading with sample metadata
args <- commandArgs(trailingOnly = T)
sample_name <- as.character(args[1])
dx <- as.factor(args[2])
... |
d4c5253b40cbb3505c8421e667f105079f53c9c3e468dbf01e988334dcd7976c | R | 2,081 | 57 | options(stringsAsFactors=F)
suppressMessages(library(tidyverse))
suppressMessages(library(janitor))
if(interactive()) {
setwd('~/d/sci/src/genetic_support')
}
omim_relational_all = read_tsv('../digap/output/omim_relational_all.tsv', col_types=cols())
mendelian_curation = read_tsv('../digap/data/curated/mendelian_cur... |
0385d912e3fa32cedbc920dda68b251683fa512d04117967154a8c13f57ba532 | R | 2,095 | 50 | library("annoFuse")
suppressPackageStartupMessages(library("readr"))
suppressPackageStartupMessages(library("tidyverse"))
suppressPackageStartupMessages(library("reshape2"))
suppressPackageStartupMessages(library("optparse"))
option_list <- list(
make_option(c("-a", "--fusionfileArriba"),type="character",
... |
6e1c3dac05c998eb10aa0b539130195e36368360bd5c8c81ffa5ce3a02abb1d3 | R | 2,095 | 48 | # TODO: Add comment
#
# Author: fec
###############################################################################
FeatureReductionContainerProvider <- R6Class("FeatureReductionContainerProvider",
public = list(
volumeColName = NULL,
initialize = function() {
},
radiomicsFeatureEl... |
055d0a119cffc5cd783ab44c0582af56771c0989bb600346d6903e738d157e94 | R | 2,109 | 83 | context("Accessor methods")
# Helper to create a test richResult
make_test_result <- function() {
new("richResult",
result = data.frame(
Annot = c("GO:0001", "GO:0002"),
Term = c("apoptosis", "cell cycle"),
Annotated = c(100, 200),
Significant = c(10, 20),
RichFactor = c(0.1, 0.1),
... |
4c5d6a58dab008ffc233a9f99be40a7a541ed3fedf9691b785e57aab806fd3f9 | R | 2,113 | 54 | library(pROC)
data(aSAH)
test_that("paired venkatraman works as expected", {
skip_slow()
ht <- roc.test(r.s100b, r.wfns, method = "venkatraman", boot.n = 12)
expect_venkatraman_htest(ht)
expect_equal(ht$alternative, "two.sided")
expect_equal(ht$method, "Venkatraman's test for two paired ROC curves")
expect... |
9f3f84d12cf9e0b089a9b8124e900bf3b3d1574f73966e1ef07b446ee42ab359 | R | 2,113 | 51 |
##-------------------------------------##
## GENES QC ##
##-------------------------------------##
tab_QC_GENES <- tabItem(
tabName = "Quality Control",
tabPanel("Features",
actionButton(inputId = "remove_features", "Remove features"),
br(),br(),
sidebarLayou... |
f4041aabfd173c828451e298e85ca2b3a8086fc46728d3864e07717a5f1d69c3 | R | 2,113 | 78 | # readme ----
# This script creates a synthetic manifest file to generate the sample manifest
# data/manifest.rda which is used throughout OlinkAnalyze.
#
# As this script did not exist prior to 2024-04-08, we have stored the original
# manifest.rds file under data-raw/ref_manifest.rds to compare to the dataset
# gene... |
0ac0d97cbb7958e6fb9d7706c03b36ff18293f803f4dbf6a892dc20646b20dd4 | R | 2,117 | 84 | #' CpG with too many NA
#'
#' select probes with percentage of missing values superior to CpGlimit
#'
#' @param betas matrix of betas
#' @param nalimit maximum proportion of NA accepted
#'
#' @importFrom dplyr filter
#'
#' @return List of probes to exclude
#'
cpg_na_excl <- function(betas, nalimit = 0.2) {
na_row <-... |
30e327a0489e2b280bda0956a3545b88b473998ba372151bee88532423ee027e | R | 2,121 | 71 | args <- base::commandArgs(trailingOnly=TRUE)
if (base::length(args) != 1) {
args_string <- base::paste(args, collapse=', ')
stop(base::paste0('expected exactly 1 argument, but got: ', args_string))
}
packages <- base::list()
is_paired <- FALSE
is_darts <- FALSE
if (args[1] == 'paired') {
is_paired <- TRUE
pac... |
2dc8da44ac0fccf543978ffecf007c5df96b7f2d5b0f005e45c1a0e18202d464 | R | 2,126 | 48 | #' The curated and aggregated genus-level count table from the schizophrenia study for demonstration
#'
#' @description A genus-level count table for instructional purposes. Accessed using the curatedMetagenomicData R package
#'
#' @format A data.frame object with 162 rows, genera, and 171 columns, samples.
#' @source... |
44a2de443b639c36ddfd1d2b74147b4005cec136500bb953388bb52a9e69b4db | R | 2,128 | 55 | ##-------------------------------------##
##### 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... |
3eb18db2348e8148d4d4ad3084fb985a24ac94b73d2264a1ae51af4971ef7a5f | R | 2,132 | 68 | # Function for splitting up MNVs to SNVs
#
# J. Shapiro for ALSF - CCDL
# 2019
#
############################## Custom Function #################################
#' Split multinucleotide variants into single nucleotide calls
#'
#' @param mnv_tbl a table containing MNVs (may be from an sql connection)
#'
#' @return a da... |
be03412d44af10fb7f1c582cbba87dad4c04aee7d96573910b3c2a3d1f3ff674 | R | 2,132 | 61 | # SMIntegration: Master Validation Script
# ==============================================================================
#
# Purpose:
# This script serves as the master controller for the SMIntegration validation suite.
# It automatically discovers and executes all unit tests located in the '/validation_figu... |
a559532aab128d544f926f075cfb11861c5472e56b1e5fe1705018613d30930b | R | 2,135 | 72 | test_that(
"olink_pathway_heatmap - 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_heatm... |
4ef393b5e90840a73ade50c5a36c66df6d1b8db90f17847461dea77ab7a6cb60 | R | 2,138 | 59 | #ANALYSIS OF ANTENNAL LOBE VOLUMES
#1. Load data and package
setwd()
library(car)
all<-as.matrix(read.csv("AL data all.csv",header=TRUE))
all$treatment<-as.factor(all$treatment)
#(if comparing between males and females)
all$sex<-as.factor(all$sex)
#filtering data needed for each globe, start from g1 (for volu... |
ed90b7ccad3b8821693303b1558f6c7bfe06659af26ef1071920406507eb55cf | R | 2,142 | 63 | ---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# wizbionet
<!-- badges: start -->
<!-- badges: end -->
wizbionet... |
092f7e7d9e9a260fff8a41be601fb60e0b38d65777027252a11f05f401582e51 | R | 2,154 | 90 | library("spatialLIBD")
#library("escheR")
library("dplyr")
library("tidyr")
library("stringr")
library("tibble")
library("ggplot2")
# Load spatial data
spe <- fetch_data(type = "spatialDLPFC_Visium")
# Recode cluster labels
tmp <- as.data.frame(colData(spe)) %>%
mutate(BayesSpace_harmony_07 = recode(BayesSpace_har... |
f25dbd7323da72eb3429fc7317109188ccd9173367ac4c5ebe13575023c81d22 | R | 2,155 | 73 | remove.calls.recursive <- function(x) {
if (is.null(x)) {
return(NULL)
}
attr(x, "roc") <- remove.calls.recursive(attr(x, "roc"))
attr(x, "auc") <- remove.calls.recursive(attr(x, "auc"))
attr(x, "ci") <- remove.calls.recursive(attr(x, "ci"))
if (!is.list(x)) {
return(x)
}
x$roc <- remove.calls.r... |
5bdd4414c79a113511ab4f0f7b8d7326fd096fa149ad3e09e7e8df9a95286616 | R | 2,170 | 95 | ---
title: "Dotplot for top marker genes"
author: "AF"
date: "`r Sys.Date()`"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r}
library(Signac)
library(Seurat)
library(tidyr)
library(dplyr)
library(ggplot2)
library(rstudioapi)
set.seed(17)
```
Dotplot of top marke... |
81a6e20ef4885d47791e06c0f4ddd4f4375fd1ebe95cf79e05d666039b1245b0 | R | 2,170 | 83 | Open the all the raw counts data
```{r}
rawdata <- read.csv("raw_data.csv")
#read the sample metadata
info <- read.csv("info.csv")
```
Data arrangement
```{r}
#select out the columns that include the data from the samples you want to analyze
data <- rawdata[,-1]
#save name of rows to names of gene list
rownames(data... |
cdf628fbb00e9a2f0872e87e9b5d9bf4827a8f223ead0c6086f991dc8a788766 | R | 2,170 | 49 |
# Define a function to process each file
process_dnn_predictions_dominance <- 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"))... |
92acfd50e11cd141e814942732f454fb76b0b822d01fc36fc018c135bee67e0a | R | 2,172 | 63 | #' make annotation database using bioAnno results
#' @importFrom AnnotationDbi keys
#' @importFrom dplyr distinct
#' @param dbname database name from bioAnno
#' @param anntype GO or KEGG
#' @param OP BP,CC,MF default use all
#' @param species species name
#' @param keytype gene ID type (e.g. "ENTREZID", "SYMBOL")
#' @e... |
cdd37bf4acfcfb9536ee5a1e20972f7559b3409b3ccaffcd6a5c4bddf1486d9a | R | 2,172 | 69 | ---
title: "Waterfall_plots"
output: html_document
---
## `r PID`
### DSS_asym
```{r}
CRA_dss_list <- list()
data_n <- readxl::read_xlsx(file.path(output_dir, paste0(PID, "_combo.xlsx")))
data_n$DSS_asym <- as.numeric(data_n$DSS_asym)
data_n <- data_n[order(-data_n$DSS_asym), ]
data <- data_n
pn <- ggplot(data, aes(
... |
0fbc950943c7e3ebdcf15f3594eccf2afde71860d361db87b3bb0fc0df537027 | R | 2,174 | 78 | ##
## Load modified gamlss functions
##
## NOTE: We have written alternative GG() family - to avoid computation issues
## We have written alternative bfp() function - to avoid NA issue
##
source("102.gamlss-recode.r")
##
## Disclaimer and version
##
##
Print.Disclaimer <- function( ) {
cat("
##### Disclaime... |
b681019eb4205a3a15b9cd77b4a7bb78b5cb328ac4b107365df712ec0a81c231 | R | 2,175 | 69 | #' Save the PNG Plots of CNVs for Prediction
#'
#' This function is used to create the dataset of PNG images for prediction
#'
#' @param root root folder for the dataset. Must not exists.
#' @param cnvs cnv data.table in the usual format
#' @param samps sample list in usual format
#' @param snps snps in the usual forma... |
27d9becd717022ee4185dde65f43afc7860500fc115d885e2e5297c85cbc71c3 | R | 2,186 | 71 | # Script to annotate with MONDO, RMTL and EFO fields
# convert to JSONL and gzip
# load libraries
suppressPackageStartupMessages(library(optparse))
suppressPackageStartupMessages(library(jsonlite))
option_list <- list(
make_option(c("--input_file"), type = "character",
help = "input file to annotate, ... |
0cce015af6a34c331e6e480c37787b36583de58059ac611ad083ef441494a758 | R | 2,194 | 72 | library(lightgbm)
# load in the agaricus dataset
data(agaricus.train, package = "lightgbm")
data(agaricus.test, package = "lightgbm")
dtrain <- lgb.Dataset(agaricus.train$data, label = agaricus.train$label)
dtest <- lgb.Dataset.create.valid(dtrain, data = agaricus.test$data, label = agaricus.test$label)
nrounds <- 2L... |
9917234853baebdf7b99320b6464905a832a044ae56e54b66f361afe63cc0111 | R | 2,194 | 37 | library(Seurat)
library(dplyr)
library(CellChat)
setwd("/home/chintan/Downloads/Chhatbar_et_al_Zenodo")
Cup <- readRDS("Cup_cellchat_Fig_7A.RDS")
unique(Cup$orig.ident)
unique(Cup$condition)
Cup_list <- SplitObject(Cup, split.by = "condition")
Cup_conditions <- names(Cup_list)
Cup_conditions
Cup_conditions.cellchat.ob... |
b88499326c9f8e80e85a0f93822cb4aece68864f9b93995c71e28933bd60ae01 | R | 2,196 | 57 | library(MOFA2)
test_that("a MOFA model can be prepared from a list of matrices", {
m <- as.matrix(read.csv("matrix.csv"))
# Set feature names
rownames(m) <- paste("feature_", seq_len(nrow(m)), paste = "", sep = "")
# Set sample names
colnames(m) <- paste("sample_", seq_len(ncol(m)), paste = "", se... |
2d9963dfd3ab398f574d9d8315a1e188c012d767f5cf164837ff867ceac9a204 | R | 2,202 | 82 | ---
title: "Script to install all necessary libraries"
author: "AF"
date: "`r Sys.Date()`"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r}
# install_all_packages.R
# Script to install all required CRAN, Bioconductor, and GitHub packages
# --------------------------... |
87dffbf85cb00bbf30030e5b0ca6d4ca6d88de704fa3f1cfeb9d47c880eccb03 | R | 2,204 | 56 | # 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_format_cohort_sample_counts.R")
# import_function is defined in tests/helper_import_function.R and tested in
# annotato... |
19b7e2f742ce4836db17e487d72fdb1b23c4548848d0c85e44d4a9cd50a0276f | R | 2,205 | 63 | # install_and_load <- function(pkg, bioc = FALSE) {
# if (!requireNamespace(pkg, quietly = TRUE)) {
# if (bioc) {
# if (!requireNamespace("BiocManager", quietly = TRUE)) {
# install.packages("BiocManager", repos = "https://cloud.r-project.org")
# }
# BiocManager::install(pkg)
# } els... |
7ddb141ef20f8c0abfe267d9b841625490cd13a79c8dedff166a3a9825d33060 | R | 2,208 | 52 | # Function to generate a p-value for the spatial correlation between two parcellated cortical surface maps,
# using a set of spherical permutations of regions of interest (which can be generated using the function "rotate_parcellation").
# The function performs the permutation in both directions; i.e.: by permute both... |
e213ebd67ce8ce79922f1a8dc72cd67607310c6aa878549dd1a3483a96c9b635 | R | 2,211 | 69 | ###############################################################
# Example script illustrating an enrichment dot-plot visualization.
# This script uses simulated data for demonstration purposes only.
# It does NOT contain real data or real analysis pipelines.
#########################################################... |
1b2e071a29ba3f1bc32d8ea0706d16120c84052f35880187e7594aab4dd9fe4e | R | 2,220 | 67 | ---
title: "TP53 annotation for HGG"
author: "K S Gaonkar, Jo Lynne Rokita"
output: html_notebook
---
In this notebook we will annotate HGG samples with TP53 status we obtained from snv/cnv and TP53 classifier. We believe TP53 annotation will add useful information to the current known subtypes as we see TP53 mutation... |
8019451dab92c191efe9826aadfadefb755439f3325f9853b9bce38d88dafa12 | R | 2,226 | 54 |
#' @title Prepare Correlation Data
#' @description Formats metabolite and transcriptomic data for correlation analysis.
#' Converts data frames to numeric matrices and sets rownames.
#' @param diff_m_cor Metabolomics data frame (rows=features, cols=samples).
#' @param diff_t_cor Transcriptomics data frame (rows=f... |
364c63632f23b564944c3f8065a0b6ff59e7a5b7a3f12a9539fc20a7533a4c47 | R | 2,227 | 59 | # Osprey command line tutorial
All **Osprey** functions descibed in the GUI section can alternatively be called directly using a series of commands in the Matlab terminal. The function RunOspreyJob.m is a one-stop-shop wrapper for all of these commands, running the full analysis without interruption:
```octave
MRSCon... |
76d4eacc80a5a2be00193e9901cfe9c84a1e5972c5a8f44cece388e9468aab30 | R | 2,228 | 66 |
# Function to extract subsets of genes for limited FDR correction from sample
# annotation
parse_subsets_for_FDR <- function(yaml_file, sampleIDs){
# if no file specific in config, return NULL
if(is.null(yaml_file) || yaml_file == ""){
return(NULL)
}
# check if file exists
if(!fi... |
1f7475331f00c4d9c0b8183318f537239c2a7705aaec09e231b5000e9ef2ef93 | R | 2,229 | 45 | # Clinically significant change
#......................................................
# Documentation
#' @title Reliable Change Index (RCI)
#' @description This function calculates Reliable Change Index (RCI) as modifed by Wiger and Solberg (2001, p.148).
#'
#' @param SD_0 standard deviation of the non-clinical popu... |
5953991c716258660c8186759e937b04d4604ac9d99f665eb794833110aa01f6 | R | 2,229 | 59 | gg_volcano_wrapper <- function(DA_df,
p.vals = c(0.01),
e.vals = c(-1, 1),
pal.name = "YlGnBu",
xlab = "Effect Size",
ylab ... |
484dfbfb44da764e631ad8ed02c1153188462c9552a812698cb9583fef00fe49 | R | 2,234 | 54 |
##-------------------------------------##
## SUBSET TAB ##
##-------------------------------------##
tab_SUBSET<- tabItem(
tabName = "Metadata",
sidebarLayout(
sidebarPanel(width = 3,
selectInput(inputId = "subset_var",
... |
ab32aaa646fb07d4a6bb4eea529629a2399e62f1ce027612cc459a91150e363d | R | 2,235 | 60 | rm(list=ls(all=TRUE))
library(dplyr);library(ggplot2);library(mvnfast)
source('simulations/mugent_pleio/functions.R')
##################################################################################
##################################################################################
## example of usage (generating data... |
5ae0f24b2c91268d438ca53f5c71d289f7484c5037481b329188690a0143201c | R | 2,249 | 54 | # 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... |
62077bbc8dc6f9853b9a75ae5e444f992a223dada9805eb8167840a8da9c78cf | R | 2,249 | 49 | #' methylkey: DNA Methylation Analysis from Illumina Arrays
#'
#' \code{methylkey} provides a comprehensive Bioconductor package for analysis
#' of DNA methylation
#' data from Illumina methylation arrays (27k, 450k, EPIC, and mouse arrays).
#'
#' The package offers:
#' \itemize{
#' \item Preprocessing pipelines us... |
73df37a9b8c5bd57aa275dfca12974ddb75b8bb8e77442a9a088d947e6777530 | R | 2,252 | 62 | # adapted from https://github.com/drisso/EDASeq/blob/master/R/methods-SeqExpressionSet.R
# modified to use ggplot2 instead of base R
suppressPackageStartupMessages({
library(ggplot2)
library(ggpubr)
library(uwot)
library(EDASeq)
})
# create clustering using PCA or UMAP
edaseq_plot <- function(object, isLog =... |
5045d61a0999dbfa5d1b5fc7a136269de65b9b62cc2d8c77e61d0c216fe5fcae | R | 2,260 | 78 | # GO Enrichment Analysis using topGO with elim Fisher test
# For OSNs and Fatbody insulin knockdown RNA-seq data
# Outputs: CSVs with adjusted GO terms (padj < 0.05)
# Load required libraries
library(readr)
library(dplyr)
library(topGO)
library(org.Dm.eg.db)
# Input data (relative path)
fat_file <- "data/InR_Fatbody... |
b131036b59a41a497102423431bc894ad71abf9bcfcda1e7e43b70b35e3bf2cb | R | 2,264 | 84 | ---
title: "qc_summary_plot"
output: html_document
date: "2023-08-30"
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r, include = FALSE}
library(readxl)
library(ggplot2)
library(reshape2)
```
```{r Define_Themes}
##DEFINE THEMES:
theme_task_names <- theme_bw() +
theme(
#panel.grid =... |
f8c22cf06dd30d648acce559c3864f9a3969f3b4b67a9b59e2d77d01e4310bcf | R | 2,267 | 68 | library('PAIRADISE')
args <- commandArgs(trailingOnly=TRUE)
input_file_name <- args[1]
number_of_threads_str <- args[2]
output_file_name <- args[3]
data_frame <- read.table(file=input_file_name, sep="\t", header=TRUE)
number_of_threads <- as.integer(number_of_threads_str)
# pairadise has an error for an input data... |
a5cb5d1084d3c54a9448f4a813b9db002019bd7bccd4ff41b2a693be7a1c8847 | R | 2,274 | 68 | #' Compute the Intersection Over the Union for a set of CNVs
#'
#' Can be usefull for exploratory reasons but also as a base to
#' construct CNVRs.
#'
#' @param cnv usual CNVs `data.table`
#' @param chr_arms chromsome arms location, from `QCtreeCNV` package
#' @param min_iou minimum IOU filter, useful to reduce output ... |
d04d0301c441e6747de44f51fb2e019b282202ccb4a34b322393f5d0fde5ea07 | R | 2,276 | 59 | library(optparse)
library(tidyverse)
library(leafcutter)
arguments <- parse_args(OptionParser(), positional_arguments = 4)
# arguments <- list()
# arguments$args[1] <- "/home/jbrenton/test_run/leafcutter/intron_clustering/testrun_perind_numers.counts.gz"
# arguments$args[2] <- "/home/jbrenton/test_run/leafcutter/intr... |
f6996b1cb6f9b22eb6e7bcf62a456c1129094ad5ef18ecef75974dd0087bf614 | R | 2,277 | 43 | #!/usr/bin/env Rscript
args = commandArgs(trailingOnly=TRUE)
partition <- as.character(args[1])
file_path <- paste0(partition, ".Rdata") # partition input file
dir <- as.character(args[2]) # path to work directory
#setwd(dir)
input_parameters <- readRDS("input_parameters.rds")
motif_probs <- readRDS("1_motif_probs.rds... |
3697fcc05db0316bd32444460e81f7d29aa10af1678ce0bd3e11038a2dfde58c | R | 2,279 | 51 | #' Normalize and scale raw count matrix
#' @description Normalize total sample/cell expression to 1, multiply by median, and log2 transform.
#'
#' @param exp matrix, raw expression count matrix (rows = genes, columns = samples/cells). CPM/RPKM matrix can also be used, however, ensure that the data is NOT on the log-sca... |
0f8fb71c09dc3e084d3f9397b6bf529f20f4a88246399495b9e028de446c01f8 | R | 2,281 | 66 | test_that("new_betas creates valid Betas object", {
# Create simple test data
betas_matrix <- matrix(runif(100), nrow = 20, ncol = 5)
colnames(betas_matrix) <- c("Sample1", "Sample2", "Sample3", "Sample4", "Sample5")
rownames(betas_matrix) <- paste0("cg", sprintf("%07d", 1:20))
ss <- data.frame(
sample... |
6efede7285f5ed25e03fa68a39e4aa84528f1c4766f2464369cf9773be83f6d9 | R | 2,281 | 56 | # JN Taroni for ALSF CCDL 2021
#
# In this script we compile pathology diagnosis and pathology free text
# diagnosis terms/strings used as part of inclusion or exclusion criteria for
# LGAT subtyping
#
# USAGE: Rscript --vanilla 00-LGAT-select-pathology-dx.R
# Detect the ".git" folder -- this will in the project roo... |
f11c3b9d9604f1c378d24ed7f23a01cbb9ea0cdc621ea3dcb5c54f2801c31835 | R | 2,284 | 57 | #' Plot cell type prioritizations as a 'lollipop' plot
#'
#' Plot the complete ranked list of prioritized cell types as a 'lollipop' plot
#' (similar to a bar chart, except with each bar replaced by a point and line).
#' In addition, the exact value of the mean AUC, to three decimal places, is
#' printed in the plot ... |
a50775c1309ef75b4e1bd2281a237db18e5dace1c40bd06512fcc6bf3fef8dfe | R | 2,286 | 55 | # network propagation for ciliopathies and mouse phenotypes
# Libraries ----
library(igraph)
source('code/0.networkPropagation.R')
'%notin%' = Negate('%in%')
# Interaction network full ----
#load open targets interaction network (IntAct, Reactome, SIGNOR, STRING)
intAll <- read.csv('./Datasets/interaction/intera... |
b5008457a7b8bc910ba3fc22955960e834df46e4ceecd99564d37e3b99d13949 | R | 2,288 | 60 |
##-------------------------------------##
## METADATA TAB ##
##-------------------------------------##
tab_METADATA <- tabItem(
tabName = "Metadata",
sidebarLayout(
sidebarPanel(width = 4,
#h4("Create new annotation from selection"),
#
... |
29aa7de12f3cc0a46ab7360d11985db94d3fa42c5e32a774abfe29d522eac427 | R | 2,289 | 72 |
##-------------------------------------##
## GSEA TAB ##
##-------------------------------------##
get_gsea <- function(dea, ordering, organism, subcategories){
dea[["|SNR|"]] <- abs(dea$SNR)
dea <- dea[order(dea[[ordering]], decreasing = TRUE),]
rank <- as.data.frame(cbind(dea$... |
0793ea022357d6654cf42948adbc91bdfb61e6b3b3cc5a496745935541f8a649 | R | 2,290 | 84 | # library(keras3)
# Hyperparameter flags ---------------------------------------------------
FLAGS <- flags(
flag_integer("n_hidden_layers", 2),
flag_integer("n_hidden_nodes", 64),
flag_boolean("dropout", TRUE),
flag_numeric("dropout_rate", 0.3),
flag_string("activation_fun", "relu")
)
# Data Preparation -... |
eb4e530af8f75071cfe3691016b7f5b70f2a52c4c25209523a83fb51e9ea6333 | R | 2,290 | 53 | # Scatter-Plot.R
# Scatter-quadrant-Plot of log2 fold changes for shared DEGs for directionality (padj < 0.05)
library(readr)
library(dplyr)
library(ggplot2)
library(scales)
# Input
osn <- read_csv("InR_OSNs_All.csv")
fat <- read_csv("InR_Fatbody_All.csv")
# Filter padj < 0.05
osn_sig <- osn %>% filter(padj < 0.0... |
b9bc04196f1d89438b2d03a4f5e07d48587b89d137b7a63fa5e5d18fbde91d7e | R | 2,291 | 50 | # In this script we will be gathering pathology diagnosis
# and pathology free text diagnosis terms to select embryonal
# samples for downstream embryonal subtyping analysis and save
# the json file in subset-files folder
# Detect the ".git" folder -- this will in the project root directory.
# Use this as the root di... |
8c3f41024cd87606f12342d32cac64943d2626bfd5ddf2f042d0277d098c79fc | R | 2,298 | 73 | ########################################
#
# Figure supp 1 plot
#
#
# Liang Qunjun 2023-12-20
library(tidyverse)
library(bruceR)
library(ggstatsplot)
library(ggridges)
library(psych)
library(RColorBrewer)
library(ggeasy)
library(ggsci)
library(patchwork)
library(cowplot)
library(scales)
library(ggsign... |
de47278d572308b25df0965f89c6074cd0e8ac4a693840c0c45ae90ad2c0f11a | R | 2,298 | 70 | # Hua Sun
library(Seurat)
library(ggplot2)
library(ggrepel)
library(dplyr)
library(data.table)
library(stringr)
library(gprofiler2) # change name
library(ggpubr)
rds <- 'multiome_integrated_plus.rds'
fmeta <- 'cluster_cellType.corrected2.xls'
gene <- 'Plagl1'
motif_id <- 'MA1615.1'
fzr <- 'out_zrFusSig93/metadata_wi... |
15b501bbfffe402e80237c7aa45efc60898a2af6a52896cf7c3c48a20bc8ebe9 | R | 2,306 | 68 | # Olink Explore 3072 to Olink Explore HT OlinkID mapping ----
eHT_e3072_mapping_rds <- system.file("extdata", # nolint: object_name_linter
"OlinkID_HT_mapping.rds",
package = "OlinkAnalyze",
mustWork = TRUE)
... |
1792f2a956ad1d7accc840192071e575e28a16d80b9119f73b5b240c4554832e | R | 2,308 | 83 | #' @name lgb.importance
#' @title Compute feature importance in a model
#' @description Creates a \code{data.table} of feature importances in a model.
#' @param model object of class \code{lgb.Booster}.
#' @param percentage whether to show importance in relative percentage.
#'
#' @return For a tree model, a \code{data.... |
f16774e32edefde1e5722e7c58c80d17e89d4a5621c6e28920b200120b514470 | R | 2,316 | 84 |
run_different_seed <- function(dat, time, status, base_seed = 123, rep = 10, scale = F, ...) {
# doParallel::registerDoParallel(10)
plyr::ldply(
1:rep,
.fun = function(i) {
mods <- mrf3_init(
dat,
scale = scale,
ntree = 300,
seed = base_seed + i,
...
)... |
95307dbd43eaebbc42ec69338dfa07a350fe2bc86ffc8bc448df4f43d9f72425 | R | 2,318 | 72 | ---
title: "Untitled"
output: html_document
date: "2025-01-28"
editor_options:
chunk_output_type: console
---
##################
Docker H5AD need a computer with lot of RAM available.
##################
```{r}
library(SeuratObject)
library(Seurat)
library(zellkonverter)
library(SummarizedExperiment)
```
```{r}
W... |
46313a7f7269dd1e4759e93fabc8d9e2d73dade47f0c82ec8288a12fb3219c49 | R | 2,321 | 79 | test_that(
"olink_volcano_plot - works",
{
# Load reference results
ref_results <- get_example_data("reference_results.rds")
skip_on_cran()
skip_if_not_installed("vdiffr")
# There's some randomness to how the labels are placed on the plot.
# Setting the seed should avoid this
set.seed(... |
5fe2d5a3873052aead6abd9dd8d1e1f59931daaba02520147f031d09858b7843 | R | 2,326 | 58 | #'---
#' title: Collect all counts to FRASER Object
#' author: Luise Schuller
#' wb:
#' log:
#' - snakemake: '`sm str(tmp_dir / "AS" / "{dataset}" / "01_5_collect.Rds")`'
#' params:
#' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`'
#' - workingDir: '`sm cfg.getProcessedDataDir() + "/aberrant_splicing/datase... |
f18d83f6064a34c08ef6a24dd802c206307318d0aed1d3d9395fc46c46490eed | R | 2,329 | 78 | # check if snapshot exists. if not skip the test.
check_snap_exist <- function(test_dir_name, snap_name) {
# check that "_snaps" exist, otherwise skip
base_test_dir <- test_path("_snaps")
skip_if_not(dir.exists(base_test_dir))
# check that test-specific snaps directory exist. if not skip.
test_dir <- test_pa... |
dd381df1155adb31b0ee9b638ac0da9f4726b918389e3c81eb034098c332fc46 | R | 2,332 | 75 | context("Input validation (new validators)")
test_that("empty gene input raises error", {
expect_error(
richR:::.validateGeneInput(character(0), func_name = "test"),
"input gene list is empty"
)
expect_error(
richR:::.validateGeneInput(c(NA, NA), func_name = "test"),
"input gene list is empty"
... |
91a7cfd395176b9df5860ca78750f98abba1e1d33d7c47aeccc0632ad8e0bc29 | R | 2,346 | 101 | ## code to prepare internal dataset goes here
## based on https://r-pkgs.org/data.html#sec-data-sysdata
## Acceptable checksum file names ----
# Used in:
# - get_checksum_file
# - get_npx_file
accepted_checksum_files <- c(
"MD5_checksum.txt",
"checksum_sha256.txt"
)
## Acceptable extensions of NPX files ----... |
717463483b0c3226d402559a440d31d08dafbd07d39e31683832003d8b77d77f | R | 2,348 | 73 | #' Expand miRNA names into precursor and mature forms
#'
#' For each miRNA in the given column, decides whether it is a precursor or a
#' mature form. Precursors are expanded into three multiMiR query rows (the
#' precursor plus the \code{-5p} and \code{-3p} mature arms); mature miRNAs are
#' kept as-is with their prec... |
5e23a3df1f5dfa9e24efe7bfc1d070faeb47e305369fd00b87012e2946d1ed05 | R | 2,349 | 59 | ## Suppress R CMD check NOTEs for non-standard evaluation variables
## used in dplyr pipelines and ggplot2 aes() calls
utils::globalVariables(c(
# ggplot2 aes variables
"x", "y", "xend", "yend", "label", "Group", "NES",
"x_start", "y_start", "x_end", "y_end", "x_group", "y_level2",
"neg_log10_Padj", "annotateTe... |
1d0f54723a62123c532141a11a8499be8901eb75f2da4313b29fb62eef18ee0a | R | 2,358 | 109 | # Hua Sun
# v0.2
library(Seurat)
library(dplyr)
library(stringr)
library(this.path)
library(GetoptLong)
path <- dirname(this.path())
fpath <- paste0(path, '/src/')
r_source <- list.files(fpath, recursive = T, full.names = T, pattern = ".R")
invisible(lapply(r_source, source))
db_path <- paste0(path, '/db')
db <- ... |
8b14a95028fcbf9208ba09a71b9450bccd129d16114bdfb498a9d702cee9be98 | R | 2,359 | 68 | ##################################################
### 02 --- add soil conditions to examples
##################################################
# libraries
library(raster)
library(terra)
library(RColorBrewer)
library(sf)
library(dplyr)
library(DBI)
library(stars)
library(ggplot2)
library(exactextractr)
library(coll... |
c08f280ef6d360d202dee7903b4675373bec1f3058a5caa16b91778284690ae3 | R | 2,359 | 52 | #' Normalize and scale raw count matrix
#' @description Normalize total sample/cell expression to 1, multiply by median, and log2 transform.
#'
#' @param exp matrix, raw expression count matrix (rows = genes, columns = samples/cells). CPM/RPKM matrix can also be used, however, ensure that the data is NOT on the log-sca... |
68f165d22868177e40d5a24b1b4fb1ebc388bb46203df772185b9876327d751a | R | 2,375 | 78 | #!/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... |
71f08dacb9ff0c830d1836c3faa01bfa894cba24143096f0b2cc633e268688a9 | R | 2,376 | 62 | library(pROC)
data(aSAH)
context("roc.utils.percent")
test_that("roc_utils_topercent works on full AUC", {
expect_equal_ignore_call(pROC:::roc_utils_topercent.roc(r.wfns), r.wfns.percent)
})
test_that("roc_utils_unpercent works on full AUC", {
expect_equal_ignore_call(pROC:::roc_utils_unpercent.roc(r.wfns.percen... |
d09606c1e2f4f29f8ce78727b5b685b28849189dfbda9b66b86802f0d3723f3c | R | 2,379 | 56 | skadi_kryss <- function(x_vector, y_metric, method = "spearman", posthoc = T, uncorrected = F, euclid.outlier.check = T){
res_df_cor = data.frame(p.value = rep(NA, nrow(x_vector)),
statistic = rep(NA, nrow(x_vector)),
out.index = rep(TRUE, nrow(x_vector)))
... |
cbf2a359000dd4ed5e2d0298194eefb59edd27f7150156e9a05c1a641a795657 | R | 2,382 | 76 | library(SummarizedExperiment)
library(SingleCellExperiment)
library(SpatialExperiment)
set.seed(1000)
spe <- simulateDataset(rate = 2)
spe <- computeBanksy(spe, assay_name = "counts", compute_agf = TRUE)
spe <- runBanksyPCA(spe, use_agf = TRUE, seed = 1000, lazy = FALSE)
test_that("clusterBanksy with invalid algo", {... |
3adc37f3d081b90bf794807560b0ca0f54b617def100210e133fd2086ef3916e | R | 2,383 | 67 | # Anchor the repo root
if (!requireNamespace("here", quietly = TRUE)) install.packages("here")
here::i_am("stats/permutation_tests/palm_code/_setup.R")
# Packages
pkgs <- c("dplyr","tidyr","purrr","stringr","readr")
to_install <- setdiff(pkgs, rownames(installed.packages()))
if (length(to_install)) install.packages(to... |
c693c8afbd78edc3f03880d0d610a9484640748786d085818fba1975e81ebcf9 | R | 2,387 | 83 | ##-------------------------------------##
## DEPTH TAB ##
##-------------------------------------##
choose_norm_method <- function(method, mat){
print(method)
if(method == "scran"){
print("running scran")
norm_matrix <- normalize_with_scran(mat)
}
else if(method == "SCTr... |
cf4b830aa9a35213245d354fa35988fcf9404844da2811a5b094242b1967cefd | R | 2,399 | 57 | ---
title: "FakeDiamond: concreteness manipulation"
author: "Ryan Law"
date: "`r Sys.Date()`"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(LexOPS)
library(tidyverse)
```
## Generate a list of single words
As a first step in our stimulus creation, we... |
66d8e85a9baefb45532077b2634fc94973d9c8c5bcf8e681daebbbd5acaddb6a | R | 2,400 | 84 | #' @export
lists.combiner<-function(inputDF){
#This function combines multiple gene lists together and summarizes occurence of the string within a list. Gene lists which will be combined should be a data frame (inputDF) of multiple gene/miRNAslists. Gene list in inputDF don't need to have equal lenght
#example:
... |
100b76245d34d415c40ec71f09741bfb27f040b4f64da1c1c9ae896014d5825c | R | 2,403 | 96 | ---
title: "MA Plot for H4K16ac positive genes in NPCs"
author: "AF"
date: "`r Sys.Date()`"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r}
library(ggpubr)
library(dplyr)
library(clusterProfiler)
```
Importing DESeq2 results:
```{r}
DESeq2_results <- as.data.fra... |
7375c76cdab2be9887237c7bf8a12d0f656052b0cf633085b8ba086dc51b0048 | R | 2,408 | 72 | ---
title: "MSLc Heatmaps"
author: "AF"
date: "`r Sys.Date()`"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r}
NPC_M1AID_24hAux_MOF_R1.filtered.subtract.NPC_M1AID_24h_IgG.bw
NPC_M1AID_24hAux_MOF_R2.filtered.subtract.NPC_M1AID_24h_IgG.bw
NPC_M1AID_24hAux_MSL2_R1.f... |
a68ac4fe5be7fb0b6828c3750a55e22c0edf5b0c076ecc9a2c86bc1422d0e52d | R | 2,408 | 72 | tuneRF <- function(x, y, mtryStart=if(is.factor(y)) floor(sqrt(ncol(x))) else
floor(ncol(x)/3), ntreeTry=50, stepFactor=2,
improve=0.05, trace=TRUE, plot=TRUE, doBest=FALSE, ...) {
if (improve < 0) stop ("improve must be non-negative.")
classRF <- is.factor(y)
errorOld <- if ... |
b165932f1789707c5d9b048ad6133cbd1aa62aeda56350cb7f531dd059d6d7f5 | R | 2,410 | 78 |
##Second Plot - Cluster Ligand-Receptor Pairs Interactions
suppressPackageStartupMessages(library(tidyverse))
library(tidyverse)
suppressPackageStartupMessages(library(reshape))
library(reshape)
library(optparse)
option_list = list(
make_option(c("-f", "--lr_file"), type="character", default="new_clusters_lr.csv", ... |
c14c50fb116c15e1c7d0ab42e024772250ab5694bb0b1e11a66dfe06795175a1 | R | 2,429 | 52 | # TODO: Make sure your qualtrics API token is reproducible yet safe from prying eyes
# TODO also: set up another target so that targets will think the survey is updated when it is
# This helper function parses this specific questionnaire, so the survey ID is hard-coded within, not an arg
get_splat_stimulus_norms_qualtr... |
2ea0ce17c4ebe7d9f2d5f1af804085f725b00d2f14231c87629a141b9397a84e | R | 2,440 | 96 |
##-------------------------------------##
## SUBSET TAB ##
##-------------------------------------##
# SEE DEA TAB WARNING
get_groups_dea <- function(group, grouping, metadata){
final_group <- c()
for (var in colnames(metadata)){
if(is.factor(metadata[[var]])){
print("Detect... |
c1b3c542e24dd8fdc80ac66197505d7be0263445e3014fe81337507b01042169 | R | 2,440 | 67 | library(pathfindR)
library(ggplot2) # Required for customizing the plot
library(Cairo)
# Process command-line arguments
args <- commandArgs(trailingOnly = TRUE)
# Check if there are arguments passed
if (length(args) < 2) {
cat("Usage: Rscript script_name.R <file_path> <pvalue_threshold>\n")
quit(status = 1)
}
# ... |
71d8e3266c21d1c6ca2dd1118338171b57d1d202febb041b01b27554cd394e26 | R | 2,442 | 51 | #' @name setLGBMThreads
#' @title Set maximum number of threads used by LightGBM
#' @description LightGBM attempts to speed up many operations by using multi-threading.
#' The number of threads used in those operations can be controlled via the
#' \code{num_threads} parameter passed through \c... |
e563431d92dae48ef0b69aded714d6a6118008fbc65521d5aa022a881d8191ea | R | 2,444 | 61 | #'---
#' title: Merge Nonsplit Counts
#' author: Luise Schuller
#' wb:
#' log:
#' - snakemake: '`sm str(tmp_dir / "AS" / "{dataset}" / "01_4_nonSplitReadsMerge.Rds")`'
#' params:
#' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`'
#' - workingDir: '`sm cfg.getProcessedDataDir() + "/aberrant_splicing/datasets"... |
2b810d77bad8176c8a35e58b05fb53bdef36d38cb2d43e5ce31bc0fc593ceef3 | R | 2,446 | 72 | # load python and packages
library(Seurat)
library(reticulate)
ad <- import("anndata")
sc <- import("scanpy")
# import data
seurat_object = readRDS("destVI-paper-code/scope-seq-liver/Liver_normal_10um_annotated.rds")
# filter genes
variable_genes = VariableFeatures(seurat_object)
seurat_object <- seurat_object[variabl... |
1d7cc6c730e8de8a3dde432acc1ed07d70b7bbd8b8bf11e92eec1a48e9aeeb25 | R | 2,447 | 106 | #' Help function checking if file exists.
#'
#' @description
#' Check \strong{one file at a time} if it exists.
#'
#' @inherit .check_params params author
#' @inherit .read_npx_args params
#'
#' @return `TRUE` if the file exists, and `FALSE` if not; error if the file does
#' not exist and `error = TRUE`.
#'
#' @keyword... |
241c470bb895022e772b266905b81e70d78fb2b71c2b2fa368d7de12896ef759 | R | 2,450 | 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.