sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
b94b55fdebf1fdb4daad01bd3fe8cbd9acf330998eb6b90db84d26614941ab6f
R
861
17
# construct a mirroring registration from landmarks mirror_banc_tps <- function(anns) { if(is.character(anns)) { anns=ngl_annotations(anns) } AB=rbind(banc_raw2nm(anns$pointA), banc_raw2nm(anns$pointB)) BA=rbind(banc_raw2nm(anns$pointB), banc_raw2nm(anns$pointA)) # have decided to use this rather than "of...
d7e6b7b93216973d6817d70c346f1ea4b13cf9b8560449d5ad2b370ff2ce800c
R
862
30
library(data.table) merge2 <- function(x, y, by, ncol_y, ...) { # Convert data frames to data.tables x <- as.data.table(x) y <- as.data.table(y) # Perform the merge merged_dt <- merge(x, y, by = by, ...) # Get the names of the columns in y that were not used for merging y_cols <- setdiff(names(y), by) ...
6527f4e2e4154ff5329f04e5f6d1584adf76da8ef56902e20163c8cea7c36a5a
R
865
40
# region items and polygons #' all possible combinations of n sets #' #' @param n dim #' #' @importFrom utils combn combinations <- function(n){ l <- lapply(seq_len(n), function(x){ m <- combn(n,x) matrix2list(m) }) unlist(l, recursive = F) } matrix2list <- function(matrix){ lapply(seq_len(ncol(matrix...
e7eb03aee61f8a586cff97f856cb9bf3f473a612e78ab42c42e1a4ab2051b303
R
867
25
library(Seurat) library(tibble) library(dplyr) SSE1_filtered <- readRDS("SSE1_5_seurat_final_sse7.rds") SSE1_filtered <- subset(SSE1_filtered,Condition_mCherry_strict %in% c("Control_No","SSE7_No","SSE7_Yes")) for (i in unique(SSE1_filtered$cell_line)) { a <- subset(SSE1_filtered,cell_line == i) a <- NormalizeD...
307953b5d0dd32b4a176c40bd9d7f31bc10c142ae5c911dca2a5d6badb971bf9
R
872
23
# Function to save a ggplot figure to a specified file save_figure <- function(plot, output_file, fig_size = c(10, 3)) { library(ggplot2) # Load ggplot2 for saving figures # Ensure results directory exists before saving results_folder <- dirname(output_file) if (!dir.exists(results_folder)) { dir.create...
f87c8c57cd981ce21c746a90a29ce26476133b4d92a06811dcf26e20ea901e8f
R
872
30
####################################################### # Add ssm2 coverage counts to db # Date: 2022.07.07 # Author: Kevin Johnson ####################################################### # Necessary packages: library(parallel) library(tidyverse) library(DBI) library(odbc) con <- DBI::dbConnect(odbc::odbc(), "Verhaak...
29736cbefec5dc3ec950223ffecebbd35eedfc4557a5f78358f4cc639252b46b
R
873
18
test_that("skeletor works", { skip_if_not_installed('reticulate') skip_if_not(reticulate::py_module_available("cloudvolume"), "Skipping live flywire tests requiring python cloudvolume module") skip_on_os("mac") skip_if_not(reticulate::py_module_available("skeletor"), "Skipping live f...
7cc966667777f07a0fe3940cae6837fb7ebbd8aed56f58ff406950be4520238e
R
878
22
# ================================ # Load or Install All Libraries # ================================ packages <- c( "readxl","conflicted", "readr", "tidyr", "tibble", "pheatmap", "ggbreak", "imputeLCMD", "openxlsx", "limma", "writexl", "showtext", "jsonlite", "curl", "ggplot2", "scales", "ggrepel", "sva", ...
54212e6931b734b8f4a3e2f70884329cfd27e7b3028227b54bad2f857fd0cee0
R
879
23
### Calculate the mol% of each individual lipid setwd(rstudioapi::getActiveProject()) rm(list=ls()) source("./Scripts/Function_scripts/Effect_size_functions.R") source("./Scripts/Function_scripts/Pre-processing_functions.R") library(tidyverse) ##########################################################################...
bb489d246a0ce8f642291f53575930205b7d55a1c8b33e629eaddb2a6063a77b
R
879
32
#!/usr/bin/env Rscript #------------------------------------------------- # Title: Clean sc DRG data; only keep naive samples # Author: Christina Meier # Date: 2025-05-25 # Email: 19cm51@queensu.ca #------------------------------------------------- # Notes ------------------------------------------- # module load StdEn...
3a7f9a094ddb36d471f86b37969a1012271e0a893091b242d35a80cc20deb078
R
886
22
library(ggplot2) # Example data (replace with your actual data) observed_counts <- c(13825, 592, 299, 170, 114) # Summed observed counts from all runs total_observed <- sum(observed_counts) expected_counts <- rep(total_observed / 5, 5) # Assuming equal distribution # Create a data frame for plotting data <- data.fr...
519490903cb664cdd636d248ba39c0b5892d4a82bfb7caed4430fba59a118eb0
R
890
26
library(ggplot2) library(viridis) # Your data data_time <- data.frame( Year = c(1950, 1955, 1960, 1965, 1970, 1975, 1980, 1985, 1990, 1995, 2000, 2005, 2010, 2015, 2020, 2024), Value = c(226, 374, 451, 563, 786, 1490, 2150, 3170, 4170, 5410, 8090, 13700, 16000, 16200, 16500, 17300) ) # Create a line plot ggplot(d...
7a5c0019e69d1f2cabb858fb9a4c328e0250da4683fb4b029d5420bcd11a41a4
R
892
38
## code to prepare `tstats_Human_DLPFC_snRNAseq_Nguyen_topLayer` dataset goes here load( here::here( "data-raw", "tstats_Human_DLPFC_snRNAseq_Nguyen_topLayer.Rdata" ), verbose = TRUE ) head(tstats_Human_DLPFC_snRNAseq_Nguyen_topLayer) write.csv( tstats_Human_DLPFC_snRNAseq_Nguyen_topLa...
7bcc264f954e889afb8dc0327921660ef95571a1b1553fb139fd55c4a370ff6a
R
893
24
design_data <- design(data = data.frame(forstmann, CO = 1:nrow(forstmann)), model=LBA,matchfun=function(d)d$S==d$lR, formula=list(v~lM,sv~lM,B~E+lR,t0~E2 + CO), contrasts=list(v = list(lM=matrix(c(-1/2,1/2),ncol=1,dimnames=list(NULL,"d")))), constants=c(sv=log(1)), ...
7e06f4326315fedcc51b8935182a4ce5de6c61e4cab26115cb684bebb4661c1b
R
894
14
#' @param model_uri The location, in URI format, of the MLflow model. #' @details The URI scheme must be supported by MLflow - i.e. there has to be an MLflow artifact #' repository corresponding to the scheme of the URI. The content is expected to point to a #' directory containing MLmodel. The follow...
beb9dc5848617ad54134d65e35d7840e069837ab913e6a96e0688f3c587f9996
R
896
22
### Append concentration to each internal standards setwd(rstudioapi::getActiveProject()) rm(list=ls()) library(tidyverse) library(stringi) ##Input IS concentration load("./Output_Data/Exp2.MS-Dial_IS.all.Rdata") labelled.conc <- read.csv("./Input_Data/KO_Labelled_IS_concentration_082720.csv", stringsAsFactors = F...
f2d92e8cda917f3ea2e3cc9433c86b9e1e5d7bb26fc4b1f4eb6d06d7ec12d7f4
R
901
26
RNGkind("L'Ecuyer-CMRG") set.seed(123) matchfun <- function(d) as.numeric(d$S)==as.numeric(d$lR) | (d$lR=="pm" & as.numeric(d$S)>2) designLBA <- design( factors=list(subjects=1,S=c("left","right","leftpm","rightpm"),RACE=2:3), Rlevels=c("left","right","pm"), matchfun=matchfun, model=LBA,constants=c(v_RACE3=0...
5f8a1ea1630eacaafb5b9f83a16e5d71af2150a226522a105368d56d0a875792
R
903
24
dGNG <- design(Rlevels = c("left","right"), factors=list(subjects=1,S=c("left","right")), functions=list( TIMEOUT=function(d)rep(2.5,nrow(d)), Rnogo=function(d)factor(rep("left",nrow(d)),levels=c("left","right")), Rgo=function(d)factor(rep...
5bd64208dd3b8717c69dd51f3bd4c6c20e6616f89281d53b77052b6f25f32746
R
904
21
### Append concentration to each internal standards rm(list=ls()) library(tidyverse) setwd(rstudioapi::getActiveProject()) load("./Output_Data/IS_invivo_samples_Int.MsD.Rdata") IS.label <- read.csv("./Input_Data/Labelled_IS_concentration_2020_052020.csv", stringsAsFactors = F, check.names = F, c...
afbd726af439f29e64ad097ffb9c99f4d490107a2134f989a548ca3fc0b74625
R
905
31
#' Determine if you have enough RAM memory #' #' This function determines if you have enough RAM memory on your system. #' #' @param how_much The number of bytes you want to compare against. #' #' @return A `logical(1)` indicating whether your system has enough RAM memory. #' @export #' #' @details If `benchmarkme::get...
b7f0dac7cd70ec1d28f70b39d04c48500851e1f46eb7e5adf8c1d15cd3eea6f4
R
909
24
# # 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...
3fcd2af2dfb0dae12ed3d9913e21770d69156365c96a42fe300db71f700b77af
R
910
40
#!/usr/bin/Rscript args <- commandArgs() # print(args) dir <- args[6] Name1 <- args[7] all <- as.integer(args[8]) dedup <- as.integer(args[9]) Df <- data.frame(sample=Name1, total=all, unique=dedup) Df$dup <- 1 - Df[ ,3]/Df[ ,2] colnames(Df)[4] <- "duprate" Df$temp <- 0 colnames(Df)[5] <- "libsize" # head(Df) for...
e176f43215b090b93f87ea8cc1d79ec8076b605737f2a52a20f4136c13672672
R
911
28
########################## Step.02 QC & Integrated All Samples ########################## if(T){ sce[["pMT"]] = PercentageFeatureSet(object = sce, pattern = "^MT-") summary(sce[["pMT"]]) summary(sce[["nFeature_RNA"]]) summary(sce[["nCount_RNA"]]) nFeature_lower = 300 nFeature_upper = 10000 nCount_lower =...
2eb90d165da79231c064b550fa55406d7c632e39bb4a6f3cb215d89193f644bc
R
916
22
#' Read one or more FANC neuron meshes #' #' @param ids One or more root ids #' @param savedir An optional location to save downloaded meshes. This acts as a #' simple but effective cache since flywire neurons change id whenever they #' are edited. #' @param ... Additional arguments passed to #' \code{fafbseg::\l...
f56182a3f2e03c8b11bdebaf246c44df3f716055e32a4d7b66e60965d356d46a
R
921
34
here::i_am("extra/Spearman_on_NPC/network_inference/1.4.1.prepare_data_for_Spearman.R") library(tidyverse) library(SingleCellExperiment) library(foreach) library(doParallel) library(glue) library(here) wd <- here("data/neural_differentiation_dataset/Spearman_network_inference_and_analysis/input/") dir.create(wd) # l...
1ae25036a8a4d4a96708ceea5255c9d993b11c88bcb2bbcce2402ab0af13ecd3
R
924
27
#------------------------------------------------- # Title: Get a named list of paths given a directory and pattern # Author: Amanda Zacharias # Date: 2022-12-31 # Email: 16amz1@queensu.ca #------------------------------------------------- # Notes ------------------------------------------- # module load nixpkgs/16.09 ...
8990537e07f945ded61dcee0fba13f2f395ba19e6483e60a35de9122c1f38e70
R
927
31
#' @keywords internal #' @import nat #' @section Registration: For information about left-right mirroring and #' symmetrising registrations within MANC, please see #' \code{\link{mirror_manc}}. #' #' For information about across-template registrations, please see #' \code{\link{download_manc_registrations}}. #'...
39f09d766e85e3c0a75fe952aeb4ee7a7967648a29a69949cc445f23e3cb75a9
R
930
33
#------------------------------------------------- # Title: Reads in dataframes from a named list of paths # Author: Amanda Zacharias # Date: 2022-12-31 # Email: 16amz1@queensu.ca #------------------------------------------------- # Notes ------------------------------------------- # module load nixpkgs/16.09 gcc/7.3.0...
4a20fa1b41a4cc2265ae5781e157b3aa2b0d44c8ada08cfd98582c65c31075dc
R
934
17
## Add aligned files library(odbc) library(DBI) con <- DBI::dbConnect(odbc::odbc(), "VerhaakDB") bamfiles = list.files("/projects/verhaak-lab/GLASS-analysis/results/align/bqsr", pattern = "^GLSS-MG.*bam$", full.names = T) md5files = list.files("/projects/verhaak-lab/GLASS-analysis/results/align/bqsr", pattern = "^GLS...
3fe500b07b8e21b678e782e965c84858baac66f12057de5c7c3399d7e7787676
R
939
28
op <- choose_malevnc_dataset('MANC') on.exit(options(op)) for(ds in c("MANC", "VNC")) { choose_malevnc_dataset(ds) test_that("manc neuprint works", { expect_equal(manc_ids(10000, as_character = T), "10000") expect_equal(manc_ids(10000, as_character = F), 10000) expect_equal(manc_ids(10000, integer64 = T), as....
a5e56b8652690a332645ddadb06b24b2b7c76026ac0b80a2186a5a58b9ad6855
R
939
54
--- title: "Identify mitochodira genes" author: "Wei Sun" date: "`r Sys.Date()`" output: html_document: theme: journal highlight: tango toc: true toc_depth: 3 toc_float: collapsed: true smooth_scroll: false number_sections: false df_print: paged --- ```{r setup, include=FALSE} ...
aeb53991c0bd1256bea4d3164e8d34fd0d6f73ff28b505010ddc31ab43561869
R
939
27
library(readr) library(tibble) library(zellkonverter) library(Seurat) library(mixhvg) library(SingleCellExperiment) library(scater) library(here) #hvg_subset <- readH5AD(here("data", "whole_mouse_brain", "processed", "merged_before_HVG.01pct.h5ad"), reader = "python", X_name="counts") #loading 5% of the cells due to R...
220d6340420ad5978dd07bf4b0a28e8664d5af9999300088d6b04d888b6fab64
R
942
17
test_that("multiplication works", { pal=c(`Tergopleural-Pleural-promotor` = "#2280B8", `Pleural-remotor-abductor` = "#7B2DBA", Tergotr. = "#EFE952", Sternotrochanter = "#CCF750", `Sternal-posterior-rotator` = "#AE22BA", `Sternal-anterior-rotator` = "#33C0D0", `Sternal-adductor` = "#145E67", `Tr-e...
3cdb8f95e198e5290e70801e4a40d1f859729b4b7086b80d6491d576d6971345
R
943
41
test_that("Test factorNaturalOrder for numeric input", { x <- 10:1 f <- factorNaturalOrder(x) expect_s3_class(f, "factor") # Levels should be sorted in increasing order expect_equal(levels(f), as.character(1:10)) # Factor values should preserve original order expect_equal(as.character(f),...
0d3f8abf4cb0ac5966a7d1b8728e12cb7e84196fa3a7b0b41e4ab30da59b47a0
R
944
35
#!/usr/bin/env Rscript #------------------------------------------------- # Title: VST Transformation # Author: Amanda Zacharias # Date: 2023-11-30 # Email: 16amz1@queensu.ca #------------------------------------------------- # Notes ------------------------------------------- # module load nixpkgs/16.09 gcc/7.3.0 r/3....
8cafe8a660738c0efe2c4f7cf65ca5997b5e8ed9b6d36a8202e204215446e70e
R
947
31
old_root=root="C:/Users/Jun/Documents/R/AA_wSignal/" #you will need to change this new_root="C:/Users/Jun/Documents/R/AA_wSignal/" #you will need to change this next_experimentName= "AA_wSignal" #you will need to change this ############################################################### newdir=paste(new_ro...
1d549fdf7379530a4e229c98b5f9dd9b687b5fad74d387ecb1ced2b2db715fb6
R
950
41
library(Seurat) library(tibble) library(dplyr) library(SCopeLoomR) SSE1_filtered <- readRDS("SSE1_5_seurat_final_sse7.rds") SSE1_filtered <- subset(SSE1_filtered,Condition_mCherry_strict %in% c("Control_No","SSE7_No","SSE7_Yes")) # scenic by library for (i in unique(SSE1_filtered$library)) { a <- subset(SSE1_filter...
ffc6c7d3106101131b70930ade152f9f20a22d53778d47d89e190659510f2388
R
950
30
rm(list=ls()) basedir <- '~/Dropbox/Cornblath_Bassett_Projects/MouseGeneExpressionABA/mouse_abi_tool/' setwd(basedir) params <- list(basedir=basedir) source('code/misc/miscfxns.R') params$source.save <- source.save params$opdir <- paste('ABA_expression',params$c.max,'/',sep='') dir.create(params$opdir,recursive = T) #...
e76a80a8d1bd1b718b04926740403354ae2c60b51d8e47ea218ad9c906709ca7
R
951
31
library(dplyr) #### import coldata_df from 00.Matrix_H.R coldata_df #### import HiRES matrix #### ## CellType1 (Integration version) ## celltype <- 'ExN_H' celltype <- 'InN_H' celltype <- 'Astro_H' celltype <- 'Micro_H' celltype <- 'Oligo_H' celltype <- 'OPC_H' celltype <- 'Endo_H' Dataset_H <- 'GSE160189_186538_In...
c676c6543691ab1f351333efc6b62f1ba3895eb8ef487b63d6db0d811ad10c70
R
953
25
library(Seurat) library(dplyr) library(Matrix) args <- commandArgs(T) input <- args[1] output <- args[2] set.seed(42) obj <- readRDS(input) exprMat <- GetAssayData(obj, layer = 'counts') #LogexprMat <- readRDS("LogexprMat.rds") cellInfo <- obj@meta.data cellInfo$CellID <- rownames(cellInfo) # Sample 500 cells for eac...
cb1c03fdeb288dea62b92f3a5b5f04de1a9e0de26fd23e2f7fe0c93b78a9dec4
R
953
21
args = commandArgs(trailingOnly=TRUE) infile = args[[1]] out_prefix = args[[2]] lds_seg = read.table(infile,header=T,colClasses=c("character",rep("numeric",8))) quartiles=summary(lds_seg$ldscore_SNP) lb1 = which(lds_seg$ldscore_SNP <= quartiles[2]) lb2 = which(lds_seg$ldscore_SNP > quartiles[2] & lds_seg$ldscore_SNP ...
f66ae4f0cc8c0dcbba2ec045c73fdd99bcea067b1896c43230dd403a980e3d12
R
954
25
library(Seurat) library(dplyr) library(Matrix) args <- commandArgs(T) input <- args[1] output <- args[2] set.seed(42) obj <- readRDS(input) exprMat <- GetAssayData(obj, layer = 'counts') #LogexprMat <- readRDS("LogexprMat.rds") cellInfo <- obj@meta.data cellInfo$CellID <- rownames(cellInfo) # Sample 500 cells for eac...
ac1c678b692bfd77ae75e0dcbea1c07002694b05e791fa76fc0d19e6f9d19484
R
955
30
#!/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", "--input", required=TRUE, help="load bam") parser$add_argument("-o", "--output", req...
463831e16d485c5d738649d2b19266cc22d57feaa5301b38d943c12d8c25b910
R
957
29
# This scripts prunes the species tree so it only keeps the species that are present in the dataset (output of script 13.2). # It produces a species tree for each site. library(ape) # Paths path_datasets <- "Data/13.Variable_Sites/out/datasets_for_BT_pair_bonding/" path_trees <- "Data/14.BayesTraits/in/trees/" # Tre...
4377a850b173d0768e83bf9d6619a34b514dc85ceed11a20ec42e2a377cceef5
R
958
25
#' Locate image files #' #' Creates a named `character()` vector that can be helpful for locating #' image files and used with `add_images()`. This function is not necessary if #' the image files don't use the `spe$sample_id`. #' #' @inheritParams vis_clus #' @param image_dir A `character(1)` specifying a path to a dir...
cb7db8c7bd6183c12b2f6b908f2e69b379b39c977f8e55e62277c5b95efa99e1
R
958
35
context("Params") test_that("mlflow can read typed command line parameters", { mlflow_clear_test_dir("mlruns") mlflow_cli( "run", "examples/", "--env-manager", "uv", "--entry-point", "params_example.R", "-P", "my_int=10", "-P", "my_num=20.0", "-P", "my_str=XYZ" ) expect_tr...
71def475da819eebca9b089962c68f54bf1a2d7de071516c3f3d59cfc97f4311
R
963
24
# Figure 3C ################################################################### DVPV_MG = read.csv("DVvsWT_DE_MAST_RNAassay_MG_pct0.15_dim15.csv", header = T) Cgas_MG = read.csv("Cgashet_DVvsDV_DE_MAST_RNAassay_MG_pct0.15_dim15.csv", header = T) DVPV_MG_UP = filter(DVPV_MG, p_val_adj < 0.05&(avg_log2FC>=0.1)) DVPV_M...
1179d7571e767a3833516428eae5547d3e98b24f4aadcd1a3c8d715cb89154dd
R
971
21
get.clusterGroupTest.function<-function (group.testing.function, x) { stopifnot(is.function(group.testing.function)) function(hcloutput, dist = as.dist(1 - abs(cor(x))), alpha = 0.05, method = "average", conservative = TRUE) { hh <- if (missing(hcloutput)) hclust(dist, method = method) e...
eefad40752fc147ce5c3af38b3d373d2db706a1dc71def6a2005a711e16004a1
R
973
37
--- title: "Seurat_tail_cell_cycle_scoring" output: html_document date: "2025-07-11" --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` # Load libraries and tail file ```{r} #library(dplyr) library(Seurat) tail <- LoadSeuratRds(file = "tail_final.rds") ``` # This code is based off of Tirosh et a...
9631c267f74498d649b038464b66677076dc8f7c321706e0cc39680860a7b290
R
977
30
if (!require("pacman")) install.packages("pacman") pacman::p_load(caret) setwd(dirname(rstudioapi::getActiveDocumentContext()$path)) # IAPS neuroticism data N_IAPS <- read.table("N_IAPS.txt") set.seed(666) testIndex <- createDataPartition(N_IAPS$V1, p = 100/nrow(N_IAPS), list = F, ti...
2a02b03248dd593acf848d570774f8e8763200a7144f8ff318aa8b423903f873
R
980
28
context("Bypass conda") test_that("MLflow finds MLFLOW_PYTHON_BIN environment variable", { orig_global <- mlflow:::.globals$python_bin rm("python_bin", envir = mlflow:::.globals) orig <- Sys.getenv("MLFLOW_PYTHON_BIN") expected_path <- "/test/python" Sys.setenv(MLFLOW_PYTHON_BIN = expected_path) python_bi...
200aa14631a939105b7f6648db56606dbb610e14efa51e9e685d30f876f49953
R
981
28
plot_color_coded_biaxial <- function(m, x.var, y.var, color.var, color.breaks = NULL) { x.var.idx <- which(colnames(m) == x.var) y.var.idx <- which(colnames(m) == y.var) color.var.idx <- which(colnames(m) == color.var) m <- data.frame(m) m <- hexbin_downsample(m, x.var.idx, y.var.idx) if(is....
0dab84815245320b67ff9200ddac89eda22f8ff0325bfafb3d16710f62735901
R
982
28
# install_R_requirements.R # Script to install all CRAN and Bioconductor dependencies for TSProm # ---- 1. Install base package manager ---- if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager", repos = "https://cloud.r-project.org") if (!requireNamespace("pacman", quietly = TRUE)) ...
46bb52087457442befdb97a0c2ca139d3227154ee8b3138b2567bb68c54aae41
R
983
35
test_that("Test ComputeSpatialEnrichmentIndex", { coords <- readRDS(system.file("extdata", "MouseBrainCoords.rds", package = "SpNeigh" )) logNorm_expr <- readRDS(system.file("extdata", "LogNormExpr.rds", package = "SpNeigh" )) bon_c0 <- GetBoundary(data = coords, one_cluster = 0) ...
6871783d81aea077342f6ba26be900f4d00b013bf9d6601a6efa350ab66b9788
R
985
34
##### ##### ##### ##### ##### ##### ##### ##### ##### ##### # Parameter settings ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### setwd(file.path(getwd(), "R")) source("00_directorySettings.R") # load baseDir <- "/WORKING_DIR" dataDir <- file.path(baseDir, "data") outDir <- file.path(baseDir, "results") ##...
12b0b2d336da78ef91790c475eb47db565f58be34af9a4db9284cb0bd193748c
R
986
23
#!/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", "--input", required=TRUE, help="input matrix") parser$add_argument("-o", "--output",...
59cbd25bbc2eaeb780d0aabf2146b28f7c0914b6ee21c2850ea2f3a8e04ab5c2
R
987
35
#!/usr/bin/env/ Rscript library(MendelianRandomization) mvdata <- mr_mvinput(bx = cbind(ldlc, hdlc, trig), bxse = cbind(ldlcse, hdlcse, trigse), by = chdlodds, byse = chdloddsse) mvdataout <- cbind( mvdata@betaX , mvdata@betaXse, mvdata@betaY, mvdata@betaYse ) colnames(mvdataout) <- c(past...
69794f80583d1284b410da3960930243f4ec0e3e994efab585e9cbd0927a94fa
R
989
47
library(STdeconvolve) library(anndata) library(scater) set.seed(101) #Read SC data sc_path = "./SC/SN_SC.h5ad" SC <- read_h5ad(sc_path) k <- length(unique(SC$obs$cell_type)) #Read ST data h5adpath <- "./simulated_gene_expression_average.h5ad" dlpfc <- read_h5ad(h5adpath) cd <- t(dlpfc$X) cd <- round(cd) pos <- dl...
470af62fe094914f5ea976639bb312d1ff17a9c9fdecd61342cbedb08e94cc1b
R
990
27
### Extract internal standards from all samples of Mboat2 overexpression and plasma membrane lipid supplementation lipidomics setwd(rstudioapi::getActiveProject()) rm(list=ls()) library(tidyverse) library(stringi) library(matrixStats) ##Input IS concentration ## ==== Ion list for internal standards ==== load("./Out...
f26d04ea20c7cafdcbbf1807341aa172385fdb3a5fa1af8903f5d9f6f54335cf
R
991
29
library(devtools) library(sva) #### matrix and coldata #### merged_matrix_M merged_matrix_R coldata_df_M coldata_df_R #### vectors #### ## Mouse vector_Sequencing_M <- coldata_df_M$Sequencing vector_Treatment_Lateral_M <- coldata_df_M$Treatment_Lateral # gene name adjusted_merged_matrix_M <- ComBat_seq(merged_matrix...
b1d0841fc1e20be2b2eaa11806250ec76ef6bdab67bc40bba5e2d45cabf11740
R
995
31
#This code combines atc and covariates data frames to QT variants #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) df.scores <- fread("./Data/PRS/PGS002120_scores.tsv...
8a1d21cfe0e71f2cfcc6b2594f565b6e833c2ad0da5e1702e76c14dc4d2c0b3a
R
997
30
####################################################### # Segments to database ####################################################### options(scipen=999) ## Parse snakemake if(exists("snakemake")) { files = snakemake@input[["seg"]] outfn = snakemake@output[["tsv"]] } else { files = list.files("results/cnv/call...
0d7fbf9b8c397fe57c18368996706fbedab05409b1dbeceb534c03be467a82ee
R
1,000
29
# =============================================================== # ?? Regression shared formula builders # =============================================================== reg_compose_random_terms <- function(random, nested = FALSE) { random <- reg_protect_vars(compact_chr(random)) if (length(random) == 0) return(...
3cd79708f0b32779f3932321d9bf1d267f09bc464f236f973b8a32eecbfe583a
R
1,009
31
# ----- # 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(".") # "inputdata/1-DESeq2_RNA_4_197...
840095b50085c8448a1d5ca63326fe82866fe134cf624e56070b3de7a4c491cd
R
1,010
37
shinyUI( navbarPage("premessa", tabPanel("Concatenate files", fluidPage( fluidRow( uiOutput("concatenateUI") ) )), tabPanel("Normalize data", tags$head(tags$script(src = "gate-plot.js")),...
cbbf0870aedc6b732911642705622be283b9150f258d9825089b9db03fb83cfc
R
1,010
32
#' @title Check headers of files stored on disk #' #' @description #' Function to check that all filenames in a vector #' point to existing files with the same resolution, #' orientation, size, and origin. #' #' @param files character vector of filenames #' @param showError logical whether to show an error (True) or #'...
ee3508fe319e42b1c082c1d1d83fadd044876be09d4543e9e2a2dce2751ab005
R
1,013
37
#' #' #' @param #' #' @return #' #' @export nested_xgboost_cox_cv_pdp <- function(results, pred_vars) { pdp_data_function <- function(x) { feature <- x[[1]] model_number <- x[[2]] model <- flatten_results[[model_number]]$model vars <- flatten_results[[model_number]]$vars data <- flatten_results[[...
18bf60f85fd01e3d7a2ca2c2ef442fc075ae4776cec347dd8227d44ca56da70f
R
1,014
27
#' @title runCorrelation #' @description Calculates the spearman correlation on the input expression matrix & saves the results in SCENIC format #' @param exprMat_filtered Expression matrix (filtered) #' @param scenicOptions Fields used: Intermediate file name "corrMat" #' @return Writes the output in the file name st...
dc17735e60ed0174bf711f4ff56f360e8106936ce2d618ec23eae2e13a53dbdf
R
1,016
38
library(Redeconve) library("anndata") library("Matrix") library("MatrixExtra") library("dplyr") set.seed(1) #memory.limit(size = 400*1024) # in Megabytes (edited) 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$var_n...
034182756cb5dbca0075611441713afcb209f503619af661cb0ce8a84ec1471a
R
1,017
34
library(tidyverse) library(odbc) library(DBI) library(GSVA) library(qusage) rm(list=ls()) myinf1 <- "/projects/verhaak-lab/GLASS-III/results/kallisto/kallisto/final/gene_tpm_matrix_all_samples.tsv" myinf2 <- "/projects/verhaak-lab/USERS/johnsk/glassx/varnf/data/msigdb/h.all.v7.1.symbols.gmt" expr <- read.delim(myinf...
1d3ccb9783141171271902d529dca8e55f56b60143b239629af01d515cd90695
R
1,017
23
calculate.Z<-function (x, parallel, ncores, verbose, Z, do.ZnZ = FALSE, debug.verbose = FALSE) { if (is.null(Z)) { message("Nodewise regressions will be computed as no argument Z was provided.") message("You can store Z to avoid the majority of the computation next time around.") message("Z only depends ...
a722d5a833407aafb1c01859cccdac9ae5f92da0c731118370e508889f21fc57
R
1,021
41
source('./R/20211129_init.R') setwd("C:/.../20211103_mutant-analysis/") source('./R/20211201_functions_data_processing.R') library(gridExtra) library(readr) library(ggplot2) library(dplyr) setwd("C:/.../data") df = NULL ID_elements = NULL thresh=543 gap2fill=0 for (i in 1:length(dir_list)){ for (...
fe316350985300f328aef1b2afc21dd25c01399294fc4cb8653dbd7e6bd8da3a
R
1,024
33
#!/usr/bin/env Rscript #------------------------------------------------- # Title: Make id2name file # Author: Amanda Zacharias # Date: 2023-08-07 # Email: 16amz1@queensu.ca #------------------------------------------------- # Notes ------------------------------------------- # module load nixpkgs/16.09 gcc/7.3.0 r/3.6...
34934041180446ecb023bd3288d3ec541e6e6d7a4a9e6a11a67ba1c2e1dec87f
R
1,029
24
#' helper-load — testthat helper: source alignment-data-sources.R for tests. #' #' Auto-loaded by testthat before each test file in `alignment/assessment/`. #' `testthat::test_dir()` walks up from the test file to find `helper-*.R` #' files, so this works whether you run tests from the repo root or #' anywhere else. #'...
8c5257c245c5f6a9def9c1528b412f59b3099d8ec22bf838b90ea85921a93220
R
1,029
27
# R script for calculating annualized percentage change in hippocampal volume based on longitudinal MRI data # Author: Maryam Hadji, University of Eastern Finland, Kuopio, Finland (maryamh@uef.fi) # Last updated: 17-Feb-2025 # # Requirements: # - R version 4.3.1 or later # # Usage: # - Set working directory to the dire...
5ec569178ea9d92bc1de631b8a33da96e567a66f5ab27893b5f071f3e6e5bd5e
R
1,030
37
# =============================================================== # ?? Regression shared utilities # =============================================================== compact_chr <- function(x) { if (is.null(x) || length(x) == 0) return(character(0)) x } reg_protect_vars <- function(vars) { if (is.null(vars) || l...
8771e2fb7c587587ebe7842cb080e8bb7a8907c590fd2d65589af7640508fc37
R
1,030
28
library(ggplot2) # Manually specify column names if they are missing or incomplete dataeli1 <- read.csv("copieddata.CSV", sep = ";", dec = ",") # Create the line graph for AvgFitness and MaxFitness over Generation ggplot(dataeli1, aes(x = Generation)) + geom_line(aes(y = AvgFitness, color = "Average Fitness"), size...
bde1757bb5159ad090d8d26e84d10089ee482b2054f98db96f228b554fb0507d
R
1,033
15
# Install MLflow for R files <- dir(".", full.names = TRUE) package <- files[grepl("mlflow_.+\\.tar\\.gz$", files)] install.packages(package) mlflow:::mlflow_maybe_create_conda_env(python_version = "3.7") # Install python dependencies reticulate::conda_install(Sys.getenv("MLFLOW_HOME", "../../.."), envname = mlflow:::...
faff01281c57ea720b1edd29d19efb5bd63b71cc8eddff505aa6ad95d990f5f6
R
1,039
44
# Deploy a Prod-Ready, Robust Shiny Application. # # 4. Test my package devtools::test() rhub::check_for_cran() # 5. Deployment elements ## 5.1 If you want to deploy on RStudio related platforms golem::add_rstudioconnect_file() golem::add_shinyappsio_file() golem::add_shinyserver_file() ## 5.2 If you want to deploy...
229586db19245fb0dfb8195aa7cf36a393bb74419e579087a6df4a6a9b1ed9a7
R
1,040
38
## Ensure reproducibility of example data set.seed(20220907) ## Generate example data sce <- scuttle::mockSCE() ## Add some sample IDs sce$sample_id <- sample(LETTERS[1:5], ncol(sce), replace = TRUE) ## Add a sample-level covariate: age ages <- rnorm(5, mean = 20, sd = 4) names(ages) <- LETTERS[1:5] sce$age <- ages[...
a9f0781873cc1cb8252ffd7bfd9a32dc0436af8d5d4ec9b7392b4f39aa80cc33
R
1,040
33
library(ggplot2) library(dplyr) library(viridis) # Your new data data2 <- data.frame( DispersalType = c("Passive Dispersal", "Combination of Passive and Active Dispersal"), Percentage = c(64.9, 35.1) ) # Create the ring (donut) chart with a larger hole in the middle ggplot(data2, aes(x = 2, y = Percentage, fill ...
db1558d6c5ea7dfdf09224a99156e6874d4721fac3f3e559b604dc1651ec26a5
R
1,041
26
# Import csv_file <- "/data/project/1_Epilepsy_RNA/RNA_Human/Raw_Data/Patients_sheet_FTP_2.csv" file_data <- read.csv(csv_file, stringsAsFactors = FALSE) files_and_labels <- setNames(file_data$Filepath, file_data$Group) # Initialize an empty list to store dataframes list_dfs <- list() # Loop through each file path a...
9ac91095ddff8fd5d299a13071746679e196ced45f7b92425d9339abe36a7c58
R
1,043
32
library(dplyr) library(ggplot2) DataName <- 'DESeq_1_0.05_FILTERED_1_MTLEALL_NL_Up' DataName <- 'DESeq_1_0.05_FILTERED_1_MTLEALL_NL_Down' InputFile <- sprintf("/home/joonho345/1_Epilepsy_RNA/RNA_Human/08.Enrichment/GO_02.ToppFun/ToppFun_%s.txt", DataName) GO_type <- "GO: Biological Process" GO_name <- "Biological" ...
2a029ed83a7b9fc59b9f8b938d93d6a63a09bf47abeacb78b136e4895ca78c23
R
1,045
30
RNGkind("L'Ecuyer-CMRG") set.seed(123) lIfun <- function(d) factor(rep(2,nrow(d)),levels=1:2) # All staircase (indicated by NA) mySSD_function <- function(d)SSD_function(d,SSD=NA,p=.25) designSSexG <- design(model=SSexG, factors=list(subjects=1,S=c("left","right")),Rlevels=c("left","right"), ...
9d24639a64b02c90e415ef1fb423b34ab849839d57e6b601edc3963ab423e290
R
1,045
31
#!/usr/bin/env Rscript args = commandArgs(trailingOnly=TRUE) # test if there is at least one argument: if not, return an error if (length(args) < 1) { stop("Please provide an input", call.=FALSE)} titan_file <- args[1] aliquot_barcode <- args[2] solutions_out <- args[3] # Interactive run #titan_file <- "/projects...
3aed7ed6f56a12f82a932fafc33372d601ce9407a077796813346b477e11fa01
R
1,048
34
.onLoad <- function(libname, pkgname) { op.fafbseg=choose_segmentation('flywire31', set=FALSE) # set a default location for sqlite databases if user has not specified their # own op.fafbseg=c(op.fafbseg, list('fafbseg.sqlitepath'="~/projects/JanFunke/")) op.fafbseg=c(op.fafbseg, list('fafbseg.cachedir'=fafbs...
9516f035000a0fcb1debf66289f1c3d72c10d271c850fbcf33f8965519f9d003
R
1,049
16
library(GeoTcgaData) library(dplyr) # https://github.com/YuLab-SMU/GeoTcgaData load("/home/joonho345/resources/GeoTcgaData/gene_cov.rda") # v1.992 #### import matrix #### merged_matrix <- as.matrix(read.table("/home/joonho345/1_Epilepsy_RNA/RNA_Human/02.Quantification/merged_matrix.txt", sep = "\t", header = TRUE, ro...
970ac098c6e22c0795daabf8cda3997a8b33025ff2a20e39997ea33e35255e54
R
1,055
31
context("annotations") op <- choose_malevnc_dataset('VNC') on.exit(options(op)) test_that("manc_meta", { skip_if(inherits(try(clio_token(), silent = T), 'try-error'), message = "no clio token available") res <- manc_meta('DNp01') expect_true(is.data.frame(res)) expect_true("dvid_group" %in% colnames(r...
49cd176ed6d3acb89f06c45e8bf8a133235e0a4017236a85b6cc4492a3d4c2f4
R
1,061
28
library(ggplot2) library(viridis) # Create a dataframe for the CCA sensitivity analysis results data <- data.frame( CCA_Concentration = c("100%", "75%", "50%", "25%", "0%"), Settlement_Success = c(96, 96, 72, 52, 1) ) data$CCA_Concentration <- factor(data$CCA_Concentration, level...
812731f992ecc361ee417b0164a9416ee1e5861230272192021240065228583f
R
1,065
28
context("test source PPI") test_that("sourcePPI works", { skip_if_offline() skip_if_not_installed("STRINGdb") tf <- data.frame(matrix(c("Rv0022c","Rv0023","Rv0042c","Rv0043c","Rv0047c","Rv0054"), nrow=6, byrow=T),stringsAsFactors=FALSE) # STRINGdb Version 10 if(R.Version()$major=="...
c04c0d2b7262b4a4c7eb30970a5769af7ee5da3de6942f54917a8187e56621f7
R
1,065
35
library(tidyverse) library(qs) library(survival) library(survminer) result_df = data.frame() para_df = qread('res/lasso_model_para.qs') for(cohort in tcga_cohorts){ final_tpm <- qread(str_glue("data/UCSC_GDC/TCGA-{cohort}_clean_tpm.qs")) genes = intersect(rownames(para_df),rownames(final_tpm)) surv_df...
84f3b6a631c8ca217b240ab8f37a05a9a33ce089b23fefb150d24b41c31580b5
R
1,066
28
## venn diagram -hacky way by saving a csv in matlab and loading it here ## -don't have time to implement this in matlab. # why does matlab suck so much # r is so great # library(venneuler) # myVenn <- venneuler(c(A=10, B=11, C=13, D=12, 'A&B'=1, 'A&C'=13, 'B&C'=4, 'A&B&C'=1)) # myVenn$labels <- c("A\n22","B\...
8f3b762c001882f887d66c5a2a9b034ff8563e9c8e39db74cd25aa05e7e3b906
R
1,066
16
rm(list = ls()) indir <- '/sc/arion/projects/adineto/ase' outdir<-'/sc/arion/projects/DiseaseGeneCell/Huang_lab_project/ADASE/ASE_individual/ASE_basic/' ### ASE analysis of each sample-variant by using binom.test files <- setdiff(dir(indir),c('msbb.meta.tsv','msbb.meta.v2.tsv','ROSMAP')) for (i in 1:length(files...
5baf2066abd948990d28d5b3850ce5e75e54a29cba16a04ac439048b64017597
R
1,069
29
library(stringr) ## Calculate MSN setwd('/home/huyang/Projects/HuYang/HY_20250708') atlas_names <- c('Schaefer300', 'DK308') meas_names <- c('Morph_5F4S', 'Morph_5F1S', 'Morph_9F1S') for (curr_atlas in atlas_names){ for (curr_meas in meas_names){ ## Load raw data (Z-score) in_fname <- paste('./PROCDATA/STATS/...
f7dd9880eba4a7e7b857742607a187ea635bcb83655df33382ad277406c443d0
R
1,069
30
#!/usr/bin/Rscript args <- commandArgs() #print(args) dir <- args[6] Name <- args[7] #tail -n +5 RNA_2500.mm10.read_distribution.txt | head -n -1 > temp2.txt #head -n 3 RNA_2500.mm10.read_distribution.txt | grep Assigned | sed 's/Total Assigned Tags//g' | sed 's/ //g' Df <- read.table(paste(dir,"temp1.txt",sep="/")...
165dbf8ea72dc724fde498bb251e431d416c47dee213beaaab925ad66658dadf
R
1,073
33
# simple get request manc_get <- function(path, urlargs=list(), as='parsed', ..., show=NULL, body=NULL) { u=manc_serverurl(path, urlargs=urlargs) if(!is.null(body)) return(manc_get_body(u, body, as=as, ...)) if(!is.null(show)) { show=match.arg(show, choices = c('all', 'time', 'user')) u = paste0(u, "&...
3c06e1e5e64e5d4bfa08075e9beb280d7e8027b4beba8400986c6ece2b54d9fe
R
1,076
34
library("rsconnect") ## Locate app_dir. Edit as needed app_dir <- here::here("inst", "spe_wrapper_app") ## Or you can go to your shinyapps.io account and copy this ## Here we do this to keep our information hidden. load(file.path(app_dir, ".deploy_info.Rdata"), verbose = TRUE) ## Authenticate to shinyapps.io rsconne...
32d017c039f0c54ae0cc79e6c9d408ceb73fb485dad59a53edc98f1e80b70fbb
R
1,079
29
propagate_transcript_filter <- function(filter_df, target_mapping, grouping_column) { filtered_target_mapping <- dplyr::inner_join(as.data.table(filter_df), # nolint as.data.table(target_mapping), by = 'target_id') # nolint filtered_target_mapping <- dplyr::select_(filtered_target_mapping, grouping_colu...
82430620ed197729b120c8a0c42f0f3620c49af4ce969c61e85578f8395ed331
R
1,080
34
#After identified the most fitted PC and resolution library(Seurat) library(dplyr) data <- readRDS("nodomap_cleaned.RDS") DefaultAssay(data) = "originalexp" data <- SetIdent(data, value = "seurat_clusters") #Find markers of every clusters, only show positive ones data.marker <- FindAllMarkers(data, only.pos = T, min....
2188eed98fc1fba02fc75af31187065602e62c9126666eb0b869b5c41c454855
R
1,081
28
library(data.table) # Inverse of sum() aggregation: repeat each row 'count' times unsummarize <- function(DT, count, cols = setdiff(names(DT), deparse(substitute(count))), drop_zero = TRUE, validate = TRUE, keep_count = FALSE) { stopifnot(inherits(DT, "data.table")) ...