sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
2e3e204fef3267cbfbbfbfd0c99b9a1846ce6770ed2dd1be04d453aa566b5fc1 | R | 1,297 | 42 | #!/usr/bin/env Rscript
#-------------------------------------------------
# Title: Download single cell DRG data
# Author: Christina Meier
# Date: 2025-05-22
# Email: 19cm51@queensu.ca
#-------------------------------------------------
# Notes -------------------------------------------
# Load in data downloaded from G... |
39f389220b92ea2c0442de9a090135145b41fb4df43d907484fc21b609ea16cb | R | 1,307 | 36 | library(dplyr)
library(tidyr)
gtf_path <- "/home/joonho345/resources/Reference/Homo_sapiens.GRCh38.112.gtf"
gtf_table <- read.table(gtf_path, header = FALSE, skip = 5, sep = "\t", quote = "", comment.char = "")
gtf_table <- gtf_table %>% dplyr::select(-c(V1, V4, V5, V6, V7, V8))
gtf_table <- gtf_table[gtf_table$V3 == ... |
eff096082e748e42f208267c6084e4650e5ff156f1ea75f90ab7126538bdf97b | R | 1,309 | 35 | #' Function factory for saving objects to specific directory with constant time code
#'
#' @param dir: target directory
#'
#' @return save function
#'
#' @importFrom magrittr %>%
#'
#' @export
mysavefactory <- function(objectdir = "rds", plotdir = "cache", time = Sys.time()) {
datetime <- format(time, '%Y%m%d_%H%M%S'... |
d2ae4271e5346902ba1510e5363aa4b9e633080f0f020a4b88e7d396983d1f5e | R | 1,313 | 31 | # prepare a data set to be used below
data_path <- 'ellahi'
sample_ids <- grep('^SR', dir(data_path), value = TRUE)
sample_ids <- rev(sample_ids)
target_mapping <- read.table(file.path(data_path, 'target_mappings.txt'), header = TRUE,
stringsAsFactors = FALSE, sep="\t", quote="")
incomplete_mapping <- read.table(f... |
eda0c37b66f63d35a699945e12b5dff5f59549dc59b81558d98a62514566fd2c | R | 1,315 | 47 | # remotes::install_github("prabhakarlab/Banksy")
library(Banksy)
library(scater)
library(anndata)
library(SpatialExperiment)
library(cowplot)
set.seed(101)
path <- "./ST.h5ad"
ST <- read_h5ad(path)
st_adata <- t(ST$X)
#Spatial coords
x<- ST$obs$array_row
y<- ST$obs$array_col
spatial_location_anndata<- data.frame(sdim... |
713ad61343c7a85cdf3dfee5280ca982bd553e9d1984b4550cd651d0bc90d837 | R | 1,316 | 27 | library(devtools)
library(sva)
#### matrix and coldata ####
# Read data from text files saved by 03.Matrix.R
merged_matrix <- as.matrix(read.table("/home/joonho345/1_Epilepsy_RNA/RNA_Human/02.Quantification/merged_matrix.txt",
sep = "\t", header = TRUE, row.names = 1, check.name... |
5d6e9044ba1ce1ee814322d5a593b300cc6e81e3d21492a92fc1e2b670496fe3 | R | 1,318 | 50 | #!/usr/bin/env Rscript
#######################################################
library(odbc)
library(DBI)
#######################################################
rm(list=ls())
# Establish connection
con <- DBI::dbConnect(odbc::odbc(), "VerhaakDB4")
args = commandArgs(trailingOnly=TRUE)
# test if there is at least ... |
148551c4044a123963394e331e79f1b5e372bf5a42e3c804bc495b0fd0f6080b | R | 1,321 | 54 | #' @title Slow R-based Brunner-Munzel tests
#'
#' @description
#' Takes a binary matrix of voxels and a vector of behavior
#' and runs Brunner-Munzel tests on each voxel.
#' This function is not compiled and is slow.
#'
#' @param lesmat matrix of voxels
#' @param behavior vector of behavior
#' @return
#' Returned list ... |
3d8e42de8787053b80046bb7f99ab52329e5d856c7b436449ec9bf01fc58c400 | R | 1,326 | 40 | library(magrittr)
options(repos = c(CRAN = "https://cloud.r-project.org"))
list_packages <- c("xgboost",
"pdp",
"smoof",
"mlrMBO",
"lhs",
"shapviz",
"ggfittext",
"gggenes",
... |
e098d3b0c009078e96fbd759f6b211a3bf8bd20b2627b8cbe3639e42d9749336 | R | 1,326 | 37 | # Load necessary libraries
library(ggplot2)
library(reshape2)
library(viridis)
# Create the data for sound sensitivity analysis (full distribution)
data_exp3 <- data.frame(
Near_Sound = c(2, 5, 5, 3, 1),
Zone2 = c(6, 5, 10, 3, 9),
Zone3 = c(11, 22, 11, 10, 19),
Zone4 = c(40, 43, 31, 22, 49),
Far_Sound = c(44... |
6f5956cec059e776282a6810306aaf63e872be29c45c72206a9e57eb72544714 | R | 1,328 | 41 |
# a simple memory cache that can efficiently store and fetch many small values
vcache <- memoise::memoise(function(cachename, default=NA){
check_package_available('fastmap')
fm=fastmap::fastmap(missing_default = default)
fm
})
vcache64 <- function(cachename) {
vcache(cachename, default = bit64::as.integer64(0... |
c9ff416a45b07fc506bf272c543cd75f94b002fcbd7eabcfe870a863c9674b4f | R | 1,333 | 27 | library(ggplot2)
library(dplyr)
# read the missingness table
miss_table <- read.table("data/variant_filtering/missing/miss_table.txt",
header = TRUE)
miss_table$percent_out <- round(miss_table$n_filter/miss_table$n_tot*100, 2)
miss_plot <- ggplot(miss_table) +
geom_line(data = miss_table %>... |
b8bcdee7b1326fc5cc542b8cf747e3c076eab11b908d4e4f08ba5ebac6f6f39a | R | 1,335 | 37 | # Load necessary libraries
library(ggplot2)
library(reshape2)
library(viridis)
# Create the data for light attenuation sensitivity analysis
data_exp2 <- data.frame(
Zone1 = c(6, 7, 6, 5, 7),
Zone2 = c(0, 0, 0, 0, 0),
Zone3 = c(5, 4, 2, 14, 19),
Zone4 = c(0, 5, 26, 15, 13),
Zone5 = c(1, 79, 266, 266, 261),
... |
d70a9c20ccee21535a670b7d6ed076b3831451fbbb42ec1d4ca6689091f81249 | R | 1,338 | 52 | PL2_MVMR = function(ab){
b<-ab
cov = matrix(nrow = exp.number, ncol = exp.number)
w=NULL
for(l in 1:nrow(r_input)){
for(pp in 1:exp.number){
for(p2 in 1:exp.number){
cov[pp,p2] <- correlation[pp,p2]*stderr[l,pp]*stderr[l,p2]
}
}
segamma<-r_input$sebetaYG
... |
8ee192ed929dcc8a3845445d5b50f6b03877d86ec8bd6d7dcef1ad4f11bd4cb4 | R | 1,342 | 40 | test_that(
"prep_stitched_data",
{
if (!exists("spe")) spe <- fetch_data("spe")
# Missing exclude_overlapping
expect_error(
{
temp <- prep_stitched_data(
spe,
point_size = 2, image_id = "lowres"
)
... |
a97299d2d769c96bb157d171643f797e76eddd0d0bf936d34af2023361050725 | R | 1,343 | 40 | #This code combines atc data frame to covariates used in analysis
#projectID: VL20243010
#by: Aleksi Kristian Winstén
#date: 20.11.2024
#University of Turku
setwd("/home/ivm/Projects/VilleLangen/EKG-MachineLearning/")
library(data.table)
library(dplyr)
library(tidyr)
#load atc data
df <- fread("./Data/medication_codes... |
cbb2680c2d4f820237228b2c6d60335b6a3a1d283f42ee30d17ef72b9f733c73 | R | 1,343 | 37 | initial.estimator<-function (betainit, x, y, sigma)
{
if (!((is.numeric(betainit) && length(betainit) == ncol(x)) ||
(betainit %in% c("scaled lasso", "cv lasso")))) {
stop("The betainit argument needs to be either a vector of length ncol(x) or one of 'scaled lasso' or 'cv lasso'")
}
warning.sigma.me... |
38a1a2e85a838d31733ee330891a46f00260b846cace3c625811a79bc9ed8d81 | R | 1,346 | 33 | context("running full sleuth pipeline")
test_that("transcript level analysis", {
# transcript level results
transcript_result <- sleuth_prep(study_mapping, study_formula)
transcript_result <- sleuth_fit(transcript_result)
expect_equal(transcript_result$fits$full$models, trans_test_data$fits$full$models)
exp... |
76367c9f0e870ddc7029409f2bb34e1259b40c1aaa98d8a3287d0964fcaebeee | R | 1,346 | 33 | library("spatialLIBD")
## Maybe subsetting the sce object will help
## with the memory issues at
## https://travis-ci.com/LieberInstitute/spatialLIBD/builds/150177257?utm_medium=notification&utm_source=slack
if (!exists("sce")) sce <- fetch_data(type = "sce", eh = ehub)
lobstr::obj_size(sce)
# 2.08
# GB
## Subsetting... |
80f9b066385fc4680b1a2dd3ff1f3631081a38b385490e7f15351048c8912a6a | R | 1,347 | 32 | #' Fetch information for one or more users
#'
#' @param uids A vector of user ids or a dataframe with a \code{user_id} column
#' @inheritParams flywire_cave_client
#'
#' @return A dataframe of user information
#' @details Note that since April 2025, the upstream \code{middle_auth} service
#' requires admin privileges... |
3a458991a2e411abd12343903806d583bf4ad747d536d18a6d66fd1f29a15c27 | R | 1,350 | 56 | library(data.table)
#' Generate equally spaced intervals between start and end
#'
#' @param start Numeric scalar. Start of the range.
#' @param end Numeric scalar. End of the range.
#' @param n Integer. Number of equally‑spaced chunks desired.
#'
#' @return A data.table with two columns: `from` and `to`, each row repr... |
b838b586e1a270e9460b62d785faf3ab738eeaf216da64978d5ff1837f1dfd25 | R | 1,350 | 56 | library(dplyr)
data <- ipsc_family_variants
#extract fam3 variants
filtered_data <- data %>%
filter(Sample %in% c("3_1_10", "3_3_1", "3_2_1", "3_4_2", "SG226"))
write.csv(filtered_data, "iPSC_variant_data_fam3.csv")
#3110_versus_321_331_342
iPSC_variant_data_3 <- iPSC_variant_data_fam3
immature_3110_versus <- i... |
1ffa6ec2981800c4c486a8b23ece0fc316b00d620f3267ca48cd702b0e30f6e1 | R | 1,357 | 49 | #' Fit Lattice Kriging Model
#'
#' Fits a Lattice Kriging model to the provided locations and gradients.
#' Returns the fitted model object.
#'
#' @param locations Matrix of spatial coordinates (n x 3)
#' @param values Vector of spatial data (n)
#' @param LKparams List of LK model parameters (from JSON)
#' @param covar... |
d065ed19535fa53a6a315bdfcca798e9e1e247bd9928c6af070d233149aebee9 | R | 1,357 | 44 | replace_NA_taxa <- function(dt, pattern = "unknown_", mode = c("column", "left", "last")) {
require(data.table)
mode <- match.arg(mode)
dt_copy <- copy(dt)
cols <- colnames(dt_copy)
if (mode == "column") {
for (col in cols) {
na_rows <- which(is.na(dt_copy[[col]]))
set(dt_copy, i = na_rows,... |
0f0ea20d45d3ea3648fd23d82258ea330606d1b5c162f79cbaae6e9f3a589387 | R | 1,360 | 28 | suppressMessages(suppressWarnings(library(Seurat)))
suppressMessages(suppressWarnings(library(future)))
suppressMessages(suppressWarnings(library(dplyr)))
### Get the parameters
parser = argparse::ArgumentParser(description="Find markers with Seurat")
parser$add_argument('-I','--input', help='input Rdata')
parser$add_a... |
68f69162b49f723b2bd0024105dad6edccaceb9fd4b749bbda8b2db065fdac44 | R | 1,364 | 47 | # R script for comparing correlations of predicted and true atrophy rates using the cocor package
# Author: Maryam Hadji, University of Eastern Finland, Kuopio, Finland (maryamh@uef.fi)
# Last updated: 20-Feb-2025
#
# Description:
# This function loads two RData files, extracts the 5th highest Pearson correlation value... |
800e6428f0d7c3420c037cc2952b22e81f576a8c6d05886245d056ecd0a18de7 | R | 1,364 | 47 | #' @include model.R
#' @include model-python.R
NULL
create_default_conda_env_if_absent <- function(
model_path,
conda_env,
default_conda_deps = list(),
default_pip_deps = list()) {
if (!is.null(conda_env)) {
dst <- file.path(model_path, basename(conda_env))
if ... |
541ddfc7f107567cbe995f1b6a10ecd9bc6ddae2ada45ee44b6c01b1ae3ac893 | R | 1,365 | 40 | #' Marker Richness Function
#'
#' This function calculates the richness of markers within clusters, either using all genes or a specified set of variable features.
#'
#' @param ann An object containing annotation data.
#' @param varfeat A vector of variable features (genes) to consider. If NULL, all genes are used.
#' ... |
cf9c6ffd0427613936b21affbcdf28027b5ec654cf80bf52a06fb3a3a42ee3c4 | R | 1,365 | 29 | #' Vector of LIBD layer colors
#'
#' A named vector of colors to use for the LIBD layers designed by Lukas M.
#' Weber with feedback from the spatialLIBD collaborators.
#'
#' @format A vector of length 9 with colors for Layers 1 through 9, WM, NA and
#' a special WM2 that is present in some of the unsupervised clusteri... |
97efda8e54a309e8b9ab1d1379dcb286bb081114d1623b9f8de7ba1447e07901 | R | 1,368 | 53 | # Load required libraries
library(eegkit)
library(scales)
library(fields)
plot_electrode_frequencies <- function(electrode_data, output_pdf) {
# Load built-in EEG layout
data(eegcoord)
enames <- rownames(eegcoord)
# Rename expected columns
names(electrode_data)[names(electrode_data) == "Category"] <- "el... |
beb7a45addef08e2d47f88860d4555aea4cb358830b4bd20ead3e02e3bcc51b5 | R | 1,371 | 33 | ### Double bond composition analysis
setwd(rstudioapi::getActiveProject())
rm(list = ls())
library(tidyverse)
source("./Scripts/Function_scripts/Pre-processing_functions.R")
load("./Output_Data/GPMV_MsD.Raw.conc.Norm_Impt_291_lipids.Rdata") #from script #3
## ==== Aggregate lipids with the same number of double bond... |
f64364705f24d36d8ce624e567468d03c91b3cc3c20f15c787f61dc8c1702667 | R | 1,376 | 32 | rm(list = ls())
gc(reset = T)
source('script/Functions/Functions.R')
pkgs[which(load.packages == F)]
rpid = Sys.getpid()
options(future.globals.maxSize = 1000 * 1024^3)
#-------------------------------------------------------------------------------
{
obj_monocle = My_RunMonocle(sce, assay = "RNA", slot = "counts")
... |
de5bd4c6b31848b642e3d0f433c2332eee3d8e02f1f9ca25392a6e0ad578d490 | R | 1,379 | 39 | # map plot
library(tidyverse)
library(raster)
library(rgdal)
library(sf)
# load data
coords <- read.table("data/samples_coordinates.csv", sep = ",", header = T)
wel_coords <- coords[coords$pop=="wel",]
sel_coords <- coords[coords$pop=="sel",]
lpa_coords <- coords[coords$pop=="lpa",]
world_map <- rgdal::readOGR("plots... |
9a884f27f8145986a575df038a43942ba503f58fae49e45ab4de52696cb27c9d | R | 1,380 | 47 | library(anndata)
library(Matrix)
library(Seurat)
library(dplyr)
set.seed(1)
##Read paths
args<-commandArgs(trailingOnly = TRUE)
st_path = args[2]
sc_path <-args[1]
celltype_key <- args[3]
output_path <- args[4]
sc<-read_h5ad(sc_path)
sc <- sc[rowSums(sc$X)!=0]
sc$var_names <- make.unique(sc$var_names)
celltypes <- sc... |
2bfd4cdacecd95bb760f39d3c7be6d26a801b724ce3733616aa269bcd1170990 | R | 1,382 | 40 | library(Seurat)
library(SeuratData)
library(cowplot)
library(dplyr)
library(SeuratDisk)
#InstallData("bmcite")
#Loading data
bm <- LoadData(ds = "bmcite")
#saving groundTruth
write.csv(bm@meta.data['celltype.l2'], 'bmcite30k_groundTruth.csv')
#preprocessing RNA assay
DefaultAssay(bm) <- 'RNA'
bm <- No... |
4bff9b5a803e3c1e344874a1efbb21a7f8f2be2a04899f23c583db70380714bd | R | 1,382 | 52 | model_type <- function(x) {
if (is.function(x)) return(model_type(x()))
if (is.list(x) && !is.null(x$type)) return(x$type)
as.character(x)
}
.model_list <- function(x) {
if (is.function(x)) return(x())
x
}
is_ordered_response_type <- function(x) {
identical(model_type(x), "ORDERED")
}
is_multinomial_resp... |
71220d811b3398acb286923258d9f9b6e88d2513792ae918ef9fd4f2c9c55c02 | R | 1,382 | 30 | library("bedr")
library("rtracklayer")
suppressPackageStartupMessages(library('GenomicFeatures'))
args <- commandArgs(trailingOnly = TRUE)
intron_coord <- args[1]
Intron_processed <- read.table(intron_coord, sep="\t")
Intron_processed <- Intron_processed[-1, ]
Intron_processed$"V4" <- as.integer(Intron_processed$"V4... |
e6b9febcc253ee129b3a78cadfe4c0833ba275a78ce06bad843c89677fe165f9 | R | 1,382 | 63 | run_lda_performance <- function(
df,
target,
predictors,
n_repeats = 100,
k_folds = 5,
seed = 1234
) {
set.seed(seed)
data <- df %>%
dplyr::select(
dplyr::all_of(target),
dplyr::all_of(predictors)
) %>%
tidyr::drop_na()
lda_re... |
f733e9d010712f0795be728c68bb72f50d0ff6848286ce786e8419cf2f45723a | R | 1,382 | 44 | # Load required libraries
library(fmsb)
library(viridis)
# Your data
data_spider <- data.frame(
Biological_Realism = c(3.5, 4.5, 2.5),
Model_Complexity = c(3.5, 4.5, 3),
Computational_Demand = c(3.5, 4.5, 4.5),
Adaptiveness = c(3, 5, 2),
Predictive_Power = c(3, 4, 3.5),
Data_Requirements = c(3.5, 4, 5),
... |
d9d150a623e23b8e4c999fa8e38aa19078a453f2ec43d92084eae0fc479a374e | R | 1,383 | 59 | #' Simplified tissue surface of FANC
#'
#' @name FANC.surf
#' @docType data
#' @description This is unsymmetrical and not normalized version of the mesh. It
#' is calibrated in nm.
#'
#' @examples
#' \dontrun{
#' # Depends on nat
#' library(nat)
#' wire3d(FANC.surf)
#' }
"FANC.surf"
#' Simplified tissue surface of ... |
2528d5778c2020075f23699f06021618f4b8e9e315c51c569311097942e85ce0 | R | 1,385 | 37 | # Function to count occurrences of unique values in a categorical variable
count_occurrences <- function(data, output_file, sort_order = "desc") {
library(dplyr) # Load dplyr for data manipulation
# Ensure data is in character format to avoid issues
data <- as.character(data)
# Remove NA values before fu... |
7f6e4160146db42ab9a7a7dd1b7af1ffd659a9b54cb2044d659ee81f54f72201 | R | 1,385 | 27 | suppressMessages(suppressWarnings(library(Seurat)))
suppressMessages(suppressWarnings(library(future)))
parser = argparse::ArgumentParser(description="Find markers")
parser$add_argument('-I','--input', help='input Rdata')
parser$add_argument('-O','--out', help='input output filename prefix')
args = parser$parse_args(... |
3db428383950981670218fb46c9e94c6557ef7e5c4ea63d68b2370febc6b8695 | R | 1,387 | 40 | library(TFBSTools)
library(RSQLite)
library(Biostrings)
setwd("./SpaDC/GRN")
# Connect to JASPAR2024 database
jaspar_db <- dbConnect(RSQLite::SQLite(), "JASPAR2024.sqlite", flags=RSQLite::SQLITE_RO)
opts <- list(species = "Mus musculus", collection = "CORE")
motifs <- getMatrixSet(jaspar_db, opts)
# read shuffled_pea... |
dc18d75526d12c249a65be012caddffadd3cc6abbb69eb7cd9886d363b3a8494 | R | 1,389 | 39 | library(Seurat)
library(SeuratData)
library(cowplot)
library(dplyr)
library(SeuratDisk)
#InstallData("cbmc")
#Loading data
cbmc <- LoadData(ds = "cbmc")
#saving groundTruth
write.csv(cbmc@meta.data['rna_annotations'], 'cbmc8k_groundTruth.csv')
#preprocessing RNA assay
DefaultAssay(cbmc) <- 'RNA'
cbmc <-... |
60280af45ca85d06011341353bd4297bc4b31363752370b6b6fd67404280137c | R | 1,390 | 42 | suppressPackageStartupMessages({
library(biomaRt)
library(tidyverse)
})
# Load Data
load("dge/Metallome_Dge_Data.RData")
# Convert to human
human = useMart("ensembl", dataset = "hsapiens_gene_ensembl")
mouse = useMart("ensembl", dataset = "mmusculus_gene_ensembl")
MGI = getLDS(attributes = c("mgi_symbol"), filters ... |
8b7c3ea75b7e67fdc6be75f9b453ca62bb53752c0322d65513fadc9396a6f9bf | R | 1,391 | 35 | ### Append concentration to each internal standards
setwd(rstudioapi::getActiveProject())
rm(list=ls())
library(tidyverse)
library(stringi)
## Generate data frame with concentration for each internal standard
IS.label <- read.csv("./Input_Data/Labelled_IS_concentration_2020_052020.csv", stringsAsFactors = F,
... |
a08226a7621dce8aa89c0f8a8d6bc71b31e1bdfd9030159fc7aa18f75ea38c82 | R | 1,391 | 35 | RNGkind("L'Ecuyer-CMRG")
set.seed(123)
# Create subject-level design
subj_design <- design(data = forstmann, model = DDM,
formula = list(v ~ S, a ~ E, t0 ~ 1),
contrasts = list(S = contr.helmert))
# Add some age covariate and roughly demean
# Demeaning is important to ensur... |
2dbf43df7f1d1aa9549b836477c9b5e388a925e4c710b38e166fc6840bd6e9a4 | R | 1,396 | 42 | #111 is p1C_007, 3110 is P2C_079 and 414 is P1C_077
#exmaple code
library(dplyr)
df1 <- fam1_111_polr3e_variants_fc0.5_density_input%>% mutate(Source = "111")
df2 <- fam3_3110_polr3e_variants_fc0.5_density_input%>% mutate(Source = "3110")
df3 <- fam4_414_polr3e_variants_fc0.5_density_input%>% mutate(Source = "414")
... |
ce781797eef24be78ebfca50cae0669ac748800c8b70f0f0fe5703dd1bb6529f | R | 1,403 | 58 | library(Maaslin2)
library(tidyverse)
data_dir <- file.path(project_dir, "Data")
met_dir <- file.path(data_dir, "Metabolomics")
meta_file <- file.path(data_dir, "QIIME2", "metadata_mouse.tsv")
metadata <- read.table(
meta_file,
header = TRUE,
sep = "\t",
check.names = FALSE,
comment.char = ... |
b2bfab653a17e4f5fff638c714447427e0d1626c3bc2321534ed65675b1323c7 | R | 1,404 | 46 | ##### ##### ##### ##### ##### ##### ##### ##### ##### #####
# Parameter settings
##### ##### ##### ##### ##### ##### ##### ##### ##### #####
setwd(file.path(getwd(), "R"))
source("00_directorySettings.R") # load baseDir <- "/WORKING_DIR"
dataDir <- file.path(baseDir, "data")
howManyFeatures <- 2000
coefVariationThres... |
4c278d0e00636c1db2aa0b908ce16c68e1b9e56d19d77be6d68b47bb52dc6d9e | R | 1,406 | 71 | write_named_object_safe <- function(
x,
name,
dir = ".",
format = c("tsv", "rds"),
compress_tsv = FALSE,
verbose = TRUE,
...
) {
format <- match.arg(format)
dir.create(dir, showWarnings = FALSE, recursive = TRUE)
if (format == "rds") {
fn <- file.path(dir, paste0(name, ".rds"))
... |
905ab2c521f0dfbbbf351a6cc352ca134265eb4506111637dc6a70d6b90dc8ce | R | 1,408 | 34 | ### Separate DB PCT and raw lipid data into samples of _Mboat2_ overexpression and young plasma membrane lipid supplementation samples
## --------------------------------------------------------------------
rm(list=ls())
library(tidyverse)
library(ggpubr)
library(ggthemes)
library(RColorBrewer)
library(rstatix)
setwd(... |
1e060f7ca8ec27c632d38d63658cfa4c34938851bc17bff2392b65a3bd47e6e2 | R | 1,411 | 27 | library(gamlss)
library(gamlss.dist)
newage <- seq(35, 85, 0.1)
metrics <- read.csv("gamlss.input.csv",header=FALSE)
m0 <- lms(V2, V1, data=metrics, trans.x=FALSE, method.pb="GAIC", k=5)
pdf(file = "centiles.lms.pdf")
centiles(m0, metrics$V1, cent=c(5,25,50,75,95), legend=FALSE, ylab="Metric", xlab="Age", pch="o", lwd... |
957a0f3845d36f604c8adab2dee575c98d9d744b12c751b9802d7165d1451e9f | R | 1,411 | 32 | #' banc-alignment-update-seatable — Push alignment results to SeaTable.
#'
#' Dispatcher that loads a region preset and runs the preset's seatable-push
#' logic. Each preset's update-seatable script differs in which SeaTable
#' columns it touches and how it reconciles conflicts with existing curation.
#' Presets live a... |
30b72cbd7c5c66acc04e1aaeb19753cba0351af95809d13bb1ce33ef419295ac | R | 1,416 | 32 | #!/usr/bin/env Rscript
library(Matrix)
library(Seurat)
library(tidyverse)
library(readxl)
source("scRNAseq_funs.R")
#####################################################################################################################################################################################
IntegratedAth <- rea... |
e5d2adf4286514757279ef3ce663996a736884e3e27503c1f9841f3f67be022c | R | 1,417 | 34 | ###############################################################################
## Generate contrast_tables checkpoint from existing model objects ##
###############################################################################
## Purpose: Create contrast_tables.rds checkpoint for downstream modules
## ... |
cc44c5538e123a7395be3d25b591edeae7809bf8ecc5b4da2db6034566f95046 | R | 1,418 | 32 | library(magick)
library(pdftools)
MAPT <- image_read_pdf("D:/colocal/MAPT.pdf", density = 300)
image_write(MAPT, path = "D:/colocal/MAPT.2.tiff", format = "tiff")
ABCA7 <- image_read_pdf("D:/colocal/ABCA7.pdf", density = 300)
image_write(ABCA7, path = "D:/colocal/ABCA7.2.tiff", format = "tiff")
TAOK2 <- ima... |
bf058f446b0300a49796777debdfa1e649ed0dc70df2fac2d1457023184d1c6a | R | 1,419 | 54 | library(Seurat)
library(dplyr)
library(stringr)
library(future)
library(future.apply)
num.cores <- as.integer(Sys.getenv("SLURM_CPUS_ON_NODE")) - 1
options(future.globals.maxSize = 1e6 ^ 3)
options(future.rng.onMisuse = "ignore")
plan("multicore", workers = 20)
setwd(Sys.getenv("HOME"))
source("R_func/seurat/Select... |
a23e0d289ccee756ac6c5ad0083cdf314e6f9c023e4460bf5a4a42117bbd06e8 | R | 1,421 | 49 | rm(list = ls())
library(dplyr)
library(plyr)
library(Seurat)
library(ggpubr)
library(reshape2)
library(tidyr)
library(tidyverse)
library(DropletQC)
library(Matrix)
library(EnsDb.Mmusculus.v79)
source('~/SCRIPTS/utility_functions.R')
samps = paste0('SRR1192', 1005:1012)
folddir = '/home2/gkonop/project/01_DROPSEQ_PREPR... |
7a6b37cca79b7326b88670ccc2e34dc1e0ab5df8fb9ca5231b6146ebd207370d | R | 1,423 | 56 |
aSPUd2<-function (Y, X, cov = NULL, model = c("gaussian", "binomial"))
{
model = match.arg(model)
n <- length(Y)
if (is.null(X) && length(X) > 0)
X = as.matrix(X, ncol = 1)
k <- ncol(X)
if (is.null(cov)) {
XUs <- Xg <- X
r <- Y - mean(Y)
U <- as.vector(t(Xg) %*% r)
Xbar <- apply(Xg, 2, ... |
2212ddff5d0c964b26207ed10498d0e358c1adb1ee27bde971721053b7cb0741 | R | 1,426 | 48 | library("spatialLIBD")
library("markdown") ## due to a shinyapps.io bug
# Launch the ShinyApp (Do not remove this comment)
# To deploy, run: rsconnect::deployApp()
# Or use the blue button on top of this file
# pkgload::load_all()
options("golem.app.prod" = TRUE)
## will download the data automatically
# spatialLIBD... |
6aa71a3d29bd4d9a9825c8c49a23421b6bb0d6b94d02f9bb49cc55088092cc2c | R | 1,428 | 32 | #' 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... |
7c238e3178f59a8449b0930e35d22a840f64760cb3d8620ca58b27c8fd46d7dd | R | 1,428 | 31 | # Moderate effect size genes project
# Author: Madison Caballero
# Desription: Performs the equilibrum test for SINGLE GENES, not pairs
# The input file is a merge of data from all cohorts. Header:
#Gene1,Gene2,N_AB_ASD,N_AB_non_ASD,N_A*_ASD,N_A*_non_ASD,N_B*_ASD,N_B*_non_ASD,N_A*B*_ASD,N_A*B*_non_ASD
library(stringr... |
e559da8dfd5bdc653b694f117f478c3aac2e776bf401828601b888928d5663ab | R | 1,437 | 42 |
```{r}
library(dplyr)
library(tidyr)
library(tibble)
# Pearson correlation helper (returns n, r, p)
safe_cor_stats <- function(x, y) {
ok <- stats::complete.cases(x, y)
n <- sum(ok)
if (n < 3) return(tibble(n = n, r = NA_real_, p = NA_real_))
ct <- suppressWarnings(stats::cor.test(x[ok], y[ok], method = "pea... |
401fbb769e801c5dede2ea46f36b64bfbca7fabca72f2814fb3f467c1644268a | R | 1,439 | 52 | #!/usr/bin/env Rscript
#######################################################
library(tidyverse)
library(odbc)
library(DBI)
#######################################################
#Establish connection
con <- DBI::dbConnect(odbc::odbc(), "VerhaakDB4")
args = commandArgs(trailingOnly=TRUE)
# test if there is at l... |
a777a3c7fc760a463fb4992591b6971c5b27a216a3368a3bf5db84f4c70f4462 | R | 1,439 | 30 | rm(list = ls())
setwd('C:/Users/wangz21/Box Sync/Huang_lab/manuscripts/ADASE/')
# Load in clinical information
clinical <- read.table('data/ReadCount_DNAHetVariant/msbb.meta.d.tsv',header = T,sep = '\t',stringsAsFactors = F)
# Classification of clinical samples
clinical$Classification <- NA
for (i in 1:nrow(c... |
8d0c7c94ec8f593f7a7e74e808d8cde7738151d03cebd947e6fae620ece7baa3 | R | 1,440 | 73 | # ### PL_MVMR
PL_MVMR = function(a){
tau2 = a[1]
PL2_MVMR = function(ab){
b<-ab
cov = matrix(nrow = exp.number, ncol = exp.number)
w=NULL
for(l in 1:nrow(r_input)){
for(pp in 1:exp.number){
for(p2 in 1:exp.number){
cov[pp,p2] <- correlation[pp,p2]*stderr[l,pp]*stderr[l,p... |
3f4f21ea1fd281f7ae059f99f46da9229a1274887d72ffe0873988c6e9c575cf | R | 1,441 | 56 | # ===============================================================
# 🔤 Base size controls (compact)
# ===============================================================
base_size_ui <- function(ns,
input_id = "plot_base_size",
default = 13,
min = ... |
7fc9785aaa89dba345d4c096fa9ab2024488d5bbb1980f6fa73d0225bb043e40 | R | 1,441 | 40 | ## description of data
#' SingleCellExperiment object containing scRNAseq data (subsampled)
#'
#' SingleCellExperiment object containing scRNAseq data (subsampled). Source of the data: Puram et al., Cell 2017: “Single-Cell Transcriptomic Analysis of Primary and Metastatic Tumor Ecosystems in Head and Neck Cancer.”. Th... |
38440448337aba6b74095d7f19f84fe2511dbfda5c7280afe56c36eb495cba1d | R | 1,443 | 38 |
library(epicalc)
args<-commandArgs(TRUE)
HPV_csv = sprintf("%s", args[1]) #PB/HPV.csv
HPV_blast_results = sprintf("%s", args[2]) #PB/complete_HPV.blast_results
ref_clone_HPV = sprintf("%s", args[3]) #/media/storage/HTS/HPV_center/ref_clones.csv
accession_to_gi_translator = sp... |
21aa07cb69dbfe2d9abb0c2ccca41378789f46e9787aaeda844b44aa5191baac | R | 1,444 | 52 | # Script to generate a chart of the base distribution by cycle
# @author Nils Homer
# 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 ... |
35b5218bc51b20cd38141e1e05e4834014a6e2055d876b4502a3ee7bc91a0c06 | R | 1,444 | 39 | #-----------------------------------------------------------------------------
###Goal: Obtain TACIT: Threshold-based Assignment for Cell Type Identifying in Spatial Omics
#-----------------------------------------------------------------------------
###Cell type annotation Step:
#### 1) Load the data
#### 2) Load sig... |
c4ca7b456ad70a124fb7a16f3142fecc930afb6b2bf48ac3eed0c568d17b8527 | R | 1,446 | 42 | set.seed(1125) # Set a seed for reproducibility
#Practice
ntrials = 12
colors <- c(rep('Green', ntrials/2), rep('Blue', ntrials/2))
csequence <- sample(colors)
print(csequence)
itis <- c(rep(1, ntrials/2), rep(2, ntrials/4), rep(3, ntrials/6), rep(4, ntrials/12))
isequence <- sample(itis)
print(isequence)
mid_tri... |
e8d013a472daa9ad5ef8afd43da56d5d22abff1d01abd62070536478f25d883a | R | 1,446 | 38 | library(Seurat)
library(SeuratData)
library(cowplot)
library(dplyr)
#InstallData("bmcite")
bm <- LoadData(ds = "bmcite")
#preprocessing RNA assay
DefaultAssay(bm) <- 'RNA'
bm <- NormalizeData(bm) %>% FindVariableFeatures() %>% ScaleData() %>% RunPCA()
ElbowPlot(bm, ndims=50)
#preprocessing ADT assay
... |
e4f07ff8175eb6ff051f4d1bf256ec70461c4d1f2d19ad298fa199eac5fac207 | R | 1,447 | 49 | #' Check input modeling_results
#'
#' This function checks that the `modeling_results` object has the appropriate structure.
#' For more details please check the vignette documentation.
#'
#' @inheritParams run_app
#'
#' @return The input object if all checks are passed.
#' @export
#' @importFrom methods is
#' @family ... |
16bc2986d7a24d5372a4a4d622fe4eed1e5416f6a205f3eeb1da5b024a074be8 | R | 1,452 | 45 | library(data.table)
merge_list <- function(dtl, by, all = TRUE,
suffixes = NULL) {
stopifnot(length(dtl) > 1,
is.character(by))
## put a sensible name on every element – used to build suffixes
if (is.null(names(dtl))) names(dtl) <- paste0("dt", seq_along(dtl))
## defin... |
161adf91a076c0c62f11b594dd0fc1520201288c937d36aa2ef67fc702e59931 | R | 1,454 | 43 | library(ArchR)
library(parallel)
addArchRThreads(threads = 12)
addArchRGenome("hg38")
library(ComplexHeatmap)
library(ggsignif)
library("RColorBrewer")
projdir <- "projrmSubset_subPeak"
proj <- loadArchRProject(projdir)
dir <- "mydir"
markersPeaks <- getMarkerFeatures(
ArchRProj = proj,
useMatrix = "PeakMatrix... |
3a49a42f8166e227ed0805321706953cdd5ddbdfa677c2adfb688d9bf2db8d14 | R | 1,455 | 43 | ## Did you miss the previous step? The one about creating your package
rstudioapi::navigateToFile(usethis::proj_path("dev", "01_create_pkg.R"))
## ********************
## Setup Git and GitHub
## ********************
## Note that Bioconductor doesn't allow *.Rproj files
## So we have to ignore it before anything else
... |
2dd0d6719c76e387d6323742e6beb1fd06ae5a5a194c88d6cd5b281e5272def3 | R | 1,460 | 48 | library(Rsamtools)
library(GenomicRanges)
library(BiocParallel)
library(tools)
# Function to filter BAM file to a specific contig
filt_bamfiles_to_contig <- function(bamfile, contig_name, output_dir) {
# Check if BAM file exists
if (!file.exists(bamfile)) {
stop(paste("BAM file not found:", bamfile))
}
# ... |
68094f89046e3957fae525a8eeca6cfe614e1d96ef07f9887863ec7d94ae3430 | R | 1,462 | 46 | #' 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... |
66084eea404e3f4458990f76fed344587e65e4c6c0e76532c80be66e55638a2c | R | 1,463 | 60 | library(methods)
library(scran)
names = list(
"data/pancreas/pancreas_inDrop_table.txt",
"data/pancreas/pancreas_multi_celseq2_expression_matrix_table.txt",
"data/pancreas/pancreas_multi_celseq_expression_matrix_table.txt",
"data/pancreas/pancreas_multi_fluidigmc1_expression_matrix_table.txt",
"dat... |
bea08c0a17cf4cb93f1e38c5dcc8c2f3ee90ee04fe27d64229d153a13b94d14c | R | 1,464 | 50 | #Integrate nodose spatial transcriptomic dataset
library(Seurat)
library(patchwork)
library(dplyr)
#Load the aligned data
nodose.st <- list()
files <- list.files(path = ".", pattern = ".rds")
for (i in files) {
nodose.st[[i]] <- readRDS(i)
}
#SC transform each .rds file
nodose.st <- lapply(nodose.st, assay = "RNA",... |
b486fee344cfa6ae8c0b3858bf6ccbdcc12527fb1984196e815f55628b41d11d | R | 1,466 | 52 | #
# sleuth: inspect your RNA-Seq with a pack of kallistos
#
# Copyright (C) 2015 Harold Pimentel, Nicolas Bray, Pall Melsted, Lior Pachter
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software F... |
0f96b51f41ce9275fcdcc7f5b2a35e449a43f348df3a488119c79551457809df | R | 1,472 | 34 | ## Calculate the positive proportion of edge-wise difference between methods
setwd('/home/huyang/Projects/HuYang/HY_20251111')
## Loop each statistic
for (curr_stat in c('CohenD')){
## Loop each dataset
for (curr_set in c('eNKI', 'Cam-CAN')){
## Loop each atlas
for (curr_atlas in c('DK308', 'Schaefer300')){... |
6b76330361813de7e6a15c984561c2d2e1eb7df59e521d8463df319f354e3f46 | R | 1,474 | 34 | ## Calculate the positive proportion of edge-wise difference between methods
setwd('/home/huyang/Projects/HuYang/HY_20251111')
## Loop each statistic
for (curr_stat in c('ICC', 'Discr')){
## Loop each dataset
for (curr_set in c('BNU1', 'HNU1')){
## Loop each atlas
for (curr_atlas in c('DK308', 'Schaefer300'... |
8dea2b170e89ea278b31a0ba37780b133377850eac291c3b0fe303452e906ed9 | R | 1,479 | 32 | # Load necessary libraries
library(dplyr)
Target_comparison <- 'FILTERED_1_MTLEALL_NL'
# Define the DESeq file and cutoff values
DESeq_file <- paste0("/home/joonho345/1_Epilepsy_RNA/RNA_Human/07.DESeq/01.DESeq_files/DESeq_", Target_comparison,".txt")
##########################
cutoff_log2FoldChange <- 1
cutoff_padj... |
66a3d8966ac8d807f27edab47cd84a659fa14c4f225f573189aae77820bfbe99 | R | 1,480 | 49 | test_that("Test PlotBoundary related functions", {
coords <- readRDS(system.file("extdata", "MouseBrainCoords.rds",
package = "SpNeigh"
))
coords$cluster <- as.character(coords$cluster)
expect_silent(PlotBoundary(coords, one_cluster = 2, split_by = "cluster"))
expect_silent(PlotBoundary(c... |
d08bcab4deb0dd6297bc297db3b01c6d68b3d7e56ec50916126a0f1af2b8293d | R | 1,483 | 44 | test_that("fanc_xyz2id works", {
expect_equal(fanc_xyz2id(cbind(34495, 82783, 1954), rawcoords=TRUE),
"648518346499897667")
expect_equal(
fanc_xyz2id(cbind(34495, 82783, 1954), rawcoords=TRUE, root=F),
"73186243730767724")
})
test_that("fanc_islatest works", {
expect_false(fanc_islatest(... |
9939ed2c26fb3122f43b00555c619e8d38c430f359ebbf7507d4315aeae298f9 | R | 1,493 | 60 | context("test SPIDER")
test_that("spider() runs with epifilter and returns panda object", {
skip_on_cran()
# Create minimal test data
set.seed(42)
tfs <- paste0("TF", 1:3)
genes <- paste0("G", 1:5)
motif <- data.frame(
tf = rep(tfs, each = 5),
gene = rep(genes, 3),
score = rbinom(15, 1, 0.5)
... |
ad469176196bfab641e0f5e1cd3b78e8b15613277700aa211561c150f886cb9f | R | 1,493 | 57 | #' @include tracking-observer.R
NULL
mlflow_push_active_run_id <- function(run_id) {
.globals$active_run_stack <- c(.globals$active_run_stack, run_id)
mlflow_register_tracking_event("active_run_id", list(run_id = run_id))
}
mlflow_pop_active_run_id <- function() {
.globals$active_run_stack <- .globals$active_ru... |
8fa6eb52bc4bc7adf16dfb81802a735e2fdb4785380dec68f746cfdb93a74a25 | R | 1,502 | 64 | test_that("vis_gene", {
if (!exists("spe")) spe <- fetch_data("spe")
# Non-numeric column to plot
expect_error(
{
p <- vis_gene(
spe,
geneid = c("sum_umi", rownames(spe)[1], "layer_guess")
)
},
"'geneid' can not contain non-n... |
9abf677ee8519efa80c91881c5e1645949ed7433d38bf1a90e4a45e5d8535f54 | R | 1,503 | 44 | library(dplyr)
library(Seurat)
library(patchwork)
# Load the malt dataset
# rename features.tsv to genes.tsv
malt.data <- Read10X(data.dir = "MALT10k_filtered_feature_bc_matrix/")
# Initialize the Seurat object with the raw (non-normalized data).
malt <- CreateSeuratObject(counts = malt.data$`Gene Expression... |
ca8feedf4d5e84ce8c2c8fb2d511e8a5124db9783eb33e38dcac5f692651b4f2 | R | 1,507 | 37 | #################################
# Plot the longitudinal difference in Sequenza estimated tumor purity - initial vs recurrence.
# Author: Kevin Johnson
#################################
library(tidyverse)
library(ggplot2)
library(ggpubr)
library(EnvStats)
proj_dir <- "/vast/palmer/pi/verhaak/kcj28/care_idh_mut"
... |
92a8411bfcda782a0cfbdfa21b9a910465080ca43e1b09a5920b17084634440d | R | 1,511 | 35 |
# This script defines utility functions only used during development.
should_enable_cran_incoming_checks <- function() {
# The CRAN incoming feasibility check performs a package recency check (this is undocumented)
# that examines the number of days since the last release and raises a NOTE if it's < 7.
# ... |
d6543fdb8cfa7d90d50435290a2fcc635b2fedd25589de66db3615e68a76b16b | R | 1,515 | 50 | #' @title Lesion size computation
#'
#' @description
#' Compute lesion sizes from a list of antsImages.
#'
#' @param lesions.list List of antsImages or vector of filenames.
#' It is assumed that images are binary (0/1).
#' @param showInfo logical show or not informations/warnings
#'
#' @return vecto... |
bdbd23bbf78b7ddeeed39583bd0ac66d1968f2240bbd8923379cedd39da784c8 | R | 1,519 | 51 | ### push pyclone results to db
library(tidyverse)
library(DBI)
library(odbc)
con <- DBI::dbConnect(odbc::odbc(), "GLASSv3")
myDir <- 'results/pyclone/run/'
files <- dir(myDir)
files <- paste(myDir, files, sep = '')
# Select H2, PD, or SN cohorts:
# files <- files[grep("GLSS-CU-P|GLSS-HF", files)]
# files <- files[-g... |
65cff460f97043a05ce4fc4d4c26ff290cf56ffc149d1895f900e7bb89fd6947 | R | 1,522 | 39 | #'
#'
#' @param
#'
#' @return
#'
#' @export
nested_xgboost_cox_cv_outer_loop <- function(data,
seed,
iteration,
interaction_list,
event_inci... |
00a61796b7b5afdb2fb005b5b5cb5e35aa27a9d9191f1b374ad58a5f09dda504 | R | 1,524 | 42 | suppressPackageStartupMessages({
library(biomaRt)
library(tidyverse)
})
# Load Data
load("dge/TETA_Dge_Data.RData")
# Convert to human
human = biomaRt::useMart(host="https://dec2021.archive.ensembl.org", "ENSEMBL_MART_ENSEMBL", dataset="hsapiens_gene_ensembl")
mouse = biomaRt::useMart(host="https://dec2021.archive.e... |
b0c614569e0cb49cea29a288b7cad3a6c3f7d137efd0bc541872d1770e3cb955 | R | 1,525 | 36 | # Set wd
#setwd("~/FC-Network-Replicability-Effects")
# Packages
library(tidyverse)
library(reshape2)
# Loading data - data after subtracting out random effect of id(site)
load("Data/processed_data_network_regressed.RData")
######### Plotting Pipeline:Atlas interaction ################################
# Getting fitt... |
4d492c624f4da065fb2908877d75f9f2acb95cb8059db2627e807ba01c0bad38 | R | 1,527 | 45 | library(PRECAST)
library(Seurat)
library(scater)
library(anndata)
set.seed(101)
ST <- read_h5ad("ST.h5ad")
ST$var_names_make_unique()
count <- t(ST$X)
meta_data <- data.frame(row=ST$obs$array_row, col=ST$obs$array_col)
row.names(meta_data) <- colnames(count)
seu <- CreateSeuratObject(counts=count, meta.data = meta_d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.