sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
c857fbe00dbd9e6f5802c112b5fbbeca6ff8252ec028e251d943309fdbe42dd2
R
490
21
### MOTIMUS PARAMETERS # General nb_participant = 36 nb_condition = 3 # HRV path_raw = gsub("1_code/", "", here("0_data/hrv/test/")) # Headset headset_fs = 100 # sampling frequency headset_time2average = 30 * headset_fs headset_nb_markers = 4 # NIRS nirs_fs = 10 # sampling frequency path_processed = gsub("1_code/",...
4965a7b932986b17e7a54a38c65469a6c65b7fcdc0825194ae06aaeec13cf04d
R
494
16
setwd('~/Documents/work/PTSD_2023/round3_medi/interaction_withMiRNA_NOV/code_for_share/Base_model/FACTORwave2and3_PTSSwave3//Life_Current_Factor_PRS//') df <- readRDS('df.rds') fomular <- as.formula(sprintf("%s ~ %s", colnames(df)[1], paste(paste(colnames(df)[-c(1)], ...
aa3014a88a95a56e85ecaf73d2ccc36580c75a203f0ff54f6f851214f0265fa7
R
503
16
setwd('~/Documents/work/PTSD_2023/round3_medi/interaction_withMiRNA_NOV/code_for_share/Base_model/FACTORwave2_PTSSwave3/Life_Current_Factor_PRS_Cellproportion/') df <- readRDS('df.rds') fomular <- as.formula(sprintf("%s ~ %s", colnames(df)[1], paste(paste(colnames(df)[-c(1)], ...
62ce2b673a40c5f9ecac4072ba6c8b27df2499b7fc3f710581ba2dd5cb6d0773
R
505
23
##-------------------------------------## ## TSNE TAB ## ##-------------------------------------## getTSNE <- function(mat, subset_row, perplexity, token, session_obj, ID){ tsne <- scater::calculateTSNE(x = mat, ncomponents = 3, subset_row = subset_r...
e888d8104e02e75606adb9ee3d44db3c65b775ff8e9a9a52bf9e78b609939084
R
507
23
if (!require("BiocManager", quietly = TRUE)) install.packages("BiocManager") if (!require("cBioPortalData", quietly = TRUE)) install.packages("cBioPortalData") BiocManager::install("cBioPortalData") require(cBioPortalData) require(BiocManager) require(AnVIL) install.packages("mice",'GGally','grpreg'...
433e8c90f3e6e42ebac8ef9836a28ec802931e598cc08ac89c7f9c7d3040ba2b
R
518
13
test_that("count_keyvec counts genes overlapping the key vector", { df <- data.frame( pathway = c("p1", "p2"), genes = c("TP53;EGFR;MYC", "KRAS;BRAF"), stringsAsFactors = FALSE ) out <- count_keyvec(df, cols = "genes", separator = ";", genes_vec = c("TP53", "MYC", "KRAS")) #...
e21fe91cd1c90db968d6bce8a7a35697132e857c79d14b38396ccfe03cb89f42
R
521
8
# Generate a consensus clustering model with given arguments CC_modelization <- function(datasets, title_model, cluster_alg = "hc", distance = "euclidean"){ CC_model = ConsensusClusterPlus(datasets, maxK = 6, reps = 50, pItem = 0.8, pFeature = 1, clusterAlg = cluster_alg, distance...
fe1bb22e3275e5875a37a40281e437fd072c94de9bd7235862b3150144f69fd5
R
523
16
source("../shinytest_helpers.R") set_window() app$uploadFile(layout_table_file = demo_path("MRA_LayoutAndReadouts_BT-40_ST04.xlsx")) app$setInputs(upload_reference_samples = TRUE) app$uploadFile(reference_samples_file = demo_path("Controls_DKFZ_ST10-min.xlsx")) app$setInputs(start_oca = "click", timeout_ = 1500e3) ap...
c0be82e1714bb47c3d7a66fec928bcfccdf966d59ab5c643ca082a02b0f5c1e1
R
534
24
messageU <- function(..., underline = "=", overline = "=") { x <- paste0(..., collapse = "") if (!is.null(overline)) { message(rep(overline, nchar(x))) } message(x) if (!is.null(underline)) { message(rep(underline, nchar(x))) } } startTimedMessage <- function(...) { x <- pa...
2e53bd0e70a6dd1b17901cb753dc7b07bd87d26d37f08163000a2da0045e7480
R
545
15
# various helper functions for working with BOLD niftis in targets pipeline ---- get_bold_gz <- function (subject, task, run) { inject(here::here(!!!path_here_derivatives, subject, "func", paste(subject, task, run, "space-MNI152NLin2009cAsym_res-2_desc-preproc_bold.nii.gz", sep = "_"))) } gunzip...
dd5f9964b3a9e3c8726ae87e76371e1622f4099d71fd631d35273c6132a91643
R
546
27
library(tidyverse) library(ggpubr) library(lme4) library(lmerTest) library(MASS) library(dplyr) library(sjPlot) library(sjmisc) library(ggplot2) library(report) library(dplyr) library(rstatix) R2_cat <- readxl::read_xlsx('anova_df_04022025.xlsx',sheet='cat_long') # category one-way anova model <- aov(...
505297f0e592311337b16c63caebad76d3d4addf71d7a61ed28b896e8af90b37
R
553
18
library(pROC) data(aSAH) a.ndka <- auc(aSAH$outcome, aSAH$ndka) test_that("can convert auc to numeric", { expect_is(a.ndka, "auc") # a.ndka is not a numeric to start with expect_equal(as.numeric(a.ndka), 0.611957994579946) }) test_that("can do math on an AUC", { expect_equal(sqrt(a.ndka), 0.782277440924859) ...
6451cd11212748a3d0f2219eba26e580e1322208cb367709133ecaf6287f6f30
R
556
20
args <- commandArgs(TRUE) name <- as.character(args[1]) cap <- as.numeric(args[2]) index <- as.character(args[3]) if (!dir.exists(name)) { dir.create(name) } setwd(name) dir.create("DDD_TES") setwd("DDD_TES") ddd_tes_list <- replicate(500, eveGNN::dd_sim_fix_n(200, pars = c(c(0.6, 0.1), cap), 10, 1), simplify = F...
94a5696e35f528dd16a3cc6db92939dcb074f49eb64bbd25cccc414b7282d3d0
R
559
15
test_that("coll_reduction replaces coll cells whose COUNT exceeds the cutoff", { df <- data.frame( Term = c("OXPHOS", "TCA cycle", "Apoptosis"), genes_coll = c("NDUFS2;SDHA;NDUFV1", "IDH1", "BID;BBC3"), genes_COUNT = c(100, 5, 60), stringsAsFactors = FALSE ) out <- coll_reduction(df, cu...
da03303d5c505084ad4b31c755295682589c77147c2098a80305a0f182664786
R
561
16
####################################### # # This function is used to obtain the # time delay projecton maps from inputs # while matching the selected participants # # This function can load the data of TDp and # ETS. Indicates what kinds of data you want to # load in [type] parameter ObtainBrainData_indivi...
19449f666c1e7a27724e2a42959d8715ead71dc9347c548db9b7b46324a9eba6
R
563
20
## ## Set up common variables across scripts ## RDS.DIR <- file.path( ".", "RDS" ) ## Where output files are saves RAW.DIR <- file.path( ".", "CSV" ) ## ## The switch below will not work on Windows, and may have some issues. ## NOTE: It is used in novel-script, to define a 'choosen' expanded-fit for the longitudinal...
18cd4d890aaa7ac39056e54fcd1cb4ed97bcf0296283bd88e5e832b3fb20b37f
R
566
18
source("100.common-variables.r") source("101.common-functions.r") source("300.variables.r") source("301.functions.r") FIT <- readRDS("Share/FIT_GMV.rds") POP.CURVE.LIST <- list(AgeTransformed=seq(log(90),log(365*95),length.out=2^4),sex=c("Female","Male")) POP.CURVE.RAW <- do.call( what=expand.grid, args=POP.CURVE.LI...
d23e052527214bbdfefc6aeed574af4d25db960b9156dc00665ae5aa3a370476
R
566
17
setwd('~/Documents/work/PTSD_2023/round3_medi/interaction_withMiRNA_NOV/code_for_share/Base_model/FACTORwave2_PTSSwave3/Life_Current_Factor/') df <- readRDS('df.rds') fomular <- as.formula(sprintf("%s ~ %s", colnames(df)[1], paste(paste(colnames(df)[-c(1)], ...
bfe23b6d2035ce452e8ae37e40792b1b663f48023d8092eef30fe5cc29aadc4d
R
569
13
################################# ED.Fig.1k #Read in the reduced_data R data from Fig.1i and All_VNG R data DimPlot(All_VNG,label = T) DefaultAssay(All_VNG) DimPlot(reduced_all) DefaultAssay(reduced_all) anchors <- FindTransferAnchors(reference = All_VNG, query = reduced_all, dims = 1:3...
efa8abbd0684ce9ec0c4e8759a0dd336062c0041e16a2b5fe4038518a9070c46
R
570
17
setwd('~/Documents/work/PTSD_2023/round3_medi/interaction_withMiRNA_NOV/code_for_share/Base_model/FACTORwave2and3_PTSSwave3/Life_Current_Factor/') df <- readRDS('df.rds') fomular <- as.formula(sprintf("%s ~ %s", colnames(df)[1], paste(paste(colnames(df)[-c(1)], ...
968503bf8fb96aff446d068236c2429a186f21eab54af9333a83bbdbffbea8e3
R
576
19
library(data.table) library(R.matlab) mvgwas <- fread('/path/to/sumstats') # 3) make sure vars_qc SNP ids are in the same order you’ll as the SNP correlation matrix extract_rs <- scan("/path/to/vars_qc.txt", what = character()) snps9 <- mvgwas[match(extract_rs, mvgwas$SNP), ] # 4) pull out the z ...
cdd505ff5cb320d01c86a11c59cd249004f817f9dddde3d614cf8065923ec73f
R
577
15
# ------ Function to compute PACES score compute_paces_score <- function(data, paces_row, col_num) { # Extract the relevant rows and convert to numeric paces <- as.data.frame(data[ (paces_row + 1):(paces_row + 10), col_num ]) paces <- as.numeric(paces[, 1]) # Define rows to reverse rows_to_reverse <- c(1, ...
406d905a7bce864b1c31fddc97bddaf81a6eef4e735bb37bdac2ff6127e7df3b
R
578
17
setwd('~/Documents/work/PTSD_2023/round3_medi/interaction_withMiRNA_NOV/code_for_share/Base_model/FACTORwave4_PTSSwave4//Life_Current_Factor/') df <- readRDS('df.rds') fomular <- as.formula(sprintf("%s ~ %s", colnames(df)[1], paste(paste(colnames(df)[-c(1)], ...
cd5112c836d99572721b065d23e69a7802f558851b99420289437fad1da7fd09
R
580
19
source("../shinytest_helpers.R") set_window() app$setInputs(layout_and_readouts = "separate_files") app$uploadFile(layout_table_file = demo_path("MRA_Layout.xlsx")) app$uploadFile(readout_matrices_file = demo_path("MRA_1ReadoutTxt_Flat.zip")) app$setInputs(start_oca = "click", timeout_ = 1500e3) app$setInputs(iTReX =...
166f76febff8f6429e2516324d9a7e404c2492e6484603cde69c446390ccfea4
R
581
12
library(org.Hs.eg.db) library(AnnotationDbi) library(tidyverse) setwd("/Users/melis/Documents/MRI_cortical_layers/MRI_layers/code") dirs <- list.files(path = "../data/GO pathways/GO_pathways_with_offspring/.", pattern = "\\.csv$") for (i in 1:6) { data = read.csv(paste0("../data/GO pathways/GO_pathways_with_offsprin...
638d55ce72793bc465cf0ba21ba5b75ec5d40beb9da73a67a03c59636556c71d
R
584
17
setwd('~/Documents/work/PTSD_2023/round3_medi/interaction_withMiRNA_NOV/code_for_share/Base_model/FACTORwave2and3_PTSSwave3//Life_Current_Factor_PRS_Cellproportion/') df <- readRDS('df.rds') fomular <- as.formula(sprintf("%s ~ %s", colnames(df)[1], paste(paste(colnames(df)[-c(1)], ...
577f93d3dac2cbc21ad826789a582fc5f5fba8e2e46527786a7c327da0e445a7
R
586
37
# Hua Sun library(Seurat) library(monocle3) library(SeuratWrappers) library(dplyr) library(data.table) set.seed(42) outdir <- 'out_monocle3' dir.create(outdir) rds <- 'seurat5.1_v6.2/multiome_integrated.plus.rds' seu <- readRDS(rds) DefaultAssay(seu) <- 'SCT' Idents(seu) <- 'cell_type2' seu[["UMAP"]] <- seu[['wnn...
0f8fb91d0ec33f597fa5185ff96c80ac44314ee77bd87b05686231d9bd0a521b
R
589
25
# Load necessary libraries library(ggplot2) # Using built-in dataset 'mtcars' data(mtcars) # Print the first few rows of the dataset head(mtcars) # Basic summary statistics summary(mtcars)`` # Create a new column 'kpl' (kilometers per liter) for fuel efficiency mtcars$kpl <- mtcars$mpg * 0.425144 # Simple plot: Mi...
aafd113d1d96cc0b986d2cac2a88ec7593e32a5eb53b40adaf6891c3f3542afd
R
590
12
library(data.table) INPUTFILE="output.paf" #mapping output in paf format READIDS="readids.repetitive.txt" #read id, one per line OUTPUTFILE="output.repetitive.paf" #filtered paf output with specified read ids allMappings = read.table(INPUTFILE, header=F, fill=TRUE) selectedReadIds = read.table(READIDS, header=F, fill...
d89c54b6bf060ca9feb776cd1d1896c7bfd45e67b36e5f5ab510bbc734374495
R
592
17
setwd('~/Documents/work/PTSD_2023/round3_medi/interaction_withMiRNA_NOV/code_for_share/Base_model/FACTORwave4_PTSSwave4///Life_Current_Factor_PRS_Cellproportion/') df <- readRDS('df.rds') fomular <- as.formula(sprintf("%s ~ %s", colnames(df)[1], paste(paste(colnames(df)[-c(1)], ...
b4a7727abe775ef766df184fe6e9986edbd39737a293c6a95493c20c659955a3
R
594
12
library(org.Hs.eg.db) library(AnnotationDbi) library(tidyverse) setwd("/Users/melis/Documents/GitHub/MRIxST/code") dirs <- list.files(path = "../processed_data/00-prepare_GO/00-fetch_GO_offspring/.", pattern = "\\.csv$") for (i in 1:6) { data = read.csv(paste0("../processed_data/00-prepare_GO/00-fetch_GO_offspring/"...
f08edf221012ea52eb454e3e2a9c0ade43f300c27e4df5af4b5a10a5c595bc71
R
594
19
source("../shinytest_helpers.R") set_window() app$setInputs(layout_and_readouts = "separate_files") app$uploadFile(layout_table_file = demo_path("MRA_Layout-Imaging-3Plates.xlsx")) app$uploadFile(readout_matrices_file = demo_path("MRA_1ReadoutTxt_NA.zip")) app$setInputs(start_oca = "click", timeout_ = 1500e3) app$set...
1ba7f501a5d5f1706cc62bb689ceb80fe311f27c449ede3fc731bfb9b1ef9fd4
R
596
14
require(GenomicSEM) library(data.table) library(devtools) ld <- "/path/to/eur_w_ld_chr/" wld <- "/path/to/eur_w_ld_chr/" traits <- c("/path/to/ADHD.sumstats.gz", "/path/to/BPD.sumstats.gz", "/path/to/MDD.sumstats.gz" ) sample.prev <- c(0.20708, 0.07055, 0.20608) population.prev <- c(0.028, 0.018, 0.064) trait.names<-c...
760aaf15c0f9abcad6f254f144173e027470a53b17654dbbf71f24fa17362477
R
599
18
setwd("/data/wuqinhua/phase/covid19/datasets") library(Seurat) library(SeuratDisk) pbmc <- readRDS('./pre_data/6_Liu_2021/GSE161918_AllBatches_SeuratObj.rds') sce <- UpdateSeuratObject(object = pbmc) DefaultAssay(sce) DefaultAssay(sce) <- "RNA" DefaultAssay(sce) sce@meta.data <- as.data.frame(sce@meta.data) sce@met...
f5c4edac9f8c8e97f4f6c49866164455943b545c57327cf0095256943df2cdb2
R
599
22
# Title : HTML Functions # Objective : Functions for creating pretty HTML links # Created by: mumichae # Created on: 6/21/21 build_link_list <- function(file_paths, captions=NULL) { if (is.null(captions)) { captions <- file_paths } file_link <- paste0('\n* [', captions , '](', file_paths, ...
bf884eb3eef2e98c77211bd63ea84548cecb0a9a0aa9204ebb895e9155049b68
R
601
16
setwd("/data/wuqinhua/phase/covid19/datasets") library(Seurat) library(SeuratDisk) sce <- readRDS('./pre_data/20_Zhu_2020/Final_nCoV_0716_upload.RDS') sce <- UpdateSeuratObject(object =sce) DefaultAssay(sce) <- "RNA" rna_counts =sce@assays$RNA@counts colnames(sce@meta.data)[colnames(sce@meta.data) == 'batch'] <- 's...
0c62b8360ba4cfbcaabde72e07f4bbbb3e8080ba4ab3a98370de247517340e45
R
603
28
beta0=-0.0439 # rs10512201 association with AD in Bellenguez et al (2022) se0=0.0103 n0=450000 sigmaj=sqrt(n0)*se0 beta=beta0/sigmaj se=1/sqrt(n0) # now beta~N(a,1/n) ns=seq(500000,1.5e6,1e4) alpha=5e-8 q0=qchisq(1-5e-8,1) power=c() for(i in 1:length(ns)) { lambda=beta^2*ns[i] power[i]=pchisq(q0,1,lambda,lower.tail=F...
917116b9c85cde1d20443d3daa07fbbb883ba806ab2467d7f8408935a1d3b163
R
603
21
##-------------------------------------## ## UMAP TAB ## ##-------------------------------------## getUMAP <- function(mat, subset_row, min_dist, nneigh, token, session_obj, ID){ umap <- scater::calculateUMAP(x = mat, ncomponents = 10, ...
9ba3a3729e771417b730e60190a084cee1059616a803e388e6275e37682da106
R
603
23
# Load packages ---- library(shiny) library(shinydashboard) library(dplyr) # Load datasets of AIRE dependant genes AIREdep = read.csv2("data/TRA_AIRE_dependency.csv") # Load datasets of gene expression in mouse and human gene_keys = read.delim2("data/Mouse_Human_merged_expression_data.txt", sep = " ") colnames(gene_ke...
e755cbecdaf78258a93055c09f20f9280ea4dc365bfa3983a6a1ac4d264a7291
R
603
18
source("../shinytest_helpers.R") set_window() app$setInputs(layout_and_readouts = "separate_files") app$uploadFile(layout_table_file = demo_path("CRA_Layout.xlsx")) app$uploadFile(readout_matrices_file = demo_path("CRA_1ReadoutXlsx_INF-R-1632.zip")) app$setInputs(type_of_analysis = "StepA") app$snapshot(filename = "00...
8934d06c7a82b98d47a2d3faeae2f63c5ac1cd52017b1c2e37abec9b1bd2527d
R
606
16
# version of write_csv that returns the file path as expected when called by targets write_csv_target <- function (x, file, ...) { write_csv(x = x, file = file, ...) return (file) } # primarily for derivatives that are getting re-written into a copy folder that mirrors bids structure # thus default 2 to get the su...
be81017cd5c1efbcb637d8388afae0c6d075616f9c65577da60d1a5ca223cd6b
R
618
19
source("../shinytest_helpers.R") set_window() app$setInputs(layout_and_readouts = "separate_files") app$uploadFile(layout_table_file = demo_path("MRA_Layout-Imaging-1Plate_ST06.xlsx")) app$uploadFile(readout_matrices_file = demo_path("MRA_Readout-Imaging_BT-40-V3-DS1_ST05.xlsx")) app$setInputs(start_oca = "click", tim...
279182e1632a3ee35fe8179acae1a0a5d2427c8daf83f4797c5500d5f506b86d
R
619
18
setwd('~/Documents/work/PTSD_2023/round3_medi/interaction_withMiRNA_NOV/code_for_share/Base_model/FACTORwave4_PTSSwave4///Life_Current_Factor_PRS//') df <- readRDS('df.rds') fomular <- as.formula(sprintf("%s ~ %s", colnames(df)[1], paste(paste(colnames(df)[-c(1)], ...
2c93577a0572387c9f935fed15e2cc80bb8557b1f4603059ff2f24ff8b632e13
R
629
24
# Hua Sun library(TFBSTools) library(JASPAR2022) library(Signac) library(BSgenome.Mmusculus.UCSC.mm10) library(BSgenome.Hsapiens.UCSC.hg38) multiome <- readRDS('multiome.rds') ref <- 'hg38' genome <- BSgenome.Mmusculus.UCSC.mm10 if (ref == 'hg38'){ genome <- BSgenome.Hsapiens.UCSC.hg38 } pfm <- getMatrixSet(x = J...
909eb68aec12c99e136e097962610f6dd5d1614684ae91f54443462163f9750f
R
636
30
test_that( "Olink color palette", { expect_equal( object = olink_pal()(n = 5L), expected = c("#00C7E1FF", "#FE1F04FF", "#00559EFF", "#FFC700FF", "#077183FF") ) expect_equal( object = olink_pal( coloroption = c("teal", "pink") )(n = 2L), expected ...
d9404159b771f38c1d787f493430ee9882ff9da0f1d42f9f9cfe0d4450b1ab6b
R
639
19
source("../shinytest_helpers.R") set_window() app$uploadFile(layout_table_file = demo_path("MRA_LayoutAndReadouts_BT-40_ST04.xlsx")) app$setInputs(upload_reference_samples = TRUE) app$uploadFile(reference_samples_file = demo_path("Controls_DKFZ_ST10-min.xlsx")) app$setInputs(type_of_analysis = "StepA") app$setInputs(...
2c7bcbbe74aad52e9ea09f624c6fafbe39264371e6816631d3118d5d08dbe9d6
R
643
19
source("../shinytest_helpers.R") set_window() app$uploadFile(layout_table_file = demo_path("MRA_LayoutAndReadouts_INF-R-153_ST12.xlsx")) app$setInputs(upload_reference_samples = TRUE) app$uploadFile(reference_samples_file = demo_path("Controls_DKFZ_ST10-min.xlsx")) app$setInputs(type_of_analysis = "StepA") app$setInp...
a6966f9033083e1ce7940a243e4d83f87e059e2ccad094145b37696100f7f7e5
R
646
26
library("UMI4Cats") library(parallel) bcpath = snakemake@params[['barcodes']] fqdir = snakemake@params[['fqdir']] ofqdir = snakemake@params[['ofqdir']] nthreads = snakemake@threads bc <- read.table( bcpath, sep=',', header=TRUE ) cl <- makeCluster(nthreads) clusterExport(cl, varlist = c("fqdir", "bc", "ofqdir", ...
5428c814a6af4044b89d6a2d922a43a69ff841e3c92c511b7aa3b9cfade63d18
R
660
21
source("../shinytest_helpers.R") set_window() app$setInputs(layout_and_readouts = "separate_files") app$uploadFile(layout_table_file = demo_path("CRA_Layout.xlsx")) app$uploadFile(readout_matrices_file = demo_path("CRA_1ReadoutXlsx_INF-R-1632.zip")) app$setInputs(start_oca = "click", timeout_ = 1500e3) for (module in...
026b79b34f43383b859056eed7f7f1cbc1ed38cee246356b5ce6953e1a1c1167
R
661
19
# OR gene filtering dplyr::filter(substring(gene_symbol,1,2) == "OR" & substring(gene_symbol,3,3) %in% seq(1,9,1)) # bulk RNA Consensus clustering ConsensusClusterPlus(KIRC_FPKM_df_OR_tumor_filtered_for_consensus, maxK = 6, reps = 500, pItem = 0.9, ...
b9694da4935ce2250ae6b5172b7f4761a5add9dfdd20c7240d42885446ac64b1
R
661
28
#' lnc_RNARNA_scanner_output #' #' #' example output from lnc_RNARNA_scanner function, tables are truncated to reduced size of the file #' #' #' #' #' @format a list of data frames #' \describe{ #' } #' #' #' @references #'RNARNA.db creators: Terai G, Iwakiri J, Kameda T, Hamada M, Asai K. Comprehensive prediction of ...
d906844a001c01f98ea6834715be74c0e043002c274518c65dafc4a437a19ffd
R
661
29
## code to prepare internal dataset goes here ## based on https://r-pkgs.org/data.html#sec-data-sysdata ## Specifications for Olink parquet files ---- olink_parquet_spec <- list( parquet_metadata = c( product = "Product", data_file_type = "DataFileType" ), optional_metadata = c( ruo = "RUO", fil...
aa285efd0287a01b51b4c3019991138d8a11a32ead1ae2979d85c0388372ee9b
R
671
26
library( rmarkdown ) library( ggplot2 ) stitchedFile <- "stitchedGrantBlurb.md" rmdFiles <- c( "format.md", "grantBlurb.md", "references.md" ) for( i in 1:length( rmdFiles ) ) { cat( rmdFiles[i] ) if( i == 1 ) { cmd <- paste( "cat", rmdFiles[i], ">", stitchedF...
5d386bec579e4ae0c9c4e3bca6ae003d94ece572daf05c58ee5abc54ab05ebec
R
675
16
library(tidyverse) # set directories root_dir <- rprojroot::find_root(rprojroot::has_dir(".git")) cnv_gatk_dir <- file.path(root_dir, "analyses", "copy_number_consensus_call", "results") cnv_manta_dir <- file.path(root_dir, "analyses", "copy_number_consensus_call_manta", "results") output_file <- file.path(cnv_gatk_di...
835e465296a62390c30fe6aadd0a1bab0a48f9319893d54ac6cb3ec155d2d33f
R
678
24
args <- commandArgs(TRUE) name <- as.character(args[1]) if (!dir.exists(name)) { dir.create(name) } setwd(name) dir.create("DDD_LAMU_TES") setwd("DDD_LAMU_TES") dists <- list( list(distribution = "uniform", n = 1, min = 0.5, max = 1.0), list(distribution = "uniform", n = 1, min = 0, max = 0.4) ) ddd_lamu_tes...
3adb0f2489f80ff8de518bcddb4208566caa58af31d010e6c04e36d274d1f36e
R
681
23
plot.randomForest <- function(x, type="l", main=deparse(substitute(x)), ...) { if(x$type == "unsupervised") stop("No plot for unsupervised randomForest.") test <- !(is.null(x$test$mse) || is.null(x$test$err.rate)) if(x$type == "regression") { err <- x$mse if(test) err <- cbind(err, x$test$mse) } els...
532071b984c21320847abf9614f15b7901338121a543fd596faa5d057a77b435
R
682
30
slim_seurat <- function(seurat_obj, keep_counts = FALSE, keep_scale = FALSE, keep_reductions = FALSE){ if (!"SCT" %in% names(seurat_obj@assays)){ return(seurat_obj) showNotification("SCT assay not found in Seurat object") } if (!keep_counts && length(seurat_obj@assays$SCT@counts) > 0) { seurat_ob...
bfe46d33f576a97b2a94a5987658fbe0a35d039b02165bb2007be9291d57b684
R
683
29
library(Seurat) library(reticulate) ad <- import("anndata") sc <- import("scanpy") library(HumanLiver) viewHumanLiver() seurat_object = HumanLiverSeurat variable_genes = VariableFeatures(seurat_object) seurat_object <- seurat_object[variable_genes] count_matrix = seurat_object@assays$RNA@counts meta_data = seurat_ob...
1fdc658a983f71ab2eb05d3ebe9ca1a9602b11d0d3766eb86aaa148c4e1a2a3a
R
685
23
# PageRank scores ---- getPageRank <- function(disease, intGraph, geneVariant) { variantList <- unique(geneVariant[geneVariant$diseaseId == paste0(disease), 'targetId']) if (length(variantList) < 2 || sum(V(intGraph)$name %in% variantList) < 2) { pageRankRes = NA } else { V(intGrap...
4d82998376ad354ba7aa2f478f7ec6398e2133b515edef5dd375ba786f550aa6
R
687
21
guess_counts <- function(vect, lowestCount = 1){ # Try to restore a compositional vector to its former count glory. # *WARNING* # In the rare case that the lowest count wasn't zero, this will fail. if(min(vect != 0)){ output <- round(vect*lowestCount/min(vect)) cat("There don't seem to be any ze...
4893bd41fdfa287a5bb316314b60cd6df68d0b043fec9b2e2defa6b2b20b57c2
R
698
35
#' Launch scFOCAL #' @examples #' runscFOCAL() #' @import shiny #' @import Seurat #' @import ggplot2 #' @import ggpubr #' @import tibble #' @import cowplot #' @import viridis #' @import dplyr #' @import ggsci #' @import ggrepel #' @import tidyverse #' @import plotly #' @import htmlwidgets #' @import reshape2 #' @import...
9dfc5a5e5cf604891685aac168562ea2faec1f152796c4d18a2a26c79d3d02ec
R
699
24
#' Convert logical TRUE/FALSE values to 1/0 #' #' Replaces every \code{TRUE} with \code{1} and every \code{FALSE} with \code{0} #' across a data frame. Convenient for turning logical membership matrices into #' numeric ones for summing or clustering. #' #' @param inputDF A \code{data.frame} of logical (or coercible) va...
2bff76da254403b00c9799da6eeb0e976607dcbacccb2f1aa86437affc9ef332
R
708
23
#' @keywords internal n2ndis = function(x, atlas, groups){ pat = x; rownames(pat)=groups; colnames(pat)=groups pat = pat[order(groups),order(groups)] pat[upper.tri(pat)]=NA pat = melt(pat, na.rm=T) pat$Var = paste0(pat$Var2, "_to_",pat$Var1) rownames(atlas)=groups; colnames(atlas)=groups atlas = atlas[o...
3dc77c59aed36c6bf8ca41b764cbb97b5e8da9b038fcf0598203bc89f0a41623
R
713
29
##-------------------------------------## ##### REPORT ##### ##-------------------------------------## tab_SESSIONINFO <- tabItem( tabName = "Session Information", #sidebarLayout( #sidebarPanel(width = 2, ...
3a28f5cf6bb0e7ae7e918ba8658e477f382206e2f89482c77716859c524d7e2a
R
714
22
#Author: Kim Kundert-Obando for questions please reach out to me at k.rogge.obando@gmail.com #Example on how to do FDR corrections with one output file from the mixed model code "net_regress_model" install.packages("FDRestimation") library(FDRestimation) #load files df<-read.csv("/Users/roggeokk/Desktop/Projects/nk...
d8e563bc7c3083386515b45f52619e1313a96084cb6094523612ea4b7bb3257a
R
715
15
test_that("miR_mature expands a precursor into three rows and keeps a mature miRNA", { df <- data.frame(mir = c("hsa-mir-21", "hsa-miR-21-5p"), stringsAsFactors = FALSE) out <- miR_mature(df, col = "mir") # precursor -> precursor + 5p + 3p (3 rows); mature -> 1 row expect_equal(nrow(out), 4)...
c1aa2fb375dfd037bd72466f2883e9f5d28952bad881293ccf4cc9db3325d0c5
R
718
40
#' Help function checking if a variable is a list. #' #' @inherit .check_params params author return #' #' @keywords internal #' @noRd #' check_is_list <- function(x, error = FALSE) { # check if input error is boolean vector of length 1 check_is_scalar_boolean(x = error, ...
1d18b4fec8031aedc018f25d33c6e8dedc0a2a88cbb831bea74c3ff47dbda299
R
722
17
# Smoke test: col_agrecounter_log has intricate merge/aggregate logic. We check # that it runs on a minimal input and produces the expected COUNT/coll columns, # rather than asserting every aggregated value. test_that("col_agrecounter_log runs and adds coll/COUNT columns", { df <- data.frame( mir = c("miR-...
feed35042f35b15d9705b73d811d2be1fd0445f0e9ab0995fba62cb6097b6434
R
726
34
genome_browser_links <- function(setbp1_metadata, gene) { if (gene == "") return() position <- gene_position(setbp1_metadata, gene) url_encoded_position <- paste0( position$chromosome, "%3A", position$beginning, "%2D", position$ending ) div( h5("Genome Browsers", tags$small(gene)), ...
09e2f346690756e26f3c3da485737120656fb2e9c2da728625c1a1f87a4b3f76
R
730
31
##-------------------------------------## # VAREXPLAINED TAB ## ##-------------------------------------## plot_variance_explained <- function(mat, vars, df_metadata){ df_metadata <- df_metadata[,vars] mat <- log2(mat+1) print("Calculating variance explained by each variable.") ...
4a2ca376664892d01bc5dbcf876bbcfd08fa1ed749488c71f1356fee4c1a2aad
R
733
26
#'--- #' title: FRASER counting analysis over all datasets #' wb: #' log: #' - snakemake: '`sm str(tmp_dir / "AS" / "CountingOverview.Rds")`' #' input: #' - counting_summary: '`sm expand(config["htmlOutputPath"] + #' "/AberrantSplicing/{dataset}_countSummary.html", #' dat...
89b816cb43c673563c362d5cf98e29ace73feb9b32245a65de2dd60554bf1b17
R
733
8
bookdown::render_book("index.Rmd", "bookdown::gitbook", clean = TRUE, preview = TRUE) bookdown::render_book("00-FAQ.Rmd", "bookdown::gitbook", clean = TRUE, preview = TRUE) bookdown::render_book("01-gettingstarted.Rmd", "bookdown::gitbook", clean = TRUE, preview = TRUE) bookdown::render_book("02-workflow.Rmd", "bookdow...
9cc8876dffab7392671f2c550bde43381808498d4b9c32b6f6bdf1e9a284be6c
R
735
20
test_that("cbind_filler binds unequal-length inputs and pads with NA", { a <- data.frame(x = 1:3, stringsAsFactors = FALSE) b <- data.frame(y = 1:5, stringsAsFactors = FALSE) out <- cbind_filler(list(a, b)) expect_equal(nrow(out), 5) expect_equal(ncol(out), 2) expect_equal(as.numeric(out$x), c(1, 2, 3, NA,...
b3fe3bd9395c95bba6435c77966fd810782b9c65afeb051f2251b6d8f07a68a7
R
737
29
#'--- #' title: VCF-BAM Matching Analysis over All Datasets #' author: #' wb: #' log: #' - snakemake: '`sm str(tmp_dir / "MAE" / "QC_overview.Rds")`' #' input: #' - html: '`sm expand( #' config["htmlOutputPath"] + "/MonoallelicExpression/QC/{dataset}.html", #' dataset=cfg.MAE.qcGroups #' ...
4245f65e5dc988096551927935665ca6adf14dfc3092a8ad5c05c1f23d6e95bb
R
738
10
source('src/transcriptomics/helpers.R') stopifnot(identical(names(make_rank(c(2,2,NA,-1),c('B','A','C','D'))),c('A','B','D'))) stopifnot(inherits(try(make_rank(c(1,2),c('A','A')),silent=TRUE),'try-error')) stopifnot(all.equal(family_bh(c(.01,.04,NA),3),c(.03,.06,1))) stopifnot(classify_robustness(.01,1,c(1,2,3),c(1,1,1...
e4e0198e49d1dfb3b076f3ef719ca62f0793746a114cfaf669f3e7ad779377af
R
741
36
#function for selecting/ reordering columns with similar names within a dataframe # use special characters to extract key_words: *=any character; ^=block beginning of the string , $=block end of the string #example### # inputDF<-iris # key_words<-c("Species", "*Width", "*Length") # temp<-col_selecto...
f17f30e436a22565bb343c590e03e496b2fd20922f38df1f586dd4edfd45107f
R
742
30
library("UMI4Cats") library(BSgenome.mm10.ensembl.local) library(stringr) fqdir = snakemake@params[['fqdir']] wk_dir = snakemake@params[['wk_dir']] dig_genome = snakemake@params[['dig_genome']] btix = snakemake@params[['btix']] bc = snakemake@params[['bcs']] sample = snakemake@params[['sample']] threads = snakemake@th...
97a34541172ad1d2c636f4518eefe55972face4fdb13350455f587f4fd445212
R
744
43
--- title: "02_Neural" output: html_document date: "2024-08-29" --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` ```{r} library("Matrix") library("readr") library(Seurat) library(tidyverse) library(harmony) library(cowplot) library(patchwork) ``` ```{r} merged<-readRDS("Ctrl_FoxA_merged_082924....
3b841bc35e0e0b43d98041e1e16f7035bdd6a5d70b981675975f68137f33bc32
R
745
28
#' flashpcaR #' An R interface to FlashPCA for fast principal component analysis and #' related analyses. #' #' \tabular{ll}{ #' Package: \tab flashpcaR\cr #' Type: \tab Package\cr #' Version: \tab 2.0.1\cr #' Date: \tab 2017-01-19\cr #' License: \tab GPL (>= 3)\cr #' } #' #' @name flashpcaR-package #' @aliases flashpc...
249d4a9c712f50c656f50e4f768f50efeda38b50095b1503e3b09cefda3371e3
R
750
23
test_that("log_to_NR converts TRUE/FALSE to 1/0", { df <- data.frame(a = c(TRUE, FALSE, TRUE), b = c(FALSE, FALSE, TRUE)) out <- log_to_NR(df) expect_equal(as.numeric(out$a), c(1, 0, 1)) expect_equal(as.numeric(out$b), c(0, 0, 1)) }) test_that("countgenes encodes the number of unique non-mi...
c42573b6f534466af8b85ec832379e6c7d11e2c14868d9baf09f218e21af7fcd
R
751
33
args <- commandArgs(TRUE) lambda <- as.numeric(args[1]) mu <- as.numeric(args[2]) cap <- as.numeric(args[3]) ntip <- as.numeric(args[4]) family_name <- as.character(args[5]) tree_name <- as.character(args[6]) path <- as.character(args[7]) pars <- c(lambda, mu, cap) meta <- c("Family" = family_name, "Tree" = tr...
2ccd1b858a8717673ba146091ea78e813ffdf1adfa6bea074032a847da04c90b
R
753
34
#' Output a vector of colours based on the ggplot colour scheme #' #' This function takes as input the number of colours the user would like, and #' outputs a vector of colours in the ggplot colour scheme. #' #' @param g the number of colours to be generated. #' #' @return a vector with the names of the colours. #' @ex...
386beb432d6715bd500414abe0a41e2bd84323c2c2a0e473d0ca7b008a3f799c
R
757
30
args <- commandArgs(TRUE) file_name <- as.character(args[1]) family_name <- as.character(args[2]) tree_name <- as.character(args[3]) tree_brts <- readRDS(file_name) ml <- DDD::dd_ML( brts = tree_brts, idparsopt = c(1, 2, 3), btorph = 0, soc = 2, cond = 1, ddmodel = 1, num_cycles = 1 ) df_ddd_results...
5a2f3e1d08b1aed6dcb1873be010912b0ada3b34b467c335df2e3bcf398cbfe7
R
763
31
library(pROC) context("large data sets") test_that("roc can deal with 1E5 data points and many thresholds", { response <- rbinom(1E5, 1, .5) predictor <- rnorm(1E5) # ~ 0.6s r <- roc(response, predictor) ci(r) expect_is(auc(r, partial.auc = c(0.9, 1)), "auc") }) test_that("roc can deal with 1E6 data poin...
5f4d60b5423d373eac35d22f4e0d5227c60a97429f050fef0fcb3d95fca6b61f
R
763
24
################################# # # This function is used to obtain # the TD for intra-SMN and inter-SMN-DMN # # the input should be the time delay matrix # ObtainTDinSMN <- function(dat_TD, net_anna){ dat_test <- rio::import(dat_TD) %>% as.matrix() sbj_name <- stringr::str_extract(dat_TD, pattern = "sub-[0-9...
9f0b2cae4af99403b1993a0843c4a73beaad2ff4aae8eca60c9e3999a053c407
R
766
23
#' Random feature selection #' #' Perform feature selection on a single-cell feature matrix (e.g., gene #' expression) by randomly removing a specified proportion of features. #' #' @param mat a single-cell matrix to be filtered, with features (genes) in rows #' and cells in columns #' @param feature_perc percenta...
ab4d5e40d9951e077fce2cf903858f214bfa26d7cdf2e8d6f4234e85e721e4c1
R
772
22
############################ # # Identify statistic function # to test the difference in # demographic information # pvalue <- function(x, ...){ # construct vectors of data y, and groups (strata) g y <- unlist(x) g <- factor(rep(1:length(x), times = sapply(x, length))) if(is.numeric(y)){ # f...
2cdab950f9ae231810c7479196c20c7fd5146571ad96447542f7ea90c520aeaa
R
774
35
library(readxl) tt <- read_excel("metadata/metadata_mid_organoids_10x_sample.xlsx", sheet = "invitro") tt <- as.data.frame(tt) list_perFile <- split(tt$Donors, tt$Sample) tt2 <- read_excel("metadata/metadata_mid_organoids_10x_sample.xlsx", sheet = "chipInfo") tt2 <- as.data.frame(tt2) tt2 <- subset(tt2, sampleOrig...
7284bfcebf467dcd57dada1fa62457aa66901163c4d66c3cdfef77a858d4d7cf
R
774
21
# File: /scripts/visualization/raincloud_RMS.R # Purpose: Generate raincloud plot for RMS_post by Group # Input: ../../data/processed/EMG_EEG_strength.csv # Output: ../../results/figures/raincloud_RMS.png library(tidyverse) library(ggdist) data <- read_csv('../../data/processed/EMG_EEG_strength.csv') p <- data %>% ...
46dce4a9091e468171878932601d98ad8c68e59940d62ca6558933086a74bd21
R
779
27
library(targets) library(dplyr) Sys.setenv(TAR_PROJECT='naturalistic') tar_prune() network_edges <- tar_network()$edges final_target <- c("rmd_ms_stats", "rmd_ms_supp") all_upstream_targets <- c() i <- 1 targets_to_check <- final_target repeat { these_upstream_targets <- network_edges %>% filter(to %in% targe...
dd0875ae1dd0d6bd17f96437949506eb1bfeba1267b843db6bc6fa136ae4a927
R
785
42
#Source the respective user interface and server R files. source("UI.R") source("server.R") #Load in necessary packages. library(shiny) library(EBImage) library(jpeg) library(ggplot2) library(shinydashboard) library(dplyr) library(tibble) library(ComplexHeatmap) library(grid) library(gridExtra) library(cowplot) libra...
0e3b719b64c0b9c946b80aee18e700433215697f71b661bc1a1fc46c22a50728
R
795
28
# Generate some data nsamp <- 10 # True cell type proportions p <- c(0.05, 0.15, 0.35, 0.45) # Parameters for beta distribution a <- 40 b <- a*(1-p)/p set.seed(986) # Sample total cell counts per sample from negative binomial distribution numcells <- rnbinom(nsamp,size=20,mu=5000) true.p <- matrix(c(rbeta(nsamp,a,b[...
6802ab40b8c3457e8459e8a2994de78d10e9fce37b6e69a453064f63472e057d
R
803
25
#' @export correct_bias_coef correct_bias_coef <- function(data, task = NULL) { pars_list <- NULL diff_list <- NULL if (task == "BD") { pars_list <- c("lambda", "mu") diff_list <- c("lambda_pred", "mu_pred") } else if (task == "DDD") { pars_list <- c("lambda", "mu", "cap") diff_list <- c("lambda...
cb6a36ccac46b42e3d6d3572b4f0e845de1402ba250b62e62ee52126b1e85ff1
R
805
34
#' Homo Sapiens annotation file #' #' Data downloaded from ftp.ncbi.nlm.nih.gov/gene/DATA/GENE_INFO/Mammalia/Homo_sapiens.gene_info.gz" #' data were pre-processed by uncollapsing the rows. Created Jun. 2020 #' #' #' #' #' @format A data frame with columns: #' \describe{ #' \item{rows}{row number before uncollapsing} #...
030b1d08baaf5b8a263354f2d69a221a781b37e0367a79337b1db5747b8c732f
R
817
29
#' @keywords internal #' @importFrom neurobase readnii writenii util_get_coords=function(cfg){ # load parcels my_img = readnii(cfg$parcel_path) # get unique values unique_v = unique(as.vector(my_img)); unique_v = unique_v[unique_v > 0] # loop through unique values and get coordinates in MNI get.coords=...
3b0cf232053168cafc8924ca4dd0a276da1ce8c14d6614e0e42dc240f2fc353b
R
821
48
#INFORMATION----------------------------- #LOAD LIBRARIES ------------------------ library(shiny) library(shinyjs) print("Sucessfully loaded libraries.") #LOAD TABS------------------------------- source("UI.R") print("Successfully loaded tabs.") #USER INFERFACE ---------------------------- ui <- fluidPage( ## t...
0241fd972a5520a7c0cdc70588526a52b86b5f5ecb6cd1cf0a2a469c79f4ff24
R
836
26
setwd("/data/wuqinhua/phase/covid19/datasets") library(Seurat) library(SeuratDisk) sbj <- list() data_folder <- "./pre_data/17_Wilk_2021/data" file_list <- list.files(data_folder, pattern=".rds", full.names=FALSE) for (file_name in file_list) { sample_id <- substr(file_name, 1, 10) sample_data <- readRDS(f...
3a609499f51b4591b1244c8621e038f89505af00b767cc782ee51164642c3162
R
841
26
source("../shinytest_helpers.R") set_window() app$setInputs(layout_and_readouts = "separate_files") app$uploadFile(layout_table_file = demo_path("CRA_Layout.xlsx")) app$uploadFile(readout_matrices_file = demo_path("CRA_1ReadoutXlsx_INF-R-1632.zip")) app$setInputs(type_of_analysis = "StepA") app$setInputs(iTReX = "QCN...
db96348fab1858946d04bcc18d9500e1078674137c981be62d2bcf8a4302e13a
R
844
30
#' Estimate the parameters of a Beta distribution #' #' This function estimates the two parameters of the Beta distribution, alpha #' and beta, given a vector of proportions. It uses the method of moments to #' do this. #' #' @param x a vector of proportions. #' #' @return a list object with the estimate of alpha in \c...
fee9af6d7d98ed8c4b077ab0efc0da89b2f1458092f1619ec3aeed6a67375e58
R
846
47
--- title: "00_Preprocess Fincher" output: html_document date: "2023-07-06" --- ```{r setup, include=FALSE} # Set global chunk options knitr::opts_chunk$set(echo = TRUE) ``` ```{r} # Load required packages library(Seurat) library(tidyverse) ``` ```{r} # Load Seurat object (raw or previously processed) Fincher.orig <...