sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
e3460cd880395a373a995d06406d102261c4123470b2d331b3eec55b3f7e9ce0
R
1,049
20
library(RCTD) library(readr) slideseqdir = "Data/Slideseq/NewCerPuck_190926_08" puck = readRDS(file.path(slideseqdir, "puckCropped.RDS")) outdir = "NMFreg/DataCer" nmf_weights <- as.data.frame(read_csv(file.path(outdir,"bead_deconv_df_norm.csv"))) rownames(nmf_weights) <- colnames(puck@counts) nmf_weights <- nmf_weight...
f4c5b6fdfaa0a9b7893e9045331e5a8abe0293528239fddaa147dc8e8491c605
R
1,050
21
####library#### #https://github.com/vdemichev/diann-rpackage #install.packages("devtools") #install.packages("rlang") #install.packages("usethis") #devtools::install_github("https://github.com/vdemichev/diann-rpackage") library(diann) ####data#### fileName<-"C:/Users/animeshs/Downloads/SILACDIA2/report.tsv" df <- diann...
5df2404961305f76af3925bc8a5b7d66aa8339aa02b9f0215af5e5ac66c99061
R
1,055
26
#' Filter unbarcoded reads #' #' @description This function filters out all the reads that don't have a barcode #' and outputs them into a separate folder. #' Option to concatenate output from several files if they belong to #' the same sample. #' @param outputFolder automatically sourced from GetBarcodes script #' @pa...
7765e693977c92c009c7e508d1b4d134818289bf0bcfc2fd286c0b21ec26de30
R
1,061
35
require(datasets) require(grDevices); require(graphics) x <- 10*(1:nrow(volcano)); x.at <- seq(100, 800, by=100) y <- 10*(1:ncol(volcano)); y.at <- seq(100, 600, by=100) # Using Terrain Colors image(x, y, volcano, col=terrain.colors(100),axes=FALSE) contour(x, y, volcano, levels=seq(90, 200, by=5), add=TRUE, co...
c7092e1fccca84dd64af1c86769680d664ad95d9c0f6d472ae898e04d3a414b7
R
1,069
37
# load the gene expression matrix chen <- get(load('GSE87544_1443737Cells.Expresssion.Matrix.log_tpm+1_.renamed.RData')) head(chen) dim(chen) # load the labels of the cells labels <- read.csv('GSE87544_1443737Cells.SVM.cluster.identity.renamed.csv') head(labels) str(labels) # check if the orders of the cells in two d...
f973b98b14cca7e820aa3a1b252d74daf6e03865fb99f8ae5b589582b4dd2f83
R
1,074
19
df <- read.csv("Extend Fig.6d,e.csv") summary_df <- df %>% group_by(Family) %>% summarise(n = dplyr::n(), mean_diag = mean(diag_delta), se_diag = sd(diag_delta) / sqrt(dplyr::n()), mean_ct = mean(ct_delta), se_ct = sd(ct_delta) / sqrt(dplyr::n())) p1 <- ggplot(summary_df, aes(x = Family, y = mean_diag)) + ge...
fe67f4f8940fbda28d1ca4879ce6556783492ad4cd3f9c94f1e13d112d4ada8a
R
1,076
40
rm(list = ls()); gc() setwd('/home/yinfeiko/DeepLINK/newdata2') dat1 = read.csv('yu_CRC_common.csv', head = T, stringsAsFactors = F) nrep = 100 pe = rep(NA, nrep) n = nrow(dat1); n.train = round(n*.5) p = ncol(dat1) - 1 indmat.dist = matrix(NA, nrep, n.train) top250 = matrix(NA, 250, nrep) library("energy") dist.m =...
51cfdecb2722842466dd912ca769c20709c729fba79d035bb07b952f62b89fd2
R
1,100
37
#pdf("gatc.pdf") plot(1) gi.id49175990.gatc=read.table('data/gi.id=49175990.gatc') #summary(t(gi.id49175990.gatc)) #hist(t(gi.id49175990.gatc),breaks=100) gi.id332341332.gatc=read.table('data/gi.id=332341332.gatc') #summary(t(gi.id332341332.gatc)) #hist(t(gi.id332341332.gatc),breaks=100) gi.id218693476.gatc=read.t...
eb42f4f29dcd22cfcc985337faa48333ccc27242e2b66d90561984dd39d20cfe
R
1,112
36
library(clusterProfiler) library(org.Hs.eg.db) # Define the list of genes gene_list <- c("ATP6", "COX2", "COX3", "CYTB", "GFAP", "GJA1", "LINC02742", "ND1", "ND2", "ND3", "ND4", "ND6", "PLCG2") # Convert gene symbols to Entrez IDs entrez_ids <- bitr(gene_list, fromType = "SYMBOL", toType = "ENTREZID", OrgDb = org.Hs....
b5725a8a4d8ab5548b8d0cbb59b10c6424991dcdf44962718679cdc55f2dfe85
R
1,113
34
extractEstimates <- function(stanfitsfile,estimatefile,model2fit) { # retrieve parameter estimates. # ===================================================================. # load parameter estimates. load(stanfitsfile) f2@.MISC<-new.env(parent=globalenv()) # retrieve estimates per parameter. ...
757f3d2d14441f83f9ef9a322603764948b5ddfc69f8f6596535984d5018c096
R
1,134
38
--- title: "Untitled" output: html_document --- ```{r setup, include=FALSE} #https://cran.r-project.org/web/packages/tidyquant/vignettes/TQ04-charting-with-tidyquant.html install.packages("tidyquant") library("tidyquant") `````` ```{r cars} c("YAR.OL", "GOOG", "TEL.OL") %>% YAR<-tq_get(x='YAR.OL',get =...
c74deae37b082a75fc279c004efc2cd02103670aedde8a6b55d552f06f51d40c
R
1,138
31
#' Creates a heatmap of DIE abundance across comparisons #' @description A quick way to summarize DIE across multiple #' pairwise comparisons #' @seealso \code{\link{DiffSplicingAnalysis}} #' @param treeDir output directory containing DiffSplicingAnalysis #' @param comparisonList List of comparisons to be included in p...
232e83c5e72e41e4e0d77c3e34acb8a76022aa7e15dd4e29a4e1a7553892cc43
R
1,170
42
rm(list=ls()) setwd("/home/animeshs/Downloads/") fileP<-"/home/animeshs/Downloads/" fileN<-"diabetes.csv" yy<-read.csv(paste0(fileP, fileN),header=T) summary(yy[,9]) plot(yy,col=yy$Outcome,main="diabetes") yyt=as.matrix(yy) library(ggfortify) log.yyt=log(yyt[,1:8]+1) yyt.pca=prcomp(log.yyt,center=TRUE,scale.=TRUE) au...
63365a197c97394c8a7990268c82c81ceb18834268bdfb113c48326ed09eb001
R
1,195
14
df <- read.csv("Extend Fig.5c.csv", row.names = 1) df$dataset <- rownames(df) score_colors <- c("2" = "#096B38", "3" = "#919495") df$criteria_score <- ifelse(grepl("S$", df$dataset), "2", "3") df_long <- df %>% pivot_longer(cols = starts_with("k"), names_to = "k", values_to = "fraction") %>% mutate(k = as.numeric(g...
b03c3985b7b235243d3db763bced4d909d867f9397770dfc34659eaa16703bf4
R
1,246
27
library(png) source <- 'data/tumor/IDP 2020-02-27-002_mousemulti - cropping (1, 9451, 7028, 6223, 6386).png' my_im <- readPNG(source, native = FALSE, info = FALSE) library(geojsonR) js_file_name <- "data/tumor/IDP 2020-02-27-002_mousemulti - cropping (1, 9451, 7028, 6223, 6386).geojson" file_js = FROM_GeoJson(url_file_...
76b76bb072f7c77f29ddbe3c9b1d33b4428b324e062784c255069cb358499690
R
1,265
46
library("RSQLite") DATA <- new.env(parent=emptyenv(), hash=TRUE) .setUp <- function() { DATA$p1 <- tempfile() DATA$p2 <- tempfile() db1 <- dbConnect(SQLite(), DATA$p1) data(USArrests) dbWriteTable(db1, "ua", USArrests, row.names=FALSE) dbDisconnect(db1) } .tearDown <- function() { file.re...
765081eab8361f2fc96ecbc6d807338ba7448e2fb4f6e129d45d01efcba6ed99
R
1,266
47
rm(list = ls()); gc() dat1 = read.csv('human_rna.csv', head = T, stringsAsFactors = F) nrep = 100 pe = rep(NA, nrep) n = nrow(dat1); n.train = round(n*.5) p = ncol(dat1) - 1 indmat.dist = matrix(NA, nrep, n.train) top500 = matrix(NA, 500, nrep) library("energy") dist.m = function(mat) { nr = nrow(mat) smat <- app...
5e27194807445951486166870645adb3b525a96862c73b505ccca84062f08626
R
1,267
47
rm(list = ls()); gc() dat1 = read.csv('murine_rna.csv', head = T, stringsAsFactors = F) nrep = 100 pe = rep(NA, nrep) n = nrow(dat1); n.train = round(n*.5) p = ncol(dat1) - 1 indmat.dist = matrix(NA, nrep, n.train) top500 = matrix(NA, 500, nrep) library("energy") dist.m = function(mat) { nr = nrow(mat) smat <- ap...
3cfc97d4d0fe902183e8d7f259dfdec6a7d04a42bb00fb502254fc9b15de1228
R
1,270
15
#check sema clinical trial paper and data, also the different doses and simulation code https://www.youtube.com/watch?v=zm9SAHc63_o #Research Study Investigating How Well Semaglutide Works in People Suffering From Overweight or Obesity (STEP 1) https://clinicaltrials.gov/study/NCT03548935?tab=results#outcome-measures ...
846c6af228831dc074e9da9562cfa512a402091c9eb5b9970099170d6965470e
R
1,300
29
#' Location Preview Plot #' #' Make a location preview plot for user to directly see the map of sample slots #' #' @param location the formatted location information #' @return a location preview plot #' @export MyPreview <- function(location){ new_loc <- loc_convert(location) new_loc$row <- factor(new_loc$row, l...
aff51421af0bd4b3be2f071692a19e5c8151e17d5257e760444e018a0b5ce615
R
1,318
37
options(na.action=na.exclude) # preserve missings options(contrasts=c('contr.treatment', 'contr.poly')) #ensure constrast type library(survival) # # Fit the models found in Wei et. al. # wfit <- coxph(Surv(stop, event) ~ (rx + size + number)* strata(enum) + cluster(id), bladder, method='breslow') wfit # Check the ...
e27804ddbbaee86354c032905d79d4f3ce95ff81ed21f939d22385b59552e25a
R
1,331
27
normalize_de_estimates <- function(myRCTD, normalize_expr, remove_junk = T, param_position = 2) { if(remove_junk) { all_genes <- rownames(myRCTD@de_results$gene_fits$con_mat) junk_genes <- all_genes[c(grep("MT-",all_genes),grep("RPS",all_genes), grep("RPL",all_genes))] junk_g...
759f2e113434613fc6c5ab9e51e97d6bcad508ebf0c8baf03845e37da7bd2816
R
1,336
36
plotFits <- function(estimatefile,plotfitsfile,model2fit) { # load parameter estimates. load(estimatefile) # print relevant stats/diagnostics. # summary statistics. print("means:") print(apply(xbay, 2, mean)) # mean print("SD:") print(apply(xbay, 2, sd))# standard deviation # PLOTTING. ...
6f4b7cb5ed762f969db72ed9dcefd74ad7b700b1e5102b5ba85f6494f852719f
R
1,339
38
#' @useDynLib fgsea #' @import Rcpp NULL #' Example vector of gene-level statistics obtained for Th1 polarization. #' #' The data were obtained by doing differential expression between #' Naive and Th1-activated states for GEO dataset GSE14308. The #' exact script is available as system.file("gen_gene_ranks.R", packag...
44cec4675022dd18b1dc2baf9c8bfd659d52b00c4d535ff44e210c6c4876ccee
R
1,349
45
preparePathways <- function(pathways, universe, minSize, maxSize){ universeArg <- deparse(match.call()$universe) # Error if pathways is not a list if (!is.list(pathways)) { stop("pathways should be a list with each element containing gene identifiers") } # Error if stats is not named if...
f9a9bbe1f3a1be6ac12f825c90be23577a52c209a5b70611dcaf4f773967eaf4
R
1,349
20
#actin-actin dist ang histograms work_dir = "/Volumes/mahamid/Dorothy/Pipeline_after_CNN/20230516_new_analysis_for_paper/analysis_output/" tomos = c("control_box046_09","control_box046_10","control_box056_01","control_box056_04","control_box056_06","control_box056_07","control_box056_12","control_box056_23","induced_bo...
112dc791afd9af0c4e5c2883543a4d573aa51734a3361cd4cc1ef0018b22a704
R
1,401
30
#prepares for NMFreg library(readr) config_data <- config::get(file = "conf/dataset.yml", use_parent = FALSE) config <- config::get(file = paste0("conf/",config_data$config_mode,".yml"), use_parent = FALSE) slideseqdir <- file.path("Data/Slideseq",config_data$slideseqfolder) resultsdir = file.path(slideseqdir,"results"...
703013959ab3fcbaceb66101a0ba11cf17b248a7fe770546095f1d40ab8cbac8
R
1,441
69
# ========================= # Weight analysis # ========================= library(rstudioapi) dataFile <- selectDirectory( caption = "Select Directory", label = "Select", path = getActiveProject() ) setwd(dataFile) getwd() list.files() library(readxl) library(dplyr) library(ordinal) library(ggpl...
1b7e3119e8326fd2e9e5fb14fa76131883f259296d38692dddcf621470b46893
R
1,445
49
## glm.nb with weights library(MASS) yeast <- data.frame(cbind(numbers = 0:5, fr = c(213, 128, 37, 18, 3, 1))) attach(yeast) n <- rep(numbers, fr) ## fitting using glm.nb with weights - wrong results in 7.2-18 yeast2.fit <- glm.nb(numbers~1, link = log, weights=fr) summary(yeast2.fit) ## fitting extending the vector...
450d277f5f1b50ee3e0e5c2a1074decf39b7126198db6dd3646d49d2caf3bccd
R
1,454
52
context("fora analysis") test_that("fora works if pathways consists of one element", { pthw <- c("1", "2", "10") genes <- paste(1:5) universe <- paste(1:10) res <- fora(list("test_pathway" = pthw), genes, universe) expect_true(nrow(res) == 1) expect_equal(res$pval, phyper(1, 3, 7, 5, lower.ta...
733e1aa8d80e22a41eb4983a5f2302ed3cab747e8ec39824a6b493978f6dcc20
R
1,454
22
df <- read.csv("Fig.2c_combined_knn.csv") score_colors <- c("0" = "black", "1" = "#88191B", "2" = "#F79520", "3" = "#096B38") criteria_info <- data.frame(dataset = c("DS6", "DS7.1", "DS7.2", "DS16", "DS12.1", "DS12.2", "DS25.2","DS18", "DS19", "DS20", "DS21", "DS22", "DS23", "DS24", "DS25.1", "DS26"), ...
4a04c3417d725230c6977162954bd717e460492058966ee3230df58c48941d24
R
1,467
32
#' Conducts gene set enrichment analysis of significantly spliced genes #' @description An easy way to look for enriched genes in the differential #' splicing analysis. Uses the ClusterProfiler package to compare geneset #' against the reference genome and outputs an .Robj file along with .pdf #' network graphs #' @see...
25ef2e57b780ae112aa805547b18446a88fdc0cc62b8cae83d2dcbe34a5f3be8
R
1,475
33
#puck 24 library(spacexr) library(Matrix) counts <- readr::read_csv('data/Reference/Testes/Testis_Ref_DGE.csv') counts = tibble::column_to_rownames(counts, var = "X1") metaData <- readr::read_csv('data/Reference/Testes/Major_Cluster_Ident.csv') metaData = tibble::column_to_rownames(metaData, var = "barcode") myCounts <...
383b0e538fafcb4b5625350604daf9bbaf4915fa2e528728a7e2234229c58029
R
1,482
38
## human gene set profiles data=read.csv("L:/Elite/gaute/test/SHBER.csv") ## mapping Uniprot to Gene Name library(org.Hs.eg.db) egmap <- revmap(org.Hs.egUNIPROT)[as.character(data$Entry)] genelist <- as.vector(toTable(egmap)$gene_id) ##basic GO profile library(goProfiles) basicProfile(genelist, onto = "MF",...
52669b58d5b46dd2a8db35b8e1c32b158d78cbee689b9a04509eb04247dbd2c3
R
1,504
43
rm(list = ls()); gc() setwd('/Users/yikong/Dropbox (CSU Fullerton)/aResearch/DeepLINK/revision/common_feature/code1') library(dplyr) mean.se = function(x, ns=3) { m = round(mean(x), ns); s = round(sd(x)/sqrt(length(x)), ns) paste0(format(m, nsmall=ns), ' (', format(s, nsmall=ns), ')') } dvec = c(20, 30, 40, 50, ...
e527d5c80bc88f137b4fecc3b536a4abad6194997e02a026bfe452b220cb2fe2
R
1,521
45
```{r data} #data <- read.table("L://Elite/kamila/BT/datamwithoutsingletons.txt", header = T) data <- read.table("L://Elite/kamila/BT/datam.txt", header = T) ``` ```{r plot} plot(data) #install.packages('ggplot2') #library('ggplot2') g = ggplot(data,aes(hgb,time)) g+geom_point(aes(color=cd34))+geom_smooth(me...
a10c418c664e0f2ab88158f1d2c0d308a93fa627fe298ea33a5ed5b8c77c903d
R
1,523
30
#used for decomposition experiment on known cell types library(RCTD) library(Matrix) args = commandArgs(trailingOnly=TRUE) if (length(args)==0) { stop("callDoublets: At least one argument must be supplied: fold_index", call.=FALSE) } fold_index = as.integer(args[1]) print(paste0("callDoublets: loading fold index: ",f...
4fb84f86e64a173ca2d46994e66764392197bdd2dada21b63224b26469f44cb0
R
1,524
48
library(clusterProfiler) library(org.Hs.eg.db) library(ggplot2) # Set environment language and working directory Sys.setenv(LANG = "en") setwd("D:/project/ndreamer_plot/") # Define the function for GO enrichment analysis and plotting perform_go_enrichment <- function(df) { print(df) # Iterate over columns from th...
0f76170938fc6ab7097909dceb366c43478495ed3cbb00c1b78f3dec8aaf3cde
R
1,525
52
options(repos = c(CRAN = "https://cloud.r-project.org")) suppressMessages(if (!requireNamespace("pacman", quietly = TRUE)) install.packages("pacman")) pacman::p_load("optparse") pacman::p_load("seqinr") pacman::p_load("bit64") pacman::p_load("ape") pacman::p_load("tidyr") option_list <- list( make_option(c("-a", "-...
79a55733d90b26dffe1f8fa1b5d3d4aa5a895ca69f6b1e1df781feceddabd3ca
R
1,536
58
```{r} #https://github.com/mlverse/torch #install.packages("torch") #install.packages("torchtext") library(torch) #library(torchvision) x <- torch_tensor(1, requires_grad = TRUE) w <- torch_tensor(2, requires_grad = TRUE) b <- torch_tensor(3, requires_grad = TRUE) y <- w * x + b y$backward() x$grad #> torch_tensor ...
2e62f0aaf528f54d24b29fd4c4a2594ebee2051f4c2d8876f544257dfea13a7e
R
1,539
52
library(fgsea) library(data.table) library(BiocParallel) data(exampleRanks) data(examplePathways) ranks <- sort(exampleRanks, decreasing = TRUE) ranks <- abs(floor(ranks * 0.5 + 0.5)) write.table(c(length(ranks), ranks), file="roundRanks.txt", row.names = FALSE, col.names = FALSE) fgseaRes <- fgsea(examplePathw...
24de05663a6a95f39e6505c954023348d68ae90394276c623d717123b30696fb
R
1,540
65
library(reshape) library(ggplot2) library(reshape) library(car) library(nlme) require(multcomp) library(rstudioapi) dataFile <- selectDirectory( caption = "Select Directory", label = "Select", path = getActiveProject() ) setwd(dataFile) a <- list.files(pattern='exp', ignore.case=T) #this should b...
2d0a53e4f1b0d0582254482d8cb3455179d883c1552237c24abd36b794c64687
R
1,547
56
# Functions that help to derive collection info for patchwork # Same logic for axes and axis_titles .collect_xy <- function(z) { if (z$x && z$y) { return("collect") } if (z$x) { return("collect_x") } if (z$y) { return("collect_y") } return("keep") } # Takes list of ggplots and determines col...
3aba05679c9728b6d1505ee59bba8855ed08a5d861b66f8e2331ec8a6b59f201
R
1,551
38
#' Align fastq.gz files with Minimap2 #' @aliases Minimap2 #' @description This function is a wrapper for Minimap2 #' with stringent parameters optimized for ONT/PacBio sequenced #' data. It performs sam to bam conversion to reduce #' space, and .bam output is necessary for downstream analysis #' @seealso \code{\link{M...
1c51f7352d562dffaf721b95f63419a3b57ef037ac89f55623d150866b137ee7
R
1,583
43
df <- readRDS("Extend Fig.8b,c,d,e.RDS") plots <- lapply(names(df), function(name) { mat <- as.matrix(df[[name]]) self_vals <- diag(mat) other_means <- sapply(1:nrow(mat), function(i) mean(mat[i, -i])) df_long <- data.frame( cluster = rownames(mat), Self = self_vals, Other = other_means ...
682ea8c7cda8bb16af6aac8df1d1957d2c446c1569c7e7d181da197e14c5c169
R
1,588
36
library(tidyverse) library(ggpubr) #read csv work_dir = "/Volumes/mahamid/Dorothy/Pipeline_after_CNN/20230527_new_analysis/" #directory where all the files should be read from setwd(work_dir) ctr_dist_ang <- read.csv(file = "control_memb_actin_dist_ang_info.csv") ind_dist_ang <- read.csv(file = "induced_memb_actin_dis...
61534d86217609401b215731a0377df3d9bcf47c336520c0348f67516ff162fd
R
1,594
43
# Set environment language Sys.setenv(LANG = "en") # Set working directory setwd("D:/project/ndreamer_plot/") library(ggplot2) # Read the data path <- c("./experimental/ablation.csv") df <- read.csv(path) # Rename columns colnames(df) <- gsub("^X1\\.cLISI$", "cLISI", colnames(df)) colnames(df) <- gsub("^kBET\\.Accep...
c8ca9ab815bd99e1756d6cc3d40b145e3ed7000ae8d2ac8dc62244d3e4c283c9
R
1,603
33
#devtools::install_github('jdrudolph/PerseusR') # All plugins can be split into 3 parts # 1. Reading the command line arguments provided by Perseus and parsing the data. # 2. Perform the desired functionality on the data. # 3. Write the results to the expected locations in the Perseus formats. # 1. Parse command line a...
7b8cf87ade628b636e4f99f817cb981bf944e7372db1c4534f2b706453279fbb
R
1,607
38
#' Align fastq.gz files with STARlong #' #' @aliases STAR #' @description This function is a wrapper for STARlong #' with stringent parameters optimized for PacBio sequenced #' data. It performs sam to bam conversion to reduce #' space, and .bam output is necessary for downstream analysis #' @seealso \code{\link{MapAnd...
8f675cf9eb29cf35e09863ea4f045facbe3c2cad1b4dc946986075acf7fc9550
R
1,608
32
#' Miami-Dade County House Prices #' #' @description #' The dataset contains information on 13,932 single-family homes sold in #' Miami-Dade County in 2016. #' Besides publicly available information, the dataset creator Steven C. Bourassa has #' added distance variables, aviation noise as well as latitude and longitude...
b66bb56ecf728034af07927572811da6b9eee6480a6afa5c32ebc89d138a1d7e
R
1,608
32
library(ggpubr) library(dplyr) work_dir = "/Volumes/mahamid/Dorothy/Pipeline_after_CNN/20230527_new_analysis/analysis_output/" setwd(work_dir) ctr_data_read <- na.omit(read.csv(file = "memb_norm_control_memb_actin_dist_20_nm_bin_noupper.csv")) ind_data_read <- na.omit(read.csv(file = "memb_norm_induced_memb_actin_dist...
210b34ba5f5af5839d9716e90440275efd6944de6fd82d70725ecca7f9ac73da
R
1,629
73
# ========================= # Eye opening analysis # ========================= library(rstudioapi) dataFile <- selectDirectory( caption = "Select Directory", label = "Select", path = getActiveProject() ) setwd(dataFile) getwd() list.files() library(readxl) library(dplyr) library(ordinal) libra...
b0011d3a7eef6ea6969f295d7f201bc439ac2a6ae1d8eae4584367e366c7c82f
R
1,633
43
options(na.action=na.exclude) # preserve missings options(contrasts=c('contr.treatment', 'contr.poly')) #ensure constrast type library(survival) # # Trivial test of stratified residuals # Make a second strata = replicate of the first, and I should get the # exact same answers test1 <- data.frame(time= c(9, 3,1,1,...
c217eeb53d23376d702986b598e5c8f5b164de4b943a4c0a1df21f3e9db5e99a
R
1,634
60
## D:\\animesh\\booksNpapers\\lang\\statistics\\time_series\\timeseries_plots ## read cocoa price file, note that we use ## comma as decimal seperator and ## semicolon as field seperator. a<-read.csv2("cocoa.csv") ## chop the year and avg columns a<-a[,2:13] ## write table to vector b row by row. ## as.nu...
4ebc432e163ad9c9a32b3e82415694132d8d5e7086042d712d904d0bdf775c29
R
1,650
60
ica <- function(X, lrate, epochs=100, ncomp=dim(X)[2], fun="negative") { if (!is.matrix(X)) { if (is.data.frame(X)) X <- as.matrix(X) else stop("ica: X must be a matrix or a data frame") } if (!is.numeric(X)) stop("ica: X ...
d76434cd96c5607a26ba8ecbb8701397353ef38e6e740823bed59dc766a04fb7
R
1,663
50
#setup#### #https://www.r-bloggers.com/2021/04/random-forest-in-r/ #install.packages("randomForest") #install.packages('caret') #install.packages('ggplot2') #data#### inpF="F:/OneDrive - NTNU/Aida/ML/dataTmmS42T.csv" data=read.csv(inpF) dim(data) dGroup="Class" print(dGroup) data[,dGroup] <- as.factor(data[,dGroup]) pr...
00a59cc24ed484b96a35e093f281e536f39fb0d0d56e0e9060d768001cf8b947
R
1,676
52
rm(list = ls()) suppressPackageStartupMessages(require(rstan)) rootdir <- "F:/PIT/model/EEGmodelHC/HC" datadir <- file.path(rootdir, "results") resultsdir <- file.path(datadir, "stan") models_to_check <- c(9, 10, 12, 13, 14, 15, 16, 19, 21) # Specify the models to inspect, e.g., c(9,10,12,14) summ_list <- lis...
b021e1610be0e40679076705f72b87aac2b69612cb2e04cc5b7109b6f827bc42
R
1,714
52
# Run from project root, or set working directory accordingly. # Exports harmony-cluster markers from the E2 Seurat object for SCSA input. library(Seurat) input_file <- "Data/E16_barcodes_E2.rds" output_file <- "Automatic_annotation/seurat_E16_barcodes_E2_harmony_clusters.csv" cat("Reading RDS file:", input_...
a28d90f20c0aafa7fe65553c953d85d265b9d3de851491c0151abb36c70ba673
R
1,719
43
#' Quantifies full-length isoforms in sample(s) #' #' @description Depending on whether you want to do downstream #' differential expression analysis of full-length isoforms, #' TSS, or PolyA sites, this function annotates and counts up #' transcripts expressed in the given set of samples #' #' @param AllInfo Merged fi...
ad3a367901e752f17270cc9d30cd85d68d8ae25724bf92f1877c8b1c9dee8e0b
R
1,743
49
#Rscript selectIDfromXlsx.r "L:\promec\Elite\LARS\2018\mai\Vibeke V\PDv2p5\Clots\suppltab2_v1.xlsx" "L:\promec\Elite\LARS\2018\mai\Vibeke V\PDv2p5\Clots\180507_VIBEKEV_C1-(12)Proteins.xlsx" #install.packages(c("gglot2","svgite")) args = commandArgs(trailingOnly=TRUE) print(paste("supplied argument(s):", length(args))) ...
920510b27750832232ac79a71b475bed9bb76fba09638b84c08a3dc67038872c
R
1,750
43
options(na.action=na.exclude) # preserve missings options(contrasts=c('contr.treatment', 'contr.poly')) #ensure constrast type library(survival) # Create a "counting process" version of the simplest test data set # test1 <- data.frame(time= c(9, 3,1,1,6,6,8), status=c(1,NA,1,0,1,1,0), ...
3942982a8f38009a5b55ceed946e9f2998abb5280916c741bfc2eca3b762ee54
R
1,759
56
#' @import dplyr #' @importFrom magrittr %>% #' @import ggplot2 #' @import cowplot `%>%` <- magrittr::`%>%` args <- commandArgs(trailingOnly = TRUE) tree_dir <- args[1] files = list.files(tree_dir,recursive = TRUE)[grep("results.csv",list.files(tree_dir,recursive = TRUE))] cT <- unique(as.vector(read.table(args[2])$...
9b26fb7c12936555e28130121509f926f2548af4223f114be1ad976250455223
R
1,761
31
#Rscript evidenceQC.r "L:/promec/TIMSTOF/LARS/2024/240404_Mathilde/combined/txt/evidence.txt" "240404_Mathilde_TN_PDAC_P1_Slot2-4_1_7011 240404_Mathilde_TN_PDAC_P2_Slot2-5_1_7013 240404_Mathilde_TN_PDAC_P4_Slot2-7_1_7017" #setup#### args = commandArgs(trailingOnly=TRUE) print(paste("supplied argument(s):", length(args)...
95bd752808e9f631e6cc21f3711a8d3de258fa5a582631e99cb5e8879a8cc493
R
1,770
78
library(dplyr) library(Seurat) library(ggplot2) library(patchwork) library(SeuratData) library(SeuratWrappers) library(Azimuth) unintegrated <- readRDS("PATH_TO_OUTPUT/unintegrated.rds") runtime_RPCAv5 <- system.time({ integrated_RPCAv5 <- IntegrateLayers( object = unintegrated, method = RPCAIntegration, ...
6b0e69013d92cbbc37b3a206601d7c08e8b5ca6feb8fde225b66da381bd13c6e
R
1,781
15
df <- read.csv("Extend Fig.6g.csv", row.names = 1) cluster_order <- c("LRP1.0", "LRP2.1", "LRP2.2", "HIn1", "HIn2", "MC1.1", "MC1.2", "MC1.3", "MC1.4", "MC1.5", "MC1.6", "MC1.7", "MC1.8", "MC1.9", "MC1.10", "MC1.11", "MC2.1", "MC2.2", "MC3.1", "MC3.2", "MC3.3", "MC3.4", "MC3.5", ...
167e1d72416fb9e737a82b864943a9aa1c2f2b46eafd2d40f648e1f7751e6064
R
1,810
35
read.Slideseq.mtx <- function(datadir, puck_no) { mtx_file <- file.path(datadir, paste0(puck_no, '.matched.digital_expression_matrix.mtx')) barcodes_file <- file.path(datadir, paste0(puck_no, '.matched.digital_expression_barcodes.tsv')) coords_file <- file.path(datadir, paste0(puck_no, '_barcode_matching.txt' )...
9b2ea70349f2a2fc13c2c6fff90420cdc08ff9acccd9dac5df4726d3b18a3d4d
R
1,810
76
library(dplyr) library(Seurat) library(ggplot2) library(patchwork) library(SeuratData) library(SeuratWrappers) library(Azimuth) unintegrated <- readRDS("PATH_TO_OUTPUT/unintegrated.rds") runtime_FastMNN <- system.time({ integrated_FastMNN <- IntegrateLayers( object = unintegrated, method = FastMNNIntegration...
6f7984fb1188242cafc4e33c73acb7b2bc53c8d2045d26ab12a06d1ef2e1304c
R
1,841
75
library(dplyr) library(Seurat) library(ggplot2) library(patchwork) library(SeuratData) library(SeuratWrappers) library(Azimuth) unintegrated <- readRDS("PATH_TO_OUTPUT/unintegrated.rds") runtime_CCAv5 <- system.time({ integrated_CCAv5 <- IntegrateLayers( object = unintegrated, method = CCAIntegration, ori...
128e0169990623d5e142d5612e80434d6981c3e185d938cc8713777e66970d82
R
1,868
73
library(dplyr) library(Seurat) library(ggplot2) library(patchwork) library(SeuratData) library(SeuratWrappers) library(Azimuth) unintegrated <- readRDS("PATH_TO_OUTPUT/unintegrated.rds") runtime_JointPCA <- system.time({ integrated_JointPCA <- IntegrateLayers( object = unintegrated, method = JointPCAIntegrat...
41b43a5103eeecb84a8e5190e86a4b55067e16c52549f8cb853442fab9a10b1a
R
1,881
71
library(plyr) library(ggplot2) DATA <- read.csv("Fig.7e.csv") # calculate density mm1 <- DATA mm1$density <- mm1$Vglut2spots / mm1$CellArea..um2. # outlier check boxplot(mm1$density ~ interaction(mm1$Age, mm1$Celltype), main = "Outlier check per groep", ylab = "density", xlab = "...
7a1ab5ed70a92cefca8f57cc6b075888ee508735bb415eac70655279a16e4949
R
1,891
75
library(dplyr) library(Seurat) library(ggplot2) library(patchwork) library(SeuratData) library(SeuratWrappers) library(Azimuth) unintegrated <- readRDS("PATH_TO_OUTPUT/unintegrated.rds") runtime_HarmonyIntegration <- system.time({ integrated_Harmony <- IntegrateLayers( object = unintegrated, method = HarmonyI...
e8574bfac46196237aaf8cb32bc1131e069de61ac18de58fc3aadfdc0939302e
R
1,892
36
#..\R-4.5.0\bin\Rscript.exe .\proteinGroupsNormGene.r "L:\promec\Animesh\Aida\txt207\proteinGroupsHCL.txt" print("USAGE:Rscript proteinGroups.r <complete path to txt file>") inpF<-file.path("L:/promec/Animesh/Aida/txt207/proteinGroupsHCL.txt") selection=c(1:10) id1="T..Gene.names" id2="T..Protein.IDs" selGene1="BRD4" s...
e79ae70fb9c9789b78d608efd6ab1e605053b0b5a8b7aea9ac8a76196b525303
R
1,898
45
#!/usr/bin/env Rscript library(optparse) #Get the options option_list = list( make_option(c("--input"), type="character", help="This is a five column text file with the following fields\n <pc bedGraph path>\t<pc type>\t<replicate name>\t<sample name> First column is the pat...
f53d9cb5376ceddca256203002a5f101075f61b76014b31f9fd2b66539512b00
R
1,912
20
df <- read.csv("Extend Fig.3c,d,e.csv", row.names = 1) df$dataset <- rownames(df) df$criteria_score <- case_when(df$Stages %in% c("N1", "N3") ~ "2", df$Stages == "AF2" ~ "1", TRUE ~ "3") score_colors <- c("0" = "black", "1" = "#88191B", "2" = "#F79520", "3" = "#096B38") c <- ggplot(df, aes(x = Stages, y = mean_an...
4cbeadb56c73cd2d30ef0c4b5a1f27ed4c6486ec3d958b4ad193fba0530bdb52
R
1,916
44
#' Count exon inclusion and exclusion according to grouping factor #' #' @description This function groups reads by either the celltype #' or cell-barcode to count inclusion and exclusion of exons. Inputs #' to this function are based on previous preprocessing steps #' #' For ONT data we recomment \link[IsoQuant]{https...
b4dd4409b558735ba6e5f1c433f16e868e83d615102accc9986bb70ccf247e5f
R
1,936
45
#' Spectral Clustering on filtered data #' #' #' #' @param df_filtered the filtered protein dataset #' @return a PCA plot colored by label from spectral clustering, and a dataset containing cluster label. #' @export SClustering <- function(df_filtered){ withProgress(message = 'Spectral Clustering', value = 0, { ...
849e75b9156084bcd5a9a58e853a9611f6c0c3c0e8345915de6768fa2e93e772
R
1,962
54
context("Plots") test_that("plotGseaTable works", { data(examplePathways) data(exampleRanks) fgseaRes <- fgsea(examplePathways, exampleRanks, minSize=15, maxSize=100, eps=0.0) tf <- tempfile("plot", fileext = ".png") topPathways <- fgseaRes[head(order(pval), n=15)][order(NES),...
f5b15fb3ae59aa90d2d06f6a7c4328cc805b957416e3925c2d38a7027014b190
R
2,005
70
library(plyr) library(dplyr) library(ggplot2) #read in RT data from 2 separate files b2 <- read.csv('batch2_pro.csv') b1 <- read.csv('batch1_pro.csv') d <- rbind(b1, b2) ##subtract 2 from zone to properly align region...should confirm with Hal that this is correct, ## but the RTs seem to line up correctly in plots d$...
a213a87d1b775216da24466c442398a68cba95fb254ae4d6677cabc714fbd0ae
R
2,021
67
interpolate <- function(x, a, adims=lapply(dimnames(a), as.numeric), method="linear"){ if(is.vector(x)) x<- matrix(x, ncol=length(x)) if(!is.array(a)) stop("a is not an array") ad <- length(dim(a)) method <- pmatch(method, c("linear", "constant")) ...
807e523f000581f83bff6d37a37c98f369e0f1b07833479e5b9c9b0dec8e6ba1
R
2,023
39
#' Make a "corrected" version of the All-Info file #' after using IsoQuant to identify incorrect splice sites #' @aliases bed2AllInfo #' @description This function takes in a corrected bed file #' that is generated after running IsoQuant, as well as the AllInfo #' file that is the output of scisorseqr. It produces a ne...
5f107f3ddf5e0cc3bdd51c41eb01990194fe2821c37cb3ccb493b371f63cd212
R
2,026
28
# Fig 2 D, E # df <- read.csv("Fig.2d,e_integration_metrics.csv") score_colors <- c("0" = "black", "1" = "#88191B", "2" = "#F79520", "3" = "#096B38") criteria_info <- data.frame(dataset_id = c("DS6", "DS7.1", "DS7.2", "DS16", "DS12.1", "DS12.2", "DS25.2", "DS18", "DS19", "DS20", "DS21", "DS22", "DS23", "DS24", "...
f045ede50275ffd8a5505757afc2bec818f9f67c76ec779b8e77eb6b43c1fcaf
R
2,043
49
# WAIC... # From Aki & Gelman 2014 # Little function to calculate posterior variances from simulation colVars <- function (a){ diff <- a - matrix (colMeans(a), nrow(a), ncol(a), byrow=TRUE) vars <- colMeans (diff^2)*nrow(a)/(nrow(a)-1) return (vars) } log_sum_exp <- function(x){ x_max <- max(x) x_max + log(su...
3dcbb5fc91bb5c2378d69d6e8275bd4bce328170a3e04b0fdd419fc886aafba3
R
2,061
63
rm(list = ls()) suppressPackageStartupMessages(library(rstan)) # ========================================== # Standalone Script 2: Export raw Stan f2 draws to CSV # ========================================== # ---------- 1) Configuration ---------- # Define the export job list here # Each row represents one export jo...
67486f8c3ca3b3700f867a037c91592fb0a9d9a8efd794b0921b1086d3ddcfd3
R
2,070
56
#4 different doses of carbamazepine alone (2, 4, 6, 8 mg/kg) and carbamazepine with tramadol (20mg/kg), flouxetine (20mg/kg) and melatonin (50mg/kg) given to mice anticonvulsant <- data.frame(x = c (2,4,6,8), n = rep(8,4), y = c(0,3,6,8)) anticonvulsant$Ymat <- cbind(anticonvulsant$y, anticonvulsant$n - anticonvulsant...
bf01a5504c1a6ba047531b5559b9f49afe1545162deef68516bdd8ebe2eccbf8
R
2,088
37
fo='L:\\promec\\TIMSTOF\\LARS\\2026\\260518_Sonali\\DIANNv2P2.63.260612_140833.64.highacc\\Outcome_data_with_PRM_median_ratios.xlsx'; testtype='WSRT'; data=readxl::read_xlsx(fo,sheet=1); print(dim(data)) dataSel1=t(data[data$"quality"=="HQ",]) print(dim(dataSel1)) dataSel2=t(data[data$"quality"=="LQ",]) print(dim(dataS...
f65815f9c1fb6189839c43f7e73dc7607cc1ac469d939d46993a07e00ac24e96
R
2,090
70
checkGesecaArgs <- function(E, pathways){ # Error if pathways is not a list if (!is.list(pathways)) { stop("pathways should be a list with each element containing names of the stats argument") } # Error if E matrix doesn't have rownames if (is.null(rownames(E))) { stop("E rows shoul...
e5d377daa9fcb06428b5e2ebd61333a07d5530cac3030e3b8f6424873dec95f1
R
2,096
33
#this script converts a DGE and coords matrix to a puck object saved as RDS library(RCTD) library(Matrix) print("prepareCropper: begin") slideseqdir <- "Data/Slideseq/Visium" counts <- readMM(file.path(slideseqdir, 'matrix.mtx')) barcodes <- read.table(file = file.path(slideseqdir, 'barcodes.tsv'), sep = '\t', header =...
286faf4653bdab6a9a3adf9a66ae3b1d334e5e6a0381edc3f883ef54735a4378
R
2,102
34
library(Matrix) library(spacexr) library(doParallel) library(ggplot2) #source('~/Documents/MIT/Research/Rafalab/Projects/slideseq/Cell Demixing/ContentStructure/RCTD/PersonalFiles/private_utils.R') #source('~/Documents/MIT/Research/Rafalab/Projects/slideseq/Cell Demixing/ContentStructure/RCTD/de.R') #source('~/Document...
cfb777bb94c77554181405aa31a31d79e273a4e69ee9d5421c7d308eb7d4d55f
R
2,102
34
library(Matrix) library(spacexr) library(doParallel) library(ggplot2) #source('~/Documents/MIT/Research/Rafalab/Projects/slideseq/Cell Demixing/ContentStructure/RCTD/PersonalFiles/private_utils.R') #source('~/Documents/MIT/Research/Rafalab/Projects/slideseq/Cell Demixing/ContentStructure/RCTD/de.R') #source('~/Document...
efa7a7017f92287c70d975970fcdd146f7078c51d70eded551c3952a369071d6
R
2,115
79
## By Anoushka Joglekar 2019. Edited 07/2020 args <- commandArgs(trailingOnly=TRUE) current_dir <- args[1] setwd(current_dir) pairwise_dir <- args[2] files = list.files(pairwise_dir,recursive = TRUE)[grep( pattern = "results.csv",list.files(pairwise_dir,recursive = TRUE))] mf <- list() bp <- list() cc <- list() ...
86598ec11e3b40af3cba172e3e15a42e3381c06b4ad4bfc7fa4fef0a4658850f
R
2,148
52
# Function to generate a p-value for the spatial correlation between two parcellated cortical surface maps, # using a set of spherical permutations of regions of interest (which can be generated using the function "rotate_parcellation"). # The function performs the permutation in both directions; i.e.: by permute both...
8c40ba0e8f4dc184a92e061951dec237f9d0865b234247e9effcc0a8e86e36ea
R
2,150
61
## some tests of inverse-gaussian GLMs based on a file suppled by ## David Firth, Feb 2009. options(digits=5) ## Data from Whitmore, G A (1986), Inverse Gaussian Ratio Estimation. ## Applied Statistics 35(1), 8-15. ## ## A "real, but disguised" set of data (Whitmore, 1986, p8). ## ## For each of 20 products, x is...
90976ec4fcc082c09abbb72f5916a80f63a9f433245dcd9659086f6ef908e9ae
R
2,168
70
# run_ace_model.R — AE model with rG + CI and nested test run_ace_model <- function(roi, mzData, dzData, return_type = "AE") { return_type <- match.arg(return_type, choices = c("AE", "ACE")) # Ensure reproducibility and stable optimization mxOption(NULL, "Default optimizer", "CSOLNP") # 1) Fit full ACE ACE ...
5e81255ae1be1fb3f89ceaeb3fed3b0fad8e4cde794b410c1af25af735096e87
R
2,171
74
#=========================================================================== # Helper functions to produce the beeswarm plots #=========================================================================== # Example # ggplot(iris, aes(Species, Sepal.Width)) + # geom_point(position = position_bee(), aes(color = Species)...
921e78df12322b13ffd1b1852926f57ac9fd08c4a5f86c84f81f56d152774ce8
R
2,197
78
## tests of the simulate.lm method, added Feb 2009 options(digits = 5) # recommended packages should be present if(!require("MASS")) q() ## cases should be named fit1 <- lm(time ~ dist, data = hills) set.seed(1) simulate(fit1, nsim = 3) ## and weights should be takedn into account fit2 <- lm(time ~ -1 + dist + clim...
6781d0d5ab194454c02d9e9d406dbc9cc1d7e45561ce7a60983a9ee1cc89e6a4
R
2,217
56
library(Seurat) library(sctransform) library(dplyr) library(stringr) library(patchwork) library(ggplot2) library(cowplot) library(SoupX) library(DropletUtils) library(scCustomize) library(scran) source("Helpers/SoupXDoubletfinder.R") # Comparing background ambient RNA Stating marker genes for diverse cell types in the...
cf56f4950b321a6b28420e4a48dd66305aebd3282949f4bae049529a44712603
R
2,217
68
# Nonlinear mixed-effects learning-curve models (p0, alpha) by group # Fits separate models for trials 1-10 and 11-200 suppressPackageStartupMessages({ library(data.table) library(nlme) }) load("/Users/doq/Geode_Data/preprocessed_data.RData") alldata <- as.data.table(alldata) # Group definitions alldata[, binar...
4f608acc584019ec70f69b541116741fc2970761356c5ef0d63582fd30ba78bf
R
2,223
73
library(Seurat) library(SeuratObject) methods <- c("JointPCA", "Harmony", "FastMNN", "Conos", "Combat", "CCAv5", "RPCAv5") base_dir <- "PATH_TO_INPUT_DIR_FOR_INTEGRATED_SEURAT_RDS/" eval_base <- "PATH_TO_OUTPUT_DIR_FOR_EXPORTS/" out_paths <- list( "JointPCA" = file.path(eval_base, "JointPCA"), "Harmony" = file....
a78a480fab9f092337f80a513124f2a95cbce02c5727b0408ac53fa4500e2377
R
2,238
45
```{r data, echo = FALSE} inpD <-"C:/Users/animeshs/OneDrive - NTNU/Lisa/" inpF<-paste0(inpD,"Log2FC monocytes all treatments trimmed and sorted final csv (Fig 2C).csv") #inpF<-paste0(inpD,"Log2FC all nine cell lines trimmed and sorted final csv (Fig 2A).csv") data <- read.delim(inpF,sep=";",dec = "," ,header = T,strin...
f9bc69602a8451d270b77381468321d51c244677cdff5121c528963d2d6207c7
R
2,247
60
```{r TEiMeta, echo = FALSE} #AEC: automated execution context / data provenance and its manifest - Salmon guy #https://bioconductor.org/packages/release/bioc/vignettes/tximeta/inst/doc/tximeta.html BiocManager::install("tximeta") ``` ```{r VRS.ga4gh, echo = FALSE} #https://github.com/ga4gh/vrs BiocManager::install(c(...