sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
c13649ac83d41f54e2576f5aa9524e4b0535156c80582a2fe6ed9be6542f24fb
R
4,550
138
#' @name DEPRECATED-read.spc.Kaiser #' @concept moved to hySpc.read.spc #' #' @title (DEPRECATED) #' Import functions for Kaiser Optical Systems `.spc` files #' #' @description #' #' These data input functions are **deprecated** and they will be removed in #' the next release of \pkg{hyperspcc} package. #' Now f...
093435916ee2802047cc2547459f9c3ec9e20041bd00766413086c36920ab6f0
R
4,552
75
#Load package suppressMessages(library(qvalue)) suppressMessages(library(limma)) suppressMessages(library(DESeq2)) suppressMessages(library(WGCNA)) suppressMessages(library(preprocessCore)) suppressMessages(library(peer)) #Read command line arguments args <- commandArgs(trailingOnly = TRUE) try(if(length(arg...
f80476d58761bc758900b5dc09c3113fa921145a3090f8b23a253639b7e7792d
R
4,555
119
###Script 20 #GSEA on MAST DE results library(fgsea) library(data.table) library(ggplot2) library(msigdbr) library(dplyr) library(ComplexHeatmap) library(RColorBrewer) library(future) library(ggrastr) library(ggrepel) gmt.file <- gmtPathways("gene_sets/m5.go.v2023.1.Mm.symbols.gmt") ###############...
e513086c4cc8fb0664f6f6ebc66286106e1bd09b3c4787f68436ab311ceff45c
R
4,556
120
--- title: "Kv_act_inact_curves" author: "Franz Xaver Mittermaier" date: "2024-04-21" output: html_document --- This script creates the graph for the activation and inactivation curves. In brief, I performed axonal bleb recordings. In voltage clamp mode I then performed two protocols: 1. Activation protocol: ...
9a417193a8d0a009cf556ffbdc60b543abff53e591c6dbd0a6c50020265815d3
R
4,557
125
is.cran <- testthat:::on_cran() ncores <- ifelse(is.cran, 1, parallel::detectCores()) # Setup parameters for test cases R <- ifelse(is.cran, 100, 200) nreps.null <- ifelse(is.cran, 50, 100) alpha <- ifelse(is.cran, 0.25, 0.15) eps <- ifelse(is.cran, 0.2, 0.1) eff_sz <- 3 n <- ifelse(is.cran, 100, 150) test_that("rej...
2a6fb4112fef315d1e1d72a29f802f4aa74e685e6213fed435811f75bebf8be3
R
4,560
165
### --------------------------------------------------------------------------- ### ### read.txt.long: import measurements from .txt file ### ### Format: ### (y x) wl int ### #' @rdname DEPRECATED-textio #' @concept moved to hySpc.read.txt #' #' @param file filename or connection #' @param cols the column names spe...
ad16024bede0f140533d2379cf53c9c3e25b3babe35d95f2f4337e1483557efb
R
4,565
70
library(DESeq2) library(Seurat) library(ggplot2) library(ggrepel) load("/media/Scratch_SSD_Voyager/sammi/RNA_editing/Figure3_ADARKO_R1/KO_4ter_project_SO_annot_collapsed_ADARB1-1rm_20230207.rda") KO_sub Idents(KO_sub) <- KO_sub$guide comps <- data.frame(compA = c("AAVS1","ADAR1","ADAR1","ADARB1","ADARB1","ADARB2","A...
c21cbcd2b5bee59d96172783a02514c611fbacb31387fd9391180818d9b59585
R
4,580
95
### OASIS-3 Retest case for Boney ### # July 2024 library(dplyr) library(stringr) library(ggplot2) library(psych) retest_Boney <- read.csv(paste0("/Volumes/OneTouch/MRData/202301_MRIbones/OASIS3/", "BIDS/sub-OAS30002/ses-d2340/anat/Boney_xm2csv_report_20240427-003047.csv")) fnames...
9751b0fa3f0700a4ef91dc69338d2336fe4f33b9e48e2fee462d338a7e3fb821
R
4,620
120
library(dplyr) library(tidyr) library(stringr) library(ComplexHeatmap) library(tibble) # Tumor # TME # CellChat csv_file <- "gProfiler_Human_LR_allterms.csv" gProf_res <- read.csv(csv_file, stringsAsFactors = FALSE) ## Get columns gProf_res <- gProf_res[,c(1,2,4,grep("adjusted_p_value__", colnames(gProf_res)))] ...
9b10690e3b7a4394e6ca38003d45bb5c17bcdf2da4a85c81e977a781e4c52186
R
4,635
195
# ------------------------------------------------------------ # Extract mean framewise displacement per movie and run ezANOVA # ------------------------------------------------------------ library(tidyverse) library(ez) # ----------------------------- # Paths # ----------------------------- fmriprep_dir <- "/projec...
986f0560e8c39872417dfca9323972e8bbff37befa49a946b2e5bbdf3385782f
R
4,655
105
--- title: "plot_gctb" author: "Gokberk Alagoz, L&G Dept., MPI for Psycholinguistics" date: "`r Sys.Date()`" output: rmarkdown::github_document --- ```{r} library(ggplot2) library(tidyverse) library(cowplot) library(reshape2) ``` ```{r readData} gctb_results = read.csv("/data/clusterfs/lag/users/gokala/beat-dyslexia...
2753729cd6ab4c3161b90e08ca5e63844fa0df6e725ac0b9e89225b7f6c6460b
R
4,669
97
#----Figure_S02_A -------------------------------------------------------------- #------------------------------------------------------------------------------- # This is the code for Figure S02 Panel A for the connectivity analysis for # Reinhard and Fukuda et al. 2024 # set variables:---------------------------...
2282aae1e583e1ae3b9e862f9bb533c9c4d875115820ef89a6538242a71aca9c
R
4,672
118
library(Gviz) library(dplyr) library(grid) library(ggplot2) library(cowplot) library(magick) args <- commandArgs(trailing=T) chromosomeRangePath <- args[1] bandsPath <- args[2] circosPicturePath <- args[3] chromosomeFontsize <- as.numeric(args[4]) chromosomeHeightPerRow <- as.numeric(args[5]) chromosomeMaxColumns <- ...
811b6fb52a04241211ac8708f54ea2027a58a35defe4e52bfb3bb0cc241ff017
R
4,674
110
#' makeBoundaryDistance #' #' Generate distance-to-class-boundary grids from mask chips #' #' This function reads raster mask chips from the "masks" subfolder of a chips #' directory created by \code{makeChips} and generates a corresponding distance #' surface for each mask. Each output raster encodes, for every pixel,...
915bf8de5be13f9fda51cb5190b75cabc39d16a0eb2c9c6e32840385511a98f1
R
4,674
67
source('./scripts/01_Setup.R') # A treemap R script produced by the Revigo server at http://revigo.irb.hr/ # If you found Revigo useful in your work, please cite the following reference: # Supek F et al. "REVIGO summarizes and visualizes long lists of Gene Ontology # terms" PLoS ONE 2011. doi:10.1371/journal.pone.0021...
1ce80f774f6ed416439b7cc6633f38d572f965de6e97d667b5a7e282b60fc65c
R
4,679
71
library(Seurat) library(ggrepel) load("/media/Scratch_SSD_Voyager/sammi/RNA_editing/Figure3_ADARKO_R1/KO_4ter_project_SO_annot_collapsed_ADARB1-1rm_20230207.rda") KO_sub comps <- data.frame(compA = c("ADAR1","AAVS1"), compB = c("AAVS1","NTC")) adipgenes <- c("FABP7","SULT1E1","DLK1","FRZB","KLF4","KLF6","CD24") stre...
6064324aa95581c5ee56617837d750a5b15efef8a3b3a20f69c61c46f35616b9
R
4,684
133
require(ks) test_that("one-hot encoding works with numeric vector", { Ts <- c(1, 1, 0, 0) Ts.ohe <- as.matrix(ohe(Ts)$ohe) expect_true(all(Ts.ohe[1,] == Ts.ohe[2,])) expect_true(all(Ts.ohe[3,] == Ts.ohe[4,])) expect_false(all(Ts.ohe[1,] == Ts.ohe[3,])) }) test_that("one-hot encoding works with character vec...
f4f81a69d1134150ba9be2aa4544009391827f3a6777847eae22c324029498d8
R
4,703
134
# simDupHMM.R library(expm) simDupHmm <- function (nsnp, theta, nullr, duplr, nulcov, dupcov, pi, p, seqid='chr1') { # simulate paralogous data according to HMM parameters # nsnp: number of SNPs to simulate # theta: population scaled mutation rate (theta = 4*N*mu) # nullr: ngsParalog output for non-paralogous s...
8da781fc0f2f08bc43235c48be649abb41392cbc19960d2ce9c04635104dddde
R
4,704
180
library(WGCNA) library(Seurat) load(file = "/media/Scratch_SSD_Voyager/sammi/RNA_editing/Figure3_ADARKO_R1/KO_4ter_project_SO_annot_collapsed_ADARB1-1rm_20230207.rda") KO_sub Idents(KO_sub) <- KO_sub$annot_v1 KO_sub <- ScaleData(KO_sub) for (i in names(table(KO_sub$annot_v1))){ celltype=i print(i) seur<-subs...
20956e628c5aabcd3baec46f46c4d1cd20c84dfdf10c38f4679430eccc2ea97b
R
4,707
140
library(data.table) library(ggplot2) library(coloc) bel2022 <- fread("/data_global/summary_statistics/Bellenguez/GCST90027158_buildGRCh38.tsv.gz") bel2022 <- bel2022[!which(duplicated(variant_id))] hs <- fread("output/gwas/mega/saige/hs_saige_results.txt") hs_pheno <- fread("data/mega/mega_np.pheno", na.strings = "...
2b7237098c8735a2804da61818759b01bcb2082d523d35f17f68740437dd46ab
R
4,712
135
#' Get some summary statistics. From library(patchseqtools) #' #' This does the summary. For each group return a vector with N, mean, and sd. #' This is called by qcPlot. #' #' @param data Annotation data frame #' @param measurevar what variables to measure #' @param groupvars what to group by #' @param na.rm how to t...
7d66a1ab835437221c0c70042a21fd4149f45b615fdb545bd5d18a5cd621f26c
R
4,720
118
# If you need the original fragment files for quality control analysis, please contact: wuhaixu@mail.kiz.ac.cn library(ArchR) addArchRThreads(threads = 8) rheMac10_UCSC = createGenomeAnnotation(genome='BSgenome.Mmulatta.UCSC.rheMac10') #Load rheMac10 Gene Annotation Information mm10_annotation = read.delim(file = '....
d63c44c3c94f3022588c04190524fcd474e014517341aa9927a74445f990de29
R
4,721
170
library(tidyverse) library(lme4) library(broom.mixed) # ------------------------------------------------------------------ # Constants # ------------------------------------------------------------------ n_subj <- 28 n_pairs <- n_subj * (n_subj - 1) / 2 # 378 k_fixed <- 2 # intercept + Beha...
c58e84174a5b68c3918b45090b0e912571f985c06b4ba7c812f430462d6952e0
R
4,726
170
library(tidyverse) library(lme4) library(broom.mixed) # ------------------------------------------------------------------ # Constants # ------------------------------------------------------------------ n_subj <- 178 n_pairs <- n_subj * (n_subj - 1) / 2 # 15753 k_fixed <- 2 # intercept + B...
5458c708278391bab2aa3804e282433d0bb3949a625f72965074788b4a57541d
R
4,727
129
# Single cell RNA-Seq of Tlx3 WT vs KO samples # Budhaditya Basu install.packages("BiocManager") BiocManager::install("AnnotationDbi") #To install the geneLists package in R, use the devtools package: # Install from github devtools::install_github("soderling-lab/geneLists") devtools::install_github("mont...
6c01efae1c2f36f60a96497e3b3046a77baa4f8932778a984a24ccb1db721c34
R
4,736
195
library(tibble) library(dplyr) library(ggplot2) library(purrr) library(tidyr) library(data.table) # Will be the dataset "wang" or "pbmc" dataset <- commandArgs(trailingOnly = TRUE)[1] output_path <- "output" source("../utils/0-indices.R") gene_indices <- read_gene_indices(sprintf("data/%s-gene-indices.txt", dataset)...
d30014a292f707ec5028ba1d40bb5320f8c02f2effe4f2cd01ce0a43624fad7b
R
4,737
133
--- title: "Optic Nerve PLP Cre+ vs. Sox10 Cre+ DEG list" author: "Jonathan Nelson and Katie Emberley" date: "`r format(Sys.time(), '%d %B %Y')`" output: html_document: toc: yes toc_depth: 3 toc_float: true number_sections: yes theme: bootstrap df_print: paged code_folding: hide highl...
6e2c8314ae90714dd8df697cdccc90994775931b56f4d3ef385fb7c5e2277ebd
R
4,738
153
tissue='Brain_Frontal_Cortex_BA9' #tissue='Whole_Blood' st<-read.table(paste0('~/../Dropbox/DansPaper/data/replication/st_',tissue,'.txt'),header = T,stringsAsFactors = F) st<-st[,-4] colnames(st)<-c('geneid','r_st','p_st') length(intersect(which((st$p_st)<0.05),which(st$r_st>0.1))) length(intersect(which(p...
02a7b6e0289c9437ef91f1b8dcc024d4bf90466555eba98c0f25f7b2ac0ba38d
R
4,743
127
#' nested_contingency_table_fun.R #' #' Function to create a contingency table - can be used in the nested data-frame #' for one or two variables of the metadata. Its done to create contingency table in #' each nested table #' #' @param data The data frame containing the metadata. #' @param ... One or two variables ...
2e6761b31b10394b65a3ccac24edba8009fa5962d71840ff2c9b011e899cbf90
R
4,745
115
library(data.table) library(ggplot2) library(forestplot) make_95CI <- function(or, p, ci=0.95) { beta <- log(or) lt_zero <- beta < 0 z <- qnorm(p/2, lower.tail = TRUE) sd <- beta / z zrad <- numeric(length = length(p)) for (i in 1:length(p)){ zrad[i] <- qnorm((1 - ci) / 2, lower.tail = lt_zero[i]) } ...
13a166ccd4e312f8b15d18a5a30bc59906c79e6c538486b20108c93d7fd89649
R
4,763
123
args<-as.numeric(commandArgs(TRUE)) #set up sub jobs run_id<-1 run_list<-list() for (i in c(13,22)){ #tissues 13:bfc and 22:lcl for (j in 1:1400){ #subjobs per tissue run_list[[run_id]]<-c(i,j) run_id=run_id+1 } } run_i<-run_list[[args]] #tissue list tissue_list<-dir('/data/c***/z***/data/...
b15810fe027efbb42b16ad0170110378b07c73bc7681150b71d44bfbba1e9365
R
4,772
161
# code Figure 1 # Optional generic preliminaries: graphics.off() # This closes all of R's graphics windows. rm(list=ls()) # Careful! This clears all of R's memory! #------------------------------------------------------------------------------- # Load rjags library and the wiener module library(plyr) library(dplyr...
bc2d75b6f44ce47a43b74ff2afd6080f57cfb5f15ca4cfe4bb085c074a0c3334
R
4,773
97
#' @title Smooth surface #' #' @description Smooths surface data at defined full width at half maximum (FWHM) as per the corresponding template of surface data #' #' @param surf_data A N x V matrix object containing the surface data (N row for each subject, V for each vertex), in fsaverage5 (20484 vertices), fsaverage6...
f501f1a83b5c2e9c4f6e5e21ed1eac732c4adbf341fbd98a5e53f466d596af11
R
4,775
196
library(tibble) library(dplyr) library(ggplot2) library(purrr) library(tidyr) library(data.table) # Will be the dataset "wang" or "pbmc" dataset <- commandArgs(trailingOnly = TRUE)[1] output_path <- "output" source("../utils/0-indices.R") gene_indices <- read_gene_indices(sprintf("data/%s-gene-indices.txt", dataset)...
c8cf189b8599dd9d355f013851aea6dc90dd96603f62b15fe721158fdd5adaad
R
4,776
124
#alkaslasi has 3 x 2 different matrices. 2 being male and female. #we will atleast want to merge the matrices belonging to the same groups here, if possible. setwd(dirname(rstudioapi::getActiveDocumentContext()$path)) library(Matrix) library(dplyr) cerv_f_dir = "../raw_data_full/alkaslasi/Cervical_F_raw_feat...
f3552c38f08468e47478850f9998a7a67903a28fcd047aaed46b5196fda65f6c
R
4,783
126
################################################################################# ### ### plotmap - plot spectral maps ### ### plots intensity or extra data column over 2 extra data columns ## TODO: check whether function should be applied or not #' Plot a map and identify/select spectra in the map #' #' [lattice...
e752c9207b6cda5b94fb216880816bc58be2c17692778a451c21cb4cb838f5fa
R
4,786
113
library(Seurat) library(SingleCellExperiment) library(Matrix) library(Matrix.utils) library(DESeq2) library(tidyverse) #specific lamina study setwd(dirname(rstudioapi::getActiveDocumentContext()$path)) #seurat_small <- readRDS("../results/results_small/query.rds") seurat <- readRDS("../Results/results_smal...
461c8e059cf5e5c465409c62ff1745dd9312ff5d89241e962738e67f56f21ceb
R
4,788
106
#this script conducts DiffBind analysis to identify differentially accessible regions #using R version: 4.1.2 # load libraries -------------------- library(DiffBind) #version 3.4 library(BiocParallel) datadir<-'DiffBind_outputs/' # read in data ------------------------------------------------------------ samples <-...
82c2fce45ee0a1019a9c5f1b0b07764ece276bbc8358554149120281821e0a20
R
4,792
140
splatPopSimConditionalEffects <- function (key, means.pop, conditions, cde.groupSpecific, sample_heterogeneity) { condition.list <- unique(conditions) if (is.null(cde.groupSpecific)) { for (c in condition.list) { c.samples <- names(conditions[conditions == c]) c.de <- key[[paste0("ConditionDE.", c)]] if (...
f6568f4edd415e3c4a8ca856752ea62c6eb004173347a38eb1a7f5c6e3c30072
R
4,805
95
#' makeMasks #' #' Make raster mask from input vector data #' #' This function creates a raster mask from input vector data. The cell value is #' indicated by the field parameter. A unique numeric code should be provided for #' each class. In the case of a binary classification, 0 should indicate background #' and 1 sh...
3b2d1b652fe25c9ed8547db6cbfdcb0182176ffcb3c2dcd97fbac269b031b42c
R
4,811
122
#' defineRegressionLoss #' #' Define a regression loss function for use in a luz training loop. #' #' Returns a \code{torch::nn_module} that computes one of four common #' regression losses between a prediction tensor and a target tensor. The #' returned object is passed directly to the \code{loss} argument of #' \code...
c490413da9fdfe903449c4ee049ffab9ff9c455ef8ce9e957b5618e46ca8678e
R
4,833
131
--- title: "Exploring the brain imaging metrics in association with GA at birth and at scan" author: - "Kadi Vaher" - "This script performs linear regression models testing for the associations of the brain MRI metrics with GA at birth and GA at scan" date: '`r Sys.Date()`' output: html_document --- ```{r setup,...
4458a9d0b9ad35bc43389ae04ead0a11af39421c429ecd34b35b6223137b6b61
R
4,834
164
--- title: "TEBC faecal samples: Clustering of the samples (hierarchical) based on shotgun species data" author: - "Kadi Vaher" - "Hierarchical clustering with all samples together" - "Based on Bray-Curtis dissimilarity matrix calculated on the species (relative abundances)" - "The clustering is only used for ...
bdfac0430c618bdc2ca700a9906fdec503304ec4a4be09fb9efae4a72c414b30
R
4,843
141
--- title: "SupplFigure_Yohimbine_Roche" author: "Fabienne Rössler" date: '2023-06-08' output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` ```{r, message=FALSE, warning = FALSE} source("../DLCAnalyzer_Functions_v4.R") source("../UnsupervisedAnalysis_Functions.R") ...
e8741ec8279fa41937a000b53c32b0e063dacb1d2cffb1a6a3cbae2dcf7768cf
R
4,844
197
#' Reduce time-series to few Principal Components #' #' This function is under active development. It is meant to #' reduce the entire time-series of normalized and baseline-corrected #' pupillary data in just a few scores obtained by Principal #' Component Analysis. PCA is an effective way to reduce data dimensionalit...
07cef7c5073674b576bd11b3b1987024c95ca6087660f2b9e9591105589d94b4
R
4,849
115
#!/usr/bin/env Rscript args = commandArgs(trailingOnly=TRUE) scoreTablePath= args[1] outDir = args[2] # .libPaths("/usr/local/lib/R/site-library") .libPaths("/usr/lib/R/library") # .libPaths("/usr/local/lib/R/site-library") library(ggplot2) library(mixtools) library(dplyr) library(robustbase) library(cluster) l...
f0ff332984d19519f67323bf242111dd074316428b53885977f3e0062718ff53
R
4,852
148
# APOE-stratified analysis for CAA library(data.table) library(ordinal) ###### NACC ###### pheno <- fread("data/adc/adc_np_ord.txt", na.strings = "-1") covar <- fread("data/adc/adc_np_apoe.covar") # plink --bfile data/adc/adc_np --recode A --snp rs7247551 --out data/adc/apoe_snp_rs7247551 snp <- fread("data/adc/apoe_...
0064a556b76560b5900b8380850462727bd993a0b5cea8f898853a255979f91e
R
4,853
79
#----Figure_04E ---------------------------------------------------------------- #------------------------------------------------------------------------------- # This is the code for Figure 04 Panel E for the connectivity analysis # for Reinhard and Fukuda et al. 2024 #-------------------------------------------...
1549d90f1f76bb49011da37a6ecd566a489059ec0ff97f3ec0b55cfa85532963
R
4,857
212
# Function ------------------------------------------------------------------- # .Summary <- function(x, ..., na.rm = FALSE) { validObject(x) if ((.Generic == "prod") || (.Generic == "sum")) { warning(paste( "Do you really want to use", .Generic, "on a 'hyperSpec' object?" )) } ## dispatch also ...
256f439a2bafcbac86ba187f8ef54b236b6c9336f0ff4d4391539fec469f730d
R
4,863
93
library(ggplot2) library(gridExtra) options(stringsAsFactors = FALSE) args = commandArgs(trailingOnly=TRUE) celltypes <- args[1] ## Tab delimited file with celltype in first column and number of replicates in the second. Should include DNA/plasmid count_table <- args[2] ## Barcode level count table from MPRAcount pip...
4de60f2dc9d2d3a8241f66da6297d5fbc61164b568dab0dad9ca4b5a6aee0ae8
R
4,867
104
# FOOTPRINTING ################### ################################################ #hacer lo de diferenciar la orientacion del motivo neurod2_peaks$dinucleotide_oriented<-substr(neurod2_peaks$ebox_seq, 3, 8) for (motif in unique(neurod2_peaks$dinucleotide_oriented)) { motifs<-neurod2_peaks %>% dplyr::filter(dinucl...
5b16a31bf9c980d3ecf1701c408633afb5c3ac6560c70318df0bdc0da9ad5e5b
R
4,876
118
# Generated by using Rcpp::compileAttributes() -> do not edit by hand # Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 allocate_into_modules <- function(resid_array, resid_var, prior_indicator, k_, update_order, prior_baseline, prior_weight) { .Call(`_scregclust_allocate_into_modules`, resid_array, resid_va...
a49e18095d82c51a8edc247e96014348a5564a6c5ecb3ebb6cc87c878b4d1e4e
R
4,889
146
library(rstatix) library(ggplot2) library(ggpubr) library(openxlsx) library(dplyr) library(RColorBrewer) library(wesanderson) library(lme4) library(nparLD) library(lmerTest) library(jtools) library(readxl) options("scipen"=100, "digits"=4) # Load the data and fix the order of the columns data_sugarf...
6c57c42d62464311d57db7b149c212af6e846e1600812be5717c8350022782a0
R
4,891
93
#' @title CAT12vextract #' #' @description Extracts vertex-wise surface-based measures for each subject from a \href{https://neuro-jena.github.io/cat12-help/}{CAT12} preprocessed directory, resampled to a 32k mesh, and stores them all as a single .RDS file. #' @details The function searches inside the CAT12 preprocesse...
dbb90a77edefdadafc747f015a15557484e62ae49b3d3681cc6b4171a07b3ee9
R
4,906
166
# Set generic ---------------------------------------------------------------- #' `as.hyperSpec`: convenience conversion functions #' #' These functions are shortcuts to convert other objects into `hypeSpec` #' objects. #' #' @param X the object to convert. If `X` is: #' #' - a `matrix`, it is assumed to contain the s...
7bf901810d4a826771f90ae75edcbe6bb742a51ffb146216962266a43c172c42
R
4,920
120
# Preparation ------------------------------------------------------------- library(geodl) library(torch) setwd("Your Working Directory") device <- torch_device("cuda") refC <- terra::rast("C:/Users/vidcg/Dropbox/code_dev/geodl/data/metricCheck/multiclass_reference.tif") predL <- terra::rast("C:/Users/vidcg/D...
9f0e286453cf5a38bc4c46866a4da099525c98fd828e6dfcde67a87944b24b9a
R
4,922
146
require(cdcsis) require(causalBatch) require(GeneralisedCovarianceMeasure) require(vegan) require(RCIT) require(np) test.cdcorr <- function(Ys, Ts, Xs, dist.method="euclidean", width="scott", R=1000, normalize=TRUE, ncores=1, ...) { if (length(width) == 1) { if (width == "scott") { width <- apply(Xs, 2,...
006cc13885fca79351e5e90c2b9bf4999472c72cd18fc37044305c69ab480819
R
4,928
223
--- title: "R Notebook" output: html_notebook editor_options: chunk_output_type: console --- ```{r, echo=FALSE} library(tidyverse) library(data.table) library(scales) library(ggforce) library(cowplot) library(dplyr) library(splitstackshape) library(ggridges) ``` ```{r} df = fread("data/calls_and_data.csv.gz") dim(...
450c8e4ddbe45490f7b0fed640263ff2dd6df053d60b454baad2c5e5096f0870
R
4,934
126
# Load and install missing packages --------------------------------------- packages <- c("ggplot2", "matrixStats", "reshape2") package.check <- lapply( packages, FUN = function(x) { if (!require(x, character.only = TRUE)) { install.packages(x, dependencies = TRUE) library(x, ch...
95b6b8fd8d989818ba7b032d6b7db7236c7089806c3968098f29631c14e6ed6c
R
4,938
161
#' @export #' @importFrom Matrix sparseMatrix colSums #' @importFrom SingleCellExperiment SingleCellExperiment counts #' @importFrom S4Vectors metadata metadata<- #' @importFrom rhdf5 h5read #' @rdname readVisium read10Xh5 <- function(dirname, fname = "filtered_feature_bc_matrix.h5") { spatial_dir <- file.path...
48778c001e9f104a08daf41f5bda029d49cc6568f4878d844fcbb7a990b9ed82
R
4,946
197
catarg <- function(x, newline = TRUE, end = "") { xname <- x x <- gsub(" ", "", x) # if (newline) cat("- ") # if (is.null(.settings[[x]])) cat(paste0(xname, ' = NULL', end, '\n')) else if (is.character(.settings[[x]])) cat(paste0(xname, ' = "', .settings[[x]], '"', end, '\n')) else cat(p...
44cb7be7e519003052d8e78cf0970220197e482880461f059ecc27be45823014
R
4,951
139
############ # function to read inputs getLOC <- function(sub, LOCbasefolder) { fcoord = file.path(LOCbasefolder, paste0(sub, '_shift_coords.csv')) fnames = file.path(LOCbasefolder, paste0(sub, '_shift_elnames.csv')) ftypes = file.path(LOCbasefolder, paste0(sub, '_shift_eltypes.csv')) fpairs = file.path(LOCba...
07a10370e00440e372b129aa8aa92cca460285de4460091934548a25dfb02419
R
4,953
204
#' Reduce time-series to few Independent Components #' #' This function is under active development. It is meant to #' reduce the entire time-series of normalized and baseline-corrected #' pupillary data in just a few scores obtained by Independent #' Component Analysis. ICA is an effective way to reduce data dimension...
7eb56bb5bd48a39116f4cb638902997cc6ca9c100611042d610f8928c429bd46
R
4,953
79
library(data.table) library(ordinal) library(mediation) library(MASS) dt <- fread("data/rosmap_data.csv") dt[, caa_4gp := ordered(caa_4gp)] dt[, apoe := factor(apoe, levels = c("apoe33", "apoe22", "apoe23", "apoe34", "apoe44"))] m_null <- dt[, clm(caa_4gp ~ scale(conversion.efficiency) + scale(pmi) + ...
1eea23a0e253750ee7c0c6fb23ca4679115d5abf595bed5f7d1af2d5383969df
R
4,963
201
# Generate permutation distributions of t values for independent groups ## cond1 and cond2 are Nt trials x Nf time frames matrices permtdist <- function(cond1, cond2, Nt, Nf, nboot = 2000){ st2 <- Nt+1 # index to start condition 2 en2 <- Nt+Nt # index to end condition 2 all <- rbind(cond1, cond2) perm.tv...
1bb7f19b8a0221bdffd7bf94b0020652cbf7363943d67e9e47901e19b503eeb9
R
4,989
99
--- title: "GWAMA_Nweighted" author: "Gokberk Alagoz, L&G Dept., MPI for Psycholinguistics" date: "`r Sys.Date()`" output: rmarkdown::github_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) source("https://github.com/baselmans/multivariate_GWAMA/blob/master/Test_Data/N_weighted_GWAMA.functio...
f890b930216406a901c6ac3ba4bb03db3664b1d2407060ae24def79345fe1458
R
4,989
165
# -------------------------------- # Load libraries and data # -------------------------------- library(rstudioapi) library(yaml) library(dplyr) library(readr) library(lme4) library(emmeans) library(ggplot2) library(xtable) # Set working directory to script location setwd(dirname(rstudioapi::getActiveDocumentContext()...
10e3e3d66bdc645d887cc7cc8aa509b662aed2cf947ff2cee91e260ccfee0fce
R
4,990
112
## Split ABCD sample into discovery and replication subsamples # Written by Valeria Kebets, based on the code by Cedric Huchuan Xia # https://github.com/cedricx/sCCA/blob/master/sCCA/code/final/go1sample_split.Rmd # https://doi.org/10.1038/s41467-018-05317-y library('caret') library('ggplot2') library('readr') libr...
3f1088292de0ff2a3f03f2de928d65f5bcbc0dbb117daaba925b69b72f591e0c
R
4,992
171
library(cocor) df = read.csv("C:\\Users\\Jeremy\\Desktop\\zotero_folder\\data\\acoustics\\cors_sf.csv") colnames(df) # low peaks truelow = cor(df$real_peak_low,as.numeric(df$pred_peak_low), method='pearson') cor.test(df$real_peak_low,df$pred_peak_low, method='pearson') fakelow = cor(df$real_peak_low,...
f3bad10862815e330ed071f028924c4c0df3442fafdf33987180ad0abd0d73e5
R
4,992
114
#' Perform threshold analysis #' #' Outputs a plot across thresholds from 0.01 to 0.99 at 0.01 increments with the following information: #' \itemize{ #' \item{Cluster Height Range: The height range of returned clusters at that threshold, normalized to the largest range across all thresholds} #' \item{Cluster Si...
e5f86f6ba745d3c352d49bc8cd27c47a9a2f3650c65ac52cd59d8a973341264d
R
5,023
112
test_that("Matching cComBat makes outcomes for each group more similar", { sim <- cb.sims.sim_sigmoid(n=200, unbalancedness=1.5) xbreaks <- seq(from=-1, to=1, length.out=100) lo.before.0 <- loess(sim$Ys[sim$Ts == 0,1] ~ sim$Xs[sim$Ts == 0]) lo.before.1 <- loess(sim$Ys[sim$Ts == 1,1] ~ sim$Xs[sim$Ts == 1])...
b44b82b74500743a717c74acf59f8b4b515f5f7e16b352a3e258979f77ea7f0d
R
5,025
180
--- title: "Data_prep_for_fastcormics2" output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` --- title: "Gene_activity" author: "Alise" date: "2019 M09 16" output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` ```{r...
2170e214336f7d433c1c9f7b0b48019a1c701fecc96ab61b5516f1ee246cdf9b
R
5,035
140
# using TCGA lung as demo. # Usage: Rscript circos.plot.***.R id ( id is a number from 1:ncol(exprs)) #setwd("/infodev1/infoderm/Projects/Naresh/scripts/misc/OmicsFootPrint/sample_data") suppressMessages(library(circlize)) library(parallel) args <- commandArgs(trailingOnly = TRUE) #id <- as.numeric(args[1]) dir <- ...
c0ca39ef194cc4e8a8c7cd74b0290ba368148645b37c5ff1bc1da71bafa021e4
R
5,038
181
#' Cochrane review: Test for funnel plot asymmetry #' #' @description #' Conduct a test for funnel plot asymmetry for all outcomes in a #' Cochrane review of intervention studies #' #' @aliases metabias.rm5 metabias.cdir #' #' @param x An object of class \code{rm5} or \code{cdir}. #' @param comp.no Comparison numbe...
3f0ad57a2c4b2fcbbe3fe3cad5616a8b321b8b6c000800c9c68527fd1fa8e62a
R
5,041
106
###Script _ #Pseudo Bulk DE analysis library(Seurat) library(SingleCellExperiment) library(scater) library(MAST) library(dplyr) library(future) library(future.apply) dt.sct <- readRDS("datasets/2_seurat_integrated_clustered.rds") Idents(dt.sct) <- "subclusterAssignment" levels(Idents(dt.sct)) calc_m...
06d3dc0b5f1339f683196e6d60b39acc543dc4d9d52348801357ceee0cd4f340
R
5,063
87
#----Figure_03_E---------------------------------------------------------------- #------------------------------------------------------------------------------- # This is the code for Figure 03 Panel E for the connectivity analysis for # Reinhard and Fukuda et al. 2024 #-------------------------------------------...
fb10813b4b0b5bfdf262549b50a74e442d8d75315c11f3dd78529d7260509fe5
R
5,077
148
library(tidyverse) #net_cols <- c("#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7") # original order net_cols <- c("#0072B2", "#009E73", "#D55E00", "#56B4E9", "#E69F00", "#F0E442", "#CC79A7") # reordering for 3 colours only plt_in = '/home/mgell/Work/reliability/input/' plt_out = '/hom...
86272b02bc5702db744a91ccd4e2fb8ef43e464b4e2181cee7904583e4ba0b4c
R
5,083
150
# Aim of script # Examine output from Baypass (C2 model): Manhattan plot & write out significant SNPs library(optparse) library(ggplot2) library(dplyr) library(tidyr) option_list <- list(make_option(c('-i','--input'), action='store', type='character', default=NULL, help='input'), make_o...
e18a347483a1f733758f47ee56c5b387756b52de5ec5c8b4186abab0841f9869
R
5,088
146
#' @title #' Predict DNA methylation age using CTS clocks #' #' @description #' This is the function for computing DNA methylation age using CTS (cell type #' specific) clocks. The inputs including DNAm matrix, the CTS clock you want to #' use, is your DNAm data from bulk tissue sample or sorted cell sample, cell #' ...
0c4491b8e20774b7a165df29fa745d7fa070a8273d334fd71d36cbd82db378ca
R
5,096
106
library(neuprintr); library(hemibrainr); library(nat); library(natverse); library(nat.jrcbrains); library(fafbseg); library(reticulate) library(R.matlab) library(RConnectomicsAnalysis) library(progress);library(bit64);library(pracma); # ### plotting packages # library(pheatmap);library(ComplexHeatmap);library(zoo);lib...
126a036f8d27124b7a1bd643abe3940cbc01a9c4bf8e73c87ea75af403dd951f
R
5,097
128
#Bone and Fat Measures Validation (using UKB data) #April 2024 library(dplyr) library(party) library(flexplot) library(psych) library(stringr) library(readr) library(caret) out_dir <- "/Volumes/OneTouch/MRData/202301_MRIbones/derivatives/" rm("spm_boney", "ukb_bone", "ukb_1000", "bones_ukb", "boney_measures", ...
ddea695cc71818904031599db058d4b937ffb6f177ae04d30fb009d2c9d7464b
R
5,097
147
# Compares b/se using z score method - doi: 10.1038/s41380-019-0596-9 fzscore <- function(b1, b2, se1, se2){(b1 - b2)/sqrt(se1^2 + se2^2)} farrer_apoe.raw <- read_csv("~/Dropbox/Research/UCSF/ABA/Farrer1997apoex.csv") farrer_apoe <- farrer_apoe.raw %>% mutate( b = log(or), se = (log(uci) - log(lci)) / 3.92...
e9c5bc70aa078da26a27b3efc94b8928f43576e7c4f7169485432b0911cde61e
R
5,101
108
#' Check neuroimaGene database downloaded #' #' Check if the NeuroimaGene database exists in the proper location prior to running the query and prompt user to download if not. #' @keywords installation #' @param timeout time to spend downloading the NeuroimaGene database in seconds (default = 900) #' @param localdb pat...
0e311b52de7f5b9391fb0a406c6f7872c6d6e2d9ec4d6d1f5ba1cc9988122cb1
R
5,107
143
source("/media/Scratch_SSD_Voyager/sammi/RNA_editing/scripts/PertLM.R") source("/media/Scratch_SSD_Voyager/sammi/RNA_editing/scripts/WGCNA.Get.Eigen.R") source("/media/Scratch_SSD_Voyager/sammi/RNA_editing/scripts/BatchSample.v2.R") library(Seurat) load(file = "/media/Scratch_SSD_Voyager/sammi/RNA_editing/Figure3_ADA...
d5a82f72e7016cedce38abface9429073d31fad46653528c25925ca0642df544
R
5,112
204
library(ggplot2) library(dplyr) library(tidyr) library(purrr) library(tibble) library(readr) library(vctrs) library(data.table) # Will be the dataset "wang" or "pbmc" dataset <- commandArgs(trailingOnly = TRUE)[1] output_path <- "output" # Load data source("../utils/0-indices.R") gene_indices <- read_gene_indices(sp...
f021f783c0a862d54416aa79e3ca189fd60e35f57f938207c4e4738c0a48ed52
R
5,115
92
#----Figure_S06_F--------------------------------------------------------------- #------------------------------------------------------------------------------- # This is the code for Figure S06 Panel F for the connectivity analysis for # Reinhard and Fukuda et al. 2024 #------------------------------------------...
42baf210b2b69784dc986d0f7f581f917c849bc084444437b105301656bfd97a
R
5,125
142
library(data.table) library(magrittr) library(kableExtra) source("code/functions/strip_alleles.R") # rosmap_phenos <- c('arteriol_scler_bin', '') rosmap_path <- "output/gwas/rosmap" adc_path <- "output/gwas/adc" act_path <- "output/act" get_file_name <- function(path, pheno) { file_name <- paste0(path, '/', pheno, ...
b771ff92582cac734f088bdd969b0fb45faf6343b67988bb80c8608138b5e75c
R
5,149
179
text_meth <- function(x, i, random, method) { # if (x$method[i] == "MH" & x$model[i] == "common") txt <- text_MH(x, i, random) else if (x$method[i] == "Peto") txt <- text_Peto(x, i, random) else if (x$method[i] == "Inverse" | (x$method[i] == "MH" & x$model[i] == "random")) txt <- text_Inv...
235c255bab7d39433ce31926105e1dd960417131cb61cfb1c7d67b7b62028c04
R
5,156
173
library(tidyverse) initial.options = commandArgs(trailingOnly = FALSE) file.arg.name = "--file=" script.name = sub(file.arg.name, "", initial.options[grep(file.arg.name, initial.options)]) source(paste0(dirname(script.name), "/Functions/functions.R")) set.seed(1234) args = commandArgs(trailingOnly = TRUE) ref_pat...
82986198cddc2a856727ac1aaa99b7814f5f794039b3bd5c78433346de028c7e
R
5,158
119
--- title: "depol_amplitude_analysis" author: "Franz Xaver Mittermaier" date: "2024-05-21" output: html_document --- This script plots the relationship between the depolarization amplitude and the subthreshold modulation effect on synapses. Three tables are needed: - The basic experiments (t_basic) - The dep...
71a07f79151dc2c15b91363b193b2aa0398556417c57effe3f25117929f3aebe
R
5,163
137
library(Seurat) library(tidyverse) library(Matrix.utils) library(dplyr) library(Matrix) library(purrr) library(tibble) library(SingleCellExperiment) library(apeglm) library(DESeq2) library(DEGreport) library(magrittr) library(sva) #to be ran after updated SeqSeek Pipeline. With updated 'query.rds' object...
63bed351c799560e6257a84f3b188e931d165c3c22143a3234e50ae7f4a7b116
R
5,167
148
#### Notes #### #### Libraries #### library(tibble) library(dplyr) #### Sourced functions #### #### Functions #### # Merge variability rank merge_ev_rank <- function(jack.summary, metadata, by=c("local","global"), join=c("inner","full"), method=c("sd","cv")) { Tissue <- as.factor(metadata$Tissue) if ("Sex" %in%...
668efd6a54a6ef601b8744e8252f17ecbae619d2c49aecd87808f8a90159735a
R
5,172
109
--- title: "LAVA" author: "Gokberk Alagoz, L&G Dept., MPI for Psycholinguistics" date: "`r Sys.Date()`" output: rmarkdown::github_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) library(LAVA) library(stringr) library(kableExtra) ``` ```{r processInput} ### Read in summary statistics and re...
10f9bc339111131cd2ee9671ca76bdd51905d8a2646a0b25303b070a78324e1f
R
5,177
116
plotKmerDist <- function(dat, baseDat, saveDatFn, dontPlot){ if (!is.na(saveDatFn)){ save(dat, file=saveDatFn) } if (dontPlot){ return() } mainP <- ggplot(dat) + ##geom_boxplot(aes(x=Kmer, y=Signal, color=Base)) + ##scale_color_manual( ## values=c('#00CC00', '#0000CC',...
19831bbe69d76590c608865127b93a5f7c7a936a4d08dfdd7daa471acb4fdc59
R
5,185
140
library(Seurat) library(SoupX) library(sctransform) library(dplyr) library(HGNChelper) library(DoubletFinder) pre_process <- function(srat, x) { print(paste0("Original data dimensions... ", x)) print(dim(srat)) #percent mitochondrial reads to regress out srat[["percent.mt"]] <- PercentageF...
93159b81e5d1b220ebab21ffde99d010ea93378b0111e372655c0692123092fd
R
5,188
136
### --------------------------------------------------------------------------~ ### ### read.txt.wide ### ### Format: ### x y ... int (wl1) int (wl2) ... int (wl p) z ... ### #' @rdname DEPRECATED-textio #' @concept deprecated #' #' @title (DEPRECATED) #' Import `hyperSpec` objects from ASCII (text) files #...
adce8c849a710352d3576ffbd7159e7eca0be4ff0d2a907fe2acd61d868ffd16
R
5,189
176
#' Expand scalar, vector, matrix or similarly shaped `hyperSpec` object to matrix #' #' Helper function for `hyperSpec` arithmetics. #' #' A row- or column vector or #' a matrix of size 1 x n or n x 1 or #' a hyperSpec object with 1 row or 1 wavelength will be expanded #' along the size-1-dimension. #' #' Dimensions th...
d9d9930b5b26dca4c8d9c58d9ff244d1de1a601030021cd8c148d1887685723c
R
5,191
63
data <- data.frame(Country = as.numeric(ases$Country), Continent = as.numeric(ases$Continent)) # "neither agree nor disagree" coded as a class data$Protectionism.d <- recode(as.numeric(ases$Protectionism), '1:2=1; 3=2; 4:5=3; 6:7=NA') data$Antiforeigner.d <- recode(as.numeric(ases$Antiforeigner), '1:2=1; 3=2; 4:5=3; 6...
586c0864832b41b38477f71fed05d9b20f00a4602d8c32942f24e326a46a38d3
R
5,200
178
#from: https://coolbutuseless.github.io/2020/08/26/run-length-encoding-and-the-problem-of-nas/ rle2 <- function (x) { stopifnot("'x' must be a vector of an atomic type" = is.atomic(x)) n <- length(x) if (n == 0L) { return(structure(list( lengths = integer(), values = x) ), class = 'rle') } ...
89c4412f4987c360247bb028df0fc130e649cb499821d4fb5fe2a65abc0150ae
R
5,218
100
#----Figure_S04_S05------------------------------------------------------------- #------------------------------------------------------------------------------- # This is the code for Figure S04/ S05 for the connectivity analysis for # Reinhard and Fukuda et al. 2024 #---------------------------------------------...