sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
01a4ae7e91c0e805ae3a6b3a1e0fb8757df684ee0d0f3912a30d68cd3850e2e8 | R | 1,729 | 60 | test_that("Test plotBoundary related functions", {
coords <- readRDS(system.file("extdata", "MouseBrainCoords.rds",
package = "SpNeigh"
))
coords$cluster <- as.character(coords$cluster)
p <- plotBoundary(coords, one_cluster = 2, split_by = "cluster")
expect_s3_class(p, "ggplot")
p <- ... |
56efc50208d0be300ff1f0ada82e06b0712816a0cf41faa59de7a140d132b90e | R | 1,734 | 44 | require(gggenes)
require(tidyverse)
require(tidygenomics)
require(fuzzyjoin)
make.genome.plot.data <- function(feature.df, feature.col=5, feature.name='gene', visfrom=NA, visto=NA) {
genome.plotdata <- feature.df
colnames(genome.plotdata)[feature.col] <- feature.name
if (all(!is.na(c(visfrom, visto)))) {
g... |
9a7c2e024d60cd84aabb87844a19b5fc9afc7046c007c692583dc2d8a7d27da5 | R | 1,735 | 57 | #!/usr/bin/env Rscript
library(MendelianRandomization)
bx = ldlc
by = chdlodds
mr_mbe(mr_input(bx = ldlc, bxse = ldlcse, by = chdlodds, byse = chdloddsse), iterations=100)
temp = density(c(-1,2, 4), kernel='gau', bw=1, adjust=1, n=512)
temp$x[temp$y==max(temp$y)]
BetaIV.in = c(1,2,3,4,5)
mad(BetaIV.in)
BetaIV.in = c(1... |
f6350b650778bad60594ce0a09429198e97ac65122e5f6ffb7e706dc7f9ad154 | R | 1,737 | 53 | #-------------------------------------------------
# Title: Helper: Detect outliers with arrayQualityMetrics
# Author: Amanda Zacharias
# Date: 2022-12-31
# Email: 16amz1@queensu.ca
#-------------------------------------------------
# Notes -------------------------------------------
# module load nixpkgs/16.09 gcc/7.3... |
2d54ffac907e933313253d35c90036339d3577f81ada0b6fd90071da37d76528 | R | 1,740 | 59 | # Script to generate a chart of mean quality by cycle from a BAM file
# @author Tim Fennell
# Parse the arguments
args <- commandArgs(trailing=T)
metricsFile <- args[1]
outputFile <- args[2]
bamFile <- args[3]
subtitle <- ifelse(length(args) < 4, "", args[4])
# Figure out where the metrics and the histogram are ... |
0e437bcdeff7fdabc0b731ba85866d02d25c412a86f1d8b382a5f31d723d454f | R | 1,742 | 40 | here::i_am("scripts/1.neural_differentiation_dataset/1.3.CroCoNet_analysis/1.3.4.CroCoNet_analysis_with_cor_adj.R")
library(CroCoNet)
library(here)
input_dir <- here("data/neural_differentiation_dataset/CroCoNet_analysis/")
output_dir <- here("data/neural_differentiation_dataset/CroCoNet_analysis_cor.adj/")
# load ... |
6724a2163b2d30a035b94ccf8e6bc0257cddc2c48c947db23a59a89e5f719987 | R | 1,750 | 71 | test_that("Test ComputeCentroidWeights", {
coords <- readRDS(system.file("extdata", "MouseBrainCoords.rds",
package = "SpNeigh"
))
cells_c2 <- subset(coords, cluster == 2)$cell
weights <- ComputeCentroidWeights(data = coords, cell_ids = cells_c2)
expect_true(is.vector(weights))
expec... |
babcd47d80ec0ff993fb0bf76b859190e1ef227d86a683a91ef1a20d4c2177e5 | R | 1,756 | 59 | library(tidyverse)
library(survival)
library(survminer)
library(qs)
para_df = qread('res/lasso_model_para.qs')
get_survival = function(para_df,expr, surv_df){
lasso_genes <- para_df %>% rownames(.)
genes = intersect(rownames(para_df),rownames(expr))
tmp_df <- expr[genes,rownames(surv_df)] %>% t() %>% as.data... |
e22d9f88ddadd8ab782ee0a3ffde8832b55066e115e37b8cba6a6e44d9aa9375 | R | 1,757 | 58 | ---
title: spatialLIBD
output: js4shiny::html_document_js
---
<img src="http://research.libd.org/spatialLIBD/reference/figures/logo.png" align="right" />
<!-- js4shiny is available through remotes::install_github('gadenbuie/js4shiny') -->
Thank you for your interest in `spatialLIBD`! We apologize for the error you s... |
9108d3c480d8953640759715e96e5fc99bc3c2eeb5161418dbfee3e4987a3a84 | R | 1,765 | 47 | ### -----------------------------------------------------------------
### Legacy exploratory analysis by a member of the Wilson Lab.
### Historical record only — not part of the bancpipeline release.
### -----------------------------------------------------------------
# Load libraries
library(bancr)
library(tidyverse... |
e2eab1897695833e22757c37dbf7430d43745445ba85c4748bbcd119a12aee30 | R | 1,768 | 72 | # -----
# UMS IPSIT BIOINFO - Licence GPL-3
# https://github.com/fdumbioinfo/moal
# -----
#
# moal install
source("https://raw.githubusercontent.com/fdumbioinfo/rtools/main/moal-demo/0-moal-install-r-universe.r")
library(moal)
# change working directory to data_analysis folder
setwd(".")
#
# QC/filter/norm
#
"inputdata... |
1c4d841764807c7a000eec072c5d05fc2eeaa779fe2405fb0efdbf323db27f37 | R | 1,770 | 57 | # Script to generate a chart of quality score distribution in a file
# @author Tim Fennell
# Parse the arguments
args <- commandArgs(trailing=T)
metricsFile <- args[1]
outputFile <- args[2]
bamFile <- args[3]
subtitle <- ifelse(length(args) < 4, "", args[4])
# Figure out where the metrics and the histogram are in... |
1689c5f3f5a60d7ecf3b2279ee91275675e18e6469119bafa5bec1a44102425c | R | 1,771 | 49 | # This script creates a dataset with three columns: species name, allele, and phenotype.
# It is used to create datasets for the corelation analysis in BayesTraits (BT).
# Allele and phenotype variables are binarized. In the case of ambiguous amino acids,
# the allele is displayes as "-", the symbol for missing data in... |
0a659d561b7a5b6e4916b0b1fbb3fd532318238d704448222e0ec781bbe9166c | R | 1,772 | 48 | test_that("cave_bbox_nm2vox converts nm bounding boxes to voxels", {
bb=rbind(c(4e5, 1.6e5, 1e5), c(4.2e5, 1.8e5, 1.2e5))
# nm table (vd=NULL) is an identity pass-through
expect_equal(unname(fafbseg:::cave_bbox_nm2vox(bb)), unname(bb))
# FAFB voxel resolution: nm -> voxels divides by (4,4,40)
vd=c(4,4,40)
... |
571e08c0a0218f17811d5746ef2aa11d749e9ff2a48c46b877799f1cc649094e | R | 1,772 | 49 | improve.lambda.pick<-function (x, parallel, ncores, lambdas, bestlambda, verbose)
{
lambdas <- sort(lambdas, decreasing = TRUE)
M <- calcM(x = x, lambdas = lambdas, parallel = parallel,
ncores = ncores)
Mcv <- M[which(lambdas == bestlambda)]
if (length(which(M < 1.25 * Mcv)) > 0) {
lambdapick... |
f4af7edbdcdd2af26d5bbfd4f5834523b43d39f402fd851f774e16f879d71a87 | R | 1,772 | 34 | # ===============================================================
# 🎨 Shared plot theming utilities
# ===============================================================
# Consistent minimalist theme for Table Analyzer plots.
ta_plot_theme <- function(base_size = 12) {
ggplot2::theme_minimal(base_size = base_size) +
... |
5b88703a0f18396d1da53d4cc40b476792ea4587415afe684207a74947c53449 | R | 1,775 | 63 | root="//eu.boehringer.com/users/bib/users1/duhoffma/Desktop/AA_pipeline/aa_test/" #this is the root folder
###########################you should only need to change the root directory to poinit towards your working directory
#following sub folders rawtrack, rawtrack_ttl, allsigs, sig_ttls
tdir=paste(root,"rawt... |
4ce9271e0a99fb6dedc6c28d3513be189c37e2e12a424efcaeb94ca9680cdec9 | R | 1,776 | 52 | #!/usr/bin/env Rscript
library(tidyverse)
library(odbc)
library(DBI)
#######################################################
rm(list=ls())
#Establish connection
con <- DBI::dbConnect(odbc::odbc(), "VerhaakDB4")
dat <- read.delim("/projects/verhaak-lab/USERS/johnsk/glass4/results/mutect2/consensusvcf/GLSS-LX-batch2/... |
0076b7309c9489b74e3879ad589e95ed4227464220a668ef74f37524f7e77932 | R | 1,777 | 35 | #' @title plotTsne_AUCellApp
#' @description Creates the AUCell shiny app to visualize the regulon activities on the t-SNE
#' @param scenicOptions Fields used: aucell_regulonAUC, aucell_thresholds, cellInfo, and default tSNE
#' @param exprMat Expression matrix
#' @param tSNE_fileName tSNE file name. If null, the defaul... |
e8ce5cc004a4c3b413777c639ad6df68bb6022fc992cef17751290f8a00b2bc0 | R | 1,779 | 47 | ### Normalization and imputation
setwd(rstudioapi::getActiveProject())
rm(list=ls())
library(tidyverse)
library(stringi)
source("./Scripts/Function_scripts/Pre-processing_functions.R")
load(file = "./Output_data/Invivo_29.lipids.conc.byMsD.Rdata")
## Normalization and imputation should exclude all QC data, include a... |
f8eb61c8f0ba455d244801c7115586cd54fdbfdde538bb8abe74e66597e924af | R | 1,781 | 47 | ### Extract internal standards from all samples of _In vivo_ lipidomics
setwd(rstudioapi::getActiveProject())
rm(list=ls())
library(tidyverse)
library(stringi)
library(matrixStats)
## ==== IS from in vivo sorted cells ====
load("./Output_Data/IS_Ion_for_quantification.Rdata")
## ==== For in vivo dataset use [M-H]- t... |
9ea8d560f60a5c52b72348f5134c261be00f3cfb5256f96cfd14a44ab656a3ed | R | 1,786 | 58 | #' @title Metric displacement of binary masks
#'
#' @description
#' This function computes the metric displacement between two binary masks
#'
#' @param manual manual segmentation of class antsImage,
#' used as reference
#' @param predict other antsImage to compare to manual
#' @param get (default='all') one of 'mean',... |
5fe833eccb43fed3a0feab9de5381247c66c4698d5e7fe9f1ca84a52db63a832 | R | 1,788 | 41 | here::i_am("scripts/3.brain_dataset/3.3.CroCoNet_analysis/3.3.2.CroCoNet_analysis_with_cor_kIM.R")
library(CroCoNet)
library(here)
input_dir <- here("data/brain_dataset/CroCoNet_analysis//")
output_dir <- here("data/brain_dataset/CroCoNet_analysis_cor.kIM//")
dir.create(output_dir)
# load preservation statistics
pr... |
e077abbc3581d490ff92659af64f58b97ac1b3d902c2dd746aeed8fd106d5e45 | R | 1,789 | 69 | #' project values to a Desikan-Killiany brain atlas
#'
#' @param dat A data frame.
#' @param fill A string.
#' @param title A string.
#' @param min A numeric.
#' @param max A numeric.
#' @returns A ggplot figure.
#'
#'
#' @importFrom magrittr "%>%"
library(ggseg)
plot_ggseg_brain <- function(
dat, atlas = "dk"... |
32823fd911a3c789d5463470feb10b1ef4e6ce271a68ad346227e0eeb775405f | R | 1,791 | 40 | here::i_am("scripts/2.validations/2.1.regulator_interactions_and_module_overlaps/2.1.1.get_regulator_interactions.R")
library(STRINGdb)
library(tidyverse)
library(here)
wd <- here("data/validations/regulator_interactions_and_module_overlaps/")
dir.create(wd)
# list of central regulators
regulators <- readRDS(here(... |
d17bc779e29d83d93970b8ae119101d612b8f60598459ba88f36118bcdc69774 | R | 1,793 | 40 | #' Generate an HTML Report from SAHA Analysis
#'
#' This function renders an HTML report using the SAHA analysis results.
#' It determines whether the provided output file path is absolute or relative,
#' resolves the final path accordingly, and uses `rmarkdown::render()` to
#' generate the report.
#'
#' @param SAHA An... |
fcbeb392a787bc3cdb63c546fde4f002543cb82a8d2218f6818991a8bc3e815d | R | 1,796 | 43 | library(GOSemSim)
library(org.Hs.eg.db)
hsGO <- godata('org.Hs.eg.db', ont = "BP")
intros <- c("lpa_to_sel", "lpa_to_wel", "wel_and_sel_to_lpa")
for (intro in intros){
go_table <- read.table(paste0("data/introgression_scans/genes/", intro, ".overrepresented_GOs.tsv"),
sep = '\t', header... |
4546308e2b5098d7199001db0dc28a0dd765b0c8f97d47d4c0d0796461fea69d | R | 1,799 | 40 | ## Calculate the SVR ACC difference between methods
setwd('/home/huyang/Projects/HuYang/HY_20251111')
## Loop each dataset
for (curr_set in c('eNKI', 'Cam-CAN')){
out_dir <- paste('./PROCDATA/STATS/AGE/', curr_set, sep = '')
## Loop each atlas
for (curr_atlas in c('Schaefer300', 'DK308')){
## Load SVR data
... |
056f2d48cf0f786d6da7d91daa27c7710f24a38ba34209b0ebc2d36427a3b095 | R | 1,800 | 47 | # Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
rowCorCpp <- function(idxX, idxY, X, Y) {
.Call('_ArchR_rowCorCpp', PACKAGE = 'ArchR', idxX, idxY, X, Y)
}
rleSumsStrandedChr <- function(rle, x, strand, width) {
.Call('_ArchR_rleSums... |
9fd04e5a3ca608fb6ca6b87d6d950dd7416e3063c935018bfc9ff1bb62b1ff2c | R | 1,803 | 49 | ### Normalization and imputation
setwd(rstudioapi::getActiveProject())
rm(list=ls())
library(tidyverse)
library(stringi)
source("./Scripts/Function_scripts/Pre-processing_functions.R")
load(file = "./Output_data/Invitro_404.quant.lipids.Smpl.Name.O8aNSC.adj.Rdata")
## Normalization and imputation should exclude all ... |
016e5d9b347a48d88926aaba582756c1eb27da4606da37164f5da0971cd2ca7a | R | 1,806 | 33 | ### Generate a combined lookup table for Sepia officinalis proteome
### from eggNOG-mapper and InterProScan annotation
library(tidyverse)
# load emapper
emapper <- read_tsv("/Volumes/scic/data/projects/CuttlefishOmics/transcriptome/sepoff241117/braker/emapper/out.emapper.annotations", skip = 4)
# add gene ids
emapper... |
16612f66c0e9bbc0736cad6604bf802730ed31f4dcca3903597de7d9e68bfad8 | R | 1,815 | 55 | ##### ##### ##### ##### ##### ##### ##### ##### ##### #####
# Parameter settings
##### ##### ##### ##### ##### ##### ##### ##### ##### #####
setwd(file.path(getwd(), "R"))
source("00_directorySettings.R") # load baseDir <- "/WORKING_DIR"
dataDir <- file.path(baseDir, "data")
outDir <- file.path(baseDir, "NMFres")
fil... |
263dc4377fd1e0438789d075468491c3cffc116615581c8207eb5271173baa27 | R | 1,816 | 82 | library(boot)
library(csSAM)
library(parallel)
library(data.table)
csSAMcsFit <- function(inputPeakDT,inputCellDT){
#convert DTs into matrices
peakMat <- as.matrix(inputPeakDT[,-1])
row.names(peakMat) <- inputPeakDT$sample
cellMat <- as.matrix(inputCellDT[,-1])
row.names(cellMat) <- inputCellDT$sample
... |
62fcadbb2fb71f9c3733ee1febe47a84bbe88329626a4755ccf2fbc0013832e4 | R | 1,816 | 36 | #' Downsamples query and database to shared genes
#'
#' This function reduces the size of the query and database components within an `ann` object by retaining only genes expressed in both datasets.
#'
#' @param ann An object containing `query$AvgExp` and `db$AvgExp` data frames.
#'
#' @return The input `ann` object wi... |
5082e1013697142b5c92a28bccbadedbba0431eea951917d6eedf4fac4f059f7 | R | 1,819 | 45 | test_that("fetch_data", {
expect_error(fetch_data(type = "BAD_TYPE"))
})
## test ERC
# ## SRT data
# spe_erc_path <- fetch_data(type = "LFF_spatial_ERC_SRT")
# spe_erc_path <- unzip(spe_erc_path, exdir = tempdir())
# spe_erc <- HDF5Array::loadHDF5SummarizedExperiment(
# file.path(tempdir(), "spe_ERC_annotated")... |
88857f224bd9e7da5809893532afca457c6b98d149686a2dafbca5f5043851ef | R | 1,822 | 67 | # see
# https://flyconnectome.slack.com/archives/C01AETN5W15/p1675441690566929
u2="https://clio-ng.janelia.org/#!gs://flyem-user-links/short/2023-08-01.060515.json"
nsc=fafbseg::ngl_decode_scene(flyem_expand_url(u2))
nsc$layers$`nerves-202301`
neuprintr::neuprint_ROI_mesh("PrN(L)", conn=manc_neuprint())
neuprintr::neu... |
297898a2f9c4af6902095e405e371e6a37c42c72aec6a606d426a21ee6bcf9df | R | 1,824 | 33 | library(VariantAnnotation)
library(stringr)
vcff = snakemake@input[["vcf"]]
tsvf = snakemake@output[["tsv"]]
vcf <- readVcf(vcff)
funcolumns <- unlist(strsplit(unlist(strsplit(info(header(vcf))['FUNCOTATION',3], '\\: '))[2],'\\|'))
funcotation <- as.data.frame(do.call('rbind', str_split(gsub("^\\[|\\]$","",as.charac... |
9915e1cb48f735ad4d6b790a50e3c6c546eaa27072cafe204b7dfde17511e696 | R | 1,827 | 51 | #' @rdname mlflow_save_model
#' @param conda_env Path to Conda dependencies file.
#' @export
mlflow_save_model.keras.engine.training.Model <- function(model,
path,
model_spec = list(),
... |
ba4a39ecaf0f8aaae35937b9709d9f21373b5efc664927865d36edaa52759d4f | R | 1,830 | 73 | #!/usr/bin/env Rscript
# read results from ksklearn
suppressPackageStartupMessages(library("argparse"))
# create parser object
parser <- ArgumentParser()
# specify our desired options
# by default ArgumentParser will add an help option
parser$add_argument("-i", "--input", required=TRUE, help="input matrix")
parser$... |
d1d0b65eb0579df745061544a8718289c204f09260cd12723ee1d7a7c61b300a | R | 1,831 | 52 | #!/usr/bin/env Rscript
#-------------------------------------------------
# Title: Combine cell type states
# Author: Christina Meier
# Date: 2025-07-15
# Email: 19cm51@queensu.ca
#-------------------------------------------------
# Notes ------------------------------------------
# module load StdEnv/2023 r/4.5.0
#
#
... |
f6f5ac2beaffe16d9bd63e4b5a7c3a78811b7b6d48be7966ac43806c809df128 | R | 1,832 | 81 | ---
title: "Quick start to COSG"
author: "Min Dai"
date: "2021/6/18"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Quick start to COSG}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
# Overview
COSG i... |
0bed3b2b78008aeffce75a1edd8bb25d67f201d2165177fd2a3761349f548f80 | R | 1,836 | 44 | library(ggplot2)
library(ggrepel)
library(ggplot2)
library(dplyr)
library(readr)
library(ggrepel)
library(patchwork)
library(ggrastr)
# Genes to label
genes_to_label <- c('MOSMO', 'POLR3E', 'CDR2', 'UQCRC2', 'PDZD9', 'EEF2K', 'VWA3A')
#input deseq2 files (all in supplementary tables) as df.
# Define thresholds
logfc_th... |
c2536c51947a045ce2ca642623fb64daf3d762b85d8f4b10014b0db8b2c9f645 | R | 1,837 | 31 | here::i_am("scripts/2.validations/2.7.POU5F1_LTR7_enrichment/2.7.4.create_Ggorilla_BSgenome_package.R")
library(here)
library(BSgenomeForge)
wd <- here("data/neural_differentiation_dataset/genomes/")
system(paste0("wget https://hgdownload.soe.ucsc.edu/goldenPath/gorGor6/bigZips/gorGor6.2bit -P ", wd))
seed_gorGor6 <... |
5cae4340acd994f2e65cc9f4e8b485f447d06db192981beca7321d3a0d871afa | R | 1,840 | 43 | #' Tunes marker set based on specified criteria
#'
#' This function filters markers within a specified set (query or database) based on
#' absolute or relative thresholding of a given variable.
#'
#' @param ann An object containing marker data in `ann1$query` or `ann1$db`.
#' @param method The tuning method ("absolute"... |
0de03868729d90ce8f2f02aeec993835d088a59aa45581606ddd7e6853ddcdbb | R | 1,841 | 51 | library(e1071)
library(caret)
library(foreach)
library(doParallel)
library(doRNG)
## Predict age using SVR model
setwd('/home/huyang/Projects/HuYang/HY_20251111')
## Load custom functions
source('./SCRIPTS/AGE/SVR_func.R')
## Set parallel cluster to speed up
n.cores <- 20
my.cluster <- parallel::makeCluster(n.cores, ty... |
e2e7646fe32645f74e3e364d1990e8686ac1ac9e5b89f7fe8274f3dd55208c92 | R | 1,841 | 42 | library(dplyr)
library(tidyr)
gtf_path_M <- "/data/resource/reference/mouse/Mus_musculus.GRCm39.112.gtf"
gtf_table_M <- read.table(gtf_path_M, header = FALSE, skip = 5, sep = "\t", quote = "", comment.char = "")
gtf_table_M <- gtf_table_M %>% dplyr::select(-c(V1, V4, V5, V6, V7, V8))
gtf_table_M <- gtf_table_M[gtf_tab... |
348c3e13439f5f0caacd9f8e745cb1d346ec0bcd80e781ffbf7e1a9a01287db8 | R | 1,845 | 65 | #!/usr/bin/env Rscript
suppressPackageStartupMessages(library("argparse"))
# create parser object
parser <- ArgumentParser()
# specify our desired options
# by default ArgumentParser will add an help option
parser$add_argument("-i", "--bed", required=TRUE, help="input bed")
parser$add_argument("-s", "--species", def... |
ea6c744b8cc9f08683ba09b03338bffef704dc904629de2acaf761b47ad502de | R | 1,847 | 49 | ### Normalization and imputation
setwd(rstudioapi::getActiveProject())
rm(list=ls())
library(tidyverse)
library(stringi)
source("./Scripts/Function_scripts/Pre-processing_functions.R")
load(file = "./Output_data/Exp2_278.quant.lipids.byMsD.Rdata")
## Normalization and imputation should exclude all QC data, include a... |
56d3d14db6fde47e1431673ef970f52c87efe9dcf422dd3d053e4d7cb679a091 | R | 1,849 | 52 |
######################
## 1. Process SNPs ##
######################
process_snps = function(module_file, snplist_file, expr_file, geno_dir,geno_name, output_dir, brain_regions, n_cores) {
## Load data
networkList = readRDS(module_file) # Load coexpression networks
snpList = get(load(s... |
f90efeda3fce594aacb6418ce3c1f2eab354aaf07f4f462272dfef23a0138e8b | R | 1,850 | 73 | detectionp_values <- function(dnam_data) {
assay_data <- SummarizedExperiment::assays(dnam_data)$dnam
parallel <- TRUE
res_parallel <- start_parallel(parallel, cores = 8)
parallel <- res_parallel$parallel
cluster <- res_parallel$cluster
detp_mat <- plyr::ldply(
1:ncol(assay_data),
.fun = funct... |
c7593849de229700a2d11b146a40b3ededd8cc677ca23af1fa32bbed046dd612 | R | 1,851 | 33 | args <- commandArgs(trailingOnly = TRUE)
pdf(paste0(out_dir, "/LDdecay_comp.pdf"))
read.table(pdf(paste0(out_dir, "/LDdecay_comp.amos")) -> Eamos;
plot(Eamos[,1]/1000,Eamos[,2], type="l", col="red", main="LD decay", xlab="Distance(Kb)", xlim=c(0,300), ylim=c(0,0.764359875061898), ylab=expression(r^{2}), bty="n", lwd=2... |
e8715b69e8951302e1b060398a22ecaae99eda6408247bb7f3c8f848d1cc7bbe | R | 1,852 | 69 |
```{r}
library(dplyr)
library(tidyr)
library(tibble)
library(effectsize)
# Paired-samples comparisons of Insomnia Severity Index (ISI) in SAD participants.
# The paired t-test evaluates within-person change between time points (difference scores).
# Effect sizes are reported as Cohen's dz for paired samples (with 95%... |
1416b3dacef27476e5ba622323996f8588ab4c157493250bab5092b63a69dabc | R | 1,853 | 66 | library(ggplot2) # plots
library(brms) # Bayesian lmms
library(tidyverse) # tibble stuff
library(SBC)
library(bayesplot)
# set options for SBC
use_cmdstanr = getOption("SBC.vignettes_cmdstanr", TRUE) # Set to false to use rstan instead
options(brms.backend = "cmdstanr")
# using parallel proce... |
94509165e4ef7c041087d1640b2ea78f69f424168eac14c54a09ec5d75ce3eca | R | 1,856 | 47 | # Moderate effect size genes project
# Author: Madison Caballero
# Desription: Calculates % of genes are expressed above baseline per tissue
args = commandArgs(trailingOnly=TRUE)
library(ggplot2)
`%ni%` <- Negate(`%in%`)
# MES genes input:
genes = read.delim(file = "passed_genes.txt", header = FALSE)
MES_genes = gene... |
89db9edcb1748ed27bc065fbdffe88abc64488b6b349de4153575055fbfba946 | R | 1,868 | 58 | # Load libraries
library(DiffBind)
library(ChIPseeker)
library(org.Hs.eg.db)
library(GenomicFeatures)
library(dplyr)
library(rtracklayer)
txdb_ensembl <- makeTxDbFromEnsembl(organism="Homo sapiens", release='113')
##### Read files ####
samplesheets <- read.csv('../samplesheet.csv' )
# DBA
dbObj <- dba(sampleSheet=sam... |
93b9c1c3c4a1b49279e18b3fe23c3bd30484c363908192ca209bb21881fb428c | R | 1,869 | 56 | #' Parse Command-Line Arguments for LK Searchlight Analysis
#'
#' Returns a named list of arguments: H, g, sl.idx, scale, side
#'
parse_args <- function(args = NULL) {
if (is.null(args)) args <- commandArgs(trailingOnly = TRUE)
if (length(args) < 5) {
stop(paste(
"Error: Not enough arguments provided.",
... |
753be038a20c2d8adf8b38fb9e96375ae75f6ef3461d258261e70216d15afa55 | R | 1,870 | 63 | # Moderate effect size genes project
# Author: Madison Caballero
# Desription: Creates contingency tables for ASD/non-ASD individuals in SPARK based on A* and B* status
library(stringr)
library(rapport)
`%ni%` <- Negate(`%in%`)
args = commandArgs(trailingOnly=TRUE)
# Has ASD status info:
FAM <- read.delim(file = "SPA... |
1644412d0438318b13b4c0fa6bedb8c0de5c43a0b70c1592ef8e75b2b188718a | R | 1,872 | 43 | ## ---- message=FALSE, warning=FALSE--------------------------------------------
install.packages('conosPanel', repos='https://kharchenkolab.github.io/drat/', type='source')
## ---- message=FALSE, warning=FALSE--------------------------------------------
library(conos)
panel <- conosPanel::panel
## ---- message=FALSE... |
535733566d909900df5570b4fc75238bd2ac512a59c128b82abb42e70ede32ce | R | 1,874 | 52 | library(Seurat)
library(SeuratData)
library(ggplot2)
library(patchwork)
library(dplyr)
library(data.table)
seu = readRDS("C:/Users/Haoting/Downloads/seurat.rds")
SpatialFeaturePlot(seu, features = "nFeature_Spatial",pt.size.factor = 2)
slide.seq <- SCTransform(seu, assay = "Spatial", ncells = 3000, verbos... |
18aff76b3a12d6567d15c19b0b5980d92fc55b2333f7a8112a4221f8ae44a8a5 | R | 1,876 | 44 | #' Add random number columns in data frame with specific seed to validate machine learning algorightms
#'
#' @param
#'
#' @return
#'
#' @export
xgb_outer_loop <- function(data,
outcome,
seed = 20241216,
iteration = 1,
... |
4873ca08a1d4f09a50d083345c5e8d0a2d1e6f5e7b67a7333edc50716e0736b5 | R | 1,876 | 68 | ################################################################################
###############---------------- HELPER FUNCTIONS ----------------###############
################################################################################
### Helper functions used in subsequent functions and code
## Population st... |
6e6bcd888700aa61809e6031c0fae68a843feb1dc706d204a780f982c94820e6 | R | 1,876 | 37 | #' Conducts SAHA analysis on query and database data
#'
#' This function orchestrates the SAHA analysis pipeline based on the specified `data_type`.
#' It includes steps for marker-based or marker-free analysis, depending on the input data.
#'
#' @param query A data frame or path to a CSV file containing query data (ma... |
c0b07b6d40d7b049cecb8b36ba389572645af386a5a5705a3cefc0ddc008a900 | R | 1,879 | 58 | #######################################################
# Necessary packages:
library(tidyverse)
library(odbc)
library(DBI)
#######################################################
rm(list=ls())
## Current project.
projdir <- "/projects/verhaak-lab/USERS/johnsk/glass4"
setwd(projdir)
## Connect to the correct* intern... |
a764bf27381d26af6b1268a9912e65c0ef610beb4e89853710793e7cb7d69ebd | R | 1,882 | 32 | ### convert Seurat object to python AnnData object
# Method 1
# Tips:
#1. set default assay to RNA before covert to h5ad.
#2. if raw read count need to be imported to anndata, you should only contain counts slot in your seurat object before convertion (https://zqfang.github.io/2020-04-28-seurat2scanpy/)
library(Seurat... |
5808aa4d488f5c89dd22fed19c9f7a6b0a8244432d836e7a1714cb2f89b613f3 | R | 1,883 | 54 | #' Analyzes self-similarity between clusters in marker space
#'
#' Compares marker overlap between two specified clusters in the marker similarity matrix. Offers the option to return a data frame of shared features (optional).
#'
#' @param ann An object containing the `ann1$Marker_selfsim_matrix` data frame.
#'
#' @pa... |
0a48fe9535dabd483e060d909241a80a1d581d3b9d278c8285b43fb069140004 | R | 1,884 | 78 | #!/usr/bin/env Rscript
# read results from ksklearn
suppressPackageStartupMessages(library("argparse"))
# create parser object
parser <- ArgumentParser()
# specify our desired options
# by default ArgumentParser will add an help option
parser$add_argument("-i", "--input", required=TRUE, help="input matrix")
parser$... |
288241f28e089fd65c6eba8ee1b824364e7f0b30dae2d7b757c46ef9f5451cfb | R | 1,884 | 46 | ##########################
# List of genes for GSEA #
##########################
library(msigdbr)
library(purrr)
# Retrieving term lists from KEGG, Reactome and Gene Ontology
## KEGG
KEGG_msigdbr_df <- msigdbr(species = "human", category = "C2", subcategory = "KEGG")
KEGG_pathways = split(x = KEGG_msigdbr... |
45e3b13d5a62c0886c0f6081271825a14915533bf970e6cde761eeff011be6c3 | R | 1,885 | 51 | #' Initializes data for marker-free analysis
#'
#' This function performs pre-processing steps on the query and database components
#' within an `ann` object to prepare them for marker-free analysis in the SAHA workflow.
#' These steps include:
#'
#' * Removing potential column names that might interfere with analysis ... |
5fcc4959edf94e1bdd6721824654921db3ac705311e3c48d9a132c00ba25e648 | R | 1,885 | 43 | # Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
get_outliers_from_dist <- function(dist_, loop_k, loop_lambda, loop_threshold, outlier_on) {
.Call('_recombine_get_outliers_from_dist', PACKAGE = 'recombine', dist_, loop_k, loop_lambda, lo... |
954283efeafc6b06d5538ad8147b4235779ef653e938b77fef27e509b0ec930e | R | 1,886 | 54 | #' Analyzes self-similarity between clusters in marker space
#'
#' Compares marker overlap between two specified clusters in the marker similarity matrix.
#' Offers the option to return a data frame of shared features (optional).
#'
#' @param ann An object containing the `ann1$Marker_selfsim_matrix` data frame.
#' @par... |
280d798a66dc8e1af2893c9df2cf0867ebf605cd39b3f7966ef2ea81e02ddba7 | R | 1,889 | 68 |
```{r}
library(dplyr)
library(stringr)
library(purrr)
library(tidyr)
# Pearson correlations between SCFA change scores and LSAS-SR change scores
make_cor_labels <- function(dat,
beh_label,
acid_pattern,
comparison_label) {
dat_cle... |
413b6aa8cf6872c761f3c154be8b9414bec732cd44b00b09cb390ead00d49ef2 | R | 1,890 | 41 | ##################################
### Upload new files data for CARE WXS files
### Author: Kevin Johnson
### Date updated: 2022.02.18
##################################
library(tidyverse)
library(odbc)
library(DBI)
library(stringi)
## Establish connection with GLASS 4 database.
con <- DBI::dbConnect(odbc::odbc(), "Ve... |
695801cedd8ca26e494845b45f22ab93458e3350a04015bf8e7a9c5c6ceadc3b | R | 1,893 | 58 | library(Seurat)
library(ggplot2)
library(dplyr)
library(cowplot)
library(reshape2)
library(MIN)
library(EnhancedVolcano)
MG <- subset(DV,idents = c('5','26') )
saveRDS(MG,"DVPV_MG_subset.rds")
AST <- subset(DV,idents = c('1','25') )
saveRDS(MG,"DVPV_AST_subset.rds")
DefaultAssay(MG) <- 'integrated'
all.genes <- rown... |
8e4fee49b917931154acc4b406b019e2d4e3448553e12c0aee1fc9ebd6a41980 | R | 1,894 | 70 | context("test ALPACA result")
test_that("ALPACA works", {
suppressWarnings(load("./testDataset.RData"))
simp.alp <- alpaca(simp.mat,NULL,verbose=F)
expect_equal(as.vector(simp.alp[[1]]),simp.memb)
})
test_that("alpacaTopEnsembltoTopSym() converts gene identifiers", {
mod.top <- list(c("ENSG001"... |
5ce5993519893fa28706422cf2a23a10642b49608932eaeaa5b3f95860bf6c29 | R | 1,899 | 49 | #' Initializes data for marker-free analysis
#'
#' This function performs pre-processing steps on the query and database components within an `ann` object to prepare them for marker-free analysis in the SAHA workflow.
#' These steps include:
#'
#' * Removing potential column names that might interfere with analysis (`"... |
e107c5466021660484f50b61fd18999e9c659148eefa46538e02ab5c030b4da3 | R | 1,899 | 58 | #' Create a unique spot identifier
#'
#' This function adds `spe$key` to a
#' [SpatialExperiment-class][SpatialExperiment::SpatialExperiment-class] object
#' which is unique across all spots.
#'
#' @inheritParams add10xVisiumAnalysis
#' @param overwrite A `logical(1)` indicating whether to overwrite the `spe$key`.
#'
#... |
69c40116662b5d6af28d64d0fe97a8d05c17734e6c6f30983ee1dc531195863b | R | 1,900 | 48 | ################################################################
# Plotting total variance explained by factor (all 50 factors) #
################################################################
library(MOFA2)
library(ComplexHeatmap)
library(dplyr)
library(circlize)
library(reshape2)
library(ggsci)
# Retriev... |
452aa7689895caa3a3e647884dad275cfcc8f88ef5defcf79a22f09e8448f73d | R | 1,903 | 45 | do.initial.fit<-function (x, y, initial.lasso.method = c("scaled lasso",
"cv lasso"), lambda, verbose = FALSE)
{
no.lambda.given <- missing(lambda) || is.null(lambda)
if (!no.lambda.given && verbose) {
cat("A value for lambda was provided to the do.initial.fit functi... |
56d5b7c6dc8f77e800e92ba44f2da2d4a3e5aa9627818f523506706c04796dc2 | R | 1,903 | 71 | #
# pliu 20160911
#
# install Bioconductor and pRSEM-required libraries to this directory
#
# require R-3.3.1
#
# CRAN: data.table, caTools
# Local: spp
# BioC v3.3: ShortRead, GenomicRanges
#
# install devtools first and use its' install_version to install packages in
# particular version.
#
# packages repos ... |
b3e7710a06b752e03110576637617db3e0919ed6637eeb8299dbcf8e409b7f1a | R | 1,905 | 48 | #!/usr/bin/env Rscript
# Import TPM matrix for CIBERSORTx
# Copy TPM matrix from 03.Normalization, add GeneSymbol header, and save to 01.IMPORT_MIXTURE
# Source and destination directories
source_dir <- "/home/joonho345/1_Epilepsy_RNA/RNA_Human/03.Normalization"
dest_dir <- "/home/joonho345/1_Epilepsy_RNA/RNA_Human/09... |
faf3a4f85b678d54b84fae9bebb4af6a9da92bf3137dce514eab6cf8f2e8070a | R | 1,906 | 56 | #' Initialize Self-Similarity Matrices
#'
#' This function initializes self-similarity matrices based on the specified slot.
#'
#' @param ann An object containing annotation data.
#' @param slot A character string specifying the slot. It can be "AvgExp" or "Markers".
#' @return An updated object with the self-similarit... |
3cb2f8dcd1b02ba4f505585f82f82fdd528e5856c0874e349b19740e076a04c7 | R | 1,907 | 57 | ### COX proportional hazards analysis ###
#following this tutorial: http://www.sthda.com/english/wiki/cox-proportional-hazards-model
#title: "Post-hoc COX analysis test"
#author: "Mona Zimmermann"
#date: ""
#output: html_document
#### Email: m.l.m.zimmermann@amsterdamumc.nl
#### Purpose of script: Post-hoc ... |
82cb22b321cd61f00f5c055bf4cf48d7496c894452877927dbcc9bfb5601ce42 | R | 1,907 | 43 | ##################################
# Plot the longitudinal shift in MES-like malignant cells in publicly available snRNAseq
# Author: Kevin Johnson
##################################
library(tidyverse)
library(ggpubr)
library(EnvStats)
proj_dir <- "/vast/palmer/pi/verhaak/kcj28/care_idh_mut/"
fig_dir <- file.p... |
f23c9f0ad03e80f00395eb9c5c4b70a7ca74f76c30afb89564e3ba57e6faf780 | R | 1,907 | 62 | # Set base directories
# base_dir = "path/to/conditional/results/"
# metadata_path = "path/to/metadata.RData"
base_dir = "./result/conditional.results/"
metadata_path = "./metadata.RData"
##### load metadata
load(metadata_path)
##### load Loci
load(file.path(base_dir, "Loci.RData"))
to.keep = names(table(L... |
457d3739d10b2fac15ddd203f8e325389207bfa225d722ce59a6e63a19c5c6de | R | 1,915 | 52 | #' Summarize cell counts and proportions inside spatial regions
#'
#' Computes the number and proportion of cells from each cluster
#' inside boundaries or ring regions.
#' This function is useful for downstream visualizations such as bar plots or
#' pie charts showing the spatial composition of cell types per region.
... |
339968f5b81b969f5f11154575e8a00335b193d0c435f982f6843025054e3524 | R | 1,917 | 52 | ### Normalization and imputation
setwd(rstudioapi::getActiveProject())
rm(list=ls())
library(tidyverse)
library(stringi)
source("./Scripts/Function_scripts/Pre-processing_functions.R")
load(file = "./Output_data/GPMV_291.quant.lipids.Rdata")
## Normalization and imputation should exclude all QC data, include actual... |
977492118e3585eb5ef3073d2c0c579b7c8d0a2e27cfdd530f5e0e6c71c1c5e6 | R | 1,920 | 51 | ### Normalization and imputation
setwd(rstudioapi::getActiveProject())
rm(list=ls())
library(tidyverse)
library(stringi)
source("./Scripts/Function_scripts/Pre-processing_functions.R")
load(file = "./Output_data/M2PM_397.quant.lipids.byMsD.Rdata")
## Normalization and imputation should exclude all QC data, include a... |
9a47e97d6e1ecff648cf6baf9777179ecd059fe0a783463cae0b7a2247cb9f1f | R | 1,921 | 49 | # Moderate effect size genes project
# Author: Madison Caballero
# Desription: Finds B* mirrored inheritence for A* cases
args = commandArgs(trailingOnly=TRUE)
# Gene A that we are comparing to other genes
geneA = args[1]
IN <- read.delim(file = "intermediates/1_valid_probands.passed.txt", header = TRUE, sep = "\t")... |
a3c45de4ff15d38961d83d88236fbb88c0fdc986d010ccc116b26549cf76ac21 | R | 1,922 | 54 | library(methods)
library(splatter)
getLNormFactors <- function(n.facs, sel.prob, neg.prob, fac.loc, fac.scale) {
is.selected <- as.logical(rbinom(n.facs, 1, sel.prob))
n.selected <- sum(is.selected)
dir.selected <- (-1) ^ rbinom(n.selected, 1, neg.prob)
facs.selected <- rlnorm(n.selected, fac.loc, fac... |
cf346fe8ccc10087b988a4f3e1f629ffee4ab9cc956a1d8eafa2d51daa5f5fe3 | R | 1,922 | 63 | ```{r}
library(readxl)
library(writexl)
library(dplyr)
library(stringr)
library(here)
# 1. Setup paths
input_dir <- here("Data", "raw", "EEG", "hypnograms_xls")
output_dir <- here("Data", "processed", "EEG", "unblinded_hypnograms")
if (!dir.exists(output_dir)) dir.create(output_dir, recursive = TRUE)
# 2. Load Blin... |
09fb684422a7f80ce90a2b86810f9ce9850cccde464fafd057bad3dd9799ec3d | R | 1,923 | 32 | library(testthat)
library(netZooR)
# Download shared test data with error handling and caching
test_data_dir <- file.path("testthat")
dir.create(test_data_dir, showWarnings = FALSE, recursive = TRUE)
download_if_missing <- function(url, dest) {
dest_path <- file.path(test_data_dir, dest)
if (!file.exists(dest_pat... |
332bfa97a0fbd3fcdfa69640e43238485b68d4b1eb4e3539f84469d20f17b478 | R | 1,924 | 65 | library(tidyverse)
library(doParallel)
library(foreach)
load("Labonte_BA89_regressed.RData")
prsCor = function(i, gene, datExpr.local) {
c <- cor.test(datExpr.local[i,], datExpr.local[gene,], use = 'pairwise.complete.obs')
dfPrs <- data.frame(Gene = rownames(datExpr.local)[i], R = c$estimate, P = c$p.value)
re... |
6761b0ea8203557385dde94bd5d4c8a0f8ed5d90c64002eaa1bb51a3f5b68edd | R | 1,927 | 49 | #######################################################
# Enumerate cumulative coverage per aliquot for WGS/WXS
# Date: 2018.11.06
# Author: Kevin J., FP Barthel
#######################################################
options(scipen=999)
## Parse snakemake
if(exists("snakemake")) {
files = snakemake@input[["metric... |
695993d11d54bceeb779976087f29842d1940d040bc354e7b738e433ce7c9efd | R | 1,929 | 45 | library(dplyr)
#### coldata ####
coldata <- read.csv("/data/project/1_Epilepsy_RNA/RNA_Human/Raw_Data/Patients_sheet_FTP_0.csv", header = TRUE)
rownames(coldata) <- coldata$Run
ncol(coldata)
nrow(coldata)
coldata_df <- as.data.frame(coldata, stringsAsFactors = FALSE)
#### matrix ####
# Define the path to your files ... |
4dbcbe6229b381a3f3fde7083d31373e803e6b5ee8ce8fc8e8435e0154f57c89 | R | 1,935 | 53 |
```{r}
library(dplyr)
library(tibble)
library(stringr)
# Baseline SCFA vs LSAS-SR change in SAD participants (Pearson correlations).
# This evaluates whether baseline SCFA concentrations are associated with:
# (i) short-term LSAS-SR change (Pre→Post; lsassr_change_post) and
# (ii) long-term LSAS-SR change (Post→Long-... |
30bd17878ebfbe617d04af35d0cea980374cb2c889e34c7a6fa442709c8dfa6a | R | 1,936 | 64 |
```{r}
library(dplyr)
# Individual-level SCFA data
df_scfa <- df_scfa %>%
mutate(across(contains("acid"), as.numeric))
# Add the prefix "Batch " to the batch column in df_scfa
df_scfa <- df_scfa %>%
mutate(batch = paste("Batch", batch))
# QC/batch-level SCFA data
df_scfa_batch <- df_scfa_batch %>%
rename(batc... |
c9f3b0b075957de152822c34c70e6b4fc5b47be907038ffc259aa9adba69967e | R | 1,937 | 70 | #' Handle raw and nm calibrated FANC coordinates
#'
#' @description \code{fanc_voxdims} returns the image voxel dimensions which
#' are normally used to scale between \bold{raw} and \bold{nm} coordinates.
#'
#' @param url Optional neuroglancer URL containing voxel size. Defaults to
#' \code{getOption("fafbseg.sampl... |
d7be2fbb2443dc59584ae5e67d13571f78c80a11802b0381294cf63fb3cfe788 | R | 1,941 | 50 | # Runs a generic MLflow command through the command-line interface.
#
# @param ... The parameters to pass to the command line.
# @param background Should this command be triggered as a background task?
# Defaults to \code{FALSE}.
# @param echo Print the standard output and error to the screen? Defaults to
# \code{T... |
fab0de3af8c0cc12daaa96b174592b2ef413aa1e4243f36e1313691f00351ec8 | R | 1,946 | 57 | #!/usr/bin/env Rscript
# -*-coding: utf-8 -*-
#-----------------------------------------------
# Title: Helper function to save plots as both PDF and PNG
# Author: Amanda Zacharias
# Date: 2025-09-04
# Email: 16amz1@queensu.ca
# Notes -----------------------------------------------
# module load StdEnv/2023 r/4.5.0
# ... |
ed44c153005bc573e858e9fafc4c932423a86f7ff5b78c30be191c58a29c7302 | R | 1,948 | 75 | require(magrittr)
require(dplyr)
require(Seurat)
my.spl_fun <- function(df, group.label, map_key, seed=42L) {
set.seed(seed)
df %>% filter(!!sym(group.label) %in% names(map_key)) %>%
group_by(!!sym(group.label)) %>%
sample_n(size=map_key[!!sym(group.label)])
}
my.sketchObject <- function(
object, sketch... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.