sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
16f1555ec55aa00346e15a462539387d5b02bad357862297fb7fa6bd81127706
R
886
28
args <- commandArgs(TRUE) if (length(args)==0) { stop("At least one argument [input file] must be supplied!", call.=TRUE) } else if (length(args)==1) { inputfile = args[1] file_ext = substr(inputfile,nchar(inputfile)-2,nchar(inputfile)) if (file_ext == '.am'){ outputfile = paste(substr(inputfile,1,nchar(...
fba159a0c624ef0f9a40b4a6a92b7ae4673a4d1141884669efe6805e50b794e4
R
896
27
# Merge all permutation files into one file library(tidyverse) library(glue) # load permutation data path <- "bids/derivatives/meg-derivatives/grand_ave/brain-space/visual_model/permutations/" path_save <- "bids/derivatives/meg-derivatives/grand_ave/brain-space/visual_model/permutations/all_perm_merged.csv" path_sa...
76ce0189a59a1de370c774b1f56dcf205031c238601517ade17df6d77da33067
R
902
30
require(gierer) rgc.file <- system.file('examples/Gierer2D-500-WT-retinal-gradients.txt', package='gierer') sc.file <- system.file('examples/Gierer2D-500-WT-SC-gradients.txt', package='gierer') op.file <- "/tmp/wts.dat" rgc.dat <- as.matrix(read.table(rgc.file)) tec.dat <- as.matrix(read.table(sc.file)) a <- gierer.f...
433fc334f0bbe9d70217d34fb926123056d1231470932bf2df1c7703e8297332
R
904
35
## Code to run and deploy Shiny app ## Code provided by Leonardo Collado-Torres ## Available at: ## https://github.com/LieberInstitute/Visium_IF_AD/tree/master/code/05_deploy_app library(rsconnect) library(here) ## Or go to your shinyapps.io account and copy this ## Here we do this to keep our information hidden lo...
bf2c4448f8aa3f3ddb81f56581f6b6c09783d3e5608293329ba86f80f8f11ccc
R
909
30
library(tidyverse) d<-read_tsv('SuppData2.txt') d2 <-d %>% group_by(CRE) %>% summarise(ntags=n()) %>% filter(ntags>3) %>% inner_join(d) d2 <- d2 %>% mutate(log2expr = log2(d2$Exp_Mean)) d3 <- d2 %>% group_by(CRE) %>% summarise(mean_log2expr = mean(log2expr)) %>% inner_join(d2) %>% muta...
7b51ef031473074b03c14a75182316472c2cc6b3fc58a3068364d8127d0d87d0
R
910
42
library("SingleCellExperiment") library("lobstr") library("here") library("scuttle") library("sessioninfo") load(here("processed_data", "SCE", "sce_updated_LC.rda"), verbose = TRUE) lobstr::obj_size(sce.lc) / 1024 ^ 3 # 5.413584 B assays(sce.lc)$counts <- NULL lobstr::obj_size(sce.lc) / 1024 ^ 3 # 4.861437 B assays(...
7a5ab07fb0ddfcb9a38a61d8dd221e5900cc50d55c9b1813f79a1976736a697e
R
916
27
## Generic functions for package scalop #' @export setGeneric("rowFtests", function(x, fac, var.equal=TRUE) standardGeneric("rowFtests")) #' @export setGeneric("colFtests", function(x, fac, var.equal=TRUE) standardGeneric("colFtests")) #' @export setGeneric("rowttests", function(x, ...
a1cfd1393391d010a39b2d218ac8660d0be240e1bf0b6b4c644b8097c96610de
R
917
22
#' @title Keep rows whose names match a pattern #' @description row_subset() is a wrapper around m[str_detect(rownames(m), pattern), ] #' @param m Input matrix or data frame. #' @param pattern Pattern to look for. The default interpretation is a regular expression, as described in stringi::stringi-search-regex. Control...
55d28faeeb3c1c6a9d509461b8476d0aef8a10ce54adf0fd1d002c1359600527
R
924
43
library(Signac) library(Seurat) library(argparse) library(BSgenome.Rnorvegicus.UCSC.rn6) parser <- ArgumentParser(description = "process input arguments") parser$add_argument("--rds", action = "store", help = "path to rds object to compute gene activity for") parser$add_argument("--out", action = "store", help = "w...
f74203e69bb6754171aabc9641f1412e1b3cdbb34671bfbd53df3317fd0def75
R
926
22
#' @title Keep columns whose names match a pattern #' @description col_subset() is a wrapper around m[, str_detect(colnames(m), pattern)] #' @param m Input matrix or data frame. #' @param pattern Pattern to look for. The default interpretation is a regular expression, as described in stringi::stringi-search-regex. Con...
161c3d03b2f3b9d1970ae7df73e403bfcc23c5e520bb98554d3604db7aa87733
R
927
23
# Generated by using Rcpp::compileAttributes() -> do not edit by hand # Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 #' Compute the Local Inverse Simpson Index (LISI) #' #' @param D Distance matrix of K nearest neighbors. #' @param knn_idx Adjacency matrix of K nearest neighbors. #' @param batch_labels A cate...
41d69e6b34ecb5b47bc2d9e1b9ccc6b8f9e6548f86037461ca330ddada78a210
R
928
28
#' @title Turn a list into a dataframe #' @param L a list #' @rdname ldcast #' @return a dataframe with as many rows as the longest vector in the list #' @export ldcast = function(L, na.rm = FALSE, na.value = NULL) { if (!is.list(L)) L = list(L) Class = unique(sapply(L, class, simplify = F)) if (Class %in...
0da1bd2986dd51ac267e16477c6753378de005ed3b6ded0090b8746a21d0a545
R
929
21
args = commandArgs(trailingOnly = TRUE) paintor <- read.table(args[1], header = T) causal <- read.table(args[2]) snps <- dim(paintor)[1] paintor$Posterior_Prob <- paintor$Posterior_Prob/sum(paintor$Posterior_Prob) x = max(paintor$Posterior_Prob) summ = x set <- paintor[which(paintor$Posterior_Prob == x)[1],"pos"] pain...
7a0f3afe72231f2e909b6237dec08f023e2198f54959bead3ad1d7eab0b80ff9
R
930
31
library("ctc"); library("ape"); get_cluster_info = function( Rdata_file ) { load(Rdata_file); ordered_genes_file = paste(Rdata_file, ".ordered_gene_matrix", sep=''); ordered_genes = hc_genes$data; write.table(ordered_genes, file=ordered_genes_file, quote=F, sep="\t"); gene_tree = hc2Newick(...
cd2bd62d8fa1d365dd17d165071c7393336110a297ffa90f0f0bae3a5f41a27e
R
931
27
# SingleR spot annotation wrapper script. library(SingleR) singleR <- function(st_expr_df, sc_expr_df, sc_labels, n_centers, de_n, de_method) { ##### Runs SingleR spot annotation ####### st_expr <- as.matrix( st_expr_df ) sc_expr <- as.matrix( sc_expr_df ) ##### Subsetting to genes in com...
b96cc1ca6d79a6c127c4434f280d807b1972039aee1101c13aa24820401db583
R
932
29
library(SeuratDisk) library(Seurat) library(tidyverse) library(here) ## load in the filtered Seurat object obj_merged = here('data/tidy_data/Seurat_projects', "BU_OUD_Striatum_refined_all_SeuratObj_N22.h5Seurat") %>% LoadH5Seurat() DefaultAssay(object = obj_merged) = 'RNA' names(obj_merged[[]]) ...
e002126d8a73355875c0c0299e1a095e773e7986503dcfba0da36639b12137b9
R
940
43
## test that the transformation interface works in R. library(SimpleITK) translationTest <- function() { fname <- deparse(sys.call(0)[[1]]) dimension <- 3 tx <- c(1,2,3) translation <- TranslationTransform(dimension, tx) offset <- translation$GetOffset() if (! (tx[1] == offset[1] && tx[2] == offset[2] &&...
945ac3f85d10fedbf4315bd650bc0be3c32a84b155e69be0c67e50b57fd4bb51
R
948
29
################################################################################################### #run BayesTraits #Run "Instructions_BayesTraits_CommandLine_VarRates Tree.docx" #Open PP_Output.txt and save rescaled Branch lengths in "PP_Output_..._rBL.txt" #Note to delete the first row of branch lenghts of the...
9b59a4c157e914784aa7d2277b4f52dd615e560e52572a6b26108311047c5933
R
948
22
#' @title Flip the (nested) elements of a character vector (or list) with its names #' @description A convenience function to switch the names and elements of a named character vector or a named list of character vectors. #' @param X A named character vector or a named list of character vectors. #' @return A named cha...
39aea59053a6f7964fcf3c60cd0cfdc2dce0aef9805a76f8f51135985e5d9190
R
953
25
################################################################################################ # Generate Supplementary Figure 12, Supplementary Figure 13, Supplementary Figure 14 ################################################################################################ setwd("D:\\PhD\\Lab\\Project_3_SVG\\...
db5dad1945b9115e3c0fbb67a67aa699b455f1406250874762807c8a0d065382
R
953
25
################################################################################################ # Generate Supplementary Figure 16, Supplementary Figure 17, Supplementary Figure 18 ################################################################################################ setwd("D:\\PhD\\Lab\\Project_3_SVG\\...
4fe94cf89510c8e6cec9d0b5a8abdcdb0505e7335f79278f08b918b5dc4a5481
R
960
37
data <- read.csv("E:/VANS/data/total_mmse_genecounts_normalized.csv") coeff <- c() pv <- c() mmse <- as.numeric(data[1,2:length(data)]) for (i in 2:length(data$X)) { test <- cor.test(mmse, as.numeric(data[i,2:length(data)]), method="spearman", alternative="two.sided") coeff...
b86d90ee1bea2cc43a822a60c8f7de9b0fdaa513bc0ba1d0576509953be620b9
R
960
22
######################################## # Below are the variables that will be used in the model ######################################## ##### Therapeutic variables ######### # Estimated reduction in annual rate of repeat expansion for cells transduced with therapeutic. Example: "4" will yield a four fold lower rat...
d1620222125283a1364a6668d04fed76913b98ac4441fb71ef5940a5cf75d4c0
R
973
31
suppressMessages(library(Seurat)) suppressMessages(library(Signac)) library(ggplot2) library(argparse) parser <- ArgumentParser(description = "process input arguments") parser$add_argument("--rna", action = "store", type = "character", help = "path to snRNA-seq rds file") parser$add_argument("--out", action = "store"...
00cb4ea641b090a5a256b424f48cdcaca28cda7cc74026c35e8fac2e2e3500aa
R
977
32
--- title: "Supplemental Table N" author: "Anthony Fischer" date: '2022-06-14' output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) source('../../../../code/mpra_tools/mpra_tools.r') library(ggpubr) library(MASS) theme_set(theme_bw(base_size = 8)) ``` ##This markdo...
ff3b7a56633f3ac363019aa1c32818bec51e549997d3eba1cf55e7ca91ec6c02
R
980
21
#' @title Center matrix rows by subsets of columns #' @description #' @param m a matrix #' @param groups list of character vectors specifying the column ids to center by. Default: split_by_sample_names(colnames(m)) #' @param by how centering should be performed. One of 'mean' or 'median'. Default: 'mean' #' @retu...
d9404a8b71f1c88799d08323004a3b753ee179e1030329d7295bd0e1133db306
R
982
36
library('org.Mm.eg.db') ##########preso da sclvm on GITHUB getEnsembl <- function(term, species = 'mMus'){ if(!(species %in%c('mMus','Hs'))){stop("'species' needs to be either 'mMus' or 'Hs'")} if(species=='mMus'){ if(require(org.Mm.eg.db)){ xxGO <- AnnotationDbi::as.list(org.Mm.egGO2EG) #org.Mm.egENSEMBL x <- org.Mm....
ffefb1406864d5ebf34bf0927fde5e59bf7d588b6894f8064f7d4a86212a976b
R
987
41
# distance based on positive TCRs from single cell data HLA_filepath = "../data/HLA_I_pseudo_40.csv" df_HLA = read.csv(HLA_filepath, header = TRUE) pos_filename = "st4_HLA_I_zheng_2021_ensemble_reshape_20.csv" df_pos = read.csv(paste0("../results/", pos_filename), header = TRUE) dim(df_pos) head(df_pos) stopifnot(d...
28f0516f2739a93505feffb7ff26f2304b6d9d8bd5aaa8a10f05b1dd5e350838
R
988
40
#' Save as single-line fasta #' #' @export #' writefasta <- function(x, outpath=NULL, ext=".fa") { if (!is.null(names(unlist(x)))) { for (i in seq_along(x)) { cat(paste0(names(x[[i]]), "\n", x[[i]]), sep="\n", file=paste0(outpath, "/", names(x)[i], ext)) } } else { stop("Need names") } } # Write single f...
a50d2b49e5cb2c3c0e75949fc368fa7624f3bdc2b4967819d024f1e01824573b
R
997
27
#' Summary statistics of MAF #' @description Summarizes genes and samples irrespective of the type of alteration. This is different from \code{\link{getSampleSummary}} and \code{\link{getGeneSummary}} which returns summaries of only non-synonymous variants. #' @details This function takes MAF object as input and return...
bff5808b64b745ceb5039c0e2624808d441018f415ee7fefe6c3b69bd3585482
R
999
34
#' Convert multi-line to single-line fastas #' #' @param fastapath path to FASTA files #' @param outpath output path #' #' @export #' # fasta <- files[1] multi2single <- function(fasta, fastapath=NULL, outpath=NULL) { # lots of files if (!is.null(fastapath)) { files <- list.files(fastapath, pattern=".fa$", full=...
67820949430f1145be79a3f09902f87eded44f79629c6d390e179a07465793e0
R
1,004
51
--- title: "R Notebook" output: html_notebook --- # Set Up ```{r setup} knitr::opts_knit$set(root.dir = normalizePath("../..")) ``` # Imports ```{r} library(finalfit) library(mice) ``` # Load Data ```{r} cog.data = read.csv("data/cog.data.csv") ``` # Prep Cog Data ```{r} cog.data.ordered = cog.data[order(cog.data$f...
acdbcd0b31f514c2f0143288464a88f07fc2b24766fe224d44dea7a8fc1ef009
R
1,008
35
#' @title fold changes #' @description fold changes #' @param x matrix or character vector with matrix column names #' @param y matrix to compare against or matrix with x and y column names #' @param ... is.log and cutoff #' @return fold changes #' @rdname foldchange #' @export foldchange = function(x, y, ...) { U...
199b5d65221dd4038093ecedf1a3b6bb895fe8dd4bee0e678ddf59571c2895c6
R
1,009
35
library(Seurat) options(Seurat.object.assay.version = "v5") library(stringr) library(purrr) Sys.setenv("_R_USE_PIPEBIND_" = TRUE) projdir <- here::here() rdir <- file.path(projdir, "package/R") import::from(.from = "cembav2env.R", .directory = rdir, Sa2Integration) import::from(.from = "utils.R", .directory = rdir, ...
5e31ac4796e228f7f47f860630d2adc40dd34c5428fa0650b1575705e9d4ac35
R
1,015
22
############################################################# # Generate 3D simulations with dropout issues ############################################################# InputDir <- "..\\Data\\3D_Standard_Sim\\" OutputDir <- "..\\Data\\3D_Standard_Sim_Dropout\\" InputFiles <- list.files(InputDir) for(InputFil...
81b068a4ffbde344c9ecbf6378c914738d1ea2910af2d2ee2adaccf6e0516c88
R
1,016
35
# compute the sequence score matrix based on blosum62 using python # load the results and compute distance based on the formula in # NetMHCpan paper HLA_filepath = "../data/HLA_I_pseudo_40.csv" df_HLA = read.csv(HLA_filepath, header = TRUE) df_blosum62_X_score = read.csv("../results/st5_blosum62_X_seq_align_scor...
fc381b3117e6ab347a4d0c61757f92843efe7773798333a287982b05486efedf
R
1,016
28
## conda activate r4 ## packages for data table processing library(tidyverse) library(data.table) library(here) ss <- function(x, pattern, slot = 1, ...) { sapply(strsplit(x = x, split = pattern, ...), '[', slot) } options(stringsAsFactors = F) options(repr.plot.width=11, repr.plot.height=8.5) DATADIR='data/tidy_...
ecad97cf654143502130c000776c9eaf6e167f7ee25e08b8986672c3ddcf63f9
R
1,017
33
library(dplyr) library(RColorBrewer) library(gplots) load("cluster_1_2_3.RData") load("bulk_dev_RNAseq.RData") rownames(bulk_RNAseq) = bulk_RNAseq$WBGene bulk_RNAseq = select(bulk_RNAseq,-c("WBGene","max")) my_palette <- colorRampPalette(c("lightgreen", "black", "red"))(n = 299) col_breaks = c(seq(-6,-2.01,le...
c4355bdf81de35b1406c70fd49f7b3bb3ef652b5f013934b3c611d3342272471
R
1,019
41
####################### ##### Kimura fits ##### ####################### # Last edited: 31/03/23 by LVB # Description: Fitting the Kimura distribution to single-cell data. #---- Packages library("tidyverse") library("kimura") library("parallel") #---- Data load("data/parsed/01-parsed-data.RData") #---- Kimura fits ...
b4ef49b1155d1a2af7e22a3d14d9b3c8f5b7f2d224707604af6e3aed7911b87f
R
1,021
32
#get libraries basic_libraries <- c("tidyverse", "devtools") for (lib in basic_libraries) { if (require(package = lib, character.only = TRUE)) { print("Successful") } else { print("Installing") install.packages(lib, repos="http://cran.r-project.org") library(lib, character....
d09c0fb9fb3a61ce1a0cb4a34c536edabdc7514494cd2988f8ba6df0062be863
R
1,033
22
############################################################# # Generate ablation test for single granlarity # Note: BSP uses paired granularities ############################################################# InputPath <- "../Data/Single_Granular_Test/Var/" InputFiles <- list.files(InputPath) OutputPath <- "../...
1ceef49fc99041a62810584856e1b0960187113165f01954e10f374dade02728
R
1,034
37
library(ape) library(geiger) library(phytools) library(nlme) setwd("your directory") ##Import tree and data mammals<-read.table("final_compilation with percentage values.R1.csv",header=T,sep=",",row.names=1) tree<-read.tree("4705sp_mean_selected.tree") tree<-treedata(tree,mammals,sort=T,warnings=T)$...
111cacf198c4e497153b3391233a2013e8f86f8c82fddee23f68aaeb3cdfbb10
R
1,038
42
# this code computes distance matrices for HLAs, based on predicted scores # from Glazer 2022 model on server on the pairs between Zheng 2021 tcrs and # HLAs # distance based on positive TCRs from single cell data pos_filename = "st8_Glazer_2022_server_on_zheng_2021_pos_extended_hlas_146.csv" df_pos = read.csv(past...
7107355dede43259f1a93c9ea73697cdda3975998d9381f1e50c231af13155c4
R
1,043
34
set.seed(123) x <- mockSC(nc = 50, nt = 3) y <- mockSP(x) z <- getMGS(x) res <- SPOTlight( x, y, groups = x$type, mgs = z, group_id = "type", verbose = FALSE) test_that("plotTopicProfiles common", { p <- plotTopicProfiles(x = res[[3]], y = x$type, facet = FALSE, min_prop = 0.1) expect_i...
6f3d795997c29cd23e13fe8c7bba82bc2c026153d5e3c5dfb9b2cd86e2425db5
R
1,045
35
#' @title FUNCTION_TITLE #' @description FUNCTION_DESCRIPTION #' @param formula PARAM_DESCRIPTION #' @param data PARAM_DESCRIPTION #' @param mod PARAM_DESCRIPTION, Default: loess #' @param n.sd PARAM_DESCRIPTION, Default: 1.5 #' @param ... PARAM_DESCRIPTION #' @return OUTPUT_DESCRIPTION #' @details DETAILS #' @example...
a119e75a10f615a432d86bdbd5718c1267ea61fe33971a0431cb7eda4dba4c92
R
1,049
32
########################################################################################################################## # Analysis using SPARKX in the comparison # # Ref: https://xzhoulab.github.io/SPARK/ # https://xzhoulab.github.io/SPARK/02_SPARK_Example/ # # Usage: # Rscript sparkx.r /home/wangjue/svgGranularity/...
83719a63895208078ffbf2e1bc95799fed9551ee5c57cda6bf4d3ad473bc96e1
R
1,058
36
## library(R.utils) ## library(purrr) args <- commandArgs(trailingOnly = TRUE) rpdpeakDir <- args[1] outdir <- args[2] # debug ## rpdpeakDir <- "/oasis/tscc/scratch/szu/projects/CEMBA2/18.snap2_peakcalling/out/tscc/rpdpeak" ## outdir <- "." recordSummitFiles <- file.path(outdir, "mba.whole.naiveSummitList.list") ## ...
c114b7918f43db1f1cabfb5d5b71e3351a2b24a2d1f030428761e367b76c87c0
R
1,060
32
# Merge all permutation files into one file library(tidyverse) library(glue) path <- "bids/derivatives/meg-derivatives/grand_ave/brain-space/visual_model/permutations/temporal-cross/{level}/" path_save <- "bids/derivatives/meg-derivatives/grand_ave/brain-space/visual_model/permutations/temporal-cross/{level}_tc_perm_a...
7e61607bef1d3cdd508c50be5a00ea1bb777769e19b0eda6530c5ddd1fd7e01e
R
1,068
31
# This model is written so that errors are appropriately trapped and #handled when running # using a shared memory multiprocessor library(lme4) # Note that lme4 functions do not report p-values. This package incorporates p-values into the output of the functions lmer and anova. library(lmerTest) processVoxel <-functi...
da14af550f741f2aea419387d634cc0d163cb8cfaefae031cee15a3f011565f2
R
1,071
27
# This model is written so that errors are appropriately trapped and #handled when running # using a shared memory multiprocessor library(nlme) processVoxel <-function(v) { Y <- voxeldat[,v] e <- try(mod <- lme(Y ~ High+Low, random=~1|subject, method=c("ML"), na.action=na.omit, corr=corAR1(form=~1|subject), co...
ea7cb5b3ade7dcba39bef38a8c3019e38ebd9a93f779984e77a1a995a8878f72
R
1,073
42
#' Obtain the raw query from a \code{cAnalysis} object. #' #' @name extract #' @rdname extract-methods #' @param object of class \code{cAnalysis}, \code{molecularcAnalysis}, #' \code{molecularComorbidity} or \code{comorbidity} #' @return A \code{data.frame} containing the raw result from the initial data #' (comorbid...
3485e7edd573a43662e4fc06800b10d4dd8d29b702e1da50b88ec0c85bea86ba
R
1,079
48
library(Signac) library(Seurat) library(argparse) library(BSgenome.Rnorvegicus.UCSC.rn6) parser <- ArgumentParser(description = "process input arguments") parser$add_argument("--rds", action = "store", help = "path to rds object to compute gene activity for") parser$add_argument("--celltype", action = "store", help...
d9a6bfe5dc353c6a28e5b3ee50d9c13d79aafdffcb676700ab28bdee33e8c0a2
R
1,084
35
# Merge permutations library(tidyverse) library(glue) library(stringr) path <- "bids/derivatives/meg-derivatives/{subject}/brain-space/visual_model/perm/merged/{level}/" # merge permutations per subject for (subject in c(1:19)) { print(subject) all_perm <- c() subject <- str_pad(subject, 2, pad = "0") subje...
2b47c476753d0409092dfbc370dfd2895c4295986ae10f921b1fe8d7f5237541
R
1,085
20
library(data.table) library(plyr) library(tidyverse) #Extra code to apply RBP gene names to IDs neg_IDs <- fread("Human_RBP_Motifs_Enriched_in_High_Excitatory_Expression.tsv") pos_IDs <- fread("Human_RBP_Motifs_Enriched_in_High_Inhibitory_Expression.tsv") ID_list <- fread("ID_to_protein.txt") setnames(ID_list,...
b2bf0bf18f48bd9c55de0b73fb85ffbcb04e36eb8044f987c4ef1fcdfbdcf357
R
1,087
26
library(tidyverse) library(ggplot2) library(gridExtra) OR_OR.con<-read_delim(file="/media/storageE/lisa_dipc/contact-densities/ors_ors_unknown_allele_contacts_densities.txt", delim = "\t", col_names = c("cell","sex","OR_OR")) density_table<-OR_OR.con %>% separate(cell,into = c("zone","num"), sep="OMP", remove=FAL...
019da52909cda0cfb90de9aa9cc984506bbcad173664b9b348c1f42f42440582
R
1,089
19
#set custom colour palette smoothBlue <- c('#142459', '#176BA0', '#19AADE', '#1AC9E6', '#1bd4d4', '#1DE4BD', '#60F0D2') smoothPink <- c('#29066B', '#7D3AC1', '#AF4BCE', '#DB4CB2', '#EB548C', '#EA7369', '#F0A58F') smoothOrange <- c('#820401', '#C02323', '#DE542C', '#EF7E32', '#EE9A3A', '#EABD38', '#E7E34E') customCol <...
990ac8449d905e1eb862db2c9c6e5f13ddbe57c52ee9499e167efbc646a37536
R
1,091
36
#' @title wilcoxon-tests #' @description wilcoxon-tests #' @param x matrix or character vector with matrix column names #' @param y matrix to compare against or matrix with x and y column names #' @param ... adjust.method and cutoff #' @return wilcoxon-tests #' @rdname wilcoxtest #' @export wilcoxtest = function(x, y,...
8d0b197af1a8bcc0c8270fc7df36e281b68a9b777ee8be4aff612ae918e6ebcf
R
1,092
42
#' Obtain the data from a \code{comorbidity}, \code{molecularComorbidity}, #' \code{cAnalysis} or \code{molecularcAnalysis} object. #' #' @name extract #' @rdname extract-methods #' @param object Object of class \code{comorbidity}, \code{molecularComorbidity}, #' \code{cAnalysis} or \code{molecularcAnalysis} object. ...
53480d0a52b8d660335b48c9512ff7804ad6dc44b05d801103b2884a5bcbed84
R
1,095
40
library(igraph) ####GRAPH filename filename='../OscopeData/FirstData/WaterfallbootstrapSequential_CPUDPSF_TF_2000Boot_data_s45res_C28G8442_edgeNetwork.csv' genedet='../OscopeData/GenesLabels/Mapping/Water45.txt' data=read.csv(file=filename, header= TRUE,row.names=1) G=graph_from_data_frame(data,directed=FALSE) ww=get...
9db5099176b9eecd929d91bca009491280f10dd8475b307ebc98374e192da269
R
1,097
40
require(scales) library(flipMultivariates) library(caTools) # dont' forget to set the working directory # setwd("wherever your data is") dset = read.csv('lda.csv') print(str(dset)) print(summary(dset)) # clean up the dataset dset$ap_ar[is.na(dset$ap_ar)] = 0 dset$bovera[dset$bovera < 0] = 0 set.seed(1) row.number =...
3f8b40b693bfefc56d90ca5461040ed51b1afa553590c1ab34a632539a774cd4
R
1,103
26
#' @title Get Genomic Information #' @param symbols character vector of HGNC symbols #' @export #' @rdname GeneInfo GeneInfo = function(symbols) { # see https://davetang.org/muse/2013/12/16/bioconductor-annotation-packages/ columns = c('ENTREZID', 'GENENAME') info = AnnotationDbi::select(org.Hs.eg.db::org.Hs.eg...
a1c3e0c315da5d2dd165616b599b616f19f2b39b2f47149eb934df6d80347a1c
R
1,118
37
context("Load data") test_that("Load data", { # load data load_ABIS() # test sigMatrix_ABIS_S0 expect_equal(class(sigMatrix_ABIS_S0)[1],"matrix") expect_equal(class(plot_similarity(sigMatrix_ABIS_S0))[1],"gg") # test sigMatrix_ABIS_S1 expect_equal(class(sigMatrix_ABIS_S1)[1],"matrix") ...
1c1f860b33b1cab1a829dca56a0d783eb14941b12c17da7a19a33829200e9550
R
1,122
30
############################################################# # Generate simulation data ############################################################# InputData <- openxlsx::read.xlsx("mmc6.xlsx", colNames = FALSE) InputData_exp <- as.numeric(unlist(InputData[,-1])) Num_genes <- c(2...
345d5663203f193211a658cf3f9ec209d6a396a46d10d113b5dd5985c1605e02
R
1,134
30
#!/usr/bin/env Rscript suppressMessages(library(argparse)) suppressMessages(library(devtools)) parser = ArgumentParser(description='Calculate CDR3 summaries and add them as columns to the given data frame.') parser$add_argument('in_csv', help='A CSV with an amino_acid column with CDR3 sequence.') parser$add_argument(...
3ab9813377de94d692508b860db3e05ddb06c8c1db99de38ed6b4067e9a9cd93
R
1,152
29
suppressMessages(library(GenomicRanges)) suppressMessages(library(dplyr)) suppressMessages(library(rtracklayer)) suppressMessages(library(Signac)) library(GenomeInfoDb) library(argparse) parser <- ArgumentParser(description = "process input arguments") parser$add_argument("--dapeaks", action = "store", type = "charact...
ecda5a7b7ee485f638ff100bf19d8000ff9acb0970bfe426e4d55008282f888b
R
1,157
29
#05/24/2023 Fengyao Yan #Plot the confusion matrix to show the performance of DL model when predicting single tissue. library(cvms) library(data.table) library(ggplot2) pred_dat <- fread('../../data/single_t/pred.csv', data.table = FALSE) true_dat <- fread('../../data/single_t/true.csv', data.table = FALSE) dat <- c...
0e738d899117859c0d4c5440d14a350461e81139ff54313dcb3a436566c12533
R
1,171
54
####╔═════ ══════╗#### ####💠Project Config💠#### ####╚═════ ══════╝#### cli_h2("┗ [CONFIG] Loading external {.file _configs.yml} file") configs <- load_yml(here("_configs.yml")) options( scipen = 999L, digits = 4L, mc.cores = max(1L, parallel::detectCores(logical = TRUE)), glmmTMB.cores = max(1L, par...
9dc1dec5c232224e53081e0b769fd3c0fb7f046e28b206554be109300f7951be
R
1,175
31
#### PCA With DeX proteins: coming from toplot! #Sanity check and just doing a rowmatch leads to 128 unique across all comparisons! ###Creating new cleanDat #Kmeans_Expr_Matrix <- backg_nano_kmeans[backg_nano_kmeans$X %in% match_diff_ex_kmeans$V1,] write.csv(cleanDat, file = "ALL_cleanDat_used4PCA.csv") write.cs...
f4ef8ba402e4dd1f9025e3455513cd207817702206b275aa1f5aa60bad4f8e07
R
1,176
31
# Dark-rearing analysis require(dplyr) require(tidyr) require(ggplot2) # --- Escape probability d <- read.csv('./_Science/Xenopus-Behavior-git/02_Collision_Avoidance/data/dark_rearing_successes.csv') d <- d %>% mutate(Successes = escapes/n) d <- d %>% rename(Group=group) names(d) ds <- d %>% group_by(Group) %>% su...
c20108adc262409f9332469019fd3c3703eb65acc051c717ad86aac728937d62
R
1,191
24
#This script is a sanity check that you have the right folders in the right places. it'll tell you if you're missing directories you should have if(!dir.exists(paste0(path,'/output'))){ warning("You don't have an output folder in your pipeline directory! Creating folder...") dir.create(paste0(path,'/output')) di...
8058933ab819f45e26c9ec694b4123a0fed2b593052f9f36e705fd473a8abc65
R
1,201
34
theme_figure <- function(){ font <- "" #assign font family up front theme_bw() %+replace% #replace elements we want to change theme( # #grid elements # panel.grid.major = element_blank(), #strip major gridlines # panel.grid.minor = element_blank(), #strip minor gridline...
7526c9fc7f69924d4d109cef120966d06d1adfa266ea9554a142193cf0bbe6a1
R
1,208
27
#' @title List combinations #' @description Combine all pairs of list elements #' @param ... Unnamed list(s). If only one list is provided, it will be combined (pairwise) with itself. #' @param by Function to apply. Default: c("intersect", "union", "c") #' @return List with combined elements #' @seealso #' \code{\l...
d740e1fb6e2b0829bf051182bdcc86ce22b5541b1fe05bb78daee3889e94fe3e
R
1,208
32
########################################################################################################################## # Analysis using SpatialDE in the comparison # # http://bioconductor.org/packages/release/bioc/vignettes/spatialDE/inst/doc/spatialDE.html # Changed for only performance usage and record # Ref: htt...
9c3b6197f052b0f52c3a0e0d7794b4ca38796d3d122b8db64543e2b8af5c6dd4
R
1,209
38
library(tidyverse) projdir <- here::here() rpack <- file.path(projdir, "package/R") import::from(.from = "cembav2env.R", .directory = rpack, Sa2PeakCalling, cembav2env) globalPeaks <- Sa2PeakCalling$readBed4File( file.path(projdir, "20.nmf", "out", "peaks.from.global.modules.bed") ) pdc <- data.table::fread( ...
245d46981913397fc68e778591ed75c2d4b128942e78ec07f4a5035a4032e0f9
R
1,213
41
# use neighborhoods from step1 to identify neighborhood-specific degs #!/usr/bin/env Rscript # to run locally: # SCRATCH1=/mnt/g/scratch # docker run -it --rm \ # --workdir $HOME \ # -v /mnt/g/ckd:$HOME/ckd \ # -v $HOME:$HOME \ # -v $SCRATCH1:$SCRATCH1 \ # -e SCRATCH1="/mnt/g/scratch" \ # p4rkerw/sctools:R4.1.3 R lib...
6e0c912c9b8b90b12a56f93110c4f4ce4eb0d90e298b94222bcb3d8afdd63d41
R
1,218
30
#' Write the output statistic files #' #' This function takes an argument structure that specifies all the parameters #' that should be input to npointillist and returns an array of voxel data and #' a design matrix. #' @param prefix Prefix for output, to be prepended to outputs #' @param results Data returned from th...
76a0eb0649382a2d2759573f8f1bf525de5467f2a6a17a07166f27de1b0c87c4
R
1,220
34
--- title: "Selecting Variants for Sanger Sequencing" author: "Stephen P Plassmeyer" date: "7/24/2020" output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = FALSE) library(tidyverse) library(data.table) library(patchwork) library_annotations <- fread('../../../library_design/mr_library_fu...
23769749267f61d3751b238589cd05b5721eaeae50750187f5d556b097228ea0
R
1,226
38
############################ ##### Install packages ##### ############################ # Last edited: 11/04/23 by LVB # Description: Installs and updates necessary packages. Note these scripts were # written and executed in R v.4.2.3. While code should have reasonable # back-compatibility, you may need to update R. T...
658b80073f19f014075094d6d8b8b8b154f9bc0bcdb34be9b255ec2b7cf07c76
R
1,226
34
#----------------------------------------------- # LICENSE #----------------------------------------------- # Copyright 2019 Novartis Institutes for BioMedical Research Inc. # Licensed under the GNU General Public License, Version 3 (the "License"); # you may not use this file except in compliance with ...
10e3c128f7db36590fef1a82b80a6a407d164300f4b7920d53bcbe8a78340df5
R
1,228
65
######################################## # LC snRNA-seq analyses: remove doublets # Lukas Weber, Oct 2022 ######################################## # run in interactive session on JHPCE # screen -S LC # qrsh -l mem_free=20G,h_vmem=22G,h_fsize=200G -now n # cd /dcs04/lieber/lcolladotor/pilotLC_LIBD001/locus-c/code/anal...
e50f5ef3ae63ccf2d9b9ca63b2f9666f3b0b3ba9aa24763b7e13f204531b6d8c
R
1,228
37
# R script that runs the LR GO analysis # library(clusterProfiler) library(org.Mm.eg.db) library(org.Hs.eg.db) #library(enrichplot) #library(ggplot2) GO_analyse <- function(genes, bg_genes, species, p_cutoff, q_cutoff, onts) { #p_cutoff=.01, q_cutoff=0.5, onts='BP') { #...
db6ed501b827e52638193e30285abd25c8af596b9d040aea7ed2a23cf1830938
R
1,232
46
library(Seurat) options(Seurat.object.assay.version = "v5") library(stringr) library(purrr) Sys.setenv("_R_USE_PIPEBIND_" = TRUE) projdir <- here::here() rdir <- file.path(projdir, "package/R") import::from(.from = "cembav2env.R", .directory = rdir, Sa2Integration) import::from(.from = "utils.R", .directory = rdir, ...
d09260790b551060b06debd3374613121b2e093f1a51ebaa92766e919ef71d7d
R
1,250
33
#TimesVector # #Created by Inuk Jung on 2016-08-3. #Copyright (c) 2016 Inuk Jung. All rights reserved. # #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 Foundation, either version 3 of the License, or #(at you...
f8ed05e4a7e39c1b92061640cddc720156b4288cc9e730ae1e368820d41a2e7c
R
1,255
49
library(Seurat) library(dplyr) library(patchwork) library(R.utils) library(rhdf5) library(hdf5r) library(Matrix) library(igraph) library(SeuratObject) library(RcppCNPy) library(reticulate) np <- import("numpy") method <-'Seurat' t<-c('DPT','YAN','Deng') for ( i in 1:length(t)) { print(t[i]) name<-paste0(t[i]) h1=H5...
a902364e3fbf7af1a62ff29c8faa81b0ef0e5423de1fd9295cb22fc930dc2f70
R
1,262
32
library(data.table) library(kimisc) args <- commandArgs(TRUE) filedir <- args[1] if(grepl("\\/$", filedir)==F){ filedir <- paste(filedir, '/', sep="") } curfile <- thisfile() source(paste(dirname(curfile), '/ConfigParser.R', sep="")) config <- ConfigParser(file=paste(dirname(curfile),'/app.config', sep="")) ENSG <- ...
3f580ff6b24155b90e78af1ac4d75feb5df385bdf68f604c8faff6c1e38453b8
R
1,263
31
############################################################# # Calculate spatial stratified heterogeneity # # Ref: Wang, Jin-Feng, Tong-Lin Zhang, and Bo-Jie Fu. "A measure of spatial stratified heterogeneity." Ecological indicators 67 (2016): 250-256 ############################################################# ...
41b87abf433bf236b553cd28e65ed9b0cb536a51da251cdf8040dccc9dc61908
R
1,266
53
--- title: "cellScaleFactors" author: "Sean Maden" date: "2023-09-07" output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` # Introduction The `cellScaleFactors` package provides access to cell size scale factor values from the literature. These are useful for cell type refere...
8143ec579b68ee0ab8fb127d364f03b39fe05e74dcd2c927daf08f45d09d6097
R
1,274
49
#Visualize UMAP colored by cell type #visualize UMAP colored by batch library(dplyr) library(monocle3) library(here) library(ggplot2) library(scales) source(here("scripts/accessory_functions/monocle_mods.R")) cds <- readRDS(here("6month_LMMP.rds")) #by cell type pdf(here("plots/supp_figures/UMAP_by_celltype.pdf")) ...
713c7d29f5e28d53153eb58f5f752f0358686a2cdf2d6bdc1653e57427bdb972
R
1,277
36
#################################################################################### # this script subsets by rat but iterates through all celltypes #################################################################################### library(argparse) library(Signac) library(Seurat) library(stringr) parser <- Argument...
54d6e583a3fe0735e6fe6ef2c07defe61ba4954243bc84f68b381d3ba886030d
R
1,278
42
# 05/19/2023 Fengyao Yan # This file is written to create the dataset of mean gene expression values of all genes in each tissue type library(tidyverse) library(data.table) data_folder <- '../../data/raw' tissue_list=c('Brain', 'Breast', 'Colon', 'Kidney', 'Liver', 'Lung', 'Ovary', 'Pancreas', 'Prostate', 'Skin', '...
0168d57d15045fbef50800421adedd3ab161a0cba16abd1d0e122d47708c0657
R
1,281
53
library("edgeR") target_list_file_to_DGEList = function(targetsFile, minSumTagCounts = 5) { # format should be like so, including header: # files group description # fileA.txt grpA my grpA replicate # fileB.txt grpB my grpB replicate # ... targets = read.delim(file=targetsFile, stringsAsFactors =...
33d7c07dd6c5fbe7d7f871fd973f347f6b083d417193bc5939122c3028f4790d
R
1,289
34
library(data.table) library(kimisc) args <- commandArgs(TRUE) filedir <- args[1] if(grepl("\\/$", filedir)==F){ filedir <- paste(filedir, '/', sep="") } ensg_v <- args[2] curfile <- thisfile() source(paste(dirname(curfile), '/ConfigParser.R', sep="")) config <- ConfigParser(file=paste(dirname(curfile),'/app.config',...
77f6a7499cf89f393a95d290e343cd770dcf8db4faf3b78ff1327e67196d7e15
R
1,294
21
#' Draw an elbow plot of cophenetic correlation metric. #' @details This function draws an elbow plot of cophenetic correlation metric. #' @param res output from \code{\link{estimateSignatures}} #' @param bestFit rank to highlight. Default NULL #' @seealso \code{\link{estimateSignatures}} \code{\link{plotCophenetic}} #...
cb6a9434baf4e4c0ec39b75c326b8c3c14b820d9d3e12821090c0511a8bf41ff
R
1,306
40
--- title: "R Notebook" output: html_notebook --- ```{r} library(tidyverse) suppressPackageStartupMessages(library(openxlsx)) library(readxl) library(limma) library(edgeR) suppressPackageStartupMessages(library(clusterProfiler)) suppressPackageStartupMessages(library(org.Hs.eg.db)) library(lubridate) library(extrafont)...
c303bb41a9f6dd12d0f905b9a94d01199181efa6e7818907e5fd191a0c59c763
R
1,307
37
### MNT 29Nov2021 ======= # Check Read 1 files for discrepant read lengths, as seen before in Tran-Maynard 2021 project: # Should be exactly 28bp = 16 [BC] + 12 [UMI] library(ShortRead) library(jaffelab) FASTQ.dir <- "/dcs04/lieber/lcolladotor/pilotLC_LIBD001/locus-c/fastq/snRNA-seq/" ### Read in abridged sample...
6d3bb1c89be245aea3c8c1adcef25df433e12564d478df48795e34059d24dcbb
R
1,321
32
library(ggplot2) library(tidyverse) library(lawstat) library(psych) Setting <- list(theme_classic(), theme(plot.margin = unit(c(1, 1, 1, 1), "lines")), theme(axis.title.x = element_text(size = 15, vjust = -0.5, color = "black")), theme(axis.title.y = element_t...
c808b5415ffaa76ac0e3fb82b30ebacb72d25313538a11b9c9301aef161f2cd5
R
1,323
49
#========================================================================= # # Copyright NumFOCUS # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/license...
fc1e03321df5586d024368dbf2adb61b529ab472f9432a518445f71f0b6300b7
R
1,327
60
### Libraries library(plyr) library(dplyr) library(tidyr) library(matrixStats) library(fst) library(misha) library(data.table) library(circlize) library(ComplexHeatmap) library(ggplot2) library(cowplot) library(patchwork) library(scales) library(GenomicRanges) library(ggpubr) library(LSD) library(pals) library(Hmisc)...
6303fa82c18f62db0fce2b651c36b5ea57933ac3f249b088cea499df2c2711d5
R
1,332
49
library("splatter") library(rhdf5) set.seed(0) # ----------------Generate the simulation data using Splatter package------------------ run<-function(cells,genes){ params = newSplatParams() d=5 params = setParams(params, list(batchCells = cells, nGenes = genes, ...
9d83d236a5acf318122f660fe35eada6a25f3838f25a8227488937f2fcb663e4
R
1,336
47
library(spatialLIBD) sce_path_zip <- fetch_data("spatialDLPFC_snRNAseq") sce_path <- unzip(sce_path_zip, exdir = tempdir()) sce <- HDF5Array::loadHDF5SummarizedExperiment( file.path(tempdir(), "sce_DLPFC_annotated")) sce # class: SingleCellExperiment # dim: 36601 77604 # metadata(3): Samples cell_type_colors cel...