sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
d6549b0fe4de77cb8e8feb4ba3a6b67dfd8bf26ece8a24ad76856f2cd8a2388c | R | 3,268 | 134 | ##########################################################
# LC analyses: spatially-aware clustering using BayesSpace
# Lukas Weber, Oct 2022
##########################################################
# module load conda_R/4.2
# Rscript filename.R
# file location:
# /dcs04/lieber/lcolladotor/pilotLC_LIBD001/locus-c/
... |
c7f4d1bba5899d2fabf04415ff4613b9fb5698b9abc69bd8cc83aac5ed4731c2 | R | 3,269 | 62 | # This type of error handling will not always work if run using the parallel library
# It should be run using the --sgeN flag
library(nlme)
processVoxel <-function(v) {
Y <- voxeldat[,v]
e <- try( mod1 <- lme(Y ~ age+ time + domain + target, random=~1+time|idnum, method=c("ML"), na.action=na.omit, control=... |
7a424db77b3f250edcf3cb90b3e0b1b641c88b84c2ae2f8517aaed16bf7b9160 | R | 3,270 | 143 | ---
title: "1 Defining intra-tumour programs of heterogeneity"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Tutorial}
%\VignetteEngine{knitr::rmarkdown}
\usepackage[utf8]{inputenc}
---
```{r setup, include = FALSE}
knitr::opts_chunk$set(collapse=FALSE,
comment="#>",
warning=... |
0ec543c53b2cb5f16423a92d7e7f3ee3fef4123346125b8ef4f4150547623077 | R | 3,272 | 93 | library(here)
library(tidyverse)
library(CoExpNets)
# Function for testing overlap between NSL regulons
#gene1 <- c("KAT8")
#gene2 <- c("KANSL1")
#results_df <- gt_aracne
fishers_test_targets <- function(gene1, gene2, results_df){
# Filter for each gene
df_gene1 <- results_df %>%
filter(Regulator_gene == gene... |
dca187bdf9c3a7c74840164239cb0f3e27b7a466abb3be4c1f715b7763d478da | R | 3,274 | 95 | library(gplots)
library(ggplot2)
library(reshape2)
library(scales)
heatmap.with.labels = function(cor.data, min, max, label) {
ggplot(melt(cor.data),
aes(Var2,ordered(Var1,levels=rev(levels(Var1))),fill=value)) +
#aes(Var2,Var1,fill=value)) +
scale_fill_gradient2(low=muted("red"),mid="white",... |
0619b2ccc2fc4cfd8c61b055d6d17489ed8581c08760b4dac85ac50fa10c8ba4 | R | 3,276 | 96 | #!/usr/bin/env R
# Author: Sean Maden
#
# Get example simulation results for main figure. Make results scatterplots
#
libv <- c("lute", "reshape2", "ggplot2", "dplyr")
sapply(libv, library, character.only = T)
# load
env.path <- './deconvo_review-paper/output/fig4_data.RData'
load(file=env.path)
# get simulation ... |
1cb93d4e069f95de0c819f585600dad9706834ecffeb346e87129342e89d3a8e | R | 3,280 | 96 | #!/usr/bin/env R
# Author: Sean Maden
#
# Get example simulation results for main figure. Make results scatterplots
#
libv <- c("lute", "reshape2", "ggplot2", "dplyr")
sapply(libv, library, character.only = T)
# load
env.path <- './deconvo_commentary-paper/output/fig4_data.RData'
load(file=env.path)
# get simulat... |
7262b28a98c86db427ff3b023d224a5a51bc273f53c21fdff9349ba5f42300fc | R | 3,281 | 102 | ss <- function(x, pattern, slot = 1, ...) {
sapply(strsplit(x = x, split = pattern, ...), '[', slot) }
options(stringsAsFactors = F)
## packages for data table processing/plotting
library(tidyverse)
library(rcartocolor)
library(ggsci)
## main Seurat package snRNA-seq pacakges
library(Seurat)
library(SeuratDisk)
li... |
9ea6a70b0dc11ed41599b22852021f84cde2cc56a0b011eb009cfd0f48ea7b6a | R | 3,283 | 76 | #' calculates MATH (Mutant-Allele Tumor Heterogeneity) score.
#'
#' @description calcuates MATH scores from variant allele frequencies. Mutant-Allele Tumor Heterogeneity (MATH) score is a measure of intra-tumor genetic heterogeneity.
#' High MATH scores are related to lower survival rates. This function requies vafs.
... |
a56d627bc996af95be5f4069a8e53e67e7f7537e4e8a14bab7493fd23f80af9e | R | 3,285 | 79 | library(here)
library(tidyverse)
library(CoExpNets)
# Checking presence of genes within GCNs under synonyms
#input_gene_list <- PD_GWAS_genes
#result_gene_list <- PD_GWAS_genes$gene
#tissue = "FCortex"
#which.one = "gtexv6"
check_synonyms <- function(tissue, which.one, input_gene_list, result_gene_list){
# Obtain l... |
5665b6ce96ab7eb513a5195064e33bdae1b27b4d042b489f9a774bb412451b80 | R | 3,291 | 95 | # this code draws barplot for the p-values from cox regression on
# Chowell 2018 patients with HLA-Is that can be matched to one of
# the 85 HLA-I alleles from Emerson data
library(ggplot2)
library(ggpubr)
result_dir = ("../results")
cox_table = "st13_chowell_2018_survival_outcome_cox.csv"
df = read.csv(paste0(resu... |
6fa46191772eff3836a6cedaf9e517c32d54edc253d6a22f18151c2fa7580f26 | R | 3,295 | 79 | library(here)
library(tidyverse)
library(CoExpNets)
# Checking presence of genes within GCNs under synonyms
#input_gene_list <- PD_GWAS_genes
#result_gene_list <- PD_GWAS_genes$gene
#tissue = "FCortex"
#which.one = "gtexv6"
check_synonyms <- function(tissue, which.one, input_gene_list, result_gene_list){
# Obtain l... |
f9078db7430db324ad2b577707d45da408e4e4a5cff970aae402df4558074a92 | R | 3,295 | 88 | # The side aesthetic attaches line segments to one side of the label:
#
# ggplot(...) + geom_text_repel(..., side = "left")
#
context("side")
# A box spanning x from 0 to 2 and y from 0 to 1.
box <- c(0, 0, 2, 1)
test_that("side = 0 attaches to the closest side of the box", {
# Point below the box attaches to the... |
c86d929cf460d4ebdb15d927c6a94c4215251047647de74229b16c9de5328380 | R | 3,301 | 107 | library(tidyverse)
library(rlang)
Sys.setenv("_R_USE_PIPEBIND_" = TRUE)
projdir <- here::here()
rpacdir <- file.path(projdir, "package/R")
workdir <- file.path(projdir, "04.cCREgene/sa2.cicero")
pdcsumdir <- file.path(workdir, "out/sa2pdcsum")
pdcdir <- file.path(workdir, "out/sa2pdc")
# * meta
subclassfnm <- file.pa... |
076904643b4b8a7d6ae64324ea829eb04a088660c240a2587482abb591119724 | R | 3,309 | 118 | #!/usr/bin/env R
# Author: Sean Maden
#
# Heatmaps for main figure summarizing deconvolution.
#
#
library(ComplexHeatmap)
set.seed(0)
#-----------------
# simulate markers
#-----------------
# simulate cells by type
# neuron data
num.neuron <- 5
neuron.data <- unlist(lapply(seq(num.neuron), function(index){
c(rpo... |
620e07023439cd0500accb2f63e8d640e7c2be883b456d18fb5f05111747515e | R | 3,314 | 102 | .hca_cor = function(m, method) {
method = match.arg(method, scalop::cor.methods)
if (method == 'none') return(m)
if (is_cor(m)) {
warning('\nComputing correlations over a correlation matrix...\n',
'Set `cor.method = "none"` to skip correlation step.')
}
stats::cor(m, method =... |
0cc25277dfefb5dfd3a220855036ac059cca10f0194007b58c76b47d89d9da7f | R | 3,320 | 107 | if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("Biobase")
BiocManager::install("limma")
BiocManager::install("SingleCellExperiment")
BiocManager::install("TOAST")
library(Biobase)
library(limma)
library(SingleCellExperiment)
library(dplyr)
libr... |
4478e88eb27512440cb1e8f6180bd468a19c16e66e25e5501e524979484fe651 | R | 3,321 | 114 | #' @export
loadGRFromBed <- function(bedFile,
header = FALSE,
sep = "\t",
colnms = c("chr", "start", "end", "name")){
beds <- data.table::fread(file = bedFile,
sep = sep, header = header)
if(!header) {
colnms <- colnms
coln... |
b70cc1c92870c81c9ce14a07802c03484f241bcba729e813b54ac87d652440cc | R | 3,324 | 57 | #' Prepares MAF file for MutSig analysis.
#' @description Corrects gene names for MutSig compatibility.
#' @param maf an \code{\link{MAF}} object generated by \code{\link{read.maf}}
#' @param fn basename for output file. If provided writes MAF to an output file with the given basename.
#' @details MutSig/MutSigCV is mo... |
eace85a18175a95d6adcce9250a9a512c116f285f79de41c179b3c1325dd3cbd | R | 3,329 | 99 | library(Seurat)
library(Signac)
library(EnsDb.Hsapiens.v86)
library(dplyr)
library(ggplot2)
######## Generate a Seurat object for one single sample ########
## Select one sample and set the working directory to the folder including its raw data
sampleID = "150656"
setwd(paste("../data", sampleID, sep = "/"))
## Rea... |
a5c405e8738cc77255df9543a4387e32a49d11a8ba5e7e9df2bf2ff64915dd36 | R | 3,330 | 85 | library(data.table)
library(kimisc)
library(rjson)
args <- commandArgs(TRUE)
filedir <- args[1]
chr <- args[2]
xmin <- as.numeric(args[3])-500000
xmax <- as.numeric(args[4])+500000
eqtlgenes <- args[5]
eqtlgenes = unlist(strsplit(eqtlgenes, ":"))
eqtlplot <- as.numeric(args[6])
ciplot <- as.numeric(args[7])
ensg_v <- a... |
65ad0e26095e3b2791015813dc82d44a8292eebcb534e8f23b8cab876aa2fb49 | R | 3,334 | 84 | ## conda activate r4
## packages for data table processing
suppressPackageStartupMessages(library(here))
suppressPackageStartupMessages(library(tidyverse))
suppressPackageStartupMessages(library(rlang))
suppressPackageStartupMessages(library(optparse))
ss <- function(x, pattern, slot = 1, ...) {
sapply(strsplit(x ... |
33940ed38c28d7f4cb8c621e5ad550eed884a0d5b64a4dbdc1049c41c967821d | R | 3,339 | 70 | #' Compare genes to known TCGA drivers and their biological pathways
#' @description A small function which uses known cancer driver genes and their associatd pathways from TCGA cohorts. See reference for details
#' @param m an \code{\link{MAF}} object
#' @param genes genes to compare. Default `NULL`.
#' @param top Top... |
06e3a48502051e4df22363eab009b209847130d0cb05afc68a83b9703172c04f | R | 3,350 | 70 | # Match each derived measurement row to locally supplied restricted HCP covariates.
args <- commandArgs(FALSE)
file_arg <- args[grepl("^--file=", args)]
this_file <- if (length(file_arg) > 0) sub("^--file=", "", file_arg[1]) else "scripts/00_prepare_restricted_covariates.R"
this_file <- gsub("~+~", " ", this_file, fixe... |
2107918717cba6735e82c574cad9550923f99b44c80719adf4742bd1a56d7a59 | R | 3,354 | 152 | # 05/23/2023 Fengyao Yan
# Apply tissue deconvolution using NNLS on the CMP data
library(tidyverse)
library(ggplot2)
library(nnls)
library(Metrics)
library(data.table)
library(doParallel)
library(parallel)
# multicore setup
cores <- 48
registerDoParallel(foreach)
mse_all <- NULL
pcc_all <- NULL
is_sens_test <- TRUE... |
6fe00ee8a8067167a228569f6f39a2e61e1951499a7892ec077b6d5d5d48a3b0 | R | 3,354 | 93 | ## conda activate r4
## packages for data table processing
library(here)
library(tidyverse)
library(RColorBrewer)
library(rcartocolor)
library(ggpubr)
## AUCell object for DNA damage estimates
library(Seurat)
library(SeuratDisk)
library(AUCell)
## statistical analyses
library(tidymodels)
library(lme4)
library(broom.... |
1e7378c0fc15c692febdfb7ed6a6c295dfe1911bd3fe2722d41bfc9b3a9b74f6 | R | 3,358 | 107 | #dir('../OscopeData/dataAdjacencyMatrixe02/',pattern='.csv')
library(igraph)
####GRAPH filename
genedet='../OscopeData/GenesLabels/Mapping/SVZa.txt'
netdirList=c('../OscopeData/dataAdjacencyMatrixe02/','../OscopeData/dataAdjacencyMatrixePiDiv9/','../OscopeData/FirstData/')
outdirList=c('../Communities/Networks02/','..... |
2f61b723ddb7df5ec7b314cbeb52b2df1dddaab10ac7e57d82ede20d3ae04245 | R | 3,360 | 86 | library(monocle3)
library(viridis)
library(ggplot2)
library(here)
source("/data/users/jared/ENS/Timecourse_ENS/scripts/accessory_functions/monocle_mods.R")
#Define function to create a plot for a given pattern
plotCellPatterns = function (pattern_number, cds_obj, red_method = "UMAP", do.clip = NULL, pattern_prefix = "... |
06f403e093af9b0f79741073dea5002d09b8b254e756db18a4bd4c243ba62866 | R | 3,375 | 80 | #' Creates a bar plot
#' @description Takes an MAF object and generates a barplot of mutated genes color coded for variant classification
#' @param maf an \code{\link{MAF}} object
#' @param n Number of genes to include. Default 20.
#' @param genes Manually provide names of genes. Default NULL.
#' @param color named vec... |
7aa7c8dae9a7f4dfb278071787d47337feef86559a5aa05c9cca203c3b5b9a2d | R | 3,376 | 96 | ---
title: "Supplemental Figure 4"
author: "Stephen P. Plassmeyer"
date: "5/16/2021"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
source('../../../../code/mpra_tools/mpra_tools.r')
library(ggpubr)
library(MASS)
theme_set(theme_bw(base_size = 8))
```
```{r... |
fea96b4f964a073a2befa4c91e5b24bd810d76f8227db134916798766ca7550f | R | 3,377 | 80 | ss <- function(x, pattern, slot = 1, ...) {
sapply(strsplit(x = x, split = pattern, ...), '[', slot) }
options(stringsAsFactors = F)
## packages for data table processing/plotting
library(SingleCellExperiment)
library(ComplexHeatmap)
library(rcartocolor)
library(data.table)
library(tidyverse)
library(ggsci)
library... |
56810c50e0e561eca3546231a579f1cc051669e281e0ae4eadb2d3d297ab2803 | R | 3,380 | 87 | library(MAST)
library(parallel)
if(!require(data.table)) {
install.packages(data.table, dependencies = TRUE)
}
library(data.table)
args <- commandArgs(trailingOnly = TRUE)
out_dir <- args[1]
split_num <- args[2]
# set up parallel backend
options(mc.cores = detectCores() - 1)
## Load data
exp_data <- read.csv(paste... |
ca0d6cf69e6b37d388fdc16ce9a02695156a5920e50e39b834baa9391bd0db96 | R | 3,380 | 154 | # Allele age estimation from filtered pairs
rm.dupl = function(x) {
k = sprintf("%d %d %d %d %d", x$SampleID0, x$Chr0, x$SampleID1, x$Chr1, x$Shared)
if (any(duplicated(k))) {
w = which(!duplicated(k))
x = x[w,]
}
x
}
qc.tmrca = function(x, ne) {
est = (x$Shape / x$Rate) * ne
est = round(est/10)* 10
con ... |
45f0c5495260a442a25008bd5ffaf10e14ac432b812bec40c686510f522d89aa | R | 3,392 | 95 | #' Convert a gene list for \code{query_gene_ctd} to correct species.
#'
#' Allows user to convert between species dependent on species in the query gene
#' vector and the ctd matrices of interest.
#'
#' @param genes Query genes as a vector of MGI or HGNC symbols.
#' @param genelistSpecies Either 'mouse' or 'human' depe... |
dda946b68071a7f9bca977c410e856a17a195072cd8ebaa17f5655ab0ef74f26 | R | 3,393 | 81 | library(tidyverse)
library(data.table)
library(rtracklayer)
library(here)
ss <- function(x, pattern, slot = 1, ...) {
sapply(strsplit(x = x, split = pattern, ...), '[', slot) }
options(stringsAsFactors = F)
options(repr.plot.width=11, repr.plot.height=8.5)
DATADIR='data/tidy_data/ldsc_interferon_response'
dir.crea... |
0874d9fa5fc86012ceac7174255efbe9c60aff92062f899bece010861e526b45 | R | 3,396 | 117 | ##' isLoaded
##'
##' @title The internal functions of the \code{scapGNN} package
##' @description Determine if the package is loaded.
##' @param name Internal parameters.
isLoaded <- function(name) {
(paste("package:", name, sep="") %in% search()) ||
(name %in% loadedNamespaces())
}
##' create_scapGNN_... |
4bc1cd3008e31ec61ec65ab9e0f68f0312a3f46e7c419760563ddb605df90619 | R | 3,406 | 102 | # supplemental figure qc metrics and lineage markers for multiomes
# figure multiome umap
library(Seurat)
library(Signac)
library(here)
library(ggplot2)
# create a plot dir
plots <- here("ckd","figures")
dir.create(here(plots))
multi <- readRDS(here("ckd","multi_aggr_prep","step3_multi_loy.rds"))
plotA <- VlnPlot(m... |
4d05edefc514ea5d9b14d4ba6d83dff5cb218eca92e46eeaa2dd99ea649e8182 | R | 3,409 | 145 | ---
title: "Liu et al. 2019 data hla ii plots with survival, three colors"
author: "Si Liu"
date: "`r Sys.Date()`"
output:
html_document:
theme: journal
highlight: tango
toc: true
toc_depth: 3
toc_float:
collapsed: true
smooth_scroll: false
number_sections: false
df_print: paged... |
98bc2beb32d273a82ec1ac116783ff0f75a9eedf8badf2bfbc1ad82b565f72db | R | 3,411 | 65 | Imputation Report
========================================================
Date: `r as.character(format(Sys.Date(), format="%B %d, %Y"))`
```{r fig.width=7, fig.height=6, echo=FALSE, results='asis'}
suppressPackageStartupMessages(library(ggplot2))
suppressPackageStartupMessages(library(xtable))
args<... |
f0d854f0e685cda5cf70a75ca3ae103974b6b8e850917ee19c37b71f316fa0fa | R | 3,418 | 96 | suppressMessages(library(dplyr))
suppressMessages(require(TxDb.Rnorvegicus.UCSC.rn6.refGene))
require(org.Rn.eg.db)
library(annotate)
library(GenomicRanges)
library(argparse)
library(broom)
parser <- ArgumentParser(description = "process input arguments")
parser$add_argument("--celltype", action = "store",
help = "na... |
06852b171a0e068720c090cba330029ea6419e54fa1a0ad33f9de5e0b49b163d | R | 3,424 | 76 | ##projections were done independently, but should be a way to merge the two technologies into one embedding
##merge the cds's here. Count data might not be comparable but the embedding in projected patterns will be
source(here("./scripts/accessory_functions/monocle_mods.R"))
source(here("./scripts/accessory_functions/... |
e9ee1ab9b55e05ae01ae7b2e9d05fd09efe59e7e4c6ceed57d35746d1173a0c1 | R | 3,426 | 83 | ## conda activate r4
## main Seurat package snRNA-seq pacakges
library(Seurat)
library(SeuratDisk)
library(future)
## packages for data table processing
library(here)
library(tidyverse)
library(writexl)
ss <- function(x, pattern, slot = 1, ...) {
sapply(strsplit(x = x, split = pattern, ...), '[', slot) }
options(... |
a8c6ac67c17ff28f6addc3865f8bca4ac2fe23df6c7fe90eba43369cf70a4da0 | R | 3,433 | 75 |
#Script shared from Charles Zheng 10/11/2020
#Classify cells into cell cycle stages with better resolution than Cyclone
#Gene sets to use from
library(devtools)
library(dplyr)
library(stringr)
#devtools::install_github('danielschw188/Revelio')
assignCC <- function(log.s.m, batch, cycleGene.l = NULL, corThres = 0.... |
e2daca266ac779ac402cd76989dcd3ca775e6803be8c558d7912b18dac2b2a93 | R | 3,433 | 144 | ---
title: "Liu et al. 2019 data hla i plots with survival, three colors"
author: "Si Liu"
date: "`r Sys.Date()`"
output:
html_document:
theme: journal
highlight: tango
toc: true
toc_depth: 3
toc_float:
collapsed: true
smooth_scroll: false
number_sections: false
df_print: paged
... |
937271ca36d023ba994793d009a01050fb19800f0ab232f01704be78be9c0b46 | R | 3,434 | 107 | ## extracted code from the edgeR software to explore TMM normalization
## test stability of TMM factors:
## - for counts matrix:
## counts.matrix = read.table("Trinity_trans.counts.matrix", header=T, row.names=1)
## sort(calcNormFactors(counts.matrix[,sample(ncol(counts.matrix))]))
## - for TPM matrix
## tpm.matr... |
5a991195431bb58d9776d884775b11c5003eca63be4ad89017be0ee377e7fcaa | R | 3,448 | 70 | ##Visualize MENS + neuronal markers in Vanderbilt data
library(monocle3)
library(scrattch.vis)
library(here)
library(tidyverse)
source(here("scripts/accessory_functions/prep_sparklines_data.R"))
cds <- readRDS(here("vanderbilt/data/cds.vanderbilt.10x_inDrop_annotated.rds"))
pData(cds) <- pData(cds) %>%
as.data.fr... |
f505ee0caf8748c400d38d0be1e0281893075c362af60c6cdfe4b98299512ed3 | R | 3,450 | 136 | library(tidyverse)
library(rlang)
library(rlang)
library(data.table)
library(reticulate)
library(furrr)
plan(multicore, workers = 5)
options(future.globals.maxSize= 15e9)
library(future.apply)
library(gamlss.dist)
library(gamlss)
library(fitdistrplus)
rdir <- file.path(here::here(), "package/R")
import::from(.from = ... |
3d9fdc54d17836cf95763d42779e50e6b290dd80913facecb039c374cfcc17f9 | R | 3,451 | 84 |
#' Write an output makefile
#'
#' Generate a makefile for running a specific analysis
#' @param prefix Prefix for output, to be prepended to outputs
#' @param resultnames List of names for the expected outputs
#' @param modelfile Name of the R model file that contains the processVoxel command
#' @param designmat Desig... |
18ca7bcb55735ea00c6b90605b82f1fb926a20bb474478ad5d2175ee142695d5 | R | 3,454 | 171 | ---
title: "BIDS Viewer"
params:
df: "image_paths"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
runtime: shiny
source_code: embed
runtime: shiny
---
```{r setup, include=FALSE}
```
# Viewer
Column {.sidebar data-width=250}
-------------------------------
... |
52b646fb1cef7204c4b065460303a171d6a86b27342ff1a187f098235dfcf577 | R | 3,457 | 73 | library(ggplot2)
# Read the data
Data = read.csv('G:/Dropbox (Personal)/Brain/Project/Paper/DataForPaper/ForR.csv')
# Aggregate all experiments CellType-metrics at each session type and cell type , calculating the mean,min,max and sem
myData <- aggregate(Data$ByCellType,
by = list(Cell = Data... |
6b8655ba57e39a08073668b3cf953098bf3091932baf3fed32382db23bd904c8 | R | 3,457 | 75 | #' @rdname colorization
#' @title Colorize cell clusters based on spatial distribution
#' @name colorize
#' @description
#' Colorize cell clusters based on spatial distribution, so that spatially interlaced and spatially neighboring clusters are assigned with more perceptually different colors.
#' SpacoR provides 3 bas... |
029e3de0d8652a6b24459f4cb9c238b56c060605e34144352a6268275f71a862 | R | 3,459 | 116 | .initialize_bam_access <- function(bam_path, verbose = TRUE) {
# Load required library functions
if (!requireNamespace("Rhtslib", quietly = TRUE)) {
stop("Rhtslib package is required but not available. Please install it with: BiocManager::install('Rhtslib')")
}
tryCatch({
# Open BAM file
bam_file ... |
3e6575914ac4691d4c6f3eaf6b2d6b318a455b291d810c6c70b52ff01dfc14cb | R | 3,464 | 93 | ## conda activate r4
## packages for data table processing
library(here)
library(tidyverse)
## main Seurat package snRNA-seq pacakges
library(Seurat)
library(SeuratDisk)
library(future)
library(SingleCellExperiment)
library(DelayedArray)
library(HDF5Array)
library(Matrix.utils)
ss <- function(x, pattern, slot = 1, .... |
3c990d3b783e374ce93afcb09d18a50b187ae87c3e15fa5ccfe66460363a7347 | R | 3,466 | 124 | # ref: https://rpubs.com/TX-YXL/662586
#' @export
dendro_data_k <- function(hc, k) {
hcdata <- ggdendro::dendro_data(hc, type = "rectangle")
seg <- hcdata$segments
labclust <- cutree(hc, k)[hc$order]
segclust <- rep(0L, nrow(seg))
heights <- sort(hc$height, decreasing = TRUE)
height <- mean(c(heights[k], he... |
75df4643a96e5d04029986102df1c50b62f00a4ab279f1238a2bc356523e359c | R | 3,467 | 76 | ---
title: "Analyzing the Rate of Chimeric Reads"
author: "Stephen P Plassmeyer"
date: "5/15/2020"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(tidyverse)
library(data.table)
library(plyr)
```
```{r}
analyze_mismatches <- function(sequencing_run, compiled_data, exc... |
89d923af8cc7a431eb86511782b386cea54d4b4068f1e5ed7da6dddf3f25b51d | R | 3,469 | 84 | #' A graphical summary of the code uses.
#'
#' Given an object of class \code{comorbidity}, and the file which contains the
#' codes.
#'
#' @param codesPth Determines the path where the file with the index diseases is
#' located (indexDiseaseCode)
#' @param input A comorbidity object, obtained applying query functio... |
f3178a96274209ee9d4cddc06bcc8c9b6105556f85df5b6e13823359fac859c0 | R | 3,476 | 75 | #' @title Split a vector, list, matrix or dataframe into into a list of matrices or nested list according to substring matches.
#' @description subsplit() divides the data in 'x' into groups defined by the presence of shared substrings. If 'x' is a list, the substrings are derived from 'names(x)'. If 'x' is a matrix o... |
afc1b27a8114993c7990f73c33d11fb02f5cc2abfe9f581de61338fd4e45df81 | R | 3,479 | 95 | ---
title: "R Notebook"
output: html_notebook
---
# Set Up
```{r setup}
knitr::opts_knit$set(root.dir = normalizePath("../.."))
```
# Imports
```{r}
library(finalfit)
library(mice)
library(purrr)
library(dplyr)
library(lavaan)
library(ggplot2)
library(gplots)
source('functions/mediation.R')
source('functions/med.plot... |
52efe5165aa711979c493e0b6bcf708ce248f293f05601edc8c3aa8e3b035e7c | R | 3,498 | 89 |
library(igraph)
library(gridExtra)
library(VennDiagram)
######Venn Diagrams
#https://rstudio-pubs-static.s3.amazonaws.com/13301_6641d73cfac741a59c0a851feb99e98b.html
####GRAPH filename Very Stringent case
filename1='../OscopeData/dataAdjacencyMatrixe02/SVZbootstrap_CPUDPSF_TF_2000Boot_data_qNSC_C60G7883_edgeNetwork... |
3a0163f005ef415009ece0d844f219967575e31abdd86e17a94e8d72d296dc47 | R | 3,500 | 60 |
library("gamlss")
pop_norms <- read.csv("~/r_files/pop_norms.csv")
boys_abcd = subset(pop_norms, pop_norms$Dataset == 'ABCD' & pop_norms$Gender == 1)
boys_not_abcd = subset(pop_norms, pop_norms$Dataset != 'ABCD' & pop_norms$Gender == 1)
x_axis = make.names("Age")
y_axis = make.names("TMT.PRED.AVG.filtered")
data_... |
5f9c58b7347dda53180e66515b9dd5fee363053cae7f853729d93f43ff6341a9 | R | 3,501 | 127 | library(SnapATAC)
library(rjson)
library(optparse)
library(pureRUtils)
op <- list(
make_option(c("--config"), type = "character", default = "config.json"),
make_option(c("--group"), type = "character", default = "GABA_1")
)
args <- parse_args(OptionParser(option_list = op))
pureRUtils::checkArgsExistOrStop(args)... |
8006d5d196e352fb6b6960fb18f5702e68c32d552ebcaa314bcf31be9b3929d5 | R | 3,501 | 94 | ss <- function(x, pattern, slot = 1, ...) {
sapply(strsplit(x = x, split = pattern, ...), '[', slot) }
options(stringsAsFactors = F)
## packages for data table processing/plotting
library(tidyverse)
library(tidymodels)
library(broom)
library(rcartocolor)
library(data.table)
library(ggsci)
library(here)
library(ggv... |
5c6ebcfa14cc55439aff55967e08f946f2dd25bdebebb36c2b293b31a818e2df | R | 3,511 | 72 | ---
title: "Reformatting Fluorescence Data"
author: "Stephen P Plassmeyer"
date: "4/23/2020"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
Make the following adjustments:
* Re-label elements to match the element names given in Mike R's library
* Re-label columsn to m... |
37c3c718ad70501cbd206ef8cee2634e2fa48ec3f71a107092207fcc3a3be770 | R | 3,515 | 96 | ######################
##### Plot setup #####
######################
# Last edited: 31/03/23 by LVB
# Description: Plot setup, including ggplot theme, labellers, colour palettes,
# and functions to combine and save figures with the appropriate dimensions.
#----- Packages
library("tidyverse")
library("MetBrewer")
lib... |
e0c289102a7d3e9f325cb6209c2e2dbc7f19bac0b6a76cbe0d59cad690e8a7e9 | R | 3,522 | 108 | #' @rdname plotTopicProfiles
#' @name plotTopicProfiles
#' @title Plot NMF topic profiles
#'
#' @description This function takes in the fitted NMF model and returns the
#' topic profiles learned for each cell \code{facet = FALSE} or cell type
#' \code{facet = TRUE}. Ideal training will return all the cell from the ... |
92e8c912810b5054a57394dc4f33879823646f5d3ce395d3613624514032502f | R | 3,527 | 164 | #nb stepbreaks values should be strictly increasing.
run_WC <-
function(rgc.file,sc.file,op.file, k=1,
alpha=0.1,
sijmin=0.00001,
timestep=0.0001,
dist=0.07,
dist.bij=0.0289,
stepbreaks=c(1,2500,5000,7500,10000,12500,15000,17500,20000),
minnoise=0,
maxnoise=0,
initsij="small",
EPS=1,
EPSA=1,
EPSB=1,
chem... |
c64c35c5cce42478c66942fcc561a48726e4612438b70fba2f184dd4441bf862 | R | 3,528 | 108 | #' Dataframe-based biomart query.
#'
#' @param dataframe Dataframe with gene names.
#' @param columnToFilter Name of column in dataframe, which contains gene names.
#' @param mart Specify genome build.
#' @param ensembl_version character scalar. If using GRCh38 genome build, can
#' specify ensembl version (as given b... |
1f61258f6cc5f2d1960598afbe1624207ff9082ae2f2ca9adaa11f80eb4f6d8e | R | 3,534 | 94 | library(AUCell)
library(readxl)
library(tidyverse)
library(here)
## main Seurat package snRNA-seq pacakges
library(Seurat)
library(SeuratDisk)
library(future)
library(BiocParallel)
library(doParallel)
library(rcartocolor)
ss <- function(x, pattern, slot = 1, ...) {
sapply(strsplit(x = x, split = pattern, ...), '['... |
a5098e76793b3bdf05409d6ddfc80c0385a2487cf07d8655c9021152382c7f20 | R | 3,534 | 92 | #=========================================================================
#
# Copyright NumFOCUS
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/license... |
46277d736d5c811ddcb51950b3c4f79565847439849def2af37750c7e5f13a74 | R | 3,535 | 137 | ---
title: "Averge of predicted scores from 20 models"
author: "Si Liu"
date: "`r Sys.Date()`"
output:
html_document:
theme: journal
highlight: tango
toc: true
toc_depth: 3
toc_float:
collapsed: true
smooth_scroll: false
number_sections: false
code_folding: hide
df_print: ... |
6605e304f0e7a3d8632f7bd3e9a05d9985e3b1517abae998f3c959adb6ba3c60 | R | 3,535 | 83 | ss <- function(x, pattern, slot = 1, ...) {
sapply(strsplit(x = x, split = pattern, ...), '[', slot) }
options(stringsAsFactors = F)
## packages for data table processing/plotting
library(tidyverse)
library(rcartocolor)
library(data.table)
library(ggsci)
library(ggh4x)
library(here)
DATADIR='data/tidy_data'
## ma... |
80ce44180d5733b951b5f25f605375cef8e1e6ec99f32dc0b1f17271fceb2851 | R | 3,537 | 124 | #' @export
getRegionPal <- function(brainRegionMeta, regionType = "MajorRegion") {
pal <- brainRegionMeta[, paste0(regionType, "Color")]
names(pal) <- brainRegionMeta[, regionType]
uRegion <- unique(names(pal))
uPal <- pal[uRegion]
return(uPal)
}
#' @export
getRegionInfo <- function(snap,
... |
1ee77ca13a128634f1ac44ec2a385f10a413dae580d5789974de6df3fd163e2b | R | 3,542 | 83 | ss <- function(x, pattern, slot = 1, ...) {
sapply(strsplit(x = x, split = pattern, ...), '[', slot) }
options(stringsAsFactors = F)
## packages for data table processing/plotting
library(tidyverse)
library(rcartocolor)
library(data.table)
library(ggsci)
library(ggh4x)
library(here)
DATADIR='data/tidy_data'
## ma... |
df4fe6b5afb4c09696adf3c1cd8c20e14c9d6517b5da43c5458125a1d22c8593 | R | 3,555 | 74 | library(scattermore)
fit_periodic_loess_mod <- function (cds_object, theta.v.name, assay.name, y.idx, span = 0.3, length.out = 200, plot = FALSE, plot_loess = T,
fig.title = NULL, point.size = 2.1, point.alpha = 0.6, line.size = 0.8,
line.alpha = 0.8, color.by = NULL, color.vars = NULL, color.name... |
cc78ece423d70e9e22ae3db6276e659f0d5844332cea837ebff8343e673c20f0 | R | 3,557 | 88 | #' Summarised specificity plot
#'
#' This function visually summarises the mean specificity values outputted by
#' \code{query_gene_ctd}, across each ctd study.
#'
#' @param filtered_specificity A dataframe that contains the columns 'CellType',
#' 'Specificity', and 'Study', as typically outputted by
#' \code{query... |
4cc0cb6477f1bb5678f928beb7001f57dd194186b6babb23f4e694f51a988c61 | R | 3,565 | 88 | #' Estimate number of signatures based on cophenetic correlation metric
#' @details This function decomposes a non-negative matrix into n signatures.
#' Extracted signatures are compared against 30 experimentally validated signatures by calculating cosine similarity. See http://cancer.sanger.ac.uk/cosmic/signatures for... |
290d1ea3f93b246c43e3229c2590c3db730076d17be835cf5e6e8befacba6702 | R | 3,572 | 53 |
.jaccard <- function(x, y) {
length(intersect(x, y)) / length(union(x, y))
}
#' @title Compute Jaccard Similarities between Pairs of Character Vectors
#' @description This function computes pairwise Jaccard Similarities for all pairs of character vectors provided. Flexibility on input allows for three use cases: ... |
1bea0a0337a7e57f7de6ac37e9c2f207c38e17b130a499e80265e79f943bba97 | R | 3,576 | 84 | ss <- function(x, pattern, slot = 1, ...) {
sapply(strsplit(x = x, split = pattern, ...), '[', slot) }
options(stringsAsFactors = F)
## packages for data table processing/plotting
library(SingleCellExperiment)
library(ComplexHeatmap)
library(rcartocolor)
library(data.table)
library(tidyverse)
library(ggsci)
library... |
38d2a4e24a62fe7cda00f27e9911e321d034b933024d4eb4f38f074bb97c1185 | R | 3,591 | 84 | library(DNAcopy)
library(ggplot2)
library(scales)
library(gtable)
library(grid)
chrNamesLong = c("chr1","chr2","chr3","chr4","chr5","chr6","chr7","chr8","chr9","chr10","chr11","chr12","chr13","chr14","chr15","chr16","chr17","chr18","chr19","chr20", "chr21", "chr22", "chrX")
#chrNamesLong = c("chr1","chr2","chr3","chr4... |
3b3bb725345191237d0df52d05d429f4e05a723174d4dad8c396e825141e7a58 | R | 3,594 | 94 | ss <- function(x, pattern, slot = 1, ...) {
sapply(strsplit(x = x, split = pattern, ...), '[', slot) }
options(stringsAsFactors = F)
## packages for data table processing/plotting
library(tidyverse)
library(rcartocolor)
library(ggsci)
library(ggsankey) # devtools::instmsn_github("davidsjoberg/ggsankey")
library(her... |
4267205abfa8e3a899d53ff0f028ecc3e4b5749c71f74bfba8b894b10866a7a7 | R | 3,598 | 132 | # cox regression for the association between survival outcome
# and HLA-I heterozygosity metrics
# based on Chowell 2018 subjects with HLA-I alleles that each either is or
# can be matched to one of the 85 Emerson HLA-I alleles with pseudo sequences
library(readxl)
library(survival)
library(survminer)
library(ggplot2)... |
7b46546715e1276ebbf85aaacb8ced391a9272987aff1e2e61f02c15594ce48d | R | 3,598 | 109 | ## ---- include = FALSE---------------------------------------------------------
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
## ----setup--------------------------------------------------------------------
library(scapGNN)
## ----echo = F, out.width = "100%"----------------------------------... |
6cd905883f29db5a61632f52e3fd6e33614e120808b6d4726ed1ec35d750ebe1 | R | 3,608 | 77 | #' Summarised specificity plot
#'
#' This function visually summarises the mean specificity values outputted by
#' \code{query_gene_ctd}, across each ctd study.
#'
#' @param filtered_specificity A dataframe that contains the columns 'CellType',
#' 'Specificity', and 'Study', as typically outputted by
#' \code{query... |
39bad5aef33f66e5da5913208cabba0f41d8a434cb4088e7c0e9e4e40665626c | R | 3,610 | 100 | #
ss <- function(x, pattern, slot = 1, ...) {
sapply(strsplit(x = x, split = pattern, ...), '[', slot) }
options(stringsAsFactors = F)
library(tidyverse)
library(here)
library(rcartocolor)
# devtools::install_github("HuntsmanCancerInstitute/hciR")
DATADIR='data/raw_data'
PROJDIR='figures/exploratory/explore_qc_dat... |
0c523b7d7ddb96bbb707de5eb597f4fc98d4926f572dcda5cbef9478640024a9 | R | 3,619 | 90 |
library(igraph)
library(gridExtra)
library(VennDiagram)
######Venn Diagrams
#https://rstudio-pubs-static.s3.amazonaws.com/13301_6641d73cfac741a59c0a851feb99e98b.html
####GRAPH filename Very Stringent case
filename1='../OscopeData/dataAdjacencyMatrixe02/WaterfallbootstrapSequential_CPUDPSF_TF_2000Boot_data_s123res_C... |
6e11c98e21c6f47794dcf11b490eef9fac7a8609199e12d2b2af6047f9438ea4 | R | 3,624 | 78 | #' Genotype known cancer hotspots from the tumor BAM file
#' @description `cancerhotspots` allows rapid genotyping of known somatic variants from the tumor BAM files. This facilitates to get a quick overlook of known somatic hot-spots in a matter of minutes, without spending hours on variant calling and annotation. In ... |
a87ba49d310661691e4b5be5e829d2794ba2fcc1f7a48d2e71c995cea8d1797f | R | 3,626 | 121 | library(data.table)
library(purrr)
library(Matrix)
packdir <- file.path(here::here(), "package/R")
import::from(.from = "cembav2env.R", .directory = packdir,
cembav2env, CEMBAMeta)
# TODO: put this class to R package
L3ClusterPeakSum <- R6::R6Class(
classname = "L3ClusterPeakSum",
public = list(
L3Id = "L3i... |
ea3ea487674155d865a262a166b8704d8b316288ff3cea4568a5abf4d8fb28b1 | R | 3,630 | 87 | ss <- function(x, pattern, slot = 1, ...) {
sapply(strsplit(x = x, split = pattern, ...), '[', slot) }
options(stringsAsFactors = F)
## packages for data table processing/plotting
library(tidyverse)
library(rcartocolor)
library(data.table)
library(ggsci)
library(here)
DATADIR='data/tidy_data'
## make for this sub... |
ffd02d6f1a8e9b5b85642b930b4b910965587bc055d01781e6861efefcfc168f | R | 3,637 | 98 | library(AUCell)
library(readxl)
library(tidyverse)
library(here)
## main Seurat package snRNA-seq pacakges
library(Seurat)
library(SeuratDisk)
library(future)
library(BiocParallel)
library(doParallel)
library(rcartocolor)
ss <- function(x, pattern, slot = 1, ...) {
sapply(strsplit(x = x, split = pattern, ...), '['... |
a7d4f223cd09aee79f35c547d7af210f22b0d3e4dc41b33697190e5500135feb | R | 3,640 | 74 |
#' @title Compute Metaprograms
#' @description programs and profiles are the lists of gene sets and DE profiles that were derived from intra-tumour cell clusters. These are integrated, according to the metaclusters clustering, into a final list of metaprograms; one per metacluster.
#' @param programs list of differen... |
9701771ab9a2ae47d2e6925a2ed1631dac496b6ff82f43a495da8bac58641f77 | R | 3,642 | 117 | ###################################################################
# LC analyses: spot-level deconvolution using cell2location - plots
# Lukas Weber, Oct 2022
###################################################################
library(SpatialExperiment)
library(here)
library(ggplot2)
library(viridis)
# directory t... |
8f51f1b4af50d4dd2c77714e9fcc9bb8be77f9f255c121332fd1fd2c2be751b7 | R | 3,646 | 82 | #' Write an output nextflow file for permutation testing
#'
#' Generate a nextflow workflow for running a specific analysis
#' @param prefix Prefix for output, to be prepended to outputs
#' @param resultnames Names of results from processvoxel. You can return multiple permutation statistics, with names, and they will b... |
21281ab77b82f1f8cbbc88794fc8db37213fc9de8c21153372af328783051649 | R | 3,648 | 102 | ## conda activate r4
## packages for data table processing
library(here)
library(tidyverse)
library(RColorBrewer)
library(rcartocolor)
library(ggpubr)
## main Seurat package snRNA-seq pacakges
library(Seurat)
library(SeuratDisk)
library(future)
## gene expression heatmap plots
library(Nebulosa)
ss <- function(x, pa... |
b500f3227ce1283683bae4f4b9481478be99fe49beef0ca0c799ca49dd101b38 | R | 3,649 | 169 | ---
title: "Recreating the GBM meta-programs"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Tutorial}
%\VignetteEngine{knitr::rmarkdown}
\usepackage[utf8]{inputenc}
---
```{r setup, include = FALSE}
knitr::opts_chunk$set(collapse=FALSE,
comment="#>",
warning=FALSE,
m... |
16544857a663e2097ae3f029d22d8e9e877a96f60b74d04762a4b212758d6f67 | R | 3,652 | 84 | #' Extract mutational signatures from trinucleotide context.
#'
#' @description Decompose a matrix of 96 substitution classes into \code{n} signatures.
#'
#' @details This function decomposes a non-negative matrix into n signatures.
#'
#' @param mat Input matrix of diemnsion nx96 generated by \code{\link{trinucleotideM... |
d46817037f5f206c215e51cc3d53ff3ce3b12111e3137bb6b6b58d963e14ad1d | R | 3,653 | 94 | #############################################################
# GOF test for different distributions
#############################################################
library(EnvStats)
library(fitdistrplus)
library(ggplot2)
library(ggpubr)
InputPath <- "../Data/Dist_TestScore/Test Score/"
OutputPath <- "../Data/D... |
b97470d7db9a01842619f0745f202ae9df529d67db8d367e3e052fea89dd6137 | R | 3,657 | 139 | ---
title: "Averge of predicted scores from 20 models"
author: "Si Liu"
date: "`r Sys.Date()`"
output:
html_document:
theme: journal
highlight: tango
toc: true
toc_depth: 3
toc_float:
collapsed: true
smooth_scroll: false
number_sections: false
code_folding: hide
df_print: ... |
196c966706a9de1ea09568066236593460576328e196d61e76cff7de636b396f | R | 3,661 | 107 | #KEGG Enrichment Analysis of the enriched genes
#this script uses clusterProfiler::enrichKEGG() function
#run locally on Ayushi's laptop
#load the required packages
library(org.Mm.eg.db)
library(clusterProfiler)
library(tidyr)
#set the working directories
indir <- paste0("~/Dropbox (Gladstone)/YH_MN02/",
... |
fe8db3246b331f20e6122b42e034d4022ceae5eb701d5a4744137394493e192f | R | 3,665 | 111 | # scatterplot between predicted expression from sequence and observed expression
args<-commandArgs(trailingOnly=T)
cvfile<-"processed/mtsa_uli16.m100.t5.e5.adj.0.cv.txt"
d<-read.table(cvfile, stringsAsFactors=F)
svr<-d[[2]]
expr<-d[[3]]
#setup for figure
wd <- 2.4
ht <- 2.4
fig.nrows <- 1
fig.ncols <- 3
pt <- 8
cex... |
460c49223c421aef4efe03fcf2b71b095cf2d855cb8502db64596b8a9c3facd5 | R | 3,666 | 93 | #' extract gene summary from MAF or GISTIC object
#' @name getGeneSummary
#' @rdname getGeneSummary
#' @param x An object of class MAF or GISTIC
#' @return gene summary table
#' @exportMethod getGeneSummary
#' @examples
#' laml.maf <- system.file("extdata", "tcga_laml.maf.gz", package = "maftools")
#' laml <- read.maf(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.