sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
6558693254098a7ee48fd0650e71428fa8161cec71e0cc52f5ee4cb8b0822f67
R
1,686
40
library(Seurat) library(Matrix) library(aricode) # read data matrix # after reading, suppose the data matrix is saved in 'data' # the true cell type labels are saved in 'type' # Seurat preprocessing data.seurat <- CreateSeuratObject(counts = data, project = "data", min.cells = 3);data.seurat data.seurat <- No...
e7c08f2592384ff849a07e62c2c0551702e974dee13192346bb1609464d0111d
R
1,698
50
my.alpha.col <- function(x, tl.level = 64, from = "#333333", to = "#FFFFFF"){ # alpha <- colorRampPalette(c(from, to))(tl.level + 1)[-1] # alpha <- gsub(".....", "", alpha) col.fill <- colorRampPalette(c("#EEEEEE", x))(tl.level + 1)[-1] # col.fill <- paste(col.fill, alpha, sep = "") col.fill } # End of my.alp...
9a2fb2b2a679bb23a4e3a56c13e18297f2f176f68923779d68491d18a4f02838
R
1,702
52
# logging which server was used to run this script system("echo \"Running this on ### $(hostname) ### \\(* w *)/\"") # load library library(tidyverse) library(Seurat) library(sctransform) library(scales) library(harmony) library(ggrastr) ## read seurat object data_obj_map_to_manuscript <- readRDS("./seurat_objects/sn...
ade41a39a31d8bee3f46e1e0e94a97fdcdbd78d1d5ba443bb841f48937b66542
R
1,733
72
test_that("encode a signal", { codebook <- construct_codebook(c('A', 'B', 'C')) result <- encode_signal( codebook=codebook, symbol = 'A', signal_power = 10, duration_in_seconds = 10 ) expect_true('group_index' %in% colnames(result)) expect_true('spike_time' ...
27f7c919cf5ea4e0a385bc5aad1d23814a483bc2173866b610e45e967737c98e
R
1,741
55
instLib = commandArgs(T)[1] r = getOption("repos") # hard code the UK repo for CRAN r["CRAN"] = "http://cran.uk.r-project.org" options(repos = r) rm(r) ipak <- function(pkg){ new.pkg <- pkg[!(pkg %in% installed.packages()[, "Package"])] if (length(new.pkg)) biocLite(new.pkg, ask=FALSE, lib=instLib, lib.loc=in...
87e499596ba3cf5a4da51c9b659abb8376477aeed03768ea1e69db509f922819
R
1,746
62
fbarmax <- function(mu, barom, maxom, eta = c(0.97675624, 0.01917240, 0.00407136)){ # require(MixSim) sigma <- array(c(1, 1, 1), dim = c(1, 1, 3)) # eta <- c(0.97675624, 0.01917240, 0.00407136) mu <- matrix(c(0, mu[1], mu[2]), nrow = 3, ncol = 1) ommap <- overlap(Pi = eta, Mu = mu, S = sigma) ((barom ...
03c08bf7decbdb4b8ad79a2250ce2a0f1b23eff70828d5d75ebcb0be298ede0b
R
1,758
59
library(tidyverse) library(ArchR) library(Seurat) library(tictoc) set.seed(666) addArchRThreads(threads = 8) addArchRGenome("hg38") proj <- loadArchRProject(path = "Dracheva_ALS_FTD_addRNA_addPseudobulkRep_testDAR/") peak_se <- readRDS("test_peak_matrix_MCX_Astro_ALS_vs_Control_useAstroPeaksOnly_reproducibility6_SE...
487e4a31f917ec81acf4cd69552df46fb2107266f6bcfa8e85fcaaa30700fe2b
R
1,768
47
context('Tests for the patched motifmatchr background conversion') library(testthat) library(TFBSTools) library(Pando) pfm <- PFMatrix(profileMatrix = matrix( c(8, 1, 1, 0, 1, 8, 0, 1, 0, 1, 8, 1), nrow = 4, dimnames = list(c('A', 'C', 'G', 'T')) )) uniform <- c(A = 0.25, C = 0.25, G = 0.25, T = 0.25) bg <...
1811a597b160e2f2b04cc020d9961404a256ef0c43d25408607b3b83b96cb8b4
R
1,770
56
#!/usr/bin/Rscript #!/usr/bin/Rscript # TODO # Add a proper example usage on the script. # The user is expected to pass: # Mandatory -> gwasFile, Nsamples, OUTCOMEcolname # Optional mafFile # if length(args == 0) I run an example usage function args = commandArgs(trailingOnly=TRUE) lengthArgs = length(args) if (l...
9fc06e6215bac588d1873fe1c651ca9d41c1b6c7eca882e7b74ee97ed87b3b7f
R
1,823
50
library(ArchR) library(ggplot2) ############################################################ #------------------------- Figure 3f-----------------------# ############################################################# ###Statastic & Plot setwd('output path') list=list.files(pattern = "__") #### Region_Celltype marker l...
69f107ac62d5cda9c3289dc3c176a117551e9bff110ff7a98785b8c5a6f6d969
R
1,829
82
# facets ------------------------------------------------------------------ # Saving ------------------------------------------------------------------ # Add a basename and figure number for file prefix # This function creates another function that can be used for a particular # presentation file makeBaseName...
44ca9e8c536043c0a2b3d44699f1a20a529cd4f5af64eb1ef714a3ec60e0eb98
R
1,832
57
### This files provides functions for output. print.fclust <- function(x, ...){ CHECK <- x$check PARAM <- x$param N.CLASS <- x$n.class Ignore.X <- x$ignore.X AIC <- x$aic BIC <- x$bic ICL.BIC <- x$icl.bic ETA <- PARAM$ETA BETA <- do.call("cbind", PARAM$BETA) if(PARAM$p.X > 0){ MU <- PARAM$MU ...
665a9c80e73fd59150587f338c5de6615f1020af9911e8c1abadde1b55eb3cea
R
1,848
68
### Plot fclust image. plotpv <- function(da, posterior, PARAM, zlim = c(0, 0.01), plot.mean = TRUE, xlab = "", ylab = "", main = NULL, xlim = NULL, ylim = NULL, col = my.YlOrRd(), ignore.bg = FALSE){ da.clust <- da id <- !is.na(da) K <- ncol(posterior) class <- apply(posterior, 1, which.max) if(is....
0bdcbf4a3e110059746184cfeb44bcbfc7877d47b3aeaba6b2a60f56012db468
R
1,864
62
### This is an independent function to provide logL. ### Note that Inf, -Inf, NA, NaN is drop from the summation. indep.logL.I <- function(PARAM){ nrow <- nrow(.MixfMRIEnv$X.gbd) p.X <- PARAM$p.X ret <- matrix(0, nrow = nrow, ncol = PARAM$K) for(i.k in 1:PARAM$K){ log.a <- dbeta(.MixfMRIEnv$PV.gbd, PARAM$...
cfcab2e2d8e7140d16e7df7ec13ddd5525c729ef2df7d781b16ff47bc2c72c7a
R
1,864
61
library(MixfMRI, quietly = TRUE) source("00-set_condition.r") ### Test 3d data da <- eval(parse(text = paste(case, sep = ""))) id <- !is.na(da) PV.gbd <- da[id] id.loc <- which(id, arr.ind = TRUE) X.gbd <- t(t(id.loc) / dim(da)) ### Load results fn.in <- paste("./output/ret.", case, ".tp.rda", sep = "") load(fn.in) ...
92b7acac1854301c3ffb65f9301d7c757b6114bb2e08612eabfdd0edc8425070
R
1,874
94
addSliceIndex <- function( df ) { df %>% # give each slice a unique index group_by( group_id ) %>% mutate( slice_index = match(slice_id, unique(slice_id)) ) %>% ungroup() } groupByROI <- function( df ) { df %>% group_by( group_idx , treatment , slice_id...
b069086553542d47b0e64dec5296b711a2b7b6db06eb463669e00f6d9a0e11f6
R
1,876
60
library(MixfMRI, quietly = TRUE) source("00-set_condition.r") ### Test 3d data da <- eval(parse(text = paste(case, sep = ""))) id <- !is.na(da) PV.gbd <- da[id] id.loc <- which(id, arr.ind = TRUE) X.gbd <- t(t(id.loc) / dim(da)) ### Load results fn.in <- paste("./output/ret.", case, ".tp.new.rda", sep = "") load(fn.i...
5de2249ea71213af3fce70b84d36d3b2ea2fefd7c23a7dd398c11ffa6a28b7ee
R
1,919
49
### Get the parameters parser = argparse::ArgumentParser(description="Script to Cluster scATAC data by ArchR") parser$add_argument('-I','--inputpath', help='input arrow directory') parser$add_argument('-D','--id', help='tissue ID') parser$add_argument('-O','--out', help='out directory') parser$add_argument('-C','--Cell...
1125b27284311773384ac78aa13699f843907cf8903dfb35f546db34d535f881
R
1,936
51
### run_QDNAseq.R ### Wrapper to perform CNV analysis on a set of bam files using the QDNAseq R package. library(GetoptLong) library(devtools) library(Biobase) # Command line arguments GetoptLong(c( "bams|b=s@", "Bam files", "sampleNames|s=s@", "Sample names, same order as bams", "qdnaseq_path|qdnaseq=s", "Path t...
baf8e5228112b5bb1e915ab8b28638d5aa8fc80e66f530c25106ac79988d3404
R
1,936
55
### Get the parameters parser = argparse::ArgumentParser(description="Script to Cluster scATAC data by ArchR") parser$add_argument('-I','--inputpath', help='input arrow directory') parser$add_argument('-D','--id', help='tissue ID') parser$add_argument('-O','--out', help='out directory') parser$add_argument('-F','--filt...
e88627a55055de5390cbecf19b22181f1f3394acb5b2b154e4ce5de0eb6c6c74
R
1,940
66
library(MixfMRI, quietly = TRUE) source("00-set_condition.r") ### Test 2d data da <- eval(parse(text = paste(case, sep = ""))) id <- !is.na(da) PV.gbd <- da[id] id.loc <- which(id, arr.ind = TRUE) X.gbd <- t(t(id.loc) / dim(da)) ### Load results fn.in <- paste("./output/ret.", case, ".tp.rda", sep = "") load(fn.in) ...
1b41c70125b712e0fa652a0b44f1d9d6271277210c2d08917cc84630df7d1254
R
1,954
58
#-------------------------------- # Fitting of evolutionary models # All phenotypes # 25 January 2023 # # Warning: this script takes >1h # to execute. #-------------------------------- source("./common.R") Y <- as.matrix(df[c("Log10Area.cb", "Log10Length.cb", "Log10ThicknessMedian", "Log10PeriodMedian", "Log10WidthM...
62e39e5cd4246148d6d00ae58e7e87223354379a504c623e7fe69763edbd4d62
R
1,981
67
### Perform H0: alpha/(alpha + beta) = 0.05 vs. Ha: alpha/(alpha + beta) < 0.05. lrt2.org <- function(PV.gbd, CLASS.gbd, K, H0.mean = 0.05, upper.beta = .FC.CT$INIT$BETA.beta.max){ if((H0.mean <= 0) || (H0.mean >= 0.5)){ stop("It should be 0 < H0.mean < 0.5.") } K.CLASS <- as.integer(max.gbd(CLASS.gbd))...
64f6193ba25498cbb68e46293a2aafb694a6cb6f9983076def15319888d348ad
R
1,981
81
# logging which server was used to run this script system("echo \"Running this on ### $(hostname) ### \\(* w *)/\"") # load library library(scDist) set.seed(1126490984) simCellType <- function(D, tau, nn = 100, G = 1000, N1 = 5, N2 = 5, J = 30, label = "A") { beta_true <- rep(0, G) beta_true[sample(1:G, size = nn...
ec02785e3a4a43c1a84f12848d1ab61959505fbaf5f754b67ac7dba90b7437b6
R
1,985
65
library(SummarizedExperiment) library(igraph) library(bmrm) T18.ontology <- function(T18,level=2) { dag <- graph_from_edgelist(unique(cbind(as.character(T18$class),"root"))) if (level>=2) { dag <- dag + graph_from_edgelist(unique(cbind(as.character(T18$subclass),as.character(T18$class)))) label <- T18$su...
381d63d47d1b9cefb3cab602cff11654b1be8201b2d946cbc97b968cf828dd90
R
1,999
76
### This implements RndEM algorithm. initial.RndEM.gbd <- function(PARAM){ logL.save <- -Inf i.iter <- 1 PARAM.org <- PARAM PARAM.save <- PARAM repeat{ if(i.iter > .MixfMRIEnv$CONTROL$RndEM.iter){ break } PARAM <- try(initial.em.gbd(PARAM.org), silent = TRUE) if(.MixfMRIEnv$any(inheri...
6bd3876a3521103d6c90a9310ee75044088242e6df3b39d9c7f4f084e1d2a42f
R
2,013
86
addVOAge <- function(df, dobAsDay = 0){ df <- df %>% mutate( VO_age = ifelse( is.na(VO_age) & sex == "F", as.numeric(VO_day - DOB) + dobAsDay, VO_age ) ) return(df) } addEstrusAge <- function(df, dobAsDay = 0){ df <- df %>% mutate( Estrus_age = ifelse( ...
4427e0f5627f6a84f7a7261a096ca85b37c2bdbc6956b22a372fe51f1a191c22
R
2,016
60
#-------------------------------- # Fitting of evolutionary models # Brain phenotypes only # 25 January 2023 # # Warning: this script takes >1h # to execute. #-------------------------------- source("./common.R") Yb <- as.matrix(df[c("Log10Area.cb", "Log10Length.cb", "Log10ThicknessMedian", "Log10...
eae14fe7cb6c2b8d2c5eecce130a654f67ce3d936a795da7f1c170c10005d160
R
2,022
83
library(pbdMPI, quietly = TRUE) init(set.seed = FALSE) library(MixfMRI, quietly = TRUE) ### Configuration case <- "ds.pval" .FC.CT$model.X <- "I" .FC.CT$ignore.X <- FALSE .FC.CT$CONTROL$debug <- 1 .FC.CT$CONTROL$RndEM.iter <- 50 .FC.CT$INIT$min.1st.prop <- 0.99 .FC.CT$INIT$max.PV <- 0.05 seed <- 1234 .FC.CT$MPI.gbd <-...
ece5ceac5083a9e32a8d10ad1c22457d5673c145d71f44cb136a54684696dcbd
R
2,023
48
library(Seurat) library(Matrix) seed <- 2020 set.seed(seed) # read data matrix # after reading, suppose the data matrix is saved in 'data' # add col and row names for seurat object colnames(data) <- as.character(1:dim(data)[2]); colnames(data) rownames(data) <- as.character(1:dim(data)[1]); rownames(data) ...
0ab25041172e4c1f31873c87057f41802e40519a4753438beee6445c2dbf47d4
R
2,050
43
--- title: "Gene-peak association" author: "Jonas Simon Fleck" date: "5/18/2022" output: html_document --- ```{r, echo = FALSE, message=FALSE} knitr::opts_chunk$set(message = FALSE, warning = FALSE) ``` A crucial step in the Pando workflow is the association of genes with putative regulatory regions inside the funct...
69058f025c6718f0315b476ddd894b4081bce2aa932e3a02e4af6ce057fb640a
R
2,069
54
require(tidyverse) results <- read_tsv('~/git/dissertation/thesis/Chapter 04 - A variable-length code/src/data/response_time_signal_1_noise_15_accuracy_08.tsv') rt <- results %>% mutate(correct = ifelse(decoded_symbol == sent_symbol,'Correct','Incorrect')) %>% group_by(correct) %>% summarise(rt = mean(st...
d7ead6559b80179a44acb9454c935b961d2ec0215285396a22572ae44446899e
R
2,074
51
#' @name testCPLEX #' @description #' Tests if CPLEX functionality has been added to gGnome #' #' #' @return returns a message whether the check was successful, else does a fresh installation of gGnome #' @author Tanubrata Dey #' testOptimizationFunction <- function() { # D...
b9499c74154436d117037807db2d69d84c59198d32167aa97d6072d8039af03b
R
2,093
54
"%&%" <- function(a,b) paste(a,b, sep = "") library(Maaslin2) library(tidyverse) #data_path <- "S:/Obesity_Bone/Paul/Data/data_to_O2/" data_path <- "/n/groups/ifaromics/paul/HRPQCT_16S_Analysis/data/" res_path <- "/n/groups/ifaromics/paul/HRPQCT_16S_Analysis/16S_results/SPECIES/FHS/both_sex/" #Load data created on #...
94027ba13572d44b4ed0c2d646992b54143dd100725f400db90960b5efa5089a
R
2,099
70
read_bc_count_file_in_list <- function(list_input, filename_input) { for (i in 1:length(filename_input)) { list_input[[i]] <- fread(filename_input[i]) } return(list_input) } merging_batch <- function(set1, set2) { merged_data <- base::merge(set1, set2, by = "barcode", all = T) merged_data[is.na(merged_d...
fe5b22a444a6979b688b8a59608dfe1909c17ae3658862c04c715f2233569218
R
2,100
54
"%&%" <- function(a,b) paste(a,b, sep = "") library(tidyverse) library(Maaslin2) #data_path <- "S:/Obesity_Bone/Paul/Data/data_to_O2/" data_path <- "/n/groups/ifaromics/paul/HRPQCT_16S_Analysis/data/" res_path <- "/n/groups/ifaromics/paul/HRPQCT_16S_Analysis/16S_results/GENUS/FHS/men_only/" #Load data created on #HS...
7c204e85f0a8c4a57c1af236002b3cad5249739d20c7508e8ccad70a5340aa4d
R
2,102
52
"%&%" <- function(a,b) paste(a,b, sep = "") library(tidyverse) library(Maaslin2) #data_path <- "S:/Obesity_Bone/Paul/Data/data_to_O2/" data_path <- "/n/groups/ifaromics/paul/HRPQCT_16S_Analysis/data/" res_path <- "/n/groups/ifaromics/paul/HRPQCT_16S_Analysis/16S_results/SPECIES/FHS/men_only/" #Load data created on #...
8e2b86ecc292ca7bdf8770edbd0988c10b7dbc64fcbe0d91f2075756965c73d7
R
2,102
27
--- title: "Splicing QTL" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Vignette Title} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- To perform splicing QTL (sQTL) analysis using LeafCutter you'll first need to preprocess your RNA-seq data as described in Steps 1 and 2 und...
993b6dd1585594cea58a0668a18649dd09eacaf29abb37aa7c33a7dc5cef3810
R
2,102
67
library(MixfMRI, quietly = TRUE) source("00-set_condition.r") ### Test 3d data da <- eval(parse(text = paste(case, sep = ""))) id <- !is.na(da) PV.gbd <- da[id] id.loc <- which(id, arr.ind = TRUE) X.gbd <- t(t(id.loc) / dim(da)) ### Load results fn.in <- paste("./output/ret.", case, ".tp.new.rda", sep = "") load(fn.i...
4cc41a3b3bc7bacc13b5b1e17463b941352d15f01ba788332fece508a0ee553c
R
2,104
52
"%&%" <- function(a,b) paste(a,b, sep = "") library(tidyverse) library(Maaslin2) #data_path <- "S:/Obesity_Bone/Paul/Data/data_to_O2/" data_path <- "/n/groups/ifaromics/paul/HRPQCT_16S_Analysis/data/" res_path <- "/n/groups/ifaromics/paul/HRPQCT_16S_Analysis/16S_results/GENUS/FHS/women_only/" #Load data created on #...
e2becdb98da40c58bc9ab1bbb47e0a9898761640ac7e9b714a3a04a3e0ab641c
R
2,105
80
library(MixfMRI, quietly = TRUE) prefix <- "simu" load("new/summary/summary.rda") ### Plot ret.table <- NULL for(i.case in 1:nrow(ret.summary.org)){ tmp.phantom <- eval(parse(text = ret.summary.org[i.case, 1])) tmp.overlap <- eval(parse(text = ret.summary.org[i.case, 2])) set.seed(1234) da <- gendataset(phanto...
c5b2882fc7c523d8b806025ed40c712e358e39f87927703949c755dda86e5f42
R
2,106
47
files<-list.files(pattern="Exp") i<-3 data<-read.table(files[i],header = T) dat<-data[,c(8:15)] d<-na.omit(dat) k3<-d i<-2 data<-read.table(files[i],header = T) dat<-data[,c(8:15)] d<-na.omit(dat) k2<-d i<-1 data<-read.table(files[i],header = T) dat<-data[,c(8:15)] d<-na.omit(dat) k1<-d k1<-k1[,c(1,2,5,6,3,4,7,8)] i<-...
3b41b26ac338e7d86bb8bde016f9ae743a62dceb2a0e94563080ef9fc05f6692
R
2,108
52
"%&%" <- function(a,b) paste(a,b, sep = "") library(tidyverse) library(Maaslin2) #data_path <- "S:/Obesity_Bone/Paul/Data/data_to_O2/" data_path <- "/n/groups/ifaromics/paul/HRPQCT_16S_Analysis/data/" res_path <- "/n/groups/ifaromics/paul/HRPQCT_16S_Analysis/16S_results/SPECIES/FHS/women_only/" #Load data created on...
caf5b4cdba022c95307fef914b582abfe32f40e346534efe7e82a9fe452139c7
R
2,110
80
library(MixfMRI, quietly = TRUE) prefix <- "simu" load("new/summary/summary.rda") ### Plot ret.table <- NULL for(i.case in 1:nrow(ret.summary.org)){ tmp.phantom <- eval(parse(text = ret.summary.org[i.case, 1])) tmp.overlap <- eval(parse(text = ret.summary.org[i.case, 2])) set.seed(1235) da <- gendataset(phanto...
d3be1c43e18c4478e2a603c42cd3e834d8f029935bf6200032684b8776c55d06
R
2,110
80
library(MixfMRI, quietly = TRUE) prefix <- "simu" load("new/summary/summary.rda") ### Plot ret.table <- NULL for(i.case in 1:nrow(ret.summary.org)){ tmp.phantom <- eval(parse(text = ret.summary.org[i.case, 1])) tmp.overlap <- eval(parse(text = ret.summary.org[i.case, 2])) set.seed(1235) da <- gendataset(phanto...
f2520ee839f2cda22c746ad643b841e5688e81cf2ea953d549b8782f2dd66d29
R
2,121
51
library(testthat) library(gUtils) setDTthreads(1) ## test_that('read_xmap, read_cmap', { ## # one test for read_xmap is already included in the haplograph tests ## # here we only test compliment functions not tested there ## system('wget https://mskilab.s3.amazonaws.com/gGnome/H838-bionano.tar.gz && tar -...
4f06c9fca5fa451b71e8373a475d438ca9bc10bc20d0501d9ad09ace48e4defe
R
2,143
78
library(leafcutter) test_dirichlet_multinomial_glm_mc <- function() { N=100 # number of samples depth=50 # number in each sample K=4 # number of classes P=3 # number of covariates softmax=function(g) exp(g)/sum(exp(g)) beta=matrix(rnorm(K*P),K,P) # true coefficient matrix x=lapply(1:N, function(g) run...
8b8696c95f08bbe919a02ad3deef9176be91346b35a577b44561b2a0955b2e40
R
2,161
68
#' @name run_gurobi #' @title run_gurobi #' #' @description #' Rcplex2-like wrapper for calling Gurobi for MIP optimization #' #' @name cvec (numeric) linear part of objective function #' @name Amat (Matrix) sparse matrix of constraints #' @name bvec (numeric) RHS of constraints #' @name Qmat (Matrix) sparse matrix, q...
73c845b36de55437c5c757d22a76f94769fdec84080e8f1e9a6d71301bbcc056
R
2,164
54
# apply_reject_table.R # # Applies custard-derived rejection verdicts to short- and long-window senktide CSVs # for both ROI and pensub data sources, producing 16 _clean.csv files. # Runnable with: Rscript 01-scripts/apply_reject_table.R # Run from the repo root; here::here() resolves all paths relative to the project ...
a8f5d9a44cd9e260537b631732e753147de0fe9519bdbad68c18396a343770e5
R
2,166
55
library(testthat) context('JaBbA') ## for testing any function upstream of junction balance invalid.jjs = system.file("extdata", "invalid.junctions.rds", package = "JaBbA") test_that(desc = "test filtering of junctions with invalid endpoints", code = { jj = readRDS(invalid.jjs) ...
3f3175fc93e3a5749ada170d1425bd6d2086e6ce416a02f688ea208a43c0feba
R
2,182
47
#!/usr/bin/env Rscript library(optparse) library(leafcutter) arguments <- parse_args(OptionParser(usage = "%prog [options] counts_file groups_file cluster_name", description="LeafCutter differential splicing plotting tool. Required inputs:\n <counts_file>: Intron usage counts file. Must be .txt or .txt.gz, output from...
0ad6287a50f1a744d6569d9ba661ff81bcd7898c382359066d5d754971d45755
R
2,187
85
setwd("~/Dropbox/Apps/ShareLaTeX/CogSci 2019/code/") require(tidyverse) require(cowplot) source('transmit/R/transmit.R') codebook <- construct_codebook(c('A', 'B', 'C', 'D'), c(1, 1, 1, 1)) noise_power = 10 timesteps=50 traces <- list() symbols <- data_frame() results <- data_frame() for(signal_power in c(1.5,2,3...
b17525d5dcefd47a44045eaaa5b19af093d9de6fca59a2166605ba1c8fdcc015
R
2,204
98
### Based on the proecdures 1, 2, and 3 in Benjamini & Heller (2007) ### `False discovery rates for spatial signals', JASA 102(480), 1272-1281 ### Author: Wei-Chen Chen Oct. 24, 2014. ### Input: ### p: p-values of length m. ### w: weights for the p-values, default 1/m. ### q: a desired cutoff for adjusting p-val...
9f24f19e3eea02780b7d89f8e7ed58a5c39ee91f8717c9295a385cc2a49a5d89
R
2,227
75
library(tidyverse) library(ArchR) library(Seurat) set.seed(666) addArchRThreads(threads = 1) addArchRGenome("hg38") proj <- loadArchRProject(path = "Dracheva_ALS_FTD_addRNA/") meta_data <- getCellColData(proj) %>% as.data.frame() %>% rownames_to_column("cell_id") %>% as_tibble() # Inh meta_data_inh <- met...
5c455ab291248f4e0be077b7ba98590e6fc8d03167fb0a14fd8099607fa66e0c
R
2,234
56
"%&%" <- function(a,b) paste(a,b, sep = "") library(tidyverse) library(Maaslin2) #data_path <- "S:/Obesity_Bone/Paul/Data/data_to_O2/" data_path <- "/n/groups/ifaromics/paul/HRPQCT_16S_Analysis/data/" res_path <- "/n/groups/ifaromics/paul/HRPQCT_16S_Analysis/16S_results/GENUS/subsample_FHS/corrected_seed_1234/" #Loa...
034a4c00a5370ad5c5be90ab28c386b074879dc7247dc81eecd44a5349188ede
R
2,242
52
library(Seurat) library(Matrix) seed <- 2020 set.seed(seed) # read data matrix # after reading, suppose the data matrix is saved in 'data' # add col and row names for seurat object colnames(data) <- as.character(1:dim(data)[2]); colnames(data) rownames(data) <- as.character(1:dim(data)[1]); rownames(data) ...
7f029bc32e60e8c6893a89e34ff4de7b51e69106252abe255f819b96d3063ad9
R
2,250
84
library(MixfMRI, quietly = TRUE) prefix <- "simu" load("new/summary/summary.rda") ### Plot ret.table <- NULL for(i.case in 1:nrow(ret.summary.org)){ tmp.phantom <- eval(parse(text = ret.summary.org[i.case, 1])) tmp.overlap <- eval(parse(text = ret.summary.org[i.case, 2])) set.seed(1234) da <- gendataset(phanto...
5ef0e12be41d60910e6930d91ef8aff1a79e8bf5752ec5d087cd51ce0d01d9a8
R
2,287
49
#'Dirichlet multinomial GLM (single overdispersion parameter) #' #'We recommend using \code{\link{dirichlet_multinomial_anova_mc}} instead. #' #' @param x [samples] x [covariates] matrix #' @param y [samples] x [introns] matrix of intron usage counts #' @param concShape Gamma shape parameter for concentration parame...
d1120ed22f5a29c724c73c3e3ff8ec625356fd180b9a5b88995f979c6bce00c3
R
2,290
72
## from ## https://stackoverflow.com/questions/11215162/how-to-perform-a-fast-dct-discrete-cosine-transform-in-r ## ## 4 down vote favorite ## Using Rprof revealed the dct in the dtt package to be the main offender in a piece of R code that was running quite slowly. ## ## Take your vector and extend it to a vector t...
4fe8bd408522c174c47bfb4eaa25cd22eb52e1620a1b2add4ca1e65ad9896196
R
2,303
59
library(MixfMRI, quietly = TRUE) set.seed(1234) phantom <- shepp2fMRI da.all <- gendataset(phantom = phantom, overlap = 0.01) da.pval <- da.all$pval da.tval <- da.all$tval[!is.na(da.all$tval)] pval.cutoff <- 0.05 qval.cutoff <- 0.05 ### Bonferroni cf.Bonferroni <- Threshold.Bonferroni(pval.cutoff, length(da.tval), ...
79f7c0cf685a274a935abe50bdc10a0e3a27db7a07054797277dd7d5eec23c0a
R
2,303
59
library(MixfMRI, quietly = TRUE) set.seed(1234) phantom <- shepp1fMRI da.all <- gendataset(phantom = phantom, overlap = 0.01) da.pval <- da.all$pval da.tval <- da.all$tval[!is.na(da.all$tval)] pval.cutoff <- 0.05 qval.cutoff <- 0.05 ### Bonferroni cf.Bonferroni <- Threshold.Bonferroni(pval.cutoff, length(da.tval), ...
9d1814b5a2ee75b248b164bd2928b7d3d1b38cd990e72a15c8eafee06738924c
R
2,318
64
mle.beta.constr <- function(PARAM, i.k, method = .FC.CT$optim.method[1]){ beta.theta <- PARAM$BETA[[i.k]] if(method[1] == "BFGS"){ ret <- constrOptim(theta = beta.theta, f = beta.constrOptim.f, grad = beta.constrOptim.grad, ui = rbind(c(1, 0)...
4f2005df76ba2993d125a3f25aa72492471bca0dde5502527c49fe57ffcdb97d
R
2,345
51
# load_raw.R # # Canonical data loader for FAST/SLOW (and custard) CSVs. # Sourced by both the Shiny app (05-app/app-plot-nested-stats.R) and the # precompute scripts (build_reject_table_fastslow.R, build_reject_table_custard.R). # # load_raw(path) reads a CSV, drops mouse_id == 81, canonicalizes treatment # strings, e...
50e3da9851f128c8b9f3818b42f3ad76f51437ed6e846d702dfdbf77a5657a1d
R
2,356
73
library(ggplot2) library(SurvMetrics) library(caret) library(survival) library(pec) library(tidyverse) DATA_DIR <- "/data2/MRI_PET_DATA/predicts/" MODELS <- c("mlp", "cnn") # model file names OTHER_MODELS <- c("cph", "weibull") MODEL_TIMES <- list( "mlp" = c(0, 24, 48, 108), "cnn" = c(0, 24, 48, 108) ) ####...
86f270088b10ba75cdbc909ba68b13d908f24a77ae8f4e0488ec2a801d02bf2d
R
2,358
45
--- title: "Region selection" author: "Jonas Simon Fleck" date: "5/17/2022" output: html_document --- ```{r, echo = FALSE, message=FALSE} knitr::opts_chunk$set(message = FALSE, warning = FALSE) ``` The underlying idea of Pando is modeling gene expression by the interaction between TFs and regulatory regions. However,...
4253fb09f0a6b8e62c4097a1ab83cda6afbc1e6cd1f1898f01c52c510ca09051
R
2,371
59
"%&%" <- function(a,b) paste(a,b, sep = "") library(tidyverse) library(Maaslin2) #In Maaslin2 The data file can contain samples not included in the metadata file #(along with the reverse case). For both cases, those samples not included in both #files will be removed from the analysis. Also the samples do not need to...
4efc648b73c3b3971e06801d5081383ba1c53bce35c36d66fa92acf66cc1c10b
R
2,397
57
# logging which server was used to run this script system("echo \"Running this on ### $(hostname) ### \\(* w *)/\"") # load library library(tidyverse) library(Seurat) ## set data path and sample info data_dir <- "/cndd2/junhao/ALS_FTD_singleCell/run_cellBender_on_raw_snRNA/" sample_meta <- read_tsv(paste0(data_dir, "...
d9c6af4f1a63e927fb00d3644170b4bb3b91a07e42146b6347a36fea9aa2f984
R
2,416
49
# Author: Francois Aguet # Description: This is a post-processing function for FastQTL. It calculates # q-values (Storey) and p-value thresholds for all genes in the permutation results file. suppressMessages(library(qvalue)) suppressMessages(library(tools)) suppressMessages(library(argparser)) # parse inputs p <- a...
a3f850c11c07d15c4d0d2aee765ed0c1921508d740eb8e0f139e2c890c6a70cd
R
2,442
80
### For LMT. ### Copy from EMCluster. ### For pvalue only. lmt.pv <- function(fcobj.0, fcobj.a, X.gbd, PV.gbd, tau = 0.5, n.mc.E.delta = 1000, n.mc.E.chi2 = 1000, verbose = FALSE){ if((!inherits(fcobj.0, "fclust")) || (!inherits(fcobj.a, "fclust"))){ stop("fcobj.0 and fcobj.a should be both in \"fclust\...
e8752f665b49bf5c71074fb3b2a7f860711728b1493d5176e3f5067d45a3666f
R
2,445
80
### For LMT. ### Copy from EMCluster. ### For identity cov matrix only. lmt.I <- function(fcobj.0, fcobj.a, X.gbd, PV.gbd, tau = 0.5, n.mc.E.delta = 1000, n.mc.E.chi2 = 1000, verbose = FALSE){ if((!inherits(fcobj.0, "fclust")) || (!inherits(fcobj.a, "fclust"))){ stop("fcobj.0 and fcobj.a should be both ...
06b9707e2d7842fb4334122bc81e2b006b5516aefb39ef08498068f40aa964c9
R
2,470
60
# logging which server was used to run this script system("echo \"Running this on ### $(hostname) ### \\(* w *)/\"") # load library library(tidyverse) library(Seurat) data_obj_sub <- readRDS("./seurat_objects/snRNA_cellBneder_corrected_postQC_scTransformed_clustered_2ndRoundAnnotated_cleanV2_SeuratV4_object.rds") me...
48b71c31609f01a0081ed7a31e0d01112c733ce939514b4dee4f80c77275e47e
R
2,482
58
#' Run a bunch of simulations with a given #' #' Some other stuff here. #' #' @param codebook constructed using construct_codebook function #' @param source_distribution source distribution of messages. Messages are generated in simulations according to this distribution. #' @param prior_distribution initial guess a...
79d88f4588099f6c4506569762276decdf38d1d8f530dafdf8c18145b529c1fc
R
2,499
56
#!/usr/bin/env Rscript library(optparse) library(leafcutter) # e.g. Rscript ../scripts/draw_clusters.R brain_liver.txt.gz chrX:clu_8,chrX:clu_9 -g brain_liver_meta.txt -e ../leafcutter/data/gencode19_exons.txt.gz arguments <- parse_args(OptionParser(usage = "%prog [options] counts_file cluster_name", description="Lea...
0d498bef122dc4bd75efa211febe69c68340d05d962d8a3b3c626ca9b1e38d16
R
2,500
79
#---------------------------- # Ancestral state estimation # 25 January 2023 #---------------------------- source("./common.R") # load mvMORPH imputation load("../data/derived/fit_OU.RData") dfOU <- imp_2$estimates rownames(dfOU) <- df$English_name anc <- anc_2$estimates # fit OU model Y <- as.matrix(dfOU[, c("Log10...
aecc8f2ed9a1e4e27f431eee1ad0976684a7691fa7d54e68e46943d69c836a0f
R
2,517
71
library(tidyverse) library(ArchR) library(Seurat) set.seed(666) addArchRThreads(threads = 8) addArchRGenome("hg38") proj <- loadArchRProject(path = "Dracheva_ALS_FTD_addRNA_addPseudobulkRep/") proj <- saveArchRProject(ArchRProj = proj, outputDirectory = "./Dracheva_ALS_FTD_addRNA_addPseudobulkRep_testDAR", load = TR...
72553c45af86733b9f1800c429460fce28a43e630f714c6de9d5722864e0d316
R
2,553
75
# logging which server was used to run this script system("echo \"Running this on ### $(hostname) ### \\(* w *)/\"") # load library library(tidyverse) library(ggrepel) library(ggrastr) rna <- read_tsv("MAST_res_level2_summary.txt") selected_cell_type <- "Astro" selected_region <- "MCX" FDR_threshold <- 0.05 FC_thres...
e4a1f64a1edc9864b09095fe1e4abb95c808eefe907ae51eca4737c45ba0ee13
R
2,566
69
### Copy some functions from "AnalyzeFMRI/R/threshold.R" since ### "AnalyzeFMRI" is archived by CRAN. Threshold.Bonferroni <- function(p.val, n, type = c("Normal", "t", "F"), df1 = NULL, df2 = NULL) { ## calculate the Bonferroni threshold for n iid tests to give a p-value of p.val ## type specifies the ...
35f96052329a1783c4d89423878cfbb8135e36b1d20f22bd473a6375a04c1d60
R
2,578
73
library(MixfMRI, quietly = TRUE) source("00-set_condition.r") ### Test 3d data da <- eval(parse(text = paste(case, sep = ""))) id <- !is.na(da) PV.gbd <- da[id] id.loc <- which(id, arr.ind = TRUE) X.gbd <- t(t(id.loc) / dim(da)) ### Load results fn.in <- paste("./output/ret.", case, ".tp.rda", sep = "") load(fn.in) ...
4ec5029de192253ead5bc577466689e1c8730c8b53c6ec2d191f5c171a841aed
R
2,578
73
library(MixfMRI, quietly = TRUE) source("00-set_condition.r") ### Test 2d data da <- eval(parse(text = paste(case, sep = ""))) id <- !is.na(da) PV.gbd <- da[id] id.loc <- which(id, arr.ind = TRUE) X.gbd <- t(t(id.loc) / dim(da)) ### Load results fn.in <- paste("./output/ret.", case, ".tp.rda", sep = "") load(fn.in) ...
762ccc324da334683b754ca9c3f8051a33a63143da4c9ff450028bfc11ec1434
R
2,578
73
library(MixfMRI, quietly = TRUE) source("00-set_condition.r") ### Test 3d data da <- eval(parse(text = paste(case, sep = ""))) id <- !is.na(da) PV.gbd <- da[id] id.loc <- which(id, arr.ind = TRUE) X.gbd <- t(t(id.loc) / dim(da)) ### Load results fn.in <- paste("./output/ret.", case, ".tp.rda", sep = "") load(fn.in) ...
81e4ba86464993107b98292d20bbcb651a103345d2e607275f776248b993b305
R
2,578
73
library(MixfMRI, quietly = TRUE) source("00-set_condition.r") ### Test 2d data da <- eval(parse(text = paste(case, sep = ""))) id <- !is.na(da) PV.gbd <- da[id] id.loc <- which(id, arr.ind = TRUE) X.gbd <- t(t(id.loc) / dim(da)) ### Load results fn.in <- paste("./output/ret.", case, ".tp.rda", sep = "") load(fn.in) ...
7113e2e470e758960fd16a9877294721ec593704f8add725dbd6251870e672fc
R
2,583
73
library(MixfMRI, quietly = TRUE) source("00-set_condition.r") ### Test 3d data da <- eval(parse(text = paste(case, sep = ""))) id <- !is.na(da) PV.gbd <- da[id] id.loc <- which(id, arr.ind = TRUE) X.gbd <- t(t(id.loc) / dim(da)) ### Load results fn.in <- paste("./output/ret.", case, ".tp.rda", sep = "") load(fn.in) ...
8e721969e8027710be6c992c9ae0ad43710e6d9b91abe51fdcefa2a9e307f11b
R
2,583
63
#!/bin/Rscript #--- Setting up the libpath, loading necesary libraries, and setting up some variable names ----#### args<-commandArgs(trailingOnly=TRUE) library.path <- .libPaths() library("tidyverse", lib.loc = library.path) args = commandArgs(trailingOnly = TRUE) cohort = args[1] #---Load principal components gen...
ab24ff4cc030528dd3b3bcba227dbbcfdebaffd081cff623d1dcb14b0ced537c
R
2,583
73
library(MixfMRI, quietly = TRUE) source("00-set_condition.r") ### Test 2d data da <- eval(parse(text = paste(case, sep = ""))) id <- !is.na(da) PV.gbd <- da[id] id.loc <- which(id, arr.ind = TRUE) X.gbd <- t(t(id.loc) / dim(da)) ### Load results fn.in <- paste("./output/ret.", case, ".tp.rda", sep = "") load(fn.in) ...
7aab3cfe5c777295d63ca368c8af6c9e48cd73c85236c5930ccb51a613b617df
R
2,592
104
# logging which server was used to run this script system("echo \"Running this on ### $(hostname) ### \\(* w *)/\"") # load library library(tidyverse) # difine samples to check # selected_region <- "MCX" selected_region <- "mFCX" selected_disease_1 <- "ALS" selected_disease_2 <- "Control" # read observed scDist resu...
9fe82aa99c0b6635bad2fa42f484dff372d5ac88b54c4ef536bc57167544fba0
R
2,598
54
####obtain a pseudo bulk expression data from a SRT data by k-means clustering based on the coordinate matrix defcol1<-c('#1C79B7','#F38329','#2DA248','#DC403E','#976BA6','#8D574C','#D07DB0','#BDBF3B', '#27BDD0','#B0C7E5','#F9BA79','#A0CC8A','#F09EA1','#C7B0D1','#D4BCB8','#F7CCDD', '#DBDD8D','#...
303d491f4dcf0983f85b4c5f9f8b8f83b83006b8b3962319561abb825b888289
R
2,609
97
# logging which server was used to run this script system("echo \"Running this on ### $(hostname) ### \\(* w *)/\"") # load library library(tidyverse) library(Seurat) library(Augur) library(tictoc) tic() data_obj_sub <- readRDS("../seurat_objects/snRNA_cellBneder_corrected_postQC_scTransformed_clustered_2ndRoundAnnot...
d9966657260432025ac1558dc02a678a71a4f58510302c9f0ea1a62a88f15f55
R
2,626
97
# logging which server was used to run this script system("echo \"Running this on ### $(hostname) ### \\(* w *)/\"") # load library library(tidyverse) library(Seurat) library(Augur) library(tictoc) tic() data_obj_sub <- readRDS("../seurat_objects/snRNA_cellBneder_corrected_postQC_scTransformed_clustered_2ndRoundAnnot...
a3d6891e46ff4b6d6d296be7acc055cfca7f85076b63dff1af1b3e04a17b2cca
R
2,631
87
### Perform H0: alpha/(alpha + beta) >= 0.05 vs Ha: alpha/(alpha + beta) < 0.05 lrt2 <- function(PV.gbd, CLASS.gbd, K, H0.mean = .FC.CT$LRT$H0.mean, upper.beta = .FC.CT$INIT$BETA.beta.max, proc = c("1", "2", "weight")){ if((H0.mean <= 0) || (H0.mean >= 1.0)){ stop("It should be 0 < H0.mean < 1.0.") } ...
796f2e6b1e8eade5ebe6d03dc2461f1dec2408723efbe188d16c3fedc5a44b70
R
2,637
84
# logging which server was used to run this script system("echo \"Running this on ### $(hostname) ### \\(* w *)/\"") # load library library(tidyverse) library(ArchR) library(Seurat) library(tictoc) set.seed(666) addArchRThreads(threads = 8) addArchRGenome("hg38") proj <- loadArchRProject(path = "Dracheva_ALS_FTD_ad...
6da692796ea0910147b2815e9cfd5d877de0ca9eb106998014904a689bac4cbd
R
2,654
73
library(tidyverse) library(edgeR) count_mat <- read_tsv("peak_Astro_ALS_vs_Control_atac_count_by_major_clusters_by_region_by_disease_by_individual.txt") pool_libsize <- read_tsv("peak_Astro_ALS_vs_Control_pooled_libSize_by_major_clusters_by_region_by_disease_by_individual.txt") run_edger <- function(selected_group1, ...
a1dc4b0acb48fc648f98d9b9a6060604a334d45d4604d9ab121c0ce9d1b1b4ee
R
2,663
57
library(rtracklayer);library(dplyr);library(Seuart) gtf.ori <- import('Mus_musculus.GRCm38.102.gtf', format="gtf") gtf.ori<-as.data.frame(gtf.ori) data<-Load10X_Spatial('my_data') mtx=GetAssayData(data,assay = 'Spatial',layer = 'counts') data=CreateSeuratObject(mtx,min.cells=1) # dim(gtf) # unique(gtf$gene_t...
f0922a4176b701a3290ec9b53589b524ccb600a16312468179675a944b451f44
R
2,741
85
library(pbdMPI, quietly = TRUE) init(set.seed = FALSE) library(MixfMRI, quietly = TRUE) source("00-set_condition.r") .FC.CT$MPI.gbd <- TRUE ### Test 3d data da <- eval(parse(text = paste(case, sep = ""))) id <- !is.na(da) PV.gbd <- da[id] id.loc <- which(id, arr.ind = TRUE) X.gbd <- t(t(id.loc) / dim(da)) ### Load re...
81b124c396aaccdb4a6cfb8b0df6c503bac1f86b88a1058255c02f18aff57787
R
2,745
67
get_angle <- function(a,b){acos( sum(a*b) / ( sqrt(sum(a * a)) * sqrt(sum(b * b)) ) )} results <- data_frame() for(i in 1:10000){ signal_power <- 100 n_neurons <- 2 noise_power <- 1 n_samples <- 5000 n_codewords <- 2 # each codeword is mapped to a different allocation #each column is a neu...
e9c3eec1faaecc7294b872e28361e353d7b35800a52421f836125947ee182c2a
R
2,763
67
library(plotly) library(ggplot2) library(ggpubr) library(RUVSeq) ###RNA data<-read.table("S-Fig1a_Gene_reads_count_table_usedforPCA",header=T) da<-cpm(data+1) names<-colnames(da) m<-t(log2(da)) pca<-prcomp(m,scale. = T) pca_plot<-as.data.frame(pca$x[,1:3]) pca_plot$name<-rownames(m) pca_plot$Region<-c(rep("NAc",4),rep(...
1bf6dfabe8d63f098b63374858dd28f064f1eca7266db5def15a77d7c63c6748
R
2,771
86
library(pbdMPI, quietly = TRUE) init(set.seed = FALSE) library(MixfMRI, quietly = TRUE) source("00-set_condition.r") .FC.CT$MPI.gbd <- TRUE .FC.CT$CONTROL$max.iter <- 0 ### Test 3d data da <- eval(parse(text = paste(case, sep = ""))) id <- !is.na(da) PV.gbd <- da[id] id.loc <- which(id, arr.ind = TRUE) X.gbd <- t(t(id...
43f69ff8711a61789c0b9f3e44f24c119a1b180ae9a9f069d58a3b5794630437
R
2,779
94
### Perform H0: alpha_1 == alpha_2 && beta_1 == beta_2 vs ### Ha: alpha_1 != alpha_2 || beta_1 != beta_2 lrt.betaab <- function(PV.gbd, CLASS.gbd, K, proc = c("1", "2")){ K.CLASS <- as.integer(max.gbd(CLASS.gbd)) if(K.CLASS > K){ stop("CLASS.gbd and K are not matched.") } ### For constrOptim() and...
8f8a833277f03dc51c6314d10962283adbaa5f7868c1bfe33d40b03bddf796ee
R
2,788
94
#' Run a mean summary on a dataframe #' #' Uses rstatix::get_summary_stats() to return the number, mean, standard error, #' and standard deviation for selected variables #' #' @param df a dataframe to be summarized. Provide a grouped df if desired #' @param col The column(s) to be summarized. Provide as colName, col1:c...
e8f1ce8f857aacca6f543add8f54da892df8e9a395672085ccea7fb25dacc295
R
2,794
98
library("ggplot2") library("gtools") myCols <- c("darkgray","steelblue3","red3","lightgray") names(myCols) <- c("neutral1","gain","loss","neutral2") # cat makeKaryotype.R | R --slave --args 2 4 500000 ".$sample_bam_name."_ratio.txt\n"; args <- commandArgs() # Settings ploidy <- type.convert(args[4]) maxLevelToPlot ...
3888506456521c1abd489e684883b4e60e57847eaaff5de706546ca26dc6d113
R
2,814
95
# init ---------------------------- library(dplyr) library(tibble) library(readr) library(tidyr) library(broom) library(ggplot2) library(gridExtra) library(sjPlot) library(purrr) if (Sys.info()['sysname'] == "Linux") { setwd('/home/mfromano/Research/mri-surv-dev/mri_surv') } else { setwd('/Users/mromano/resear...