sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
80e4b6482e45f2f8fd93c0fc93ffe6f87bfe83601da2c6416f3a19b7f3fe2e02
R
1,327
38
#' Reorder Matrices #' @description Tries to find an order for matrix by different cluster methods. #' @param x a matrix-like object. #' @param is.cor logical value (defaults to TRUE) indicating wheater #' \code{x} is a correlation matrix. #' @param cluster.method a character string with the name of agglomeration meth...
297738225ea9b9506cefc02b9dbef3b62d921449f102f9dbd26b9547d379ce89
R
1,329
33
#!/usr/bin/env Rscript source(here::here("src/shared/R-helpers/get_settings.R")) suppressPackageStartupMessages({ library("dplyr") library("tidyr") library("readr") library("tibble") }) settings <- get_settings(omic = "phosphoproteomics", stage = "filter_STY", dataset_name = NULL) # dataset_name = "c9" loc_p...
2551cda166625ba4b9e9cbbe81304d45ae51eee3dec35f773643fd1bd97c8b8a
R
1,330
56
source(here::here("src/shared/R-helpers/memoise_decorator.R")) suppressPackageStartupMessages({ requireNamespace("gprofiler2") }) gost_memoise <- function(cache_dirname, ...) { .gost_robust <- function(...) { args <- list(...) q <- args$query if (length(q) > 0) { Sys.sleep(1) out <- gpro...
9a0b7145b7149b44eba4441c142f33c7e799ef5e603a512396d8b9a662a6ef2d
R
1,334
25
plot_dendrogram_replicates <- function(matrix_proBatch_Tatjana, sample_annotation = sample_annotation_PanCancer, color_list = color_list_PanCancer, biospecimen_id_col = 'patient_IDs', sample_id_col ='sample...
14d3a434ac4b985fd9ced56586f6f528e3ad6c86de5170f2f197eaaa1cd82ec2
R
1,346
32
library(rstan) library(ltjmm) # from https://bitbucket.org/mdonohue/ltjmm/src/master/ library(doParallel) # rstan settings options(mc.cores = parallel::detectCores()) options(auto_write = TRUE) # Read data # The data needs to be in long format with following columns: Patient_ID, Time.since.diag_scaled, Age_at_diagnos...
eea621046f28c59483a051901ed9a8c05b8f1ca90b366ed5237c458b2c9626eb
R
1,346
28
# Laura Aarnos 211118 # Create new plate layout for meaRtools - Axion12 # Original code from meaRtools: Reading in MEA data #library(IGM.MEA) library(meaRtools) #attach meaRtools after IGM.MEA to get right parameter names # name your plate layout - the name goes between '' my.name <- 'Axion12' # e.g. '1-electrode' ...
9cf71c296636d8d4e48c9446d8c0de96d0659c2c0438230acd45bfffa71ed9fa
R
1,350
49
#!/usr/bin/Rscript ## Import Libraries library("DESeq2") library("ggplot2") ## Import counts matrix cts <- as.matrix(read.csv("../../../data/bernardo/processed/04.deseq2/new_mito_unique.tsv", sep="\t", row.names="transcript_id")) ## Import metadata coldata <- read.csv("../../../data/bernardo/processed/04.deseq2/ex...
f22a997ad3f2740c25aabb7fb417719801680b803e3322a65c4703d469b83064
R
1,357
44
#' Creates a \code{blots} argument #' #' This helper function creates a valid \code{blots} object. The #' \code{blots} object is an argument to the \code{mice} function. #' The name \code{blots} is a contraction of blocks-dots. #' Through \code{blots}, the user can specify any additional #' arguments that are specifica...
97b987583861a5c01e26ecba5bf8a211cc160d9f63ea73d838f1eaeb435784d3
R
1,360
49
#!/usr/bin/Rscript ## Import Libraries library("DESeq2") library("ggplot2") ## Import counts matrix cts <- as.matrix(read.csv("../../../data/bernardo/processed/04.deseq2/new_mito_full_length.tsv", sep="\t", row.names="transcript_id")) ## Import metadata coldata <- read.csv("../../../data/bernardo/processed/04.dese...
6c77c0fee6bda97e88a33cbbe38ddd06b8eeee119fcab954a23f4af9f8041167
R
1,371
41
```{r} library("Seurat") library("BayesSpace") ``` load spatialLIBD ```{r} st_data_libd = read.csv("libd_df.csv", header = T,row.names = 1) st_data_coordinates = data.frame(read.csv("meta_data.csv",row.names =1)) st_df_libd = t(st_data_libd) ``` analysis ```{r} library(SpatialExperiment) ...
ea958827235caf41bf8d84108c55def5d3ef0b8904bb182f1d453b5facf572b0
R
1,371
41
library(data.table) D <- fread("C:/STUDIES/RESEARCH/neural_ODE/breast_cancer_data/clean_data/desmedt_11165genes_1sample_186T.csv") top_row <- D[1, ] time_row <- D[.N, ] D <- D[-c(1, .N), ] dim(D) num_genes <- dim(D)[1] ### this part is just to see what's happening idx = sample(1:500, 1) mod_loess <- loess(as.numeric(...
bdf7b63c6dd3ce35f8728132e80366c740bb74fe6a4400b1dc114ea72499459f
R
1,372
17
###DTS script to check that all prerequisites are met and what kind of experiments have been conducted #make sure all flies have the identical experimental design and find out which don't xml_list = paste(dataset.path, unlist(do.call("rbind", lapply(dataset.data$resources, '[', 4))), sep = "/") #create list of all fil...
8964d3186bf8828fb6fbacdd02c2bd3f9c3655e9ed508abd5d7862849f2a8384
R
1,379
34
#' Subset of Irish wind speed data #' #' Subset of Irish wind speed data #' #' The original data set is much larger and was analyzed in detail by Haslett #' and Raftery (1989). Van Buuren et al (2006) used this subset to investigate #' the influence of extreme MAR mechanisms on the quality of imputation. #' #' @name wi...
5091b6260f0cb30ef54a5b2362a2ce58fc232adeb99bf6a33187285018701474
R
1,386
49
```{r} library(CARD) library(MuSiC) library(Seurat) # library(data.table) ``` load sc_ref_data ```{r} sc_data_1 = read.csv("sc_ref_hippo.csv", header = T,row.names = 1) sc_data_labels = read.csv("sc_label_hippo.csv",row.names = 1) sc_df = t(sc_data_1) ``` load 5k ```{r} st_data_1_5k = data....
77d8d59484da8f90fc1b6f15cbefcc8da0f2269cadb839db9ca5e9092e34b9bf
R
1,386
36
#!/usr/bin/env Rscript --vanilla #load the libraries library(readr) library(tidyverse) library(reshape2) #load the annotation sample_annotation_InterLab = read_csv('data_InterLab/3_data_for_plots/sample_annotation_InterLab.csv') #load the spike-in concentrations #load the list of spike-in peptides and corresponding...
2e9188173e369f6781c39cc5f0513993978a93419aa56da06f810abad4158ca5
R
1,388
39
library(ggplot2) library(dplyr) # read in results xis.1 <- read.csv("juliacon/results/simulation1_case1.csv") xis.2 <- read.csv("juliacon/results/simulation1_case2.csv") xis.3 <- read.csv("juliacon/results/simulation1_case3.csv") xis.4 <- read.csv("juliacon/results/simulation1_case4.csv") xis.5 <- read.csv("juliacon/r...
962a46a5372bfc6b3be1a5688d61dbc88c2c449e50e6c3c040f0795416971fda
R
1,390
39
# required libraries library(clusterProfiler) library(GSEAplot) # set working directory setwd("GSEA_Lam_et_al_2024") # locate directory containing archive files # read in summary statistics for Lewy body differential expression sumstats <- read.csv("LBpath_DEG_sumstats.csv") # read in experimental gene set...
3da06fb762eb37cc43a10a05bcffcd7e93f3f99b71666273c8643e3e29745bdb
R
1,404
49
#TODO: Check or refine this. Maybe change name mutate.factR <- function(object, meta = "samples", data=NULL, ...){ # check for type of meta to modify if(!meta %in% c("gene", "transcript", "AS", "samples")){ rlang::abort("Incorrect input for `meta`") } # get meta if(meta == "samples"){ ...
74b36a0766298110590d3dc623acf550ab60ad5118ccd705b61c8e33f63aceea
R
1,409
48
```{r} library(CARD) library(MuSiC) library(Seurat) library(spacexr) ``` load sc_ref_data ```{r} sc_data_1 = read.csv("sc_ref_hippo.csv", header = T,row.names = 1) sc_data_labels = read.csv("sc_label_hippo.csv",row.names = 1) sc_df = t(sc_data_1) st_data_1_5k = read.csv("hippo_st_5k.csv", ...
9ccf64e0e395f0c4f2a27a945d33cb44e9283d622783bca5410295392167a16d
R
1,412
55
source("common.R") searchRepeats <- 1 # Number of times to continue search at each k kValues <- c(10, 40, 3, 20, 6) # Concavity constants for implied weighting timeout <- 240 # Minutes after which to terminate each search hits <- 480 # Maximum times to hit a best score ratchets <- 24 # Ratchet iterations # Lo...
56dc88a6a3f453891d91e53db4f204dbfc494be0fcdb4e05a5160b68327b791b
R
1,417
38
library(readxl) library(boot) #1. load excel or csv file containing n-NRF magnitudes "both_sites_magnitudes.xlxs" both_sites_magnitudes <- read.csv("both_sites_magnitudes.csv") #2. create dataframes for UCL and Exeter magnitudes separately UCL_magnitudes <- both_sites_magnitudes[both_sites_magnitudes$Site == "UCL", ]...
7df907d12c284daf418791d2a9524f275b04f2abe0719513767d4a09aa37ffac
R
1,417
31
mergeDGEList <- function(firstDgeList, secondDgeList, DGEListLabels=NULL) { stopifnot(is.null(DGEListLabels) || length(DGEListLabels)==2) commonFeat <- intersect(rownames(firstDgeList$counts), rownames(secondDgeList$counts)) commonSampleCols <- intersect(colnames...
96ad8a380933a397cf2bef45dafce1019dcafd5143056237add55795a6214915
R
1,418
48
suppressPackageStartupMessages(library(cellrangerRkit)) suppressPackageStartupMessages(library(ggplot2)) suppressPackageStartupMessages(library(reshape2)) #suppressPackageStartupMessages(library(cowplot)) suppressPackageStartupMessages(library(scales)) # Get paths. args = commandArgs(TRUE) cellrangerPath = as.characte...
953e992eaabd09814c4ae7188aac03c03dfa05231ff9288f6b95dd6c5532cddf
R
1,420
16
###DTS script to display a progressbar during the evaluation if (exists("starttime")){iter_time = round((Sys.time()-starttime), 2)} else iter_time = 20 #calculates the iteration time if (exists("Progressbar")){dev.off()} #deletes the previous plot. If not, this will generate an ever increasing number of plots in the e...
a7b81996a821cd06fde1154edb8d76d05c46d7240e2d78177c4c149af48e13a3
R
1,428
27
#!/usr/bin/env Rscript --vanilla #load the libraries library(readr) library(proBatch) library(RColorBrewer) #load the data sample_annotation_AgingMice = read_csv('data_AgingMice/3_data_for_plots/sample_annotation_AgingMice.csv') #define the colors color_list_AgingMice = sample_annotation_to_colors(sample_annotation_...
72bbf1c27b234064b3c7193a293e71042fb761be01bb30d6b49244dc75846314
R
1,432
41
#' Scale continuous with liner transform #' @title Scale continuous #' @param from input range. #' @param to output range. #' @return liner trans. #' @importFrom scales trans_new #' @rdname liner_trans #' @author Houyun Huang, Lei Zhou, Jian Chen, Taiyun Wei #' @export liner_trans <- function (from, to) { force(from)...
684e6a57074ef0b01cece7aaf9197303a6a1bf5adcb2274416e9611baf66ddff
R
1,436
46
parse.ums <- function(x, ums = NULL, umx = NULL, ...) { if (is.null(ums)) { stop("Unidentifiable model specification (ums) not found.") } if (!is.null(umx)) { x <- base::cbind(x, umx) } ## Unidentifiable part # e.g. specified in blots as list(X = list(ums = "-3+2*bmi")) mnar0 <- gsub("-", "+-", u...
70263a76ccec49eb31d706bfc4232653133a7fd80c1d832e0f6dd3f7af61992e
R
1,440
56
#!/usr/bin/env Rscript ############# ## gene level ############# # download metadata and kallisto summarized to the gene level txi.gene = readRDS('checkpoints/kallisto_genes.RDS') meta = readRDS('checkpoints/cayo_bulkbrain_combined_metadata.RDS') txi.gene$counts = txi.gene$counts[,which(colnames(txi.gene$counts) %i...
46b1067afed3d2390b490b93ffa2cd649c81eefbbda830f576e20dda46a64780
R
1,442
61
#' Colour pal #' @description Wrapper for the diverging palettes provided by \code{\link{RColorBrewer}}. #' @param n number of different colors in the palette, minimum 3, maximum 11. #' @return a palette. #' @rdname colour-pal #' @export brown_blue <- function(n = 11) { RColorBrewer::brewer.pal(n, "BrBG") } #' @rdnam...
d64c12ffa4fedd38048eb277564315c83108f09ad679864c54126d0450390750
R
1,445
27
# 程序功能:scRNA-seq 分析通用绘图参数与分组信息 # Functions: shared plotting themes, group orders and color palettes for figures 1-6 # 1. ggplot2 通用主题(类似 example 模板中的 main_theme) main_theme = theme(panel.background = element_blank(), panel.grid = element_blank(), axis.line.x = element_line(size = ...
d66ac3fc25bb2b00296d88de3657b2609e8b0762f17ca752306e3ad1b3e48243
R
1,451
60
library(reticulate) library(fda) library(lme4) np <- import("numpy") #topfeat <- 5 #d = 1 #mat1 <- np$load("JPTA_exampleDataset1.npy") # Data of Shape: (N,P,T) #y <- sample(0:1, dim(mat1)[1], replace = TRUE) variables = list() weeks = list() class = list() subject = list() variable_values...
3a3727cfba6e6e81bed1b269819a10ad0783dc80b69e4d2b0afa9bae50167a8c
R
1,453
44
## This script generates median rank across N folds for each feature. suppressPackageStartupMessages({ library(dplyr) }) extract_rank <- function(tissue, feature){ new_feature <- paste0(tolower(feature), "s") ml_file <- paste('../../..',tolower(tissue), '_m', new_feature,'...
c7ca8cba65cbe297f0eef739799c0125bdecb82294f61f26f22cdd24134c8388
R
1,453
42
library(readxl) library(meta) #1. load excel or csv file containing mean and SD of n-NRF magnitudes at each site metamean_bysite <- read.csv("metamean_bysite.csv") # Oxford, UCL, Exeter. "metamean_bysite.xlxs" meta_analysis <- metamean(n=n_hyp2, mean = mean_hyp2, ...
15db5cc0542e9873c76caafd28e6df9a8bc5ae0d28daacc0a90bf9086d8806b4
R
1,456
39
## Example sharing using posterior sampling. library(mashr) library(corrplot) plot_heatmap <- function(feature, factor){ config <- list("0"="signOnly", "0.5"="general", "0.99"="strict") fn <- paste("../../_m/mashr_meta_results.RData", sep="/") load(fn) pdf(file = paste0("sharing_heatmap_",config[[a...
809a180b3d9c97c47c6f86f709ce4b1ddebbbe0455a9ddde92a54471b33f38ec
R
1,456
39
## Example sharing using posterior sampling. library(mashr) library(corrplot) plot_heatmap <- function(feature, factor){ config <- list("0"="signOnly", "0.5"="general", "0.99"="strict") fn <- paste("../../_m/mashr_meta_results.RData", sep="/") load(fn) pdf(file = paste0("sharing_heatmap_",config[[a...
b92b56364e3a7510a151511d7ca401a5ffd0a8f9055a181141318f21ef0eece4
R
1,456
44
source('~/scripts/single_cell/de.R') source('~/scripts/single_cell/atac.R') source('~/scripts/perturbator/de.R') library(Pando) setwd('~/projects/cutntag/') #### Read stuff #### drugs_init <- read_rds('/links/groups/treutlein/USERS/fides/CutNTag_analysis/hashing/hashing/202205_drugs_all_combined/20220414_annotatio...
e8c2fd6df9106723c8f2b98a58940f74397a347ffc3daa1650e9ddd82706f334
R
1,459
37
library(tidyr) library(reshape2) library(plyr) library(dplyr) library(grid) library(gridExtra) library(Seurat) library(textTinyR) library(pbapply) current = getwd() folder = "1_calculate_pseudobulk" setwd(current) system(paste0("mkdir -p outputs/",folder,"/")) ## read in single cell data (raw UMI counts stored in RNA...
a9c22062ce1724f298af05a20f0e2211f0f8225bab05a53bd804518bd8ecca34
R
1,460
39
## Example sharing using posterior sampling. library(mashr) library(corrplot) plot_heatmap <- function(feature, factor){ config <- list("0"="signOnly", "0.5"="general", "0.99"="strict") fn <- paste("../../_m/mashr_meta_results.RData", sep="/") load(fn) pdf(file = paste0("sharing_heatmap_",config[[a...
dabcb556d92907437e8831b4c93ef55f22fab38f2c0123980a81e883d922d127
R
1,462
45
#' Create the default ggcor theme #' @details The theme_cor, with no axis title, no background, no grid, #' made some adjustments to the x-axis label. #' @param legend.position the position of legends ("none", "left", "right", #' "bottom", "top", or two-element numeric vector). #' @param ... extra params passin...
e0c06f04aeab61e27b5229a0a61c29c68a628877a024e4caaae1373c8687f146
R
1,462
39
## Example sharing using posterior sampling. library(mashr) library(corrplot) plot_heatmap <- function(feature, factor){ config <- list("0"="signOnly", "0.5"="general", "0.99"="strict") fn <- paste("../../_m/mashr_meta_results.RData", sep="/") load(fn) pdf(file = paste0("sharing_heatmap_",config[[a...
5002cef36012acee89b5cee56de62e219ad7708ddb97be29e2bd904fe5dbd7f4
R
1,467
33
#!/usr/bin/env Rscript --vanilla #load the libraries library(readr) library(aLFQ) print(sessionInfo()) print(Sys.time()) #load the data data.median <- import(ms_filenames= "data_InterLab/2_interim_data/all_sites_global_q_001_applied_to_local_global_medianCentered.tsv", ms_filetype = "openswath"...
8890966c70fe79e89086d52325c124c0ab44ca7875502de9b2e799c099180a8e
R
1,471
73
## https://stackoverflow.com/questions/58266785/mice-2l-pan-multilevel-multiple-imputation-error-missing-values-in-pred-not-all?sem=2 skip_if_not_installed("pan") library("pan") # Not multilevel to illustrate need set.seed(100) data <- data.frame( patid = rep(1:4, each = 5), sex = rep(c(1, 2, 1, 2), each = 5), ...
8367550b967087369fadeb7e4ea40c90e17a367a850b1e3660cd5a427ca309a5
R
1,472
56
lmp <- function (modelobject) { if (class(modelobject) != "lm") stop("Not an object of class 'lm' ") f <- summary(modelobject)$fstatistic p <- pf(f[1],f[2],f[3],lower.tail=F) attributes(p) <- NULL return(p) } coef.p.lm <- function(mod){ if (class(mod) != "lm") stop("Not an object of class 'lm' ") coeffs=s...
c07c12a1449998bd7a51a12857fb1471507c44b0fe9b7ee6d798f6c5d31302fa
R
1,478
53
### Import data from salmon raw output into R # Note: this script uses tximport as installed from the github repository: # the bioconductor version for R3.5 has bugs # Load packagess library(magrittr) library(tximeta) library(tidyverse) library(SummarizedExperiment) library(DESeq2) # Import metadata and add filenames...
54ca312adfa59727cd50aab6783fe4f0bdf0a16dc0281a0f728f995a40b637e9
R
1,489
47
## This script generates a clustered dotplot for ## enrichment analysis (XCI) library(dplyr) library(ggplot2) save_plot <- function(p, fn, w, h){ for(ext in c(".pdf", ".png", ".svg")){ ggsave(filename=paste0(fn,ext), plot=p, width=w, height=h) } } #### Main xci <- data.table::fread("../../_m/xci_enri...
9b33276e1ae9a753ca67bdec3b813a45077790902b1736efecb4c3cfaf4b8900
R
1,490
28
# Laura Aarnos 230718 # Create new plate layout for meaRtools #library(IGM.MEA) library(meaRtools) #attach meaRtools after IGM.MEA to get right parameter names # name your plate layout - the name goes between '' my.name <- 'Axion48' # e.g. '1-electrode' # create plate layout for single electrode new_platelayout = ...
365fb9a2abd23e0e2cf0f685985edda6c34e6ac50f006b1a215619dda664f68d
R
1,498
37
#' @templateVar MODEL_FUNCTION task2AFC_sdt #' @templateVar CONTRIBUTOR \href{https://github.com/heesunpark26/}{Heesun Park} <\email{heesunpark26@@gmail.com}> #' @templateVar TASK_NAME 2-alternative forced choice task #' @templateVar TASK_CODE task2AFC #' @templateVar MODEL_NAME Signal detection theory model #' @templa...
515d081a81c42e2e598aded1473071c6e485cf467b6f1ed4dbab78ebea2e63fc
R
1,500
44
#5 SCENIC # Setup--------------------------------------------------------------- rm(list = ls()) ; gc() ; gc() set.seed(1234) wdir <- 'set your working directory' setwd(wdir) save.path <- 'object folder path' # load library easypackages::libraries(c('Seurat','tidyverse','SCENIC','AUCell')) # load pySCENIC data-----...
19c632ffe309d25c7b1445d64107f43fc3e12d1a39a3d108cb082a1491742ac2
R
1,501
28
# Laura Aarnos 230718 # Axion 48 plate layout for meaRtools #library(IGM.MEA) library(meaRtools) #attach meaRtools after IGM.MEA to get right parameter names # name your plate layout - the name goes between '' my.name <- 'Axion48' # e.g. '1-electrode' # create plate layout for single electrode new_platelayout = li...
60b82af15aecb18544784a4705f42c6fdb59baa0b5152fdc16fcad2193c33b70
R
1,511
33
#!/usr/bin/env Rscript --vanilla #load the libraries library(proBatch) library(ggplot2) library(dplyr) library(readr) proteome_df_AgingMice = read_csv("data_AgingMice/2_interim_data/raw_proteome_AgingMice.csv") peptide_df_AgingMice = read_csv("data_AgingMice/1_original_data/peptide_annotation.csv") proteome_df_Agin...
f7b4ae23b0ae0ecff75cd8a3c223b911e66fed0a38c68c2a660ec79c02d4420a
R
1,515
30
--- title: "Annotation report" --- Typically in a sequencing experiment a lot of focus is directed towards ensuring that the quality control of fastq files is good. However, equally important is quality checking the mapping. Currently there are a number of cgat specific and external tools that have been developed to a...
d1ab59043c975a15d1fa1a77caaedc9e9c845ccbca76b8fb95418ca8fcbdb146
R
1,516
39
#### Extract colocaliztion results library(here) library(dplyr) load_enloc_results <- function(tissue){ fn <- here("prep_eqtl_analysis", tolower(tissue), "genes/interaction_model/dapg_finemap", "fastENLOC/_m/pgc3.enloc.sig.out") return(data.table::fread(fn) |> rename("RCP"=V6) |> ...
f65af5804ba89a2f08a17be05885f8300fca96bbaa6c8673cedbdd1807d0bb0e
R
1,521
56
source('~/scripts/single_cell/atac.R') source('~/scripts/single_cell/wrapper.R') source('~/scripts/single_cell/markers.R') source('~/scripts/single_cell/celltype.R') source('~/scripts/single_cell/de.R') source('~/scripts/single_cell/graphs.R') source('~/scripts/grn/models.R') library(ChIPseeker) library(ArchR) library...
b2b9001be5086ad12c8730885fd69f042fddbd0d66e1e736cafdbb896afd87aa
R
1,523
53
# Check that mice.mids correctly appends the newdata to the # existing mids object init0 <- mice(nhanes, maxit = 0, m = 1, print = FALSE, seed = 1) init1 <- mice(nhanes, maxit = 0, m = 1, print = FALSE) init1$ignore <- rep(FALSE, nrow(nhanes)) init2 <- mice.mids(init0, newdata = nhanes, maxit = 0, print = FALSE) tes...
39811b34e6b35d6f7650315c151355a745458d143951ff74ec3d6aed70809942
R
1,524
37
#'################################################################################# #'################################################################################# #' Process GSE169038 gene expression for deep learning #'################################################################################# #'#######...
11db63964eafbe7b80118e0d0f9dc7ab848389a9873875a1458e1c33afebaa97
R
1,537
38
library(readr) library(ggplot2) source('analysis_AgingMice/plot_split_violinplot.R') source('../lib/plot_themes.R') peptide_corr_raw <- read_csv('plots_AgingMice/interim_data_for_plots/peptide_cor_raw.csv') print('file reading completed!') Sys.time() peptide_corr_batchCorr <- read_csv('plots_AgingMice/interim_data_for...
72efcbf805b8a2ad6eaa54e259fa78e01f3923c0b5e8c03a3006705aa9cba61c
R
1,541
39
#'################################################################################# #'################################################################################# #' Download and preprocess GTEx data #'################################################################################# #'#########################...
5c127cbda3c91b7ae65c371bb4ecf70c646d8df159160639712dc0ca7697748c
R
1,546
33
getwd() df = read.csv("df_exp4_vdj1.csv") head(df) library(ggplot2) library(ggsignif) library(ggpubr) df$Model=factor(df$Model,level=c("Without Heterogeneous GNN Module","With Heterogeneous GNN Module")) df$Peptide=factor(df$Peptide,level=c("GTSGSPIVNR","FLKEKGGL","GTSGSPIINR","KLVALGINAV","GLCTLVAML","FPRPWLHGL","...
c75ec66ca6db47146ec11817c7c89372564e3ebec188e4364efd99fbcd2ce999
R
1,554
37
# set the random generator to V3.5.0 to ensure that this test # passes in V3.6.0 and later # see mail Kurt Hornik, dated 06mar19 suppressWarnings(RNGversion("3.5.0")) imp <- mice(nhanes2, print = FALSE, maxit = 2, seed = 121, use.matcher = TRUE) fit <- with(imp, lm(bmi ~ chl + age + hyp)) est <- pool(fit) mn <- c(18....
392d923f0a12bb216cff5f3f0c45428b981cc5ab986813874d0c0d5e35096520
R
1,555
41
library(MCMCpack) library(dplyr) make_bulk_sample <- function(seuratobj, celltype_ids, celltype_counts){ cell_ids = lapply(names(celltype_ids), function(celltype){ cell_count = celltype_counts[celltype] sample(celltype_ids[[celltype]], size=cell_count, replace=TRUE) }) bulk_sample = rowSums(seuratobj[,u...
73c8ca06ebc6ce3906533adbfe79b054e340dfa12937986b9233e6f5e6f06975
R
1,564
48
#!/usr/bin/env Rscript # print usage usage <- function() { cat( 'usage: lib_stats.R <file> lib_stats.R author: Colby Chiang (colbychiang@wustl.edu) description: Plot a library information for BAM file positional arguments: <input JSON> JSON file of library info, created by SVTyper <output PDF> ...
6e8c05634deb2d80c240a99ffaf6daa03dcf9797155d7b4e884c728e2b1321c9
R
1,566
35
theme_publication <- function() { new_theme = theme(plot.title = element_text(face = "bold", size = rel(2), hjust = 0.5), axis.title = element_text(face = "bold",size = rel(1.5)), axis.title.y = element_text(angle=90,vjust =2), ...
7c0e51ccc5291e109db58c8532715f960408dedb9d36d87f0eed8564f7861218
R
1,566
58
rm(list=ls()) options(stringsAsFactors = F) #setwd('') meth.file=c('simulated_450k.rds') impute.qc=read.csv('MeasuresTEST_EPICtoMM_v2_450k.csv') ######## load the functions source("fns_ArrayConverterAlgorithm.R") ######## load the trained model fitall = readRDS('fit_EPICtoMM_v2_EPIC450k.rds') ########## a quick look ...
9f6d827230cda5eaab2c50cdc21d55705ba545db914376941e8f2a703dc32a37
R
1,567
33
#!/usr/bin/env Rscript --vanilla #load the libraries library(proBatch) library(ggplot2) library(dplyr) library(readr) proteome_df_AgingMice = read_csv("data_AgingMice/3_data_for_plots/batchCorrected_proteome_AgingMice.csv") peptide_df_AgingMice = read_csv("data_AgingMice/1_original_data/peptide_annotation.csv") pr...
d7a196bd68a0123c859c4f5f3ad99b844df0e2c1e75d49597b5f03e47525c5ee
R
1,567
43
#!/usr/bin/Rscript library("optparse") option_list = list( make_option("--ld_ref_dir", action="store", default=NA, type='character', help="Directory where FUSION LD reference files are stored [required]"), make_option("--PLINK_prefix", action="store", default=NA, type='character', help=...
168003d6f8485a7236bc72a2d0f22c94161971b18efe828ceacc8a4e3dc52ad2
R
1,568
33
getwd() df = read.csv("fig5c.csv") head(df) library(ggplot2) library(ggsignif) library(ggpubr) df$Model=factor(df$Model,level=c("Without Heterogeneous GNN Module","With Heterogeneous GNN Module")) df$Peptide=factor(df$Peptide,level=c("GTSGSPIVNR","FLKEKGGL","GTSGSPIINR","KLVALGINAV","GLCTLVAML","FPRPWLHGL","GILGFVF...
bb6539b3a41497cc7a0ab66b80f4c82b7e000367cbfcf7a7480a285c2e42efa4
R
1,569
34
#'################################################################################# #'################################################################################# #' #' Download and filter newer version of gene SYMBOL ID to update PROMOTE gene names #' #'##################...
231964ef0bce44ec46943ebb1f68091ac39cfff2c432740824fe7f32e28432ef
R
1,572
31
library(tidyverse) library(data.table) library(R.utils) library(here) gtex <- fread("/data/GTEx_expression/GTEx_v8/GTEx_Analysis_2017-06-05_v8_RNASeQCv1.1.9_gene_tpm.gct.gz") samples <- read_delim(file = "/data/GTEx_expression/GTEx_v8/GTEx_Analysis_v8_Annotations_SampleAttributesDS.txt", delim = "\t") pheno <- read_de...
aec2fcb39875656c83f604a74f106433bb11bc4d46f9e94ab96a2b350781a679
R
1,574
38
library(tidyverse) # Fill this in with appropriate values df <- data.frame(Balanced_Accuracy_Random = c(0.9, 0.9, 0.9, 0.9, 0.9, ...
8feb6cea9db4774e40c94762d6e61b34246208825431b0e5597f96107d8271e3
R
1,578
31
# Theme for graphs theme <- theme(plot.title = element_text(vjust = 2), legend.key.height = unit(1.5, "lines"), panel.grid.minor = element_blank(), legend.position = "right") + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank()) + theme(axis.text.x = element_text(colour = "black", size = 1...
ba7024569dc014d594dc2da7af17c81c6b9ba39aff4f707c578a04355bf07200
R
1,579
38
############################################################################ # R FUNCTIONS FOR THE INVERSE GAMMA DISTRIBUTION # # (by Jeffrey S. Rosenthal, probability.ca, 2007) # # The base package of the statistical software R does not seem to include # built-in functions for the inverse gamma distr...
cc98cc3df77ab22bfbc7e8b95b62e3d7bf8a651438192c812c5e800757403769
R
1,581
42
# Load libraries ---------------------------------------------------------- library(tidyverse) library(here) # Load data --------------------------------------------------------------- parent_pseudo_homology <- read_tsv(here::here("data", "similarity.dat"), col_names = TRUE, show_col_types = FALSE) # Main ---------...
deb5384255b7b92138782e42ceb0fab3be5e46263f339e1efe3977d66d4319b8
R
1,586
43
#'################################################################################# #'################################################################################# #' Prepare files to generate models with less or random gene sets #'################################################################################# #...
3d08be4aa34affb51c14ad3e8b4521fcc43526142bb92c7d3be263a1688e7d4b
R
1,587
34
fit_plasticity <- function(df, weights = TRUE) { df_means <- df %>% group_by(year_site.UID) %>% summarise(year_site_mean = mean(BLUE)) df <- inner_join(df, df_means) if(!weights) df$weights_vcov <- 1 df <- df %>% mutate(genotype.id = as.factor(genotype.id), year_site.UID = as.factor(year_s...
27bd55b96145cb581b0c6ca7805580020bf7b5033e1410ad0f9011f3a570d794
R
1,590
50
#!/usr/bin/Rscript ## Import Libraries library("DESeq2") library("ggplot2") ## Import counts matrix cts <- as.matrix(read.csv("../../../data/bernardo/processed/04.deseq2/transcript_counts_unfiltered.tsv", sep="\t", row.names="transcript_id")) ## Import metadata coldata <- read.csv("../../../data/bernardo/processed...
46333201d91456e0c8ff0038e60afbddf3b7c4c7b95c52fe67e30feb189a952f
R
1,596
50
#' Plots individual posterior distributions using \pkg{bayesplot}. #' #' @param obj An output of hBayesDM. Its class should be \code{'hBayesDM'}. #' @param pars Character vector of parameter names to plot. #' @param show_density If \code{TRUE}, draws posterior densities via #' \code{bayesplot::mcmc_areas}; otherwise ...
8776ecbd3a118e8ff7120697a85d4a1cc10362db36efe8e4ad6de297f96ac029
R
1,597
69
#' @rdname anno_link #' @format NULL #' @usage NULL #' @export add_link <- function(...) { warning("`add_link()` is deprecated. ", "Please see `?anno_link()` for more detail.", call. = FALSE) NULL } #' @rdname anno_link #' @format NULL #' @usage NULL #' @export anno_link_label <- function(...) { warnin...
53646af1e279357aefa89f377e5f532a200eeda242532c9e2b912f78766fbbfa
R
1,601
45
guha_sim2_case2 <- function(nburn = 30000, nsamp = 20000) { rm(list=ls()) #if (!require(timeR)) install.packages('timeR') sim2 <- read.csv("data/test/simulation2_case2.csv") sim2_b <- read.csv("data/test/simulation2_case2_bs.csv") y <- sim2$y Xmat <- data.matrix(sim2[1:190]) source("additional_materia...
be3b921dd0ff33eb8fa48ccd9a04b57ca53dafd88b9bdf5f41cb3fd5049d176e
R
1,602
49
## Implementation of RRHO for sex-specific expression library(RRHO2) library(dplyr) get_de <- function(){ err <- 1e-320 fn <- paste0("../../summary_table/_m/", "differential_expression_analysis_4features_sex.txt.gz") return(data.table::fread(fn) |> filter(Type == "Gene") |> ...
c3edb94ac41dcd1ec0c442cab241fcd98c0ebe9b1dd1faa37764792f71fe46d8
R
1,602
47
guha_sim2_case1 <- function(nburn=30000, nsamp=20000) { #rm(list=ls()) #if (!require(timeR)) install.packages('timeR') sim2 <- read.csv("data/test/simulation2_case1.csv") sim2_b <- read.csv("data/test/simulation2_case1_bs.csv") y <- sim2$y Xmat <- data.matrix(sim2[1:190]) source("additional_materia...
cb7250884a4d2f2bc3e66f31bbe4104fd618d5c41f34fd57f415b6bbf38c387b
R
1,603
35
##' @title Match samples in metadata and expression matrix ##' @description Check if samples in the metadata and expression data match ##' @param metadata metadata parsed from \code{\link{gdcParseMetadata}} ##' @param rna.expr \code{\link[limma]{voom}} transformed expression data ##' @return A logical value. If \code{T...
9ab498a9984fa8d9ca62cf006394aeec61d6391b01d15ea6cea7446300a8d59d
R
1,607
46
# Load libraries ---------------------------------------------------------- library(tidyverse) library(here) # Load data --------------------------------------------------------------- load(here::here("results", "pseudogenes", "pseudogene_annotated.rda")) # Main -----------------------------------------------------...
38f8f66c0aaeb33eccd7311f96b7f14f64118f47388d275e052362dc343e15c6
R
1,616
53
ListPriors <- function(){ output <- data(package="PLIER")[[3]] prior.index <- which(output[,"Title"]!="" & (!output[,"Title"] %in% c("Immune Markers (Clinical Pathways)", "Surrogate Proportion Variables","Vaccination Data" ))) print(output[prior.index,c("Item","Title")]) }#ListPriors VarianceExplained <- funct...
5ded1708c2bbbcf056920018ff055d1af29b11420d2e7c7ef7dc16d100720ff2
R
1,619
43
test_that("COMPLETE-001: long and all produce same data", { imp <- mice(nhanes, maxit = 1, m = 2, seed = 123, print = FALSE) lng <- subset(complete(imp, "long"), .imp == 1, select = c(age, bmi, hyp, chl)) all <- complete(imp, "all")[[1]] expect_equal(lng, all) }) # preserve rownames type nhanes3 <- mice::nhane...
89095a80b9d9a811e678f1e51356ea772b0847da055ddfd1a56a103b67c5c877
R
1,619
51
## This script generates a clustered dotplot for ## enrichment analysis (XCI) library(dplyr) library(ggplot2) save_plot <- function(p, fn, w, h){ for(ext in c(".pdf", ".png", ".svg")){ ggsave(filename=paste0(fn,ext), plot=p, width=w, height=h) } } #### Main xci <- data.table::fread("xci_enrichment_an...
f0a46b21f95183ceaed53890f0176d191c076c2e78415d8149e21118f07d2222
R
1,622
54
#### Visualization of GO plots suppressPackageStartupMessages({ library(dplyr) library(ggplot2) }) save_plot <- function(p, fn, w, h){ for(ext in c('.svg', '.pdf')){ ggsave(file=paste0(fn,ext), plot=p, width=w, height=h) } } get_top_GO <- function(tissue){ fname <- paste0(tolower(tissue),...
b815da8f0e47a7efe22cc488abb5a88531c15f36b59711bff5fa1b620b5a4845
R
1,629
61
library(paradox) library(R6) library(mlr3) # Partial Least Squares Regression LearnerRegrPls = R6Class("LearnerRegrPls", inherit = LearnerRegr, public = list( #' @description #' Creates a new instance of this [R6][R6::R6Class] class. initialize = function() { ps = ps(scale = p_lgl(tags = "train...
c57765f405155203b21139f89d97a74e5308d3f2b9f00831f1d85427ab509944
R
1,629
63
#!/usr/bin/Rscript ## Import Libraries library("DESeq2") ## Import counts matrix cts <- as.matrix(read.csv("../../../data/bernardo/processed/04.deseq2/transcript_counts_multiple_median_cpm_1.tsv", sep="\t", row.names="transcript_id")) cts_med <- as.matrix(read.csv("../../../data/bernardo/processed/04.deseq2/transcr...
da9fe798a228bbeca154a60ff1fca2d1f250ca596935a9717a3199542ee7813a
R
1,630
43
--- title: "Untitled" output: html_document date: '2023-03-29' --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` ```{r} library(pacman) p_load(tidyverse, ggsignif,multcomp, broom, emmeans, DescTools) setwd("~/Documents/Systemic ESYT1 project locomotion, behavior, survival, anatomical data/Locomot...
4b9e994a81c0447dcdada9f666028e5dfd2c3b34ee059880274c3beba0e94ed7
R
1,633
41
#load the libraries library(readr) library(tidyverse) library(reshape2) spike_ins_in_samples = read_csv('data_InterLab/2_interim_data/spike_ins_in_samples.csv') #load the data raw (non-normalized) peptide data peptide_df_raw = read_csv("data_InterLab/2_interim_data/peptide_df_raw.csv") spike_in_quantities_raw = pep...
3b488ebe0f4403b7cf9fd027d7deaff6e82fe73f4f04f1cbe46e9c6adc1a1f83
R
1,637
36
cheminfo<-function (file, masterChemFile = masterChemFile) #function from IGM.MEA package { masterChem = read.csv(masterChemFile) masterCD <- as.data.frame(masterChem) masterCD <- masterCD[, 1:9] temp1 <- paste(masterCD$Project, masterCD$Experiment.Date, masterCD$Plate.SN, sep = "_") mas...
6af61d055d3e6984ae4938278ee3ced245e9c5fd5df90cf3dd533b94fac107a2
R
1,637
65
#!/usr/bin/Rscript ## Import Libraries library("DESeq2") ## Import counts matrix cts <- as.matrix(read.csv("../../../data/bernardo/processed/04.deseq2/gene_counts_unfiltered.tsv", sep="\t", row.names="gene_id")) ## Import metadata coldata <- read.csv("../../../data/bernardo/processed/04.deseq2/experimental_design...
2879f57534a4b0dc27607d6bfd1fcccf22be51b385ceb0e58effba464f5e8638
R
1,644
25
jagsify <- function(d){ ACCN <- d %>% filter(condition=="N") %>% select(Participant, ACC) %>% unstack(form="ACC~Participant") %>% as.matrix ACCA <- d %>% filter(condition=="A") %>% select(Participant, ACC) %>% unstack(form="ACC~Participant") %>% as.matrix ACCB <- d %>% filter(condition=="B") %>% select(P...
2a4960acc433f40bd9d5fb486752b0a29cd091fc6b133bc69c1cd56bd165277b
R
1,644
61
data('factRsample') counts.path <- system.file("extdata/counts.txt", package = "factR2") meta.path <- system.file("extdata/meta.txt", package = "factR2") cts <- read.delim(counts.path) cts <- as.matrix(cts) meta <- read.delim(meta.path) obj <- addTxCounts(factRsample, cts, meta, ~samples) test_that("Test addCountsDa...
e81a94cf228700cb4bd8549ecba468b4d50966e1c1f75dcb019cee7903696b82
R
1,644
44
#!/usr/bin/Rscript # Source: https://github.com/opain/Calculating-FUSION-TWAS-weights-pipeline/ library("optparse") option_list = list( make_option("--ld_ref_dir", action="store", default=NA, type='character', help="Directory where FUSION LD reference files are stored [required]"), make_option("--PLI...
5653818aacd0bdfdd1bdd65c4b6b5ae14191a1bb28113b0c6c10ed655dc78d5a
R
1,645
65
#!/usr/bin/Rscript ## Import Libraries library("DESeq2") ## Import counts matrix cts <- as.matrix(read.csv("../../../data/bernardo/processed/04.deseq2/gene_counts_unfiltered.tsv", sep="\t", row.names="gene_id")) ## Import metadata coldata <- read.csv("../../../data/bernardo/processed/04.deseq2/experimental_design...
93b2810174831686d56fb0ad1ef74716f456228123c9bed77c101aec6642d3b2
R
1,647
50
# Author: # # This snippet has been taken directly from here: # http://www.cookbook-r.com/Graphs/Multiple_graphs_on_one_page_%28ggplot2%29/ # Multiple plot function # # ggplot objects can be passed in ..., or to plotlist (as a list of ggplot objects) # - cols: Number of columns in layout # - layout: A matrix speci...
b89cb8fbfc2d037ac9e150dee78236603aba00dda9c392918447d522bb0af9a9
R
1,647
61
#### module enrichment ##### #module load R/4.0.3-Python-3.8.5-Anaconda3-2020.11 # on the Kimel cluster module load R/4.2.1 #install.packages("BiocManager") #BiocManager::install("org.Hs.eg.db") #install.packages('./HDO.db_0.99.1.tar.gz', repos = NULL, type="source") #BiocManager::install("clusterProfiler") #update.pac...
a8c5fde438f975e954b7d9907d33879f72f8bc939bc8cd7bd135d9642f20ae0c
R
1,653
56
#### This script measures sematic similarity between GO annotations suppressPackageStartupMessages({ library(dplyr) library(GOSemSim) library(corrplot) }) load_go_data <- function(tissue, sex, ont){ fname <- paste0(tolower(sex), "/", tolower(tissue), "_gsea_", ont, ".tsv") retur...
f1fa4f4ebd8e0cfc6a09bde1ec38157f81226e65a047648472b87b5fa4dc865d
R
1,653
39
#' Leiden 85+ study #' #' Subset of data from the Leiden 85+ study #' #' The data set concerns of subset of 956 members of a very old (85+) cohort in #' Leiden. #' #' Multiple imputation of this data set has been described in Boshuizen et al #' (1998), Van Buuren et al (1999) and Van Buuren (2012), chapter 7. #' #' The...