sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
7b04816abc8e647aae0c9200d349c6999a401c6f63f19586628a3cea7a349cc6
R
1,740
56
#========================================================================= # # 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...
87ac76a1e466697e3257ce0916ea0e995c03e662cded4bd03b0bcbf6af170ae2
R
1,740
58
library(BayesSpace) library(ggplot2) data_path <- "/home/xuchang/Project/DeepST/code_20220617/All_methods/data" save_path <- "/home/xuchang/Project/DeepST/code_20220617/All_methods/Results" # sample <- c('Section1_Posterior', 'Section1_Anterior', 'Section_Coronal', "Human_breast_FFPE") # sample <- c('15150...
1ad6ca7d6c11baf1dc49091a0dba3d7987b27cf1765b24e08b7f273ff9058699
R
1,742
43
# this script will run epianeufinder with 1MB windows on the multiome atac fragments files # SCRATCH1=/mnt/g/scratch # docker run -it \ # --workdir $HOME \ # -v /mnt/g/ckd:$HOME/project \ # -v /mnt/g/cellranger_atac_counts:$HOME/cellranger_atac_counts \ # -v /mnt/g/cellranger_multi_counts:$HOME/cellranger_multi_counts...
f996195f2be7c8c16ea5b2f6308591e013233f80fe49823a4b2899649a0e0f5e
R
1,742
76
library(GO.db) ###################### library(biomaRt) library(limma) Dirlist=c('../Communities/Networks02/','../Communities/NetworksPiDiv9/','../Communities/FirstData/') #file='W45fastgreedy.txt' file='Safastgreedy.txt' thresh=8 for (h in c(1:3)){ Dircom= Dirlist[h] #Dircom='../Communities/Networks02/' filecomm=p...
48cf2792f36d85658dd0ec047cab39f5b1edad0d0de71139fafa8307ee9379f4
R
1,750
50
library(SeuratDisk) library(Seurat) library(tidyverse) library(here) ## load in the filtered Seurat object obj_merged = here('data/tidy_data/Seurat_projects', "OUD_Striatum_refined_all_SeuratObj_N16.h5Seurat") %>% LoadH5Seurat() DefaultAssay(object = obj_merged) = 'RNA' head(obj_merged[[]]) ## ...
73013b790898cc8a976640a9b3c5ea88bef3cc3b34c3b6abc30b17b907f959e6
R
1,752
47
#' @title A plot-friendly output for the Barnes-Hut implementation of t-SNE. #' @description A plot-friendly output for the Barnes-Hut implementation of t-SNE: test different perplexities and dimensions. See Rtsne::Rtsne for details on the algorithm. #' @param m matrix; each row is an observation (eg. cell); each colu...
d5348f67ecf1ed68c18ce45e985ff929f0c2e49e38da8c99c89b59c3266fa5bc
R
1,758
53
# density plots for thresholds library(dplyr) library(ggplot2) library(here) library(gridExtra) atac_frags <- readRDS(here("ckd","atac_aggr_prep","atac_frags.rds")) # LOY per library by sequencing depth in PT # pull meta data with number of counts per cell meta <- readRDS(here("ckd","atac_aggr_prep","step6_meta.rd...
16ce5071ac60acd354df4ee77e7f209c0d4514fbb80ae4282f7e46f37f6d9e20
R
1,767
52
# EXAMPLE USAGE source("heatmap.3.R") # example of colsidecolors rowsidecolors (single column, single row) mat <- matrix(1:100, byrow=T, nrow=10) column_annotation <- sample(c("red", "blue", "green"), 10, replace=T) column_annotation <- matrix(column_annotation, nrow=1) rownames(column_annotation) <- c("Variable X"...
bdd5ba857ebfb49dabce53707d1716100e7e578d97f9446d8763a95a1f34b2d8
R
1,767
58
# Prepare data for nmf. # TODO: This script can be generalised. # Currently, I use it case by case. library(data.table) library(hdf5r) packdir <- file.path(here::here(), "package", "R") import::from(.from = "cembav2env.R", .directory = packdir, cembav2env) # * configs outdir <- "data" outh5 <- file.path(outdir, "cp...
ea3b0ad494b21234175d7130b9a8e0274366f32921ba5b7698d2e2235768f265
R
1,776
58
library(dplyr) library(stats) load("bulk_dev_RNAseq.RData") load("cluster_1_2_3.RData") zscore = function(x){ x = (x - mean(x))/sd(x) } for(i in 1:nrow(bulk_RNAseq)){ bulk_RNAseq[i,"max"] = max(as.numeric(bulk_RNAseq[i,2:49])) } bulk_RNAseq2 = filter(bulk_RNAseq,max>10) rownames(bulk_RNAseq2) = bul...
43c93bb42f832e25639960ace4114f31288d06dc2bdad2490b5edd1883b4292e
R
1,778
45
#' @title Apply a Function to All Pairs of Elements in 'x' or Between 'x' and 'y' #' @description Apply a Function to All Pairs of Elements in 'x' or Between 'x' and 'y' #' @param x a vector or a list of vectors #' @param y a vector or a list of vectors. If y is NULL, y will be set to x, such that if x is a list, th...
4171545ae07a285de09c5e4ef9d84dd4c6c6ecac4895902aa4b14c485e78a593
R
1,788
73
library(nnls) library(data.table) library(pbapply) library(glue) f_name_ref <- "../../data/raw/selected_gtex_top_1_NT_1_fc_3_data.csv" dat <- fread(f_name_ref, data.table = FALSE) dat <- dat[, -1] exclude <- c("Adrenal Gland", "Fallopian Tube", "Vagina", "Salivary Gland") dat <- dat[!dat$tissue %in% exclude, ] ogs ...
2e9c822938365f930265926019f305f4f781067fd6e0aa9baafda95a3604d36f
R
1,789
53
#' @title Combine ggplot grobs or plots #' @description combine ggplot grobs or plots #' @param ... plots/grobs to combine. A mix of the two is fine. #' @param by axis to combine plots by. Default: 'x' #' @param size which plot's dimensions to prioritise. One of 'first' or 'last'. Default: 'last' #' @param draw logical...
d2a65310cf75cf51f2ba4c6127508c7fa34fdf39a5a00733726cec3bbcbd7df4
R
1,790
43
#################################################################################### # this script is flexible for getting barcodes by rat, by celltype, or by both #################################################################################### library(argparse) library(Signac) library(Seurat) library(stringr) p...
8cddedbbf36aee7b999613d1b782b2edd7cf6da9bd89380ec96233d63c2f3a7b
R
1,804
66
#' @title FUNCTION_TITLE #' @description FUNCTION_DESCRIPTION #' @param category PARAM_DESCRIPTION, Default: c("H", "C2", "C5") #' @param subcategory PARAM_DESCRIPTION, Default: NULL #' @param exclude.subcategory PARAM_DESCRIPTION, Default: 'HPO' #' @param split.by.subcategory PARAM_DESCRIPTION, Default: F #' @param sp...
3948489e71986ef6eed170d7c52c84d4092857d128fdcc8daafee5f49c98aef8
R
1,806
54
#----------------------------------------------- # 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 ...
798c9b3f133a5fb3673b0c9101c351a9fba0383dab53d7d5086649f7c09e9740
R
1,806
46
library(data.table) #Read in the latest 455 N2A NovaSeq data counts <- fread("compiled_counts_455_10182021.csv") #Reformat to Counts Per Million, ugly but here goes for(i in 3:14){ counts[[i]] <- round((counts[[i]]/sum(counts[[i]]))*1e6,0) } #We sum the DNA counts and the RNA for this fwrite(data.ta...
838e04569e223ff49d7b17b73ebffd1fab05b9f7141564c664e0f63a9e490253
R
1,814
49
# this code draws barplot for the p-values from MiRKAT-S on Chowell 2018 # subjects after filtering out subjects with HLA-Is that cannot be matched # to any of the 85 ones from Emerson library(ggplot2) library(ggpubr) result_dir = ("../results") MiRKAT_S_2018_table = "st12_chowell_2018_MiRKAT-S_pvalues.csv" df_mir...
cccb51f7172961432f0febd2e64668c2b665ca2548d078e9dd532e4babaecd15
R
1,818
72
# This script uses iterative heirarchical clustering to group cells, # checking at each stage for DEgenes to define groups as distinct ## ----receive input from nextflow---------------------------------------------- args <- commandArgs(TRUE) path<-args[1] file<-args[2] print(path) set.seed(123) timepoints<-substr(...
812b14dfbd9d813eb78c9c2a5f731b0fc24061dc7ac269ca4e8b88fc00dcc63e
R
1,820
52
ss <- function(x, pattern, slot = 1, ...) { sapply(strsplit(x = x, split = pattern, ...), '[', slot) } options(stringsAsFactors = F) ## packages for data table processing/plotting library(tidyverse) library(rcartocolor) library(data.table) library(ggsci) library(KEGGREST) library(here) DATADIR='data/tidy_data' ##...
e279f8b58dd8af54d2e4f4b0685d5b25903e6cd6917a8006d5093b47639e8cbd
R
1,820
58
# this code gets the side-by-side violin plots based on the scores on # test positive pairs, test negative pairs, Szeto 2021 43 pairs library(ggplot2) library(ggpubr) library(pROC) theme_set(theme_classic()) results_dir = "../results/" pos_random_forest_file = "st3_test_pos_random_forest.csv" neg_random_forest_fil...
94509fd8f6f94de6ab706dbe1e2d2d9d13712d15964334e03cafbf55e6ba8573
R
1,821
59
######create a summary network with nodes given by the communities ####find intra-cluster density: library(igraph) karate <- graph.famous("Zachary") wckarate <- walktrap.community(karate) #any algorithm comm=wckarate Net=karate comm=wt Net=G ######compute the number of edges within each community intra=sapply(unique(...
95e53f5b1fdf8f1482e3f658099973fd2e7cff55ac86de3035c4e0c9cbeead6a
R
1,824
83
############################################################################## # LC snRNA-seq analyses: normalization, feature selection, dimension reduction # Lukas Weber, Oct 2022 ############################################################################## library(here) library(SingleCellExperiment) library(scate...
bd9991c46cca474908e1b643e943a1e13d0a10410369ab3087070976127e47eb
R
1,825
49
library(ggplot2) library(lmtest) setEPS() for (i in 1:10){ latent_embeddings<-read.csv(paste0("results_intermediate_encoders/embs/combined_10fold/latent_embeddings_global_",i,".csv")) data<-latent_embeddings[,c(1:(dim(latent_embeddings)[2]-3))] outcomes<-latent_embeddings[,c((dim(latent_embeddings)[2]-2):dim(late...
635bb4b52f04b158c90f81192c9425269dc83b2afc5f4b05c4c782475bfecb1c
R
1,828
75
library(SPOTlight) library(SingleCellExperiment) # library(RcppML) set.seed(321) # mock up some single-cell, mixture & marker data sce <- mockSC(ng = 200, nc = 10, nt = 3) spe <- mockSP(sce) mgs <- getMGS(sce) # Function to run the checks .checks <- function(decon, sce) { mtr <- decon[[1]] rss <- decon[[2]] ...
7e81bca6b6a0efe9d9eddf3d158af8015134be2b593cb35a60ad4c7f402f3ec7
R
1,829
43
"pwr.f2.test" <- function (u = NULL, v = NULL, f2 = NULL, sig.level = 0.05, power = NULL) { if (sum(sapply(list(u,v, f2, power, sig.level), is.null)) != 1) stop("exactly one of u, v, f2, power, and sig.level must be NULL") if (!is.null(f2)){ if (is.character(f2)) f2 <- cohen....
151dfb4a008d2caaedb1305b031c056b61b39c2a1933b25aa6e0da255fb65d8e
R
1,837
82
--- title: "R Notebook" output: html_notebook --- # Set Up ```{r setup} knitr::opts_knit$set(root.dir = normalizePath("../..")) ``` # Imports ```{r} library(lavaan) library(semPlot) library(factoextra) source('functions/explained_variance.R') source('functions/heatmaps.custom.R') ``` # Load Data ```{r} vrf.cog.heart...
0f8aa89681116a73420adb7555ef80a18c380a1e0c460bb539a14ce6a77e4324
R
1,839
50
dirichletClusters = function(tsb.dat){ #Initiate mcmc parameters nburn = 1000 nsave = 10000 nskip = 20 ndisplay = 1000 mcmc = list(nburn=nburn,nsave=nsave,nskip=nskip,ndisplay=ndisplay) #Hyper parameters prior1 = list(alpha=0.05,m1=rep(0,1),psiinv1=diag(0.5,1),nu1=6,tau1=0.2,tau2=1000) #Run main funct...
2f88f6f375ee07b666da2c9004e5ddf8773b7a072089bc76365fc30f3f137efe
R
1,848
60
# roc curve for DePTH trained on Emerson 2017 and testted on Emerson 2017 library(ggplot2) library(pROC) # load scores for hla_i pos_i_file = "HLA_I_all_match_test_pos_20.csv" neg_i_file = "HLA_I_all_match_test_neg_20.csv" df_pos_i = read.csv(paste0("../results/ensemble_scores/HLA_I_all_match/", pos_i_file), heade...
76fc17f6eb437efadd46e8e710506ad69913f701d01de10f4f3b3405746ffa16
R
1,854
44
#!/usr/bin/env Rscript # Here's some R I used to process the aggregated results of this command: # # df = read.csv(paste(dir, 'loss_regression.agg.csv', sep='')) # df = df[, colnames(df)!='X.Intercept.'] # df = df[, colnames(df)!='beta'] # # ggplot( # drop_rows_with_na(melt(df, c('sample', 'model'))), # ...
3daa427fa455b9169990e52aa6d7306380ae96775d5db8a6799172b3d88e183a
R
1,856
56
#----------------------------------------------- # LICENSE #----------------------------------------------- # Copyright 2018 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 ...
a5b521cc93d9a50631edaaa7c51e38aceb661be5c1989fd99da64b6da946aa87
R
1,864
55
--- title: "Formating VCF for DeepSEA Models" author: "Stephen P Plassmeyer" date: "12/9/2020" output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) library(tidyverse) library(data.table) ``` This notebook takes in the library design csv file and formats a tab-separated file follow...
5ee26dca7dbd6132a9cc6ab792aa62635d243c4a8fb2627e04689e605670978a
R
1,865
72
--- 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} heart.radiomics = read.csv("data/heart.radiomics.csv") heart.traditional = read.csv("data/cardio.data.csv") ``` ...
a5323378f1214986bd750cb3093f02666e0ea7977f62040ca63ab482fc4dc77a
R
1,865
38
mouse#library(AnnotationDbi) library(tidyverse) #library(biomaRt) ### Load lookup table homolog_table <- read.delim('HOM_MouseHumanSequence.rpt.txt') ## Load human and mouse genes mouse_map <- data.table::fread('data/mouse_map_genes.csv') %>% select(-V1) human_map <- data.table::fread('data/human_map_genes.csv')%>% s...
7d79d1c24cd4acc89b20b06493d7f85bad768f2346ee86ea00d0097e9831abd6
R
1,868
47
#' Write an output SGE submit script #' #' Generate an SGE submit script for the given workflow #' @param prefix Prefix for output, to be prepended to outputs #' @param resultnames List of names for the expected outputs #' @param modelfile Name of the model file that contains the processVoxel command #' @param designma...
415c272149753aa3bd6868eb52dfb515f4a6102a8f595f46d16a7afefddf0426
R
1,874
37
# # correlation with bulk RNAseq bulk_expr = read.table("/nfs4/chaozhang/proj/Neuron/Aritra/bulk/stringtie/merge.TPM.txt", row.names = 1, header = T) merFISH_integrated = readRDS(file = "./RDS/merFISH_final.0827.RDS") merFISH_avg_expr = AverageExpression(merFISH_integrated, group.by = "orig.ident", slot = "counts") m...
757195aa6eea6475549bec79f7ef1b3949bac1c06cd23faf532cfc3052c690ca
R
1,878
57
#========================================================================= # # 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...
4710c4586e4ff3d113c0603ccfaf57dc32c9a2fa5bac5a87f6ff46359cfc5904
R
1,883
58
#' @title Convert a list to a jaccard matrix and plot with `scalop::gmap` #' @param L list of character vectors to compute jaccard indexes between. #' @param ratio aspect ratio. Default: 1 #' @param limits colour key limits. Default: c(0, 1) #' @param tile.col draw lines between tiles. Default: 'black' #' @param tile...
6e9a93e694c0d970123d10bd94691564c535e506f915767b5905ce8cf81d8a81
R
1,886
58
#05/23/2023 Fengyao Yan #plot dot plot of mse change for CMP dataset comparing NNLS vs DL library(ggplot2) library(tidyverse) mse_dots <- data.frame(matrix(ncol=4, nrow=0)) colnames(mse_dots) <- c('tissue', 'mse', 'n_gene', 'model') mse_nnls <- read.csv('../../data/gtex/mse_all_gtex_nnls.csv', row.names = 1) mse_dee...
db54ef9bd8b204d544bf24a68f99eac68f248dcdfa23f2c3b358bb6f6af5e2e2
R
1,887
56
project = function(data.matrix, latent.matrix) { latent.unit = latent.matrix / norm(latent.matrix, 'f') proj.scores = t(data.matrix) %*% latent.unit data.projected = data.frame(outer(latent.unit,t(proj.scores))) return(data.projected) } evr_ = function(data.matrix, latent.matrix) { data.projected = project(d...
91b14bdc822aba4340c53f6ae146a93df8d33733482b805a0b5dba756297afc1
R
1,892
42
# A function I use to do my own windowing to compare results with sequence data to normal plp models. timeWindowing <- function(plpData, windows){ maxTimeBeforeIndex <- max(abs(windows)) covariates <- plpData$covariateData$covariates %>% collect() cohorts <- plpData$cohorts %>% collect() joined <- covariates %>% in...
6be5a830a0975c37582a5148be9c3c963fd6bc291a3c753e66ee1dc8f62389db
R
1,898
80
--- title: "R Notebook" output: html_notebook code_folding: show --- ```{r interactive_check} if(interactive()){ print(date()) print("This was run interactively. Please run with rmarkdown::render") }else{ print(paste0("This notebook was compiled on ", date())) } ``` ```{r, message = F, results = 'h...
a56375ada081696b3693288199a7a9a6bdb6d1aad785e204702e08a02e47c3d5
R
1,899
60
--- title: "R Notebook" output: html_notebook --- # Set Up ```{r setup} knitr::opts_knit$set(root.dir = normalizePath("../..")) ``` # Imports ```{r} library(finalfit) library(mice) library(purrr) library(dplyr) ``` # Load Data ```{r} vrf.latents = read.csv('data_derived/dim_red/latents_vrf.csv') cog.latents = read.c...
a9c1bfac3fda02686bb8a2ea4d99a8246457ac2698c6f912025d9ae1b82e2303
R
1,905
44
"pwr.anova.test" <- function (k = NULL, n = NULL, f = NULL, sig.level = 0.05, power = NULL) { if (sum(sapply(list(k, n, f, power, sig.level), is.null)) != 1) stop("exactly one of k, n, f, power, and sig.level must be NULL") if (!is.null(f)){ if (is.character(f)) f <- cohen.ES...
61f9ebfacd1e87243759a4bd591ee9df90d7eed0222bdea91ed143012c528c06
R
1,906
63
source("paper.R") scnmMap <- cembav2env$load.sa2.subclass.names() rownames(scnmMap) <- scnmMap$subclass_id_label allenSubclass2Region <- Sa2Integration$getAllenSubclass2Region() rownames(allenSubclass2Region) <- allenSubclass2Region$subclass_id_label mrMeta <- list( Telencephalon = c("Isocortex", "HPF", "OLF", "AMY"...
84144a38a0ed656de793c46ff23f55a98a56fd62d6398792fbecd86d2783ac3c
R
1,906
68
####╔══════ ══════╗#### ####💠 Project Setup 💠#### ####╚══════ ══════╝#### load_package_if_installed <- function(pkg) { suppressPackageStartupMessages({ require(pkg, character.only = TRUE, quietly = TRUE, warn.conflicts = FALSE) }) } install_if_missing_then_load <- function(pkgs) { for (pkg in pkgs) { ...
cd695a9ea9774301a8987f4be9810039320358a517eef9f83a43cdd01eb5d870
R
1,908
56
library(Seurat) library(SeuratDisk) library(tidyverse) library(RColorBrewer) library(data.table) library(here) library(rcartocolor) PLOTDIR='figures/exploratory/preprocess_snRNA-seq' here(PLOTDIR, c('plots', 'tables', 'rdas')) %>% sapply(dir.create, showWarnings = F) ################################### # 0) pre-set c...
8d9b86fc045f8d36add8aebb350f0a2dec4c5d78604daeeff54986fc8a0c124e
R
1,916
61
#========================================================================= # # 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...
7d0fe7b931bf605114189576b5c5f642765e4b3026594ce00d912f85a8593963
R
1,920
57
#05/19/2023 Fengyao Yan #plot TSG genes distribution in 15 tissue types library(ggplot2) library(ggpubr) library(data.table) convert_dat <- fread('../../data/raw/martquery.txt', data.table=FALSE) data0 <- fread('../../data/raw/selected_gtex_top_1_NT_1_fc_3_data.csv', data.table=FALSE) data0 <- data0[,-1] data0 <- da...
e6de199d8170a1c334457089bdfe026069a153b3e9c44e2c69992d5d45d17523
R
1,921
69
library(data.table) library(optparse) packdir <- file.path(here::here(), "package/R") import::from(.from = "utils.R", .directory = packdir, checkArgsExistOrStop, prepareOutdir, checkFileExistOrStop) import::from(.from = "peak.R", .directory = packdir, loadStatPeak.NMF) import::from(.from = "cembav2env.R", .director...
5db2aa2e09c9b2d1c0f92c104c0776b2bc8b8faf7008520d49b4c5b68f8b3927
R
1,923
59
suppressMessages(library(Signac)) # suppressMessages(library(Seurat)) library(GenomicRanges) library(Matrix) suppressMessages(library(HDF5Array)) library(argparse) parser <- ArgumentParser(description = "process input arguments") parser$add_argument("--fragments", action = "store", type = "character", help = "path to...
115111f2f9263e64b59a974f3d6165069ce2a3822091e30d35f7ff0bf63b3fa1
R
1,935
102
get_Poisson_conf_intervals = function(seq_range, quantile_vec = c(0.05,0.95), plot=T) { num_rows = length(seq_range) num_cols = length(quantile_vec) m = matrix(nrow=num_rows, ncol=num_cols) colnames(m) = quantile_vec rownames(m) = seq_range row_count = 0 for (i in seq_range) { q = qpois(quantile_vec,...
5e9f6bafb0a59150cf72a592af90d73bbad20e17a0f3c539fd9c3b4586440837
R
1,943
42
add_oncoprint = function(type, x, y, width, height, variant.classes, type_col) { for (i in 1:length(variant.classes)) { if (any(type %in% variant.classes[i])) { grid::grid.rect(x, y, width - unit(0.5, "mm"), height - grid::unit(1, "mm"), gp = grid::gpar(col = NA, fill = type_col[var...
667f9bf65545597bd1a30db2059e66396b53fec1f630198488e3978456932636
R
1,946
69
library(data.table) library(optparse) packdir <- file.path(here::here(), "package/R") import::from(.from = "utils.R", .directory = packdir, checkArgsExistOrStop, prepareOutdir, checkFileExistOrStop) import::from(.from = "peak.R", .directory = packdir, loadStatPeak.NMF) import::from(.from = "cembav2env.R", .director...
996299b56d5ce48494bfb7abcbfd6141ddd8437dc52492285da0cb185a14ee78
R
1,951
62
library(Matrix) library(monocle3) library(cicero) #CellType = "ABC_NN" args <- commandArgs(trailingOnly = TRUE) CellType <- args[1] print(CellType) path = "/oasis/tscc/scratch/smamde/mouse_atlas/mtx_files/" # Read in matrix data using the Matrix package indata <- Matrix::readMM(paste0(path,CellType,".mtx")) # Binari...
70d03d952d415cbd5ab3427972c48f9a81f8ae29516a6d966af17d15b47ab09b
R
1,953
35
library(tidyverse) library(reshape2) library(ggsignif) library(ggpubr) ### Assign labels and specific cell-types in validation data------------- alldata <-data.table::fread('../../../Fibrosis Species Translation/human lung fibrosis/all_mouse_lung.csv') allmeatadata <- data.table::fread('../../../Fibrosis Species Trans...
3e3e6bd79ad916c1dff72ef350e89de99522d7daad77018e9e05347679fc6b5b
R
1,959
60
.fitBimodalBySampling = function(x, sample.size = 100, tries = 2000, force.tries = FALSE, prob = 0.95, coverage = 0.8, si...
dc992459f429edb6a6e0cfb5a24616e33332e07f8a764a1e2939bc2fd9afb4e0
R
1,963
56
#----------------------------------------------- # 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 ...
9b1ba2f925ad4edd80b0f4eba563db5b06ac861adf8b158363d8cbe583fc09bd
R
1,972
61
library(dplyr) load("cell_emb_late.RData") load("cell_L4.RData") load("sc_exp.RData") load("celltype.RData") load("cluster_1_2_3.RData") zscore = function(x){ x = (x - mean(x))/sd(x) } ###all cells at 440 mins enrichment min440 = filter(emb_late,Start_time < 440 & End_time >= 440) names(min440)[names(m...
f8e2c466207f2a0497da7b7cd75be2a1ae87c63030a5ed89a638deda57b7ad99
R
1,980
76
library(tidyverse) library(reticulate) library(gamlss.dist) library(gamlss) library(fitdistrplus) usePython <- "/home/szu/mambaforge/envs/sa2/bin/python" reticulate::use_python(usePython) pd <- reticulate::import("pandas", convert = FALSE) projdir <- here::here() workdir <- file.path(projdir, "18.snap2_peakcalling") ...
aa4bb7c7e04a710705733dc5c47e49ade923f598d2876ff42b84b2e408e33f04
R
1,983
61
# Gregory Way 2017 # PanCancer Classifier # scripts/viz/nf1_summary_figures.R # # Visualize summary for NF1 classification scores # # Usage: Run in command line # # Rscript --vanilla scripts/viz/nf1_summary_figures.R # # Output: # Heatmap for included cancer-types in NF1 classifier library(dplyr) library(pheatmap)...
abef25d5d15bac216a0ae9b745bb5728d89bbccb8137401268ad5b37841ba4d2
R
1,983
49
#' Writes maf summaries to output tab-delimited text files. #' @details Writes MAF and related summaries to output files. #' #' @param maf an \code{\link{MAF}} object generated by \code{\link{read.maf}} #' @param basename basename for output file to be written. #' @param compress If `TRUE` files will be gz compressed. ...
baf7610ccffa054e6155e5a8e7ec5f77357521a04440d9fd9058885d5c24079e
R
1,983
40
#' @title State Fractions (by group) #' @description Get the fraction of cells in each state, by group if <groups> provided. Here, the rows in <scores> are interpreted as cells and the columns as their state scores, but more generally the function assigns each row to its maximum column (state) and subsequently count...
cf3f3f2afb7d615fce7e3d5ec0abac4e4807acb70d0bd23d6185411d2827bf5d
R
1,986
37
#' @title #' Introduction to file2meco package (\href{https://github.com/ChiLiubio/file2meco}{https://github.com/ChiLiubio/file2meco}) #' #' @description #' For the detailed tutorial on the file2meco package, please follow the tutorial link in the github repository #' (\href{https://github.com/ChiLiubio/file2meco}{htt...
2087cb127a9f61151387bebb48a9dba7d2a4c7cf7e025e1f4215e81225ef693b
R
1,994
60
# cell chat library(Seurat) library(CellChat) library(patchwork) options(stringsAsFactors = FALSE) library(Matrix) library(dplyr) library(ComplexHeatmap) # construct data tnbc1.tu.obj <- readRDS("tnbc1.tu.obj.rds") tnbc1.normal <- readRDS("tnbc1.normal.rds") ar.p <- subset(tnbc1.tu.obj, subset = HALLMARK_G2M_CHECKPOIN...
5f459011af38e4d8dbf5a19663641458f80c7b8db443250cb464dfdb6ed05958
R
1,997
59
library(Seurat) library(dplyr) library(ggplot2) # If your expression matrix contains a mix of different pre-determined cell clusters or labels, it may be wise to run OscoNet seperately for each cell type. # To do so specify the cell label you would like to isolate and run below. Remember to modify your output file nam...
afb773d7ecbf8dd2d49b683d92508792419f2ff5a021703f3500f33d5f9b8671
R
1,999
64
# compare expression between two randomly selected tags # from each of the CRE elements before and after normalization args<-commandArgs(trailingOnly=T) suppressMessages(library('ggpubr')) suppressMessages(library('ggplot2')) suppressMessages(library('gridExtra')) workingdir<-args[1] tag_cnt_cutoff<-as.numeric(args...
0b2e8ad18450e1012c9ad532bd1798683ab03cd063076657aaff128ffcc932c3
R
2,000
50
library(tidyverse) library(readxl) ### Load data human_hiv <- data.table::fread('data/Rv144_Systems_Serology.csv') colnames(human_hiv)[1] <- 'id' human_hiv <- human_hiv %>% mutate(trt=ifelse(trt=='PLACEBO',0,1)) human_hiv <- human_hiv %>% mutate(infect=ifelse(infect=='Yes',0,1)) human_expr <- as.matrix(human_hiv[,12:...
af782c1d96d230e1f9c85b39e29acdf64354d741e000aad1da74ce1736e952f3
R
2,006
62
#' Aggregate cancerhotspots reports #' @description Takes tsv files generated by \code{\link{cancerhotspots}} and aggregates them into an MAF for downstream analysis #' @param tsvs TSV files generated by \code{\link{cancerhotspots}} #' @param minVaf Min. VAF threshold. Default 0.02 #' @param minDepth Min. depth of cove...
aef935b24710adae13c830a0787a732362ce65772949e6234d7e59ad65092938
R
2,010
82
# this file is the third part for getting p-value cutoff for FDR 0.05 # for each of the 20 permutations, get the number of false positives at each true data # p value cutoff. # first, sort the p values; O(nlogn) # second, for each cutoff, do binary search. O(nlogn) # this part is be done in the format of 20 job subm...
047e8ceac1c3925efc9abfc946b49d4f56ab140148ec5d237f76f3c83fde5681
R
2,016
55
library(stats) library(dplyr) library(tidyr) load("Cel_dup_N4Cel.RData") load("celltype.RData") load("sc_exp.RData") for(i in 1:ncol(sc_exp)){ cur = filter(celltype, index == colnames(sc_exp)[i]) colnames(sc_exp)[i] = cur$celltype2 } for(i in 1:nrow(sc_exp)){ sc_exp[i,"max_cell"] = colnames(sc_exp)...
d1b3d1226021a60e19d7a0b2b2fddb75d5da842b21b495c67dc1629b8a057b95
R
2,016
60
#----------------------------------------------- # 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 ...
64778126995bc52d0336297abb1ce03c9b67e155aa1e83a0eb67bcb437daa219
R
2,019
68
####╔═══ ══╗#### ####💠 Utils 💠#### ####╚═══ ══╝#### cli_h2("┗ [SCRIPTS] Loading helper functions") #--------------# ####🔺Pipes #### #--------------# "%ni%" <- Negate("%in%") "%s+%" <- \(lhs, rhs) paste0(lhs, rhs) "%ne%" <- \(lhs, rhs) if(is.null(lhs) || rlang::is_empty(lhs) || (length(lhs) == 1 && lhs == ...
7649cd9d41ac286cf202bf87d43b7075d6bb70834f9c7bf385211585638cbe5b
R
2,028
47
library(gifti) library(R.matlab) library(RNifti) library(ciftiTools) ciftiTools.setOption('wb_path', '/Users/askeller/Documents/workbench/') library(ggplot2) PFNs_hardparcel<-read_cifti('/Users/askeller/Documents/Kellernet_PrelimAnalysis/hardparcel_group.dscalar.nii') map_predacc_PC1_lh <- PFNs_hardparcel$data$corte...
94caa5eae011969698efef1a9a677ff04375b0f1c2dcee3e980a9743cbcd9d29
R
2,029
52
# RCTD deconvolution wrapper script library(RCTD) library(data.table) rctd <- function(st_counts, st_coords, sc_counts, sc_labels, doublet_mode, min_cells, n_cores) { ###### Performs RCTD deconvolution of the st data from sc data ####### # Making sure correct namings # colnames(st_counts) <- r...
7b25e9b829e48b9a4e398db54782e9dcaa60d6df7e0ae1102bbe46fd4c056e74
R
2,037
80
# load packages suppressPackageStartupMessages({ library(caret) library(rhdf5) library(HDF5Array) }) # split train and test on 50% training set, 50% test set # input "rna" can be sce, seurat, or matrix, "cty" is a vector of cell type train_test_split <- function(rna, cty, seedInput = 1234){ set.seed(seedInpu...
515a2000bda8e613bba87bc4bed73fb2837e3197c3ddc8d26ac2fa91833b5384
R
2,042
54
#! /software/crgadm/software/R/4.2.0-foss-2021b/bin/Rscript ### USAGE CNAG cluster ## module purge; module load R/4.2.0-foss-2021b; ## Usage: cis_pairs_dist.v03.R <infile.pairs> <out_basename> ## example: cis_pairs_dist.v03.R mapped.mq40.Capra_hircus.pairs mRupRup # Name: cis_pairs_dist.v03.R # date: 2025-10-16 ...
456b2108c843a398d70b5d6875919c78fd216346e6750d05d4d67644e9298694
R
2,049
56
# Since ggplot2 4.0, geom_text() and geom_label() take default aesthetics such # as family, size, and colour from the theme. The repel geoms should match them. # # ggplot(...) + geom_text_repel(...) + theme_gray(base_family = "serif") # context("theme defaults") custom_theme <- theme_gray( base_size = 16, base_fam...
0fa1b238c574ade909e5aa8d008c5dc1a94cc9992a33e9fcba308c70fccf48f2
R
2,052
80
--- title: "R Notebook" output: html_notebook --- # Set Up ```{r setup} knitr::opts_knit$set(root.dir = normalizePath("../..")) ``` # Imports ```{r} library(finalfit) library(mice) library(purrr) library(dplyr) ``` # Load Data ```{r} cardio.data = read.csv("data/cardio.data.csv") brain.confounders = read.csv('data/b...
0759fa26b11cf4d196b76fc60eb99d5bde30b634d71ac4ef2cd72f269bc9d616
R
2,063
59
# quantile normalization for dyn data library(preprocessCore) library(Seurat) library(dplyr) design <- "5000.gene.4ct" n.cells <- 4000 n.cells.per.type <- 1000 n.genes <- 5000 version.n <- 1 output_dyn_data <- function(design, version.n){ gen <- read.csv(paste0(design, ".dyn.v", version.n, ".S.clean.csv"), header ...
daee542f7d42dc70b88279a6ca4ce578b1afd4e2dec17db5e747b0e240cf2455
R
2,071
66
# summarise tr and cumulative permutations and merge + tstat # subject, level, perm library(tidyverse) library(glue) args <- commandArgs(trailingOnly = TRUE) subject <- args[[1]] level <- args[[2]] perm <- args[[3]] subject <- str_pad(subject, 2, pad = "0") subject = glue("sub-{subject}") path <- glue("bids/derivat...
07bad99c98387d62325c90fd043ad88675687609edc9f6b21d0b57ff58e4185d
R
2,076
37
library(tidyverse) library(ggplot2) library(gridExtra) ##################################### # boxplot of ChIP signal (Figure 2B) ##################################### # zonal OR color palette zonal_fine_colors_fish_classIfirst<-c("#990000","#FF0000","#FFCC00","#33CC33","#0099FF","#0000FF") zonal_fine_colors_dark_fi...
20dc699cdfcfb5d702a57904570d148ea1f547605e81804dcd2000c7800dd56e
R
2,077
62
#----------------------------------------------- # 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 ...
7e04bd3a9fdf8ca0d57f137fc83b85d1e2c674a7258a00ba1ceb1762bb87b652
R
2,078
90
#' Results of ConNetGNN() for scATAC-seq data from SNARE-seq dataset #' #' @description A list to store the gene association network of scATAC-seq data. #' Case data from the SNARE-seq dataset. #' #' @format a list of three adjacency matrices. #' @examples #' data(ATAC_net) "ATAC_net" #' Results of ConNe...
0576b709608f1cff6149a3179a730ec732955655f39ac5d413f602a095f68562
R
2,081
65
# compare expression between two randomly selected tags # from each of the CRE elements before and after normalization args<-commandArgs(trailingOnly=T) suppressMessages(library('ggpubr')) suppressMessages(library('ggplot2')) suppressMessages(library('gridExtra')) workingdir<-args[1] tag_cnt_cutoff<-as.numeric(args...
9a428e626e1716289fc6b6b059df70d45143bbe5e7762dabe9a468b42ca909aa
R
2,086
68
library(purrr) Sys.setenv("_R_USE_PIPEBIND_" = TRUE) library(stringr) projdir <- here::here() resourcedir <- "../resource" rdir <- file.path(projdir, "package/R") import::from(.from = "cembav2env.R", .directory = rdir, Sa2Integration) # * simply extract allen's cluster marker genes annotAllen <- Sa2Integration$loadA...
864f05487fcd670e0a88768f4f554ff2eb8a97dfc1f6c5aae0890200bb76266e
R
2,092
50
rm(list=ls()) gc() #################### ## Load libraries ## install.packages('pheatmap') install.packages("lmerTest") install.packages("robustHD") library(data.table) library(dplyr) library(readxl) library(pheatmap) library(lmerTest) library(robustHD) setwd('/share/inspurStorage/home1/zixing/ABCDR/Project_1') datase...
e4193aede8459c4cd05b730df3ba4f1694e631a0af02a71cbcf45aca847403f8
R
2,094
71
# suggested comp env - mem_free=150G thread 4 ## conda environment can be created from https://github.com/brianherb/HumanHypoDev2Adult/blob/main/Hypo_R_Env.yml library(CoGAPS) library(Seurat) flexsplit <- function(dat,char){ test=strsplit(as.character(dat),char,fixed=TRUE) n.obs <- sapply(test, length) seq.max <- se...
17fe6995e182f1ea52d09f12a5d520ca7a95b752fd15e64b00c9a301f42c443c
R
2,095
80
#This scripts calls a validation function to check cluster assignments by random forest models trained on DE genes ## ----receive input from nextflow---------------------------------------------- args <- commandArgs(TRUE) path<-args[1] file<-args[2] dendrogram<-args[3] print(path) set.seed(123) timepoints<-substr(f...
2d0bc9029d7e72de98e04603bd11501dfea300e6969eb365049c10232f21a118
R
2,095
59
#setwd(dirname(rstudioapi::getActiveDocumentContext()$path)) suppressPackageStartupMessages({ library(SingleCellExperiment) library(Seurat) library(glue) library(stringr) source("../../Utils/utils.R") source("../../Utils/Feature_selection_methods/Traditional/doDE.R") source("../../Utils/Classification_me...
bc96f5c97d3c4007aa2ef9bcff4275b63b48be0014f465dd33004f42f55e8450
R
2,103
61
--- title: "Proteomics" output: html_document date: "2023-07-19" --- ```{r} library(ggplot2) ``` ```{r} volcano <- function(dea, th.logFC=log2(1.5), th.FDR=0.05, hl=NULL, sxlim=NULL){ dea$logFC <- dea$diff dea$significant <- as.integer(dea$FDR <= th.FDR & abs(dea$logFC) >= th.logFC) * sign(dea$logFC) if(isTRUE...
678c9cbf1f43d43aa5bfb176c61fe5bab65effc98140ce4e69cf69678cd35728
R
2,104
88
# this file is the fourth part for getting pvalue cutoff for FDR 0.05 # calculate # \hat{q}(p_(n)) = E(# false positives with pvalue <= p_(n))/n; O(1) # for i = n-1, n-2, ..., 1, calculate # \hat{q}(p_(i)) = # min(E(# false positives with pvalue <= p_(i))/i, \hat{q}(p_(i+1)))); O(n) # load the p values o...
4c7ba3ee9af09c3fbb545ff10615cacd3438074161e2a404f87b0b02027c883e
R
2,105
49
library("gamlss") pop_norms <- read.csv("~/r_files/pop_norms.csv") boys = subset(pop_norms, pop_norms$Gender == 1) boys[boys==0] <- NA boys1<-na.omit(boys) xsteps = (35 - 4)/31 xlim1 = 4 - xsteps xlim2 = 35 + xsteps ysteps = (25 - 5)/20 ylim1 = 5 - ysteps ylim2 = 25 + ysteps #*************************************...
d613013fd3c0c0f1a90d123c817d9e3809bfdd386cd3368f0e1c34158a95211f
R
2,106
63
#----------------------------------------------- # 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 ...
5f696ef55d6be0a2e9232ea659f5fccdee06aba65a10755488794042362c9ad5
R
2,108
54
## packages for data table processing library(tidyverse) library(igraph) library(network) library(sna) library(stringr) library(RColorBrewer) library(data.table) library(here) library(leiden) ss <- function(x, pattern, slot = 1, ...) { sapply(strsplit(x = x, split = pattern, ...), '[', slot) } options(stringsAsFac...
1f79f24d67d6d08e3ef63610e19b11ff56f43f210507194f304fb6152b3bd2f0
R
2,111
58
snapshot <- "/lab-share/RC-Data-Science-e2/Public/DST_software/pipeline_R_snapshot/r4.1-20220803-bch-dst-v1/" .libPaths(snapshot) library(Seurat) library(ggplot2) library(ggrepel) setwd('/lab-share/RC-Data-Science-e2/Public/Daniel/p147-scRNAseq-Koehler/') # Loading data load('/lab-share/RC-Data-Science-e2/Public/Danie...
0e5a249823d2e25572c5800707f3f411f05413cf82d2ebc465a10908e473823e
R
2,114
60
require(symphony) require(Seurat) snapshot <- "/lab-share/RC-Data-Science-e2/Public/DST_software/pipeline_R_snapshot/r4.1-20220803-bch-dst-v1/" .libPaths(snapshot) source('/lab-share/RC-Data-Science-e2/Public/Daniel/rFunctions.R') setwd('/lab-share/RC-Data-Science-e2/Public/Daniel/p147-scRNAseq-Koehler') # Loading Da...
6f9f67582f66207f1811cd191addc285160d35969451d882aec5321190e8c85d
R
2,116
53
library(NASTIseq) ## generation of test set # data(WholeRoot) # WholeRoot$genepos$feature <- 'gene' # # set_attri <- function(attri){ # attri = paste('gene_id ', '"', attri, '"', ';', sep = '') # return(attri) # } # # WholeRoot$genepos$attributes = as.character(lapply(as.character(WholeRoot$genepos$attributes), se...
abf30298163b50916f8000a1ad875e6a56b8d37b8179d4a3054affa47af2ab04
R
2,119
63
# Generated by using Rcpp::compileAttributes() -> do not edit by hand # Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 exp_mean <- function(x, p, i, ncol, nrow, groups, group_sizes) { .Call(`_symphony_exp_mean`, x, p, i, ncol, nrow, groups, group_sizes) } log_vmr <- function(x, p, i, ncol, nrow, means, gro...
8b7a166f16234d7723abfe29060e69e0e32b35ca1b6be0711ec87a0a5026453b
R
2,121
66
library(Matrix) library(monocle3) library(cicero) #CellType = "ABC_NN" args <- commandArgs(trailingOnly = TRUE) CellType <- args[1] print(CellType) path = "/oasis/tscc/scratch/smamde/mouse_atlas/mtx_files/" path_save = "/oasis/tscc/scratch/smamde/mouse_atlas/shuffle_cicero/cicero_shuffle_results/" # Read in matrix dat...