sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
38fd067cb18308cfd5eccd3019b2f53da8a142b9658fa1c97896235e3263bdc6
R
1,705
88
# Test check_library_installed ---- test_that( "check_library_installed - works - TRUE", { expect_no_condition( object = check_library_installed( x = c("tools", "base"), error = FALSE ) ) expect_no_condition( object = check_library_installed( x = c("tools", "ba...
8afa3ed9fc1486be53fc8eaeb7ac4f8f5ba282160c727918a95554c25215aa24
R
1,707
61
# Hua Sun # Seurat v5.1 library(Seurat) library(Signac) library(GenomicRanges) library(dplyr) library(stringr) library(stringi) library(EnsDb.Mmusculus.v79) library(EnsDb.Hsapiens.v86) rdir <- 'out_cellranger_arc' seed <- 42 ref <- 'mm10' regress <- NULL # set it by data outdir <- 'out_multiome_integrated' set.se...
7f053c31b3ce8d6b57fd32759b2575bf4d8493e5638bd7bc7b1e80ccb1552796
R
1,709
42
# Function to add HPO terms to results table add_HPO_cols <- function(RES, sample_id_col = 'sampleID', gene_name_col = 'hgncSymbol', hpo_file = NULL){ require(data.table) filename <- ifelse(is.null(hpo_file), 'https://www.cmm.in.tum.de/public/paper/drop_analysis/reso...
f3f29594c0c3be786bef96ce91ed6129dbbb7462b196312a110b6d98932f8f5a
R
1,716
59
#'--- #' title: Create datasets from annotation file #' author: Christian Mertes, mumichae #' wb: #' log: #' - snakemake: '`sm str(tmp_dir / "AS" / "{dataset}" / "00_defineDataset.Rds")`' #' params: #' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`' #' - ids: '`sm lambda w: sa.getIDsByGroup(w.dataset, assa...
339db2d8efd0a87a91412f16c7676a89ffecc524564b769681123cbf66eb9480
R
1,718
44
#' richR publication-ready ggplot2 theme #' #' A clean, consistent theme for all richR visualizations. Designed for #' publication-quality figures with legible fonts and minimal clutter. #' #' @param base_size base font size (default: 12) #' @param base_family base font family (default: "") #' @return A ggplot2 theme o...
041bd4f5aeb5f74da5f2f0d3c006da1c47b7e0721879f55af39c1b97820e8f97
R
1,719
61
setwd("/media/user/disk21/completeAnalysis/") data = read.table("cellbrowser/scRNA-Seq/l3.coords.tsv", row.names = 1, header = T) meta = read.table("cellbrowser/scRNA-Seq/meta1.tsv", row.names = 1, header = T, sep = '\t') identical(rownames(meta), rownames(data)) library(ggplot2...
a1d123fac1553d6ab0910e8a48be52f1edfa7e3604c243881d0e08d9c702cbc0
R
1,719
55
# Calculate current coverage coverage <- covr::package_coverage(path = "OlinkAnalyze") coverage_value <- covr::percent_coverage(x = coverage) |> ceiling() if (coverage_value > 0L && coverage_value < 50L) { coverage_badge_color <- "red" } else if (coverage_value >= 50L && coverage_value < 70L) { coverage_badge_col...
efb1c84ad82a261926a7e429ebe419ae0d04ba4d56f68667abb3aed6694b5974
R
1,726
50
library(tidyverse) library(openxlsx) ## set directories root_dir <- rprojroot::find_root(rprojroot::has_dir(".git")) input_dir <- file.path(root_dir, "data") output_dir <- file.path(root_dir, "tables", "results") mb_dir <- file.path(root_dir, "analyses", "molecular-subtyping-MB", "results") ## read file hist <- read_...
2ef870532c85ba954e46a5964705a153520b839795ff583eb68197a654b1ea04
R
1,728
87
# Hua Sun library(infercnv) rds <- 'pre_infercnv_obj.rds' func <- 'hmm' sd_amp <- 2 cutoff <- 0.1 outdir <- 'out_infercnv' dir.create(outdir) infercnv_obj <- readRDS(rds) infercnv_obj2 <- '' # fast if (func == 'default'){ infercnv_obj2 <- infercnv::run( infercnv_obj, cutoff=cutoff, o...
4463ec3c239c195ba41a15c1070d5fad25cffd8509e212481c1261fe24492ecc
R
1,730
56
#' Remove a metadata from being included in the shiny app #' #' Remove a metadata from being included in the shiny app. #' #' @param scConf shinycell config data.table #' @param meta.to.del metadata to delete. Users can either use the original #' metadata column names or display names. For more information regarding...
b10584337f681426ea797ab178c89d6dd36b6c416efcf9cbb2002bd6d60f3515
R
1,731
50
# load libraries suppressPackageStartupMessages({ library(tidyverse) library(pheatmap) }) # function to create heatmap of average immune scores per cell type per cancer and gtex group heatmap_by_group <- function(deconv_output, annot_colors, output_file) { # create a generalized group column deconv_output ...
114b6c8805f85f678c14ac45dcd4d37676f818139b8050467674862ec02902a7
R
1,740
59
#' Modify the legend labels for categorical metadata #' #' Modify the legend labels for categorical metadata. #' #' @param scConf shinycell config data.table #' @param meta.to.mod metadata for which to modify the legend labels. Users #' can either use the actual metadata column names or display names. Please #' s...
c26108d6ac33bde89c86e436ccedb8c204bcde90d63e93d4dad1c5196cdfa563
R
1,745
74
multi_defined <- function() { return(1) } multi_defined <- function() { return(2) } # Test comment multi_defined_multi_ways1 <- function() { return(1) } # Test comment assign("multi_defined_multi_ways1", function() { return(1) }) `<-`(multi_defined_multi_ways2, function() { return(1) }) # Test comment assign("m...
a310ca68cf621a0c141e7b08d0d1effdddd99ec70df44faf2c670f57627f1522
R
1,749
49
# Author: Komal S. Rathi # Function: Script to perform MB molecular subtyping # load libraries suppressPackageStartupMessages(library(optparse)) suppressPackageStartupMessages(library(tidyverse)) suppressPackageStartupMessages(library(medulloPackage)) suppressPackageStartupMessages(library(org.Hs.eg.db)) # source cla...
8d390d0408ad04190b4bd54c2753a06776a38d8c2128bcc1582206a3e272f0ed
R
1,751
43
#' Read nucmer coordinates file in to PAF formatted table #' #' This function takes alignments produced by nucmer (parameters: --mum --coords) and loads #' reported coordinates file (suffix .coords) into a PAF formatted table (see PAF specification). #' #' @param nucmer.coords A path to a nucmer coordinates file contai...
1d049186a495115292b08d3919af08d4e3600dc9c3a88a4a0330d8f0c05f44df
R
1,752
54
# ref for this file: # # * https://r-pkgs.org/testing-design.html#testthat-helper-files # * https://r-pkgs.org/testing-design.html#testthat-setup-files # LightGBM-internal fix to comply with CRAN policy of only using up to 2 threads in tests and example. # # per https://cran.r-project.org/web/packages/policies.html # ...
e3a2179eea10927e79dd873a089cd85553a42c8abf211275c51c8e99bfbef6ea
R
1,754
56
#' Reverse-combine logical columns into gene lists #' #' For each logical indicator column, extracts the values of \code{input_col} #' where the indicator is \code{TRUE}, deduplicates them and returns one gene #' list per indicator column bound side by side. #' #' @param inputDF A \code{data.frame} with an identifier c...
e414f8bdb6765200583aa308f4ce23baee5802cb822d49fcae289b48a94884b2
R
1,757
62
#' @title Modify the colour palette for categorical metadata #' @description Modify the colour palette for categorical metadata. #' @param scConf shinycell config data.table #' @param m metadata for which to modify the colour palette. Users #' can either use the actual metadata column names or display names. Please ...
172b6506fd46b37b99be6b8b915102658a6f081237231d0463062aa42a117eaa
R
1,759
56
# AR1 ar1=function(n,rho=0.9) rho^toeplitz(0:(n-1)) # CS cs=function(n,rho=0.9) {r=matrix(rho,n,n);diag(r)=1;r} # trace function tr=function(x) sum(diag(x)) # function to return P-values for sum(zs^2) using method of moments to find null distribution gent=function(zs=NULL,LD,A=NULL,chisquares=NULL) { # find null dist...
48c098d9346d4004c1c8bb5d6bdad8b38e59ac517cc0bc666297e51fbdafa874
R
1,766
46
DEgenesMAST <- function(Data, Labels, Normalize = FALSE, LogTransform = FALSE){ # This functions applies a differential expression test to the data using one vs all # The training data should be used a an input # The output is a matrix with marker genes where the columns are the cell populations and the rows a...
c8aaa65530cf9fa7c0188208afd5f92239c43373f9b39c8494943e53112398c0
R
1,766
55
library(pROC) data(aSAH) test_that("var with delong works", { expect_equal(var(r.wfns), 0.00146991470882363) expect_equal(var(r.ndka), 0.0031908105493913) expect_equal(var(r.s100b), 0.00266868245717244) }) test_that("var works with auc", { expect_equal(var(auc(r.wfns)), 0.00146991470882363) expect_equal(v...
96390b371b719bd097df16cb2b82ab72cdaa99081ccaee4cb78ada8826f4ce66
R
1,768
59
###### load data load("imp.mlmi.RData") #TRUE still has some missing values otherwise FALSE data_imp <- complete(imp.mlmi, "long", include = FALSE) # load packages library(mice) library(dplyr) library(flextable) library(crosstable) library(caret) library(skimr) library(pROC) library(purrr) library(tidyr) library(GGa...
661cfa07231c5d86a13a89a6ff84a9ffa3059d158612a4b5973ec0f88908b1dd
R
1,773
30
GeomSplitViolin <- ggproto("GeomSplitViolin", GeomViolin, draw_group = function(self, data, ..., draw_quantiles = NULL) { data <- transform(data, xminv = x - violinwidth * (x - xmin), xmaxv = x + violinwidth * (xmax - x)) grp <- data[1, "group"] newdata <- plyr::arrange(transform(data,...
992f99f1f11e25e3eae203d9674a52c1ab43b21bb4d04584b75629804f03deca
R
1,776
55
# Create a subset for the the histologies-base.tsv with WGS samples missing # in the GATK CNV calls to generate consensus calls if present in Manta SV caller # Load libraries suppressPackageStartupMessages(library(optparse)) suppressPackageStartupMessages(library(tidyverse)) # set up optparse options option_list <- l...
b55623afa924c11e7081bb08d9bffc4f2237ba4938eb735115762e8bf3d0bed1
R
1,788
69
library(tidyverse) library("GPA") library(readxl) library(data.table) library(parallel) library(foreach) library(doParallel) library(writexl) # Set up parallel processing num_cores <- 10 cl <- makeCluster(num_cores) registerDoParallel(cl) # Read data cmd_pair <- read_excel("/path/cmd_heart_brain.xlsx")...
f5b8584d65f14396f55518ae2811668983fd1934596377e8a35179d041828b45
R
1,789
55
#' @title Modify the display name of metadata #' @description Modify the display name of metadata. It is possible that the original #' metadata name is not so informative e.g "orig.ident" or too long e.g. #' "seurat_clusters" and users want to shorten the way they are displayed #' on the shiny app. This function all...
672b72dc3997120bd2670c6218a01d5631abc7ac340116e014047f620affcd73
R
1,794
44
rm(list=ls(all=TRUE)) library(mvnfast) source('simulations/gent/functions.R') ################################################################################## # changing ms, ngwas, LD density ms=c(50,100,150) ngwas=c(10000,50000,100000) rhos=c(0.1,0.5,0.9) h2=0 nref=500 niter=10000 #m.=n.=r.=1 for(m. in 1:length(ms))...
a24f3d3f0a4551f3b70a1bcbb9ee7d87b3f77c9e4c16cd0ea25d0957c0bc98ba
R
1,798
44
# function to create clustering plot using either umap or t-SNE suppressPackageStartupMessages(library(uwot)) suppressPackageStartupMessages(library(Rtsne)) suppressPackageStartupMessages(library(ggplot2)) suppressPackageStartupMessages(library(irlba)) suppressPackageStartupMessages(library(tidyverse)) clustering_plo...
c919a5d9ad8be7495f396364a3d301f6605ce72f3e0afb87e7b926c0e74a5591
R
1,799
54
#' Column-bind data frames or vectors of unequal length #' #' Binds a list of data frames or vectors by column, padding the shorter inputs #' with \code{NA} rows so that all share the number of rows of the longest one. #' Written in base R (no external dependencies), so it works identically on #' Windows, macOS and Lin...
b85e7f7c492647fad9c571d4028b637178c651b30fe96c9c69dd2dda7cce6d77
R
1,805
52
library(ggplot2) library(ggpubr) # Data comes from the below link: # https://kb.10xgenomics.com/hc/en-us/articles/360001378811-What-is-the-maximum-number-of-cells-that-can-be-profiled- ### Path to dataset: pathtodpcsv<-'' dp<-read.csv(paste0(pathtodpcsv,'/DoubletPrediction.csv')) plot(dp$MultipletRate, dp$...
4654074aeb100767dfab51252b2d37aac154e3c3caa702ae5ec21844e715bbbe
R
1,812
53
library( psych ) ants <- read.csv( "../../Kirby/antsThickness.csv" ) antsxnet <- read.csv( "../../Kirby/antsxnetThickness.csv" ) visitPairs <- c( '01', '25', '02', '37', '03', '22', '04', '11', '05', '31', '06', '20', ...
30da3c7bdb02382fcc0e7f8cd9db3afd30fda930a804462ac7ce3ac7a7555f6a
R
1,814
69
require(luz) require(torch) require(torchvision) npx <- 96 classes <- 3 convnet_dropout_5_10 <- nn_module( "convnet_dropout_5_10", initialize = function() { self$features <- nn_sequential( nn_conv2d(3, npx, kernel_size = 3, padding = 1), nn_relu(), nn_max_pool2d(kernel_size = 2), nn_dr...
16eeee48ca720366f1840c97d561d2f49879021588cb9545e34df8fbc797d704
R
1,816
59
#' Set the default metadata to display #' #' Set the default metadata to display in the shiny app. Default1 is used when #' plotting metadata with gene expression or when plotting two metadata #' simultaneously. Default2 is used when plotting two metadata simultaneously. #' #' @param scConf shinycell config data.tabl...
a667c2a5949d95f761ffb777c9e125a3dff9b2d2a657abd53637c41be1678cc6
R
1,820
64
# to run on laptop # set.seed(33) library(tidyverse) Exposure_Data <- data.table::fread("~/Documents/SGG/Projects/SampleOverlap/Data/Simulations/noY/GWAS_X.tsv") Outcome_Data <- data.table::fread("~/Documents/SGG/Projects/SampleOverlap/Data/Simulations/noY/GWAS_Y100.tsv") # take 750,000 SNPs SNPs <- sample(x = 1:nr...
0914e96d8a14b750a248e09beb5b2bf2e875ac4a4db3cbca7ea36bd806b111e8
R
1,827
46
test_that(".species_table returns valid data.frame", { tbl <- richR:::.species_table() expect_s3_class(tbl, "data.frame") expect_true(all(c("species", "dbname", "kegg", "msigdb", "reactome") %in% colnames(tbl))) expect_true(nrow(tbl) >= 20) expect_false(any(duplicated(tbl$species))) expect_false(any(is.na(t...
50d7898ebfcd4e66ec3182228e4fd235342eb076a688c258816ebde068941f23
R
1,829
51
#'--- #' title: Fitting the autoencoder #' author: Christian Mertes #' wb: #' log: #' - snakemake: '`sm str(tmp_dir / "AS" / "{dataset}" / "05_fit.Rds")`' #' params: #' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`' #' - workingDir: '`sm cfg.getProcessedDataDir() + "/aberrant_splicing/datasets/"`' #' threa...
e3476429b36cccd9ad04e384af8d60acb4c339d067ccb23b2e72a7d8c868a979
R
1,833
52
library(tidyverse) library(readxl) library(optparse) library(data.table) arguments <- parse_args(OptionParser(), positional_arguments = 1) base_dir<- arguments$args[1] base_dir<-"/home/jbrenton/nextflow_test" sample_info <- read_excel( path = file.path( base_dir, "20201229_MasterFile_Sa...
19d8d07ccb49b99adb160f39295c65d0091f7575f401d602791e7d7ae18fe819
R
1,837
57
# prepare_seg_for_gistic.R # # # Purpose: Generate seg files that are compatible with GISTIC # Currently, if we use the cnv consensus seg file as is, since we define copy.num=NA for neutral calls # a lot of NAs are present in the file and will cause GISTIC to error out. # Those changes were made for the focal CN mod...
0e5cbc0277f37fe47341af358af418bd9382750919863f976a5f7e33b7f87c83
R
1,838
55
#' @title Set the default metadata to display #' @description Set the default metadata to display in the shiny app. Default1 is used when #' plotting metadata with gene expression or when plotting two metadata #' simultaneously. Default2 is used when plotting two metadata simultaneously. #' @param scConf shinycell co...
835ee8c1f9b4b22c493e59da076360b7940cf6d73e3937be9b150d3aa0d10e88
R
1,843
51
#' Estimate parameters of a Beta distribution from counts #' #' This function estimates the two parameters of the Beta distribution, alpha #' and beta for each cell type. The input is a matrix of cell type counts, #' where the rows are the cell types/clusters and the columns are the samples. #' #' This function is c...
5d5b6fe7c29463ed1342d616b8df02fd9abadb41b8e83614b0242d3323c18adf
R
1,845
51
library(lightgbm) # Load in the agaricus dataset data(agaricus.train, package = "lightgbm") data(agaricus.test, package = "lightgbm") dtrain <- lgb.Dataset(agaricus.train$data, label = agaricus.train$label) dtest <- lgb.Dataset.create.valid(dtrain, data = agaricus.test$data, label = agaricus.test$label) # Note: for ...
7f53fcaf82a451ebb72493438c3c906a585f8e8d5e62fcf09b0cf94e653e067e
R
1,847
22
# The Osprey Workflow **Osprey** was designed to have an easy, linear workflow with as little user input as possible. It has many built-in routines to recognize data formats and sequence types, and will be able to perform most required processing steps automatically. Osprey consists of seven separate modules – Job, ...
a4e8dc32de572ffe32ba609818620e8887fc5fcd3f55db8f45c135606c393b8f
R
1,851
47
library(Seurat) library(ggplot2) library(patchwork) ba9.integrated = readRDS("ba9_array_integrated.rds") # Read in tissue annotation info (BA46 vs BA9) df.meta = read.csv("../U54_Metadata_Full.tsv", header=1, sep="\t") res = sapply(df.meta$tissue_id, FUN=function(x){ parts = strsplit(x, '_') first_elements = sapp...
03cb938c1b3bd7e0b208496a4b1cb9dcf1a880a93fbb553ae4612a23a1ffcca8
R
1,854
57
calc_flynet_activations <- function (videos, out_path, script, weights, output_type = "activations") { # TODO: May still need to batch this in case there are too many videos to feed into one arg video_paths <- paste(videos, collapse = " ") command_args <- c(script, "-l 132", ...
56745aeb4e0dc5040e961f16770778f8be9dead1907bd286a188a346c4ec773c
R
1,855
52
# power as more SNPs are included #### ms=c(5:200,300,400,500,600,700,800,900,1000,1250,1500,1750,2000) # number of tested SNPs alpha=0.05 # Type I error rate m0=3 # number causal SNPs h2=0.0005 # h2 explained by gene ngwas=30000 # GWAS sample size cortypes=c('CS','AR1') # CS, AR1 rhos=c(0,0.3,0.5,0.9) POWER=array(dim=...
c6a91af334fd06cb9b96e10591c44c18ad09a52c9157dfd0085dbabd4d19f134
R
1,861
63
#' Create a Scatter Plot for Visualizing Beta Values #' #' This function generates a scatter plot for visualizing #' beta values using multidimensional scaling (MDS). #' It takes beta values, group information, sample names, #' color palette, point size, and other optional parameters #' for customization. #' #'...
aff1e404e49f4408791093ebc9a50049a34bad54710b14e85e61950732be3a21
R
1,872
75
#checking assumptions install.packages("readxl") library(readxl) #check my decoding accu normality using shapiro test setwd("/Users/shahzad/Documents/tryANOVAAssumptions") myData<-read_excel(path = "anatExt_decodAccu.xlsx") # checking for normality qqnorm(myData$anat_lS1) qqline(myData$anat_lS1) # test of normality ...
8b7a69450134cb9dda6c6baf0126e1eb7f3393738ac7db90ff4d83967e7fe3b2
R
1,883
46
setwd("/media/user/disk21/completeAnalysis/visium_2Jun/") meta = read.csv("meta_12Mar2025.csv", row.names = 1) info = read.csv("SNUH_AF_15Jun.csv", row.names = 1) identical(rownames(meta), rownames(info)) meta$ravi_module = info$RaviModule df1 = as.data.frame(table(meta$AF_mar2025, meta$greenwald)) colnames(df1) =...
9d21dcdedcdb66df2edddd49b4a36f5e50b8d0aeaa9f9bcffcf43a54c078c0f3
R
1,887
70
#! /usr/bin/Rscript --vanilla library(MuMIn) library(survival) library("survminer") source("DataSplitter.R") source("Outcome.R") source("MelanomeCSVParser.R") source("FeatureReduction.R") source("Model.R") source("PredefinedFeatureReductionRuleSequences.R") source("MelanomeSettings.R") source("ModelTrainer.R") sourc...
a51353d7f3d5b62357cb7ba1dafe6e2a7e38369aad1b7461f8b902c30e155140
R
1,890
71
# Scripts to create ensembl_id gene lists for IEGs # Mouse gene list is from: SI Table 4 from \doi{10.1016/j.neuron.2017.09.026}. Human # gene list was compiled by first creating homologous gene list using biomaRt and then adding some manually curated # homologs according to HGNC. See data-raw directory for scripts ...
d4d79c27b87c678ccade88dce700044a935870dd114735372d5dba52021dc332
R
1,893
56
--- title: "Readme_Wei et al" output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` Vagal sensory neuron single cell analysis This repository contains the code used for the single-cell analysis of vagal sensory neurons from healthy and tumor-bearing mice. The data generated fro...
ee842e2426fa7d4e5da7303b66ef17a8ebd6e75ad3460bbfad6595ca51f89a6a
R
1,895
57
################################# ED.Fig.10a and b ###R data adapted from Zhao, Q., Yu, C.D., Wang, R. et al. A multidimensional coding architecture of the vagal interoceptive system. Nature 603, 878–884 (2022). https://doi.org/10.1038/s41586-022-04515-5 ###Please refer to Extended.Data.Fig.2c.R for generation of "Lung...
24a6495c594a01bde2ed87ff9a8343bf35510d06e55e16f1c37869b64817c717
R
1,901
47
--- title: "Figure 5" author: "Maksym Zarodniuk" date: "Compiled on `r format(Sys.time(), '%d %B, %Y')`" output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(warning = FALSE, message = FALSE) ``` ```{r, include=FALSE} library(tidyverse) # dplyr, ggplot2, readr, tibble, pipes library(ggplot...
481ecd6f1affb3ed6cba2050fbeff5d181c1299da243291ffc8cde98676d138e
R
1,901
47
message("=================================================") message("Check geom_miropeat and plotMiro wrapper function") ## Get PAF to plot ## paf.file <- system.file("extdata", "test1.paf", package = "SVbyEye") ## Read in PAF paf.table <- readPaf(paf.file = paf.file, include.paf.tags = TRUE, restrict.paf.tags = "cg"...
9d0a5e67e663745659c457873c06e8b4fed76a8314ff1a959a8e07ad04c5c822
R
1,903
70
library(lightgbm) # We load the default iris dataset shipped with R data(iris) # We must convert factors to numeric # They must be starting from number 0 to use multiclass # For instance: 0, 1, 2, 3, 4, 5... iris$Species <- as.numeric(as.factor(iris$Species)) - 1L # We cut the data set into 80% train and 20% validat...
63648d2e9d9610d9210826e95009aeb95e53e670ad6e64c20eda4a03b1c3f9eb
R
1,908
70
#' Help function checking whether a dataset contains NA or empty strings on #' its column names #' #' @author #' Klev Diamanti #' #' @inheritParams .read_npx_args #' @inheritParams .downstream_fun_args #' #' @return Error is file contains problematic column names. `NULL` otherwise. #' #' @keywords internal #' read_np...
871b8364fee2e52c835efaf73a22624d1485de272adb0580e2b88918cd7ad052
R
1,909
47
#' @name lgb.restore_handle #' @title Restore the C++ component of a de-serialized LightGBM model #' @description After a LightGBM model object is de-serialized through functions such as \code{save} or #' \code{saveRDS}, its underlying C++ object will be blank and needs to be restored to able to use it. Such #' object ...
45a0afaeb1d641ca0adf1b53a1e77ca36f58a110cce32a07b499eddb0ff450fd
R
1,912
58
#' Modify the display name of metadata #' #' Modify the display name of metadata. It is possible that the original #' metadata name is not so informative e.g "orig.ident" or too long e.g. #' "seurat_clusters" and users want to shorten the way they are displayed #' on the shiny app. This function allows users to spec...
6e52c8d0703b995a14ea3a03729575ed51602fe269f4d8f38cf2153b004234d9
R
1,917
76
args <- commandArgs(TRUE) name <- as.character(args[1]) params <- yaml::read_yaml("../Config/pbd_sim.yaml") if (!dir.exists(name)) { dir.create(name) } setwd(name) dists <- params$dists within_ranges <- params$within_ranges nrep <- params$nrep age <- params$age proportion <- params$proportion nworkers_sim <- par...
984154831dc873a88230092bc82ff518a2262fa466e849ced18ca5b5539a5ecf
R
1,923
60
library(testthat) library(biodiscvr) # Setup paths [cite: 12, 16] synth_data_root_dir <- system.file("synthdata", package = "biodiscvr", mustWork = TRUE) path_to_pkg_files <- system.file("files", package = "biodiscvr", mustWork = TRUE) pkg_synth_config <- "config_synth.yaml" pkg_synth_dict <- "dict_suv_synth.csv" tes...
7c36ced3b0408514b7fed3918e1acec255fd9562e86dd7c7c86dac9e55bab72e
R
1,927
61
setwd("/Volumes/IqraMacFmri/visTac/fMRI_analysis/outputs/derivatives/decoding/glm_noResponse_forIMRF_includesAllSub") # Remove all variables rm(list = ls()) library(openxlsx) # import excel file library(reshape2) # reshape data library(ggplot2) # plots library(lmerTest) # linear mixed model library(emmeans) # multip...
ab63327a4c7de3ca4b898328d29a87d5ed08aac902756548e9f812c9979f4f8d
R
1,936
65
#' Modify the colour palette for categorical metadata #' #' Modify the colour palette for categorical metadata. #' #' @param scConf shinycell config data.table #' @param meta.to.mod metadata for which to modify the colour palette. Users #' can either use the actual metadata column names or display names. Please #' ...
148053ea38e8c8a8f05c15db9917c216b3203ba8165d8d832c9ab9747e42cc21
R
1,946
63
library(dplyr); library(tidyr); library(broom) # ==== 入力データ ==== dat_long <- read.csv("DFT_VAS_spellout.csv", header = T, stringsAsFactors = F, fileEncoding = "SJIS") value_col <- "VAS" # 例: "VAS" # 前処理(Timeの順序を固定) dat_long <- dat_long %>% ...
19b9c10554b81e83de3538eb8bd6c3c46d714f3527950f2c3508161fbc0b968a
R
1,952
66
# ----------------------------------------------------------------------------------------------------------- # For reproducible research, please install the following R packages # and make sure the R and BiocManager versions are correct # ─ Session info ─────────────────────────────────────────────── # setting value...
2950144f2dc703c06dccee509c4a80a3be1ca42e62382a219fed2c0640089148
R
1,954
50
df = read.csv("res/predictive_connections.csv") modul = c(structure(as.character(df$mod_A), names=as.character(df$reg_A)), structure(as.character(df$mod_B), names=as.character(df$reg_B))) modul = modul[!duplicated(names(modul))] modul = modul[order(modul, names(modul))] mod_colors=c( rgb(171/255, 112/255, 83/255), ...
fe9a5d76bac3cdaa9436e100674fd42347d73f6159785fb659272de75d7011a0
R
1,957
80
setwd("/data/nas1/liuyiding_OD/project/01_project_147/11_Cor_GSEA/gsea") library(data.table) exp=fread("log2TPM.txt",header=T,data.table=F) exp=column_to_rownames(exp,"V1") exp=exp[,-c(1:40)] library(stats) library(clusterProfiler) genelist <- c("PATZ1", "SIN3B", "BLK", "MTHFD2") subFpkm <-as.data.frame(t(exp[genelist...
98291e4db9060d6b50fc5f25dc3b4e34bb7731628bbc0e0ff8f9c878d86b3ef2
R
1,962
62
#' Download example Seurat objects / single-cell data #' #' Download example Seurat objects / single-cell data required for #' ShinyCell tutorials. #' #' @param type can be either "single" or "multi" or "h5ad" or "loom" #' or "plaintext" #' #' @return downloaded Seurat object #' #' @author John F. Ouyang #' #' @im...
43fa75d5416194b98e246b40f64352e63bfd14209deed0e71e4839eb42372a33
R
1,963
61
#'--- #' title: Preprocess Gene Annotations #' author: mumichae #' wb: #' log: #' - snakemake: '`sm str(tmp_dir / "AE" / "{annotation}" / "preprocess.Rds")`' #' input: #' - gtf: '`sm lambda wildcards: cfg.genome.getGeneAnnotationFile(wildcards.annotation) `' #' output: #' - txdb: '`sm cfg.getProcessedDataDir()...
90160f796183cad6d5a5ca17878c42bde2fc43043de4cd76b6ffea589aa4bbb4
R
1,964
59
#' Reverse-combine logical membership columns into gene lists #' #' For each logical membership column, extracts the values of \code{main_col} #' where the column is \code{TRUE}, deduplicates and sorts them, and returns one #' gene list per membership column bound side by side. #' #' @param inputDF A \code{data.frame} ...
417141e3ebd58a23acb7a5dafa06ba786a2307d2a5358757aad30be9e1e6a868
R
1,967
45
# Clinically significant change #...................................................... # Documentation #' @title Clinically significant change #' @description This easy function calculates Clinically significant change (clinical cut-off scores) as defined by Jacobson and Truax (1991). #' #' @param SD_0 standard devia...
3a944727a76a86833c8935660228e511a2502f32e60f2e95af7e8afdca96f381
R
1,968
55
#'--- #' title: Count Split Reads #' author: Luise Schuller #' wb: #' log: #' - snakemake: '`sm str(tmp_dir / "AS" / "{dataset}" / "splitReads" / "{sample_id}.Rds")`' #' params: #' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`' #' - workingDir: '`sm cfg.getProcessedDataDir() + "/aberrant_splicing/datasets/"...
2c31a82620718216731b8a07ee9896a4da3776614bf03d46085631241d8683a4
R
1,975
77
# Load related function dir.base <- "." script <- list.files( path = file.path(dir.base,"function"), pattern = "[.]R$", full.names = T, recursive = T ) for (f in script) source(f) dir.data <- file.path(dir.base, "$data path$") # Data folder cohort <- "BRCA" dir.data.raw <- file.path(dir.data, cohort, "raw/"...
c7528088134b23a939884a9ef65c4ccab38c2ec842d3f37bf35099eeca1bc593
R
1,978
51
#' Compute the overlap between a CNV table and a list of genomic bins #' #' This can be regular windows throughout the genome or exons / genes for example. #' #' @param cnvs usual CNV `data.table` #' @param format format for the output table, "count" and "both" return a list #' @param bins for computing the overlap, by...
800eea267a2db5460d35d392b31ea2a5829aff3e3b9d39e20d15247112531354
R
1,988
47
#!/usr/bin/env Rscript # This is a helper script to run the pipeline. # Choose how to execute the pipeline below. # See https://books.ropensci.org/targets/hpc.html # to learn about your options. # Leaving USE_SLURM as FALSE will build each pipeline _in series,_ # one intermediate object at a time. Nothing wrong with ...
cc7d45ec5a4a851ee6f14b27cfa99a052e0b41ea4f4e4743b2e28b3c1b7a10e4
R
1,995
58
#'--- #' title: Filter Counts for OUTRIDER #' author: Michaela Mueller #' wb: #' log: #' - snakemake: '`sm str(tmp_dir / "AE" / "{annotation}" / "{dataset}" / "filter.Rds")`' #' input: #' - counts: '`sm cfg.getProcessedDataDir() + #' "/aberrant_expression/{annotation}/outrider/{dataset}/total_counts....
670a4a5e1f86258ef58a1eda9291c42b987748b8270d06a38c4a53875b92e5d8
R
2,003
111
## code to prepare internal dataset goes here ## based on https://r-pkgs.org/data.html#sec-data-sysdata ## Acceptable Olink platforms ---- # this tibble contains generic information about the Olink platforms that # Olink Analyze accepts, their names, regular expressions to determine them from # the data, quantificati...
ee27eb2a6fc32adc593c091c081a8aec0d1e4508b0a142e26dba68d1bccd1174
R
2,008
68
#!/usr/bin/env Rscript library(SummarizedExperiment) ## Create SummarizedExperiment (se) object from Salmon counts args <- commandArgs(trailingOnly = TRUE) if (length(args) < 2) { stop("Usage: salmon_se.r <coldata> <counts> <tpm>", call. = FALSE) } coldata <- args[1] counts_fn <- args[2] tpm_fn <- args[3] tx2g...
ba053f43331467d2052a1a6954e1374cc6aca3cd1c475f327c1177e9af3a731a
R
2,015
62
setwd("/Volumes/IqraMacFmri/visTac/fMRI_analysis/outputs/derivatives/decoding/glm_noResponse_forIMRF_includesAllSub") # Remove all variables rm(list = ls()) library(openxlsx) # import excel file library(reshape2) # reshape data library(ggplot2) # plots library(lmerTest) # linear mixed model library(emmeans) # multip...
433c113e5a68e022d4747d3d84376c739ad1f409427b4d3f610a8203cd149efe
R
2,016
84
--- title: "1p/19q co-deleted oligodendrogliomas" output: html_notebook: toc: TRUE toc_float: TRUE author: Jaclyn Taroni for ALSF CCDL date: 2020 --- This notebook will look at 1p/19q codeletions in the entire OpenPBTA cohort. The purpose is to identify samples that should be classified as 1p/19q co-delete...
54ef341c224ca1a03229dda4c8ebc5cde42bf03778234e5c5fa917b1f5b87532
R
2,017
53
context("Prepare the model from different objects") library(MOFA2) test_that("a MOFA model can be prepared from a list of matrices", { m <- as.matrix(read.csv('matrix.csv')) # Set feature names rownames(m) <- paste("feature_", seq_len(nrow(m)), paste = "", sep = "") # Set sample names colnames(m) <- paste("sampl...
12ce987a45a929dce01d3d9dffcd9f043d176d2b010217eeea0066307753bf21
R
2,026
53
#'--- #' title: Nonsplit Counts #' author: Luise Schuller #' wb: #' log: #' - snakemake: '`sm str(tmp_dir / "AS" / "{dataset}" / "nonsplitReads" / "{sample_id}.Rds")`' #' params: #' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`' #' - workingDir: '`sm cfg.getProcessedDataDir() + "/aberrant_splicing/datasets"...
1983a8825dcd25c62d3bcc71a8c16a46bded5f02d0b900177159f5e07e8cc3c8
R
2,027
58
# pROC: Tools Receiver operating characteristic (ROC curves) with # (partial) area under the curve, confidence intervals and comparison. # Copyright (C) 2010-2014 Xavier Robin, Alexandre Hainard, Natacha Turck, # Natalia Tiberti, Frédérique Lisacek, Jean-Charles Sanchez # and Markus Müller # # This program is free soft...
a0e1345bd83d081d27466a3c931f92460a6aaaad21ec8be9f135031ab1cb6ba0
R
2,028
63
##-------------------------------------## ## FEATURE SELECTION TAB ## ##-------------------------------------## calculate_hvg <- function(mat){ hvg <- modelGeneVar(mat) hvg <- as.data.frame(hvg) hvg <- hvg[order(hvg$bio, decreasing = TRUE),] return(hvg) } plot_varvsmean <- function(hvg, top, p...
b2a3763fd654bc580f6632c4b445e60a68e08e8f40c599515d00b3e3cbfb6219
R
2,029
72
rm(list=ls()) ## COMMON LIBRARIES AND FUNCTIONS source("100.common-variables.r") source("101.common-functions.r") source("300.variables.r") source("301.functions.r") ## SCRIPT SPECIFIC LIBRARIES ## ## library("doSNOW") library("foreach") ## loaded by doSNOW ## SCRIPT SPECIFIC FUNCTIONS if( 1 ) { if( exists("GA...
bbf205b5e19bd1afdcb4421e0345154d27ddd87f337bb10ec2423aede5a7707f
R
2,031
78
test_that(".validate_enrichment_input rejects empty gene vector", { expect_error( richR:::.validate_enrichment_input(character(0)), "empty" ) }) test_that(".validate_enrichment_input rejects all-NA genes", { expect_error( richR:::.validate_enrichment_input(c(NA, NA, NA)), "NA" ) }) test_that("...
3fac210bab981f7e43264bad3e84551a0788e6cdda3bbfe6da75c6a3fe2f3777
R
2,032
59
rfImpute <- function(x, ...) UseMethod("rfImpute") rfImpute.formula <- function(x, data, ..., subset) { if (!inherits(x, "formula")) stop("method is only for formula objects") call <- match.call() m <- match.call(expand.dots = FALSE) names(m)[2] <- "formula" if (is.matrix(eval(m$data, p...
884c6d9b8b2125ff9b7ce3de36eaac4c56cb440106162569657ca427ec479bfb
R
2,033
56
#'--- #' title: P value calculation for OUTRIDER #' author: Ines Scheller #' wb: #' log: #' - snakemake: '`sm str(tmp_dir / "AE" / "{annotation}" / "{dataset}" / "pvalsOUTRIDER.Rds")`' #' params: #' - ids: '`sm lambda w: sa.getIDsByGroup(w.dataset, assay="RNA")`' #' - parse_subsets_for_FDR: '`sm str(projectDir ...
c476d6f7b926f230361b4c22edcda4e4f13bcbf13e81ad72f378f629de885d5e
R
2,034
59
#Adapting the plot function from # https://github.com/PediatricOpenTargets/OpenPedCan-analysis/blob/785c3224de29f701b1c1b62841d0f84d46f7eaca/analyses/molecular-subtyping-embryonal/03-clean-c19mc-data.Rmd#L56-L112 # Apply this code to chromosome 2 since MYCN is on Chromosome 2 plot_chr2 <- function(cn_df, biospecimen...
e8471ed0e3e430ef6634e972d5d22421a7ac32d967c663667785c80c7b4603bb
R
2,038
63
############################################### # Mfuzz Clustering of Age-Binned TPM Profiles ############################################### # --- Load libraries --- library(Mfuzz) library(Biobase) # --- Input parameters --- outn <- "TPMs_by_AgeGroup5_Hours_CENGEN_zscore" # Base file name (no .csv) mfuzz_dir <- "/M...
7a65f61f9b03d1df1c515d7310bcb5e8d0bcc980a6429c1b10b9f5de14736bd5
R
2,041
78
# Extreme gradient boosting # Parallel processing ----------------------------------------------------- library(doParallel) all_cores <- parallel::detectCores(logical = TRUE) # for 8 core 16 thread machine, good performance running more than # physical but less than all logical registerDoParallel(cores = all_cores - ...
2741adc84abae58c1591c54227a34889d892460d21248318c2f3d023b94ef688
R
2,043
52
run_SCINA<-function(DataPath,LabelsPath,GeneSigPath,OutputDir){ " run SCINA Wrapper script to run SCINA on a benchmark dataset, outputs lists of true and predicted cell labels as csv files, as well as computation time. Parameters ---------- DataPath : Data file path (.csv), cells-genes matrix w...
7473043ebb6dcc2667c748daa13dc05269001b8a39e8d0f01e873bf274094853
R
2,044
55
#'--- #' title: RNA Variant Calling #' author: nickhsmith #' wb: #' log: #' - snakemake: '`sm str(tmp_dir / "RVC" / "Overview.Rds")`' #' params: #' - annotations: '`sm cfg.genome.getGeneVersions()`' #' - datasets: '`sm cfg.RVC.groups`' #' - htmlDir: '`sm config["htmlOutputPath"] + "/rnaVariantCalling"`' #...
ec505a2d7e8738b5dc09eb0bc0b0575cd401e5e1f272f66df852fe327759f5a2
R
2,046
61
# Author: Komal S. Rathi # Function: Function to classify MB subtypes # load libraries suppressPackageStartupMessages(library(tidyverse)) suppressPackageStartupMessages(library(medulloPackage)) suppressPackageStartupMessages(library(org.Hs.eg.db)) # function to run molecular subtyping classify_mb <- function(exprs_ma...
1260d8251a62d4e14c6414776208a8c43dfaf8dd8abce776170cc2d729d1d785
R
2,048
66
##-------------------------------------## ## NORM TAB ## ##-------------------------------------## tab_DEPTH <- tabItem( tabName = "Depth Normalization", sidebarLayout( sidebarPanel(width = 3, selectInput("norm_method", label = "Select m...
0eafbd625da57c2e741d7483369beccd92942eff01fd55ce9f0b29384ba49650
R
2,061
59
test_that(".clean.char removes newlines", { expect_equal(richR:::.clean.char("foo\nbar"), "foo bar") expect_equal(richR:::.clean.char("no newlines"), "no newlines") }) test_that(".filter_ora_result filters by pvalue", { df <- data.frame( Annot = c("A", "B", "C"), Pvalue = c(0.01, 0.05, 0.1), Padj = c...
c8a0045be7a2a44ab3efb0c84380cf5380d688d39a5ca090e7c03bf258a5e346
R
2,061
66
########################### Process configuration file ################ # # Objective: Process parameters from configuration file ########################### <<<<<>>>>> ############################################## # Load libraries library(yaml) # Read configuration file load_configs <- function(path) { # Read ...
b2d063aadd0d12460305f95e99c5035241dfa1245896cb46ae474d4d7f15eab1
R
2,063
85
library(doMC) library(fields) library(ggplot2) registerDoMC(cores=20) # Your FAM file here famfile <- "" # Your phenotype file here phenofile <- "" # Number of eigenvectors used ndim <- 10 lpx <- list.files(pattern="pcsX") lpy <- list.files(pattern="pcsY") lpu <- list.files(pattern="eigenvectorsX") names(lpx) <- ...
2f065e096431ba6119be7957eb0f5d1ec31fd2fd4f1b8c9533163a999d32ed5e
R
2,066
64
## ========================= ## Experiment I vs. II: sham (amygdala) vs sham (hippocampus) ## ========================= if (!requireNamespace("here", quietly = TRUE)) install.packages("here") source(here::here("stats","lme_models","_setup.R")) # acquisition: CS run_lmer_test( data_name = "scr_df_exp_acq_sham_CS",...
d78033e11465c5a234503dc8ff556ac0e6c0f25bac34a838a1b45f08e347b6c7
R
2,068
60
DA_plot_prepper = function(DA_df, limit_p = 0.1, limit_e = 0.25, name_cutoff = ".*ales_", sig_symbols = c("*" = 0.1, "**" = 0.01, ...
89b064be888ad4732dfb17af3741226e8664e1890bafca0e3410a82d742e3ec7
R
2,072
76
# 00-subset-for-EPN.R # # Josh Shapiro for CCDL 2020 # # Purpose: Subsetting Expression data for EPN subtyping # # Option descriptions # -h, --histology : path to the histology metadata file # -e, --expression : path to expression data file in RDS # -o, --output_file : path for output tsv file, optionally gzipped wit...