sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
c5bfb1542404427ab255c44dd08a1c14b5dc2cdc48edbb32c34a7926d9eed444 | R | 3,082 | 56 | load("/gpfs/mrc0/projects/Research_Project-MRC148213/EmmaW/DementiaMouseRRBSmethylation/rTg4510_RRBSbetasComplete.RData")
#load("/gpfs/mrc0/projects/Research_Project-MRC148213/sl693/DMP/RRBSmergedThatCorrelate.Rdata")
library("dplyr")
library("ggvenn")
library("ggplot2")
library("stringr")
RRBS_Phenotype= read.csv("... |
3a41d1a49af71dc04b356b9835849a47d78f5ccd3ad36ae326500557b5cc35e5 | R | 3,089 | 83 | log <- file(snakemake@log[[1]], open = "wt")
sink(log)
sink(log, type = "message")
library(tibble)
suppressPackageStartupMessages(library(ggplot2))
suppressPackageStartupMessages(library(DESeq2))
parallel <- FALSE
if (snakemake@threads > 1) {
library("BiocParallel")
# setup parallelization
register(Multic... |
aa94576b5c7083cf6165fe4e36139b0d8e8e2d2b78e028d850493b608c15b6b6 | R | 3,092 | 108 | #' @name DEPRECATED-wc
#' @concept moved to hySpc.read.txt
#'
#' @title (DEPRECATED)
#' Line/word/character count of ASCII files
#'
#' @description
#'
#' These data input related functions are **deprecated** and they will be
#' removed in the next release of \pkg{hyperspec} package.
#' Now functions in package \... |
5afbbbcdb95a67d65fcfa73f502458f710a6fc7684a7297881714374883c9924 | R | 3,094 | 57 |
#' archstabms__define_confident_free_energies
#'
#' Call confident ddGs.
#'
#' @param input_dt data.table with model free energy estimates (required)
#' @param report_outpath output path for scatterplots (required)
#' @param highlight_colour colour for highlights (default:red)
#' @param energy_max_ci maximum energy co... |
e8d3ca49e56efad3e9f6218e5409457906c50633ef556afa2b59672ed450e511 | R | 3,105 | 82 | rm(list=ls())
data<-read.delim("/Users/cazaledl-admin/Library/CloudStorage/OneDrive-UniversityofBirmingham/Post_doc/XP/ethograms/lisa_quantification/original.spreadsheet/analysisframeV2/Ethogramm_bending_V2.txt",h=T,sep="\t",na.strings = "NA", stringsAsFactors=T)
attach(data)
library(beeswarm)
firstT<-data[1:560,... |
0040982673e775d0ae53dde1f28f08f791198e6c1df6086db1ceaefa872a4ffd | R | 3,106 | 87 | ##Code to do DESeq2 analysis from read counts
##Written by Aysegul Guvenek
##November 2023
library("DESeq2")
library("GenomicAlignments")
library("GenomicRanges")
library("rtracklayer")
library("Rsamtools")
library("GenomicFeatures")
library("dplyr")
library("ggplot2")
rm(list = ls())
par(ask=TRUE)
lc=12 #number of ... |
cddc5f5a79e76986f7fcbe2893f1800d4dc52cd70d213fb2db3821090503ccde | R | 3,111 | 108 | require(testthat)
require(Cardinal)
context("binning")
test_that("bin - SpectralImagingArrays", {
path <- CardinalIO::exampleImzMLFile("processed")
s <- as(readImzML(path), "SpectralImagingArrays")
s2 <- bin(s, units="relative")
s3 <- bin(s, units="absolute")
expect_is(s2, "SpectralImagingExperiment")
expect... |
c714d86c8caeba66e525e61a78c8912ffddb6340f1c32ff89c1af5ffc2d0b6cb | R | 3,112 | 96 | ##### Confounding:
# Site effect in covariance
# Covariate effect in mean/covariance, confounded with site effect
library(reshape2)
library(mvtnorm)
library(invgamma)
library(randomForest)
library(pROC)
library(ROCR)
library(caret)
library(Matrix)
library(CovBat)
source("covbat_sim_functions.R")
load("animats_add.Rd... |
37c90afee9b7bcfdd56a40e0f8a0272716a24a995b811a8dfe2c672f3cf86d22 | R | 3,116 | 97 |
#' archstabms__pairwise_distances_from_PDB
#'
#' Calculate pairwise (side-chain) heavy atom distances or minimum thereof.
#'
#' @param input_file path to PDB file (required)
#' @param chain_query query chain id (default:A)
#' @param chain_target target chain id (default:B)
#' @param min_dist minimum distance (default:... |
404cfd996870f4e97019912c2a7252507c9da693e485325e85e4f653043b9936 | R | 3,120 | 56 | #!/usr/bin/env Rscript
## ----------Script-----------------
##
## Purpose: Comparison of Kumar2024 dataset
##
## Author: Szi Kay Leung (S.K.Leung@exeter.ac.uk)
##
## ---------------------------
dirnames$kumar2024 <- "/lustre/projects/Research_Project-MRC148213/lsl693/rTg4510/0_otherStudies/Kumar2024/"
## ---------- c... |
ab854c4ff84fedfa60278f8e55373bc65d431124baa014ad90f2c1565208f364 | R | 3,120 | 118 | library(sccomp)
data("counts_obj")
n_iterations <- 1000
methods <- c("pathfinder", "hmc")
test_that("sccomp_estimate is reproducible with fixed mcmc_seed", {
skip_cmdstan()
# An sccomp tibble carries the cmdstanr fit as an attribute, and
# `expect_identical()` compares attributes: that would demand two runs a... |
5b4aa77375724ff747a282313b52a65cb5bf3f35c4aef24acf859e5276c9736f | R | 3,130 | 96 | library(DESeq2)
library(dplyr)
setwd("G:/ROSMAP_RNAseq/ROSMAP_AMP_AD_Jose")
ROSMAP_AMP_AD=readRDS("ROSMAP_AMP-AD.rds")
expression_matrix=ROSMAP_AMP_AD@assays[["data"]]@listData[["counts"]]
#Add official metadata
setwd("G:/PFC_429_final_Spring2021/Vanshika")
metadata=read.csv("dataset_652_basic_04-23-2020.c... |
a1ff1ecd595bbfb9950fac6f42b82685876175ab67d89ad9417e609663487fed | R | 3,134 | 98 | library(DESeq2)
library(dplyr)
setwd("G:/ROSMAP_RNAseq/ROSMAP_AMP_AD_Jose")
ROSMAP_AMP_AD=readRDS("ROSMAP_AMP-AD.rds")
expression_matrix=ROSMAP_AMP_AD@assays[["data"]]@listData[["counts"]]
#Add official metadata
setwd("G:/PFC_429_final_Spring2021/Vanshika")
metadata=read.csv("dataset_652_basic_04-23-2020.c... |
f5bd91c71bb9a3ae36f44ac4b0fe2eea0857cc23f86e46e63e9015feb69ff04f | R | 3,140 | 85 | setwd("F:\\Manuscript\\ATAC\\data")
##PCA Analysis
library(ggplot2)
library(dplyr)
datTPM_filter <- read.table("AllPeakList.merged.TPM2.txt", header=T, row.names = 1)
group <- read.table("Meta.txt",header = T, row.names = 1)
group <- filter(group, !(rownames(group) %in% c("LD70_M_Pl3")))
tpm <- t(datTPM_fi... |
20e85f9d8beb16f780f39a0a043b5c19da1673c4101a712987d48e5d001b53d0 | R | 3,141 | 64 | source("R/setup.R")
metrics <- readr::read_delim("evaluation/tables/error_metrics.csv", delim = ";")
round_tidy = function(x, digits){
sprintf.arg = paste0("%.", digits, "f")
x.out = do.call(sprintf, list(sprintf.arg, x)) # keep trailing zeros
return(x.out)
}
metrics <-
metrics %>%
dplyr::select(dataset_n... |
c64c859b9d52fe70b01ed76be7562f94f902be79c4f975f3596d781db47d5fe0 | R | 3,150 | 125 | # libraries
library(readxl)
library(tidyverse)
library(ggpubr)
library(rstatix)
library(emmeans)
library(sjstats)
library(lme4)
library(lmerTest)
library(MuMIn)
library(multcomp)
library(nlme)
library(r2glmm)
library(ggplot2)
library(ggthemes)
library(svglite)
library(sjPlot)
# prepare --------------------------------... |
15310770f2ef2b7524fd9d9ff58feff98b7ae4e8fd06778bc2455be3b808dbcb | R | 3,156 | 97 | ---
title: "Comparison between sc, bulk dartseq and MeRIP"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
In this document we show the Venn diagrams of the bulk dart-seq and single-cell dart-seq m6a sites. Note that for single cell, these are unique sites, i.e., if a site... |
f5b1a8272ea9f0dd19eced31a55fecb28fe1b59fa11f4f94952751b73ff88ec2 | R | 3,156 | 96 | #!/usr/bin/env Rscript
# Script to run cn.MOPS on a coverage matrix as output by makeMatrix.sh
####Load optparse
require(optparse)
####List of command-line options
option_list <- list(
make_option(c("-I", "--ID"), type="character", default="CNMOPS",
help="sample group ID (used for output filenames) [... |
f84d7f02be0d8600ccaa55f2cc4efc5ad5daea599cbe4b4210d07c712220fc4e | R | 3,156 | 113 | #' @name DEPRECATED-read.mat.Cytospec
#' @concept moved to hySpc.read.mat
#'
#' @title (DEPRECATED)
#' Import for Cytospec `mat` files
#'
#' @description
#'
#' These data input functions are **deprecated** and they will be removed in
#' the next release of \pkg{hyperspec} package.
#' Now functions in package \pk... |
01da702d7963d062e53b386078a4927573cab9817e7280c8a662aa1abb2163fc | R | 3,161 | 74 | rm(list=ls())
library(data.table)
load("CPM_exp.RData")
CPM_exp -> PDGC_CPM_exp
load("NMF_res/NMF_LOOV_cluster.RData")
###########################################################################
DEAgroups <- function(ddata,
groups,
method = c("MWW", "t-test")
... |
281a87d366fc75c7e98d78eff8b6e831e261fe484132ff8741f3d1c0ca673539 | R | 3,162 | 100 | rm(list = ls())
library("GenomicAlignments")
library("GenomicRanges")
library("rtracklayer")
library("Rsamtools")
library("GenomicFeatures")
library("org.Mm.eg.db")
library("org.Hs.eg.db")
library("BiocParallel")
library("matrixStats")
library("magrittr")
library("readr")
library("TxDb.Mmusculus.UCSC.mm10.knownGene")
... |
364cb6952c1db852e48fa28854f2be1e337847fe4a75cf46069f186bcf1fcafa | R | 3,171 | 108 | #!/usr/bin/R
# ---------------------------------------------
# Print the DEGs that drive module enrichments:
# Updated 12/11/2021
# ---------------------------------------------
library(cbrbase)
set_proj('DEVTRAJ', 'multiRegion')
if (!exists("cellmeta")){
source(paste0(sbindir, 'load_metadata.R'))
}
library(tidyr... |
0b225a2c63dd43d0e89753722de1b6d1d72965d7b5fafa7b98ab41b80927a280 | R | 3,172 | 100 | library(data.table)
library(dplyr)
df_bim <- fread("UKB_random10k_noqc.bim",
sep="\t", data.table = F, col.names = c("chr", "snp", "cm", "bp", "ref_ukb", "alt_ukb"),
nThread = 20) %>%
dplyr::select(snp, ref_ukb)
### F1 GWAS
trait <- "F1"
file_gwas <- "MetS_F1_GWAS.withQsnp.cs... |
43f8f1b9d17eb5f135043f0a8f8b2b0d54cbf84f9f28c684e279e2ba248cf741 | R | 3,174 | 103 | # Importing libraries ------
library(tidyverse)
library(metrica)
library(caret)
library(ggplot2)
# Density maps -----
## Loading data -----
modelAnalised <- "CerealNet_VGG16"
data <- read.table(paste0("results/", modelAnalised, ".csv", sep = ""))
## Computing metrics -----
### RMSE -----
rmse <- metrica::RMSE(data, ... |
5404a823aab87d376ad324977bbd0f03d5e20a0a8774fb34d798494eda32a859 | R | 3,183 | 105 | #!/usr/bin/R
# -----------------------------------------------
# Load pseudobulk data for differential analysis:
# Updated: 10/28/23
# -----------------------------------------------
library(cbrbase)
set_proj('DEVTRAJ', 'multiRegion')
if (!exists("cellmeta")){
source(paste0(sbindir, 'load_metadata.R'))
}
library(M... |
3ddf193041421f0b3e2b42bbce0896e2136591b86decb97fb62a6d4491f69085 | R | 3,185 | 109 | library(data.table)
library(dplyr)
### MetS
trait <- "MetS"
file_gwas <- "MetS_noUKB_GWAS.csv"
df <- fread(file_gwas, sep=",", data.table=F, nThread = 5) %>%
dplyr::select(SNP, CHR, BP, A1, A2, MAF, est, Pval_Estimate) %>%
rename(BETA = est,
P = Pval_Estimate)
write.table(df,
file = p... |
615bc8c694f169cd520038bd5072455fa8d62ee7551f2a0d350362ee10adf088 | R | 3,187 | 86 | #!/usr/bin/R
# ---------------------------------------------------------------
# Load all of the modules and save pseudobulk data as a resource:
# Updated 01/13/2022
# ---------------------------------------------------------------
library(cbrbase)
set_proj('DEVTRAJ', 'multiRegion')
if (!exists("cellmeta")){
source... |
7db0400b25ead3e951202b68195481750479aec6b979ed44046075f286520dd0 | R | 3,191 | 71 |
library(monocle3)
hardAssignDonorAges <- function(inputCDS){
colData(inputCDS)$Age = 0
colData(inputCDS)$Age =ifelse(colData(inputCDS)$Donor == "W134", 43, colData(inputCDS)$Age)
colData(inputCDS)$Age =ifelse(colData(inputCDS)$Donor == "W135", 60, colData(inputCDS)$Age)
colData(inputCDS)$Age =ifelse(colData(... |
13a5771c47b30c5b66b71c143daed5f4de6f05c51f3c94726bacdafc31b67aef | R | 3,193 | 101 |
#### Row/column apply ####
## ------------------------
setMethod("spectrapply", "SpectralImagingExperiment",
function(object, FUN, ...,
spectra = "intensity", index = NULL,
simplify = TRUE, outpath = NULL,
verbose = getCardinalVerbose(), chunkopts = list(),
BPPARAM = getCardinalBPPARAM())
{
if ( length(pr... |
974ce4d45f4d02ec3376f0c89c70ff1e029d952c8b49f5ee3524ee28bca5c863 | R | 3,193 | 112 |
#### Spatially-aware FastMap ####
## ------------------------------
setMethod("spatialFastmap", "ANY",
function(x, coord, r = 1, ncomp = 3,
weights = c("gaussian", "adaptive"),
neighbors = findNeighbors(coord, r=r),
transpose = TRUE, niter = 10L,
verbose = getCardinalVerbose(), chunkopts = list(),
BPPARAM ... |
fb9087c7f7888206fbb4860f80a230bcac4dae108f7121b69b93dc6903847302 | R | 3,197 | 61 | library(Seurat)
library(dplyr)
library(tidyverse)
library(magrittr)
library(liana)
setwd("F:/Brain_region_project/Brain_region_final_12TB/Data_for_Connectome")
pbmc=readRDS("TH_merge_major_cell_type.rds")
Idents(pbmc)<-"cell_type_high_resolution"
pbmc=subset(pbmc,idents=c("Ast DPP10","Ast GRM3","Ast DCLK1",... |
42f51026ef9c5e04b7cedeb037e2b8d88741d98b62a536c009ed9fda41f276ad | R | 3,198 | 101 | # Helper functions for structured logging
#' Create or retrieve a subject level logger
#'
#' @param base_logger Name of parent logger (e.g., "glm_pipeline/l1_setup")
#' @param id Subject identifier
#' @param gpa glm_pipeline_arguments object containing logging settings
#' @param log_prefix Optional filename prefix for... |
901b649022dc71c61cc2b57afe63efdd59026c489b176cc26b4016207970594e | R | 3,198 | 98 | # backend-scoped l3 setup should not overwrite other backends
test_that("setup_l3_models(backend='spm') preserves existing FSL l3 tables", {
spm_dir <- file.path(tempdir(), "spm_l1_test")
dir.create(spm_dir, recursive = TRUE, showWarnings = FALSE)
file.create(file.path(spm_dir, "SPM.mat"))
file.create(file.pat... |
e91717423fa200294b0981fa5197e323132820776d9df150faf84e41a1355b64 | R | 3,204 | 93 |
.libPaths('1')
# Get functions
library(monocle3)
# source("/net/trapnell/vol1/home/readdf/trapLabDir/sharedProjectCode/utility/singleCellUtilFuncs.R")
# modStatus <- loadMonoclePackages()
# library(tidyr)
library(cicero, lib.loc="/net/trapnell/vol1/home/readdf/R/x86_64-pc-linux-gnu-library/4.0")
# cicero_1.3.5.
l... |
5602f4edaa6a417afdd06c8882358b8bd135ade872e43dbeda8052c5be8697da | R | 3,208 | 72 | ## ---------- Script -----------------
##
## Purpose: input variables for Iso-Seq targeted mouse transcriptome datasets
##
## Author: Szi Kay Leung (S.K.Leung@exeter.ac.uk)
## ---------- Directory and input files -----------------
dirnames <- list(
root = "/gpfs/mrc0/projects/Research_Project-MRC148213/sl693/rTg4... |
b1b5ea4a029cfd5dc536e01782ce20ac5dc52a134280eaf47562b6a397f569df | R | 3,208 | 124 | ---
output: pdf_document
---
```{r}
library(dplyr)
library(ggplot2)
library(tidyr)
library(wesanderson)
```
```{r}
myfiles <- list.files(pattern='simulations-spatial-gradient-params')
df <- NULL
for (f in myfiles) {
load(f)
if (is.null(df)) {
df <- bb.results
} else {
df <- bind_rows(df, bb.results)
}... |
74b5dcf4210e1ab6c957e12fca162e21ac39cdc6562b32bd080bd59b448a880a | R | 3,209 | 120 | #' @rdname palettes
#' @aliases palette_matlab colors,palette_matlab
#'
#' @title Matlab-like color palettes
#'
#' @description
#' Two palettes going from blue over green to red, approximately as the
#' standard palette of Matlab does. The second one has darker green values and
#' is better suited for plotting lines on... |
68e49fb58bf3f8b54cc8db881a3d60c05619ee281ea086a2aae6f66902062ba3 | R | 3,220 | 104 | ## Figure 1 Overall results volcano plot```{r}
library(ggplot2)
library(ggrepel)
require(dplyr)
require(tidyr)
require(RColorBrewer)
rm(list=ls())
setwd('/Volumes/Elements SE/ppmi_zheda/kegg')
# corr_proteins <- read.csv('/Volumes/Elements SE/ppmi_zheda/step3_RSA_739/latent_vecs10_cvae_bspline_10_1_0... |
8919ac0d7f10d37be2e14b89409231283ada688902f16071ee8bd90b1aa6a504 | R | 3,230 | 77 | #!/usr/bin/env Rscript
# Talkowski SV pipeline downstream analysis helper script
# Clean allele frequency table across batches
###Set global parameters
options(stringsAsFactors=F,scipen=1000)
###################
###HELPER FUNCTIONS
###################
#Import a single table of freq data
import.freq.table <- funct... |
4193ba77ee1b9b78acd1259bbc1fcc9cfa4a3522e63c265805722879985c79d2 | R | 3,232 | 113 | library(data.table)
library(dplyr)
### MetS
trait <- "MetS"
file_in <- "leadSNPs.txt"
df <- fread(file_in, sep="\t", data.table= F, nThread = 1)
write.table(df$rsID,
paste0("leadSNP_list.", trait, ".txt"),
sep="\t", row.names = F, quote = F, col.names = F
)
### TG
trait <- "TG"
file_in <- pas... |
f70aeec32964692a52b079b5373e1444067b86133eedd3c4e2945adf1e0b22cf | R | 3,232 | 96 | library("batchtools")
## use the bath tools for RNA contamination detection and doublet removal
setwd("./Step4.IterativeCleaning")
reg <- makeExperimentRegistry("ReclusterMajorCluster.Registry",
packages = c("tidyverse", "Seurat", "data.table", "harmony"),
s... |
c1635aae908f6d89713ad9f29515af56a90a6a4551924bfe522a4272d6a074bb | R | 3,237 | 102 | test_that("combine_spm_l3_to_afni forces +tlrc output view", {
tmp_dir <- tempfile("spm_l3_afni_")
dir.create(tmp_dir, recursive = TRUE)
spm_dir <- file.path(tmp_dir, "spm_l3", "L1m-m1", "L3m-l3")
dir.create(spm_dir, recursive = TRUE)
con_file <- file.path(spm_dir, "con_0001.nii")
stat_file <- file.path(s... |
1a1e1ca7f3a99789ea2e3e218562fc8731325cc49ddf4825a55d60c06dd89571 | R | 3,240 | 88 | setwd("D:/Brain_region_project/Brain_region_final")
library(ggplot2)
library(Seurat)
pbmc <- readRDS(file = "Ex_raw_highly_variable_mscores_integrated2_adjusted_umap.rds")
Idents(pbmc)<-"cell_type_high_resolution"
DefaultAssay(pbmc)<-"RNA"
library(RColorBrewer)
# Define the number of colors you want
nb.cols... |
7b937c85ef9877fd817725ae60c27fb3f3d82cc5c438d8878dc10ddb8719add6 | R | 3,240 | 84 | library(spacexr)
library(spASE)
library(data.table)
library(Matrix)
library(dplyr)
library(tidyr)
library(tibble)
hippo_ref <- readRDS('../inst/extdata/reference_scrna/scRefSubsampled1000.rds')
celltypes_hippo <- hippo_ref@meta.data$liger_ident_coarse
levels(celltypes_hippo)[levels(celltypes_hippo)=='Denate'] <- 'Den... |
931049495c33f194ca18b6b20489895ff146b6e27864befe687fb84e22155737 | R | 3,240 | 82 |
# Library used for network generation
library(bnlearn)
library(parallel)
library(Hmisc)
library(xlsx)
# load expression of DE miRNAs and biclust mRNAs for each timepoint
load("miRNA_DE_DEseq2_exp.rda")
load("biclust_mrna_exp.rda")
set.seed(123)
# generate bayesian network using bnlearn package with r =10000 iteratio... |
f06c49364fd693805327b4af26363466502967fb564e34adb0a8068ae6979316 | R | 3,243 | 86 | ```{r init}
library(Matrix)
library(tidyverse)
library(biomaRt)
library(monocle3)
library(rgl)
library(tricycle)
library(dplyr)
```
```{r load_cds}
baseDir = "./"
setwd(baseDir)
cds<-readRDS("cache/merged_CDS_expressed_genes_CellRanger.rds")
fname<-"CR_BC_sans9"
```
```{r, eval=FALSE}
## Step 1: Normalize and pre-pro... |
321aa6f7c2ad9517b735eb1477675b4679634d5f9878fc32288b8e23873a9aef | R | 3,246 | 101 | #!/usr/bin/R
# -----------------------------------------------
# Create files for the MR UCSC site, minus matrix
# Updated: 09/08/23
# -----------------------------------------------
library(cbrbase)
library(Matrix)
library(gplots)
library(RColorBrewer) # colorRampPalette
library(gplots) # col2hex
set_proj('DEVTRAJ', ... |
53fb669e0026b361ea44435794c04daa57574b82dda975494ac52d7cb8ae4952 | R | 3,248 | 94 | #' @title Mark groups in [stats::hclust()] dendrograms
#'
#' @description
#' Groups are marked by colored rectangles as well as by their levels
#'
#' The dendrogram should be plotted separately, see the example.
#'
#' @param dendrogram the dendrogram
#' @param groups factor giving the the groups to mark
#' @param col v... |
6e8f2c5c49e4caa92b4fa81bdf1d2e263584f4c562f4d4f2dd26762d46feeb92 | R | 3,248 | 91 | #!/usr/bin/R
# ---------------------------------------------------------
# Load all of the modules and save gene sets as a resource:
# Updated 01/12/2022
# ---------------------------------------------------------
library(cbrbase)
set_proj('DEVTRAJ', 'multiRegion')
if (!exists("cellmeta")){
source(paste0(sbindir, '... |
388252cb075b66a34cdcf9d1b5d5dfb8cfe5c9552833c94d45b87b7f8b58e62b | R | 3,255 | 118 | #!/usr/bin/env Rscript
# Helper script to clean final table of vcf vs vcf comparisons
###Set parameters
options(stringsAsFactors=F)
###Helper function to clean an input overlap file
cleanData <- function(dat){
uniq = dat[dat[,2]=='NO_OVR',]
dat = dat[dat[,2]!='NO_OVR',]
dat[,2]=as.numeric(as.character(dat[,2]... |
77770386c71c796850b0db39c6c0ddddb9f8676e556c9ec5f2d3e2388ef9da7e | R | 3,255 | 84 | # for example
# setwd("/Users/michael/OneDrive/collected_letters/papers/sceptic_fmri/dan/plots/rt_decode/")
# load("/Users/michael/OneDrive/collected_letters/papers/sceptic_fmri/dan/plots/rt_decode/rt_decode_output_streams_mixed_by.Rdata")
# setattr(ddf, "split_variables", c("stream", "evt_time", "side"))
#' Function ... |
75bc81871fe4537cb159118a18d87c00a0f460729e4ab043299148267bb2b11a | R | 3,258 | 70 | rm(list=ls())
options(stringsAsFactors = F)
read.table("GBM_TCGA/HT_HG-U133A",header=T,row.names=1,sep="\t") -> U133A_exp
U133A_exp <- U133A_exp[,-(grep("11$",colnames(U133A_exp)))]
load("sig_res/markers100.RData")
library(ssgsea.GBM.classification)
source("~/ssgseaMOD.r")
marker <- rep(1,length(markers100$mes))
names... |
6f0dddc2e0af006ccad67159b2bc5cb90cc5afc1bf37c7b11cd3daa6265e7d5d | R | 3,259 | 106 | library(dplyr)
celltype_list = c("Exc","Inh","Ast","Oli","OPC","Mic")
region_list = c("AG","EC","HC","MT","PFC")
for (i in 1:length(region_list)){
region=region_list[[i]]
Marker_genes_list <- list()
Marker_genes_list2 <- list()
for (i in 1:length(celltype_list)){
celltype=celltype_list[[i]]
#####... |
12da2f95e70f743c89e0810ab7c937299cba0a758da8fcfb8ff5501f598a2942 | R | 3,261 | 106 | library(dplyr)
celltype_list = c("Exc","Inh","Ast","Oli","OPC","Mic")
region_list = c("AG","EC","HC","MT","PFC")
for (i in 1:length(region_list)){
region=region_list[[i]]
Marker_genes_list <- list()
Marker_genes_list2 <- list()
for (i in 1:length(celltype_list)){
celltype=celltype_list[[i]]
#####... |
865d547d047478a5b7d0d1f1493f651fc0cbe5738af51dcd2f1562271efb26c0 | R | 3,265 | 95 | #!/usr/bin/R
# ----------------------------------------
# Auxiliary functions for DE calculations:
# Multiregion (matching AD430)
# Updated: 10/05/22
# ----------------------------------------
library(cbrbase)
library(tidyr)
library(Matrix)
# Functions:
# ----------
# Ensure data matches datasets on both meta/mat:
ha... |
328f44674f781b92d2d1731cdf5d330058a1f3086d2eaed7515468c6c4d0595a | R | 3,275 | 101 | library("batchtools")
## use the bath tools for RNA contamination detection and doublet removal
setwd("./Step4.IterativeCleaning")
reg <- makeExperimentRegistry("ReclusterMajorCluster.R2.Registry",
packages = c("tidyverse", "Seurat", "data.table", "harmony"),
... |
1dbdbf140d3739a177f2a26ec2c9cb2ace4be53323c815dd01ab3e97e4523351 | R | 3,288 | 96 | predictor_network <- nn_module(
"prediction",
initialize = function(n_feature, n_batch, n_covariate, n_hidden, dropout_rate = 0.8) {
self$dropout_rate <- dropout_rate
self$layer_dim <- calculate_vae_dim(n_feature, n_covariate + n_batch, n_hidden = n_hidden)
self$n_layers <- length(self$layer_dim)
se... |
c8ef5d252c26339b097b1da7872b5c2915c31da33fad8a61753d3e8413f3df57 | R | 3,292 | 110 | log <- file(snakemake@log[[1]], open = "wt")
sink(log)
sink(log, type = "message")
# versions
out <- snakemake@output[[1]]
print(out)
write("", file = out)
write(paste("STAR", system2("STAR", "--version", stdout = TRUE)),
file = out, append = TRUE
)
write(system2("samtools", "--version", stdout = TRUE)[1],
file ... |
1df103e19422c8c4f2ee0da0b18440b0911935d057d8f661589f5d544564ddfb | R | 3,295 | 64 | ##HOUSE KEEPING##
library(dplyr)
library(tidyr)
library(rstudioapi)
##PREPARE FOR ANALYSIS##
#Get a list of files to analyze
setwd(selectDirectory(caption="Select the folder containing the raw counts you want to analyze..."))
myFiles <- list.files(path=getwd(), pattern=".csv")
#Identify individual samples fro... |
415f00a3c569f319db97846223ec85511fb5a932333ec952b098ab9e455abe9d | R | 3,301 | 95 | #!/usr/bin/R
# ---------------------------------------
# Plot the HIP + EC annotation from Jose:
# Updated: 12/02/2021
# ---------------------------------------
library(cbrbase)
set_proj('DEVTRAJ', 'multiRegion')
source(paste0(sbindir, 'load_metadata.R'))
library(tidyr)
library(ComplexHeatmap)
library(circlize)
# Dir... |
0b1f3a3af5bf00bbafac98b57ea22e1bfb74e8ef651f80ea4fdd1f37d3e1e3ca | R | 3,304 | 92 | ### -----------------------------------------------------------------------------
###
### read_txt_wide
###
### Format:
### x y ... int (wl1) int (wl2) ... int (wl p) z ...
###
#' Import/export of `hyperSpec` objects to/from ASCII files
#'
#' @details
#' A detailed discussion of \pkg{hyperSpec}'s file import and e... |
6ca76916112f327cdc6967f46f399bc7b21b886e3393c5f3e15f8bd8e98984c7 | R | 3,307 | 89 | library(mgcv)
library(plotrix)
library(latex2exp)
library(cfdr)
library(dplyr)
cortex<-read.csv(file="/data/breadhea/qwang178/NOMIS/scRNA/Drop8/eQTL/data/Cortex_MetaAnalysis_ROSMAP_CMC_HBCC_Mayo_cis_eQTL_release.GRCh38.csv")
qtl<-read.csv(file="qtl_results_all.txt", sep="")
inner_joined<-inner_join(qtl, cortex, by = c... |
aaaf7c5838ff2259a7a7e36de76beb4d6e0b62afb66dea028cd3ca8058e0929c | R | 3,315 | 86 | library(dplyr)
setwd("F:\\RNA_20221101\\02_ModifiedGenome\\C_POEgeneSelection\\figures_tables\\02_POE»ùÒòλÖ÷ֲ¼")
input=c("F:\\RNA_20221101\\02_ModifiedGenome\\C_POEgeneSelection\\figures_tables\\02_POE»ùÒòλÖ÷ֲ¼\\data\\")
##pig chromosome length
chr_bed <- read.table(paste0(input,"pig_karyotype.txt"), head... |
2e6b282c56488e0f2c4413b87698aa5090da1ef2aa3d402427e86f02c9082a72 | R | 3,317 | 107 | #!/usr/bin/R
# -----------------------------------------------
# Comparison of DE methods - NB / MAST / Wilcoxon
# Updated: 05/25/21
# -----------------------------------------------
# Aggregate number of sign. genes:
library(cbrbase)
set_proj('DEVTRAJ')
source(paste0(bindir, 'multiRegion/load_metadata.R'))
library(ti... |
dfb83d46c454144ca6f4b6b9ce70c5212a07b3bb7a81843c809edec89bbe1130 | R | 3,319 | 89 | ### Ref links
# http://tuxette.nathalievilla.org/?p=1696
# https://swcarpentry.github.io/r-novice-inflammation/05-cmdline/
## -----------------------------------------------------------------------------
# get the input passed from the shell script
args <- commandArgs(TRUE)
## ----------------------------------------... |
671feb65d587498bb06717f29a90ea6efe83c2f50526e149cabec9dcfae15870 | R | 3,321 | 118 | require(testthat)
require(Cardinal)
context("MSImagingArrays")
test_that("MSImagingArrays accessors", {
msa <- MSImagingArrays()
expect_true(validObject(msa))
set.seed(1)
n <- 10
i <- rep(list(501:510), n)
a <- replicate(n, rlnorm(n), simplify=FALSE)
s <- SpectraArrays(list(mz=i, intensity=a))
pdata <- Pos... |
98ff4ef1f0eaf7a5b99b8f0b3b67d0f2419966437093344f885d9b7486841b23 | R | 3,322 | 119 | ---
title: "prep_all_sporo_for_scvelo"
author: "T Attenborough"
date: "16/01/2023"
output: html_document
---
```{r, message=FALSE}
library(remotes)
library(Seurat)
library(zeallot) # For %<-% that unpacks lists in the Python manner
library(DropletUtils)
library(tidyverse)
library(GGally) # For ggpairs
library(scales)
... |
7aa1485699aab9a3c4d2fb373b441a2ddf914e3fe3ac5dd3e5e37ac68c459827 | R | 3,326 | 68 | ACGGCAACATCCTGGGGCACAAGCTGGAGTACAACTAC
suppressPackageStartupMessages(library(knitr))
suppressPackageStartupMessages(library(ShortRead))
suppressPackageStartupMessages(library(ggplot2))
suppressPackageStartupMessages(library(ggbio))
suppressPackageStartupMessages(library(beanplot))
suppressPackageStartupMessages(librar... |
56105002bfd42a4fd754ffe5edce2e0428de6def8d3b3540db6a22c5c156bbce | R | 3,327 | 89 | if (!require("dplyr")){
install.packages('dplyr')
library(dplyr)
}
if (!require("lavaan")){
install.packages('lavaan')
library(lavaan)
}
################################################################################
# 1. DMP analysis
##############################################################... |
2774a8695dfee2a4e1b8b14c7948c32286cd15da916b377e37c4ef64a2b24e9e | R | 3,329 | 140 |
getPseudobulkData <- function(inputCDS, opt){
# Track with covariates to put into a DF. Manually set in opt.
covarToGet = strsplit(opt$variables, ",")[[1]]
colData(inputCDS)$biolSample = paste0(colData(inputCDS)$DataSource, "_", colData(inputCDS)$Donor, "_", colData(inputCDS)$Anatomical... |
450ba1f12fa1e60bfd752c1f8e48e78e7b79585a603abd14fcfdb134bb0b7482 | R | 3,331 | 117 | #!/usr/bin/env Rscript
print_help <- function() {
cat(paste(
"Log FLAME12-to-FLAME1 slice fallback records produced by flame_runner.",
"Options:",
" --feat_dir <path>: FEAT output directory containing flame_runner_fallbacks.tsv.",
" --level <n>: FEAT level, used in the logger name.",
" --log_t... |
52acfd41e52aaca55dfbb059e7e56d4e43d301bc551330314b5c1a83db81df58 | R | 3,335 | 106 | #!/usr/bin/R
# ------------------------------------------------
# Plot UMAPs for each of the celltypes separately:
# Updated 11/04/2021
# ------------------------------------------------------
library(cbrbase)
set_proj('DEVTRAJ', 'multiRegion')
source(paste0(sbindir, 'load_metadata.R'))
library(tidyr)
library(ggplot2... |
941f74f9a4406c0757586bf345ba43edb03758795c4be45b2a6eae834a60d4df | R | 3,336 | 89 | library(optparse)
getJitter <- function(x,dens){
jit <- dens$y[head(which(dens$x>=x),1)]
return(jit)
}
jitterX <- function(y,dens){
return(jitter(1,amount=getJitter(y,dens)))
}
###List of command-line options
option_list <- list(
make_option(c("-i","--input"), type="character",
help="stat table... |
fb283a94575b49fff58caa6dd161df7c65ab6eb239fa23a73138429af7f203be | R | 3,337 | 100 | library(testthat)
library(sccomp)
test_that("covariates are z-scored against the reference samples", {
training <- tibble::tibble(
sample = paste0("S", 1:5),
age = c(10, 20, 30, 40, 50),
condition = c("a", "b", "a", "b", "a")
)
grid <- tibble::tibble(sample = "g1", age = 50, condition = "a")
sca... |
f4ad1b10ef07eb9e6f96ce7e8f19342f4c9e7ae4a7c23d4529604aa16473dcd8 | R | 3,341 | 65 | #' DEPRECATED: Remove Unwanted Variation from sccomp Estimates
#'
#' @description This function is DEPRECATED. Please use \code{\link{sccomp_remove_unwanted_effects}} instead.
#' This function uses the model to remove unwanted variation from a dataset using the estimates of the model.
#' For example, if you fit your d... |
ce226cf3dc4f0c2b59ccdcb991a7b1226351bc3ea19664b6071b26e5e6f894fa | R | 3,349 | 89 | ### Ref links
# http://tuxette.nathalievilla.org/?p=1696
# https://swcarpentry.github.io/r-novice-inflammation/05-cmdline/
## -----------------------------------------------------------------------------
# get the input passed from the shell script
args <- commandArgs(TRUE)
## ----------------------------------------... |
bd2a8a9df68eb327de305de65850a8ef09c780af0711dca1872ce0082a1d9790 | R | 3,354 | 90 | ### Ref links
# http://tuxette.nathalievilla.org/?p=1696
# https://swcarpentry.github.io/r-novice-inflammation/05-cmdline/
## -----------------------------------------------------------------------------
# get the input passed from the shell script
args <- commandArgs(TRUE)
## ----------------------------------------... |
959454620f0a73853e02ee2afc1ce517e95b9657f646baa941b7cfc3389f49c9 | R | 3,359 | 104 | #!/usr/bin/R
# ----------------------------------------------------------
# Plot basic marker differences between inhibitory subtypes:
# Updated 12/03/2021
# ----------------------------------------------------------
library(cbrbase)
set_proj('DEVTRAJ', 'multiRegion')
source(paste0(bindir, 'multiRegion/load_metadata.R'... |
e94d619dedb89e840bf70afdb8de0d9a40b3021a4500d4bd998a6d6a46c60f9c | R | 3,359 | 102 | #' Formats a value as scientific notation if it is less than 0.0005, otherwise rounds to three decimals.
#'
#' @param value Numeric value to be formatted.
#' @return A character string of the formatted value.
#' @examples
#' format_value(0.0001) # returns "1.0e-04"
#' format_value(0.005) # returns "0.005"
format_val... |
8dea171ee043d80af6aa82c34506f2a6534f19780601eaaa4933e955de29ad66 | R | 3,363 | 120 | #Tests of homogeneity and completeness
#in this version, "tissue" is dependent on gfp neg/pos
#e.g. "CN12-neg" is different than "CN12"(pos)
#Test 1: cluster, Tissue+time
#Test 2: subcluster, Tissue+time
#Test 3a: cluster, Tissue+time for only GFP pos
#Test 3b: cluster, Tissue+time for only GFP neg
#Test 4a: subcluste... |
7c8645c49d36c7655494aaefe01212609de9a9b02ccc377628e0e2974d69c9c9 | R | 3,376 | 86 | test_that("convergence metrics are available for both fixed effects and random effects", {
# Skip if cmdstanr is not available
skip_if_not(instantiate::stan_cmdstan_exists(), "cmdstanr not available")
# Load test data
data("counts_obj")
# Test 1: Model with only fixed effects (no random effects)
# Thi... |
b14b0a9f97ae74fd69256f6821a89e067ea0f6b604b0879a917ad7759887be5c | R | 3,386 | 89 | ### Ref links
# http://tuxette.nathalievilla.org/?p=1696
# https://swcarpentry.github.io/r-novice-inflammation/05-cmdline/
## -----------------------------------------------------------------------------
# get the input passed from the shell script
args <- commandArgs(TRUE)
## ----------------------------------------... |
78a6b835cb6a161127c1d4331f56522454619a0a2f0ab1fb07f251da0d0a787d | R | 3,398 | 112 | library(tidyverse)
library(lme4)
library(mixedpower)
# set working path
setwd("D:/OneDrive/projects/ms2_numerosity/data/")
# Exp1-------------------------------------------------------------------------
data_e1 <- readxl::read_excel(path = file.choose())
data_e1_ws04 <- subset(data_e1, winsize == 0.4)
data_e1_ws06 ... |
c8afa9959df2371ad4e7a394a351db42c69fc57e01339f18eef4302d800eed9e | R | 3,405 | 115 | library(ggplot2)
library(ggseqlogo)
library(Biostrings)
# # Mane only
# dna <- readDNAStringSet("../../src/INPUTS/800bp/input_pos_MANE.shuffle.fa")
# dir.create("MANE")
# # Donor
# ggseqlogo(as.character(subseq(dna, 580, 620)), method = 'bits' )
# ggsave(
# "MANE/acceptor.png",
# width = 15,
# height = 3,
# d... |
d1f8f9006b7d50b2273c09eb91a1a782734c5953309644decefa80ec12ffc8da | R | 3,415 | 104 |
library(monocle3)
library("optparse")
library(ggplot2)
outDir = "rdsOutputs/RNA_Data/"
dir.create(outDir)
# Get the passed parameters
option_list = list(
make_option(c("-c", "--cdsRNA"), type="character",
default="allCells_HM10UMI=100_mito=10Scrub=0.2noPackerMNN=sampleNameK=40addAllTypes.rds",
... |
5f8624151330e3e6ce8032960c2b20fb2d494397ab7a213f682b57168d03e107 | R | 3,420 | 133 | n_iterations = 1000
test_that("test NA factors with interactions",{
skip_cmdstan()
library(dplyr)
formula = ~ group2__ * type
# Test that sccomp_estimate and sccomp_predict work with NA values and expect the ESS warning
res =
seurat_obj |>
sccomp_estimate(
formula_composition = f... |
24ba8979ef7fd321d06e0f45177f377f063981fafc68c257a29f272ea61940f5 | R | 3,422 | 88 | #!/usr/bin/R
# -----------------------------------------------
# Plot statistics for cohort and choose datasets:
# Preliminary plots for the metadata figures
# -----------------------------------------------
library(cbrbase)
set_proj('DEVTRAJ')
source(paste0(bindir, 'multiRegion/load_metadata.R'))
library(tidyr)
libra... |
e7a4b8e0e169598c928a35642569d922b64c7a94c813dac9ce05d704076353c9 | R | 3,422 | 96 | library(testthat)
test_that("get_3dlmer_status returns a refresh-compatible data frame", {
out_dir <- tempfile("afni_3dlmer_status_")
dir.create(out_dir, recursive = TRUE)
prefix <- file.path(out_dir, "lmer_result")
head_file <- paste0(prefix, "+tlrc.HEAD")
file.create(head_file)
status <- fmri.pipeline::... |
75db4d13afbf4c9b971eba6d4a4964b498b9eaed96204bec9894b47df1deecb2 | R | 3,424 | 87 | #!/usr/bin/R
# ---------------------------------------------------
# Plot composition differences - boxplots + barplots:
# Updated 11/25/2021
# ---------------------------------------------------
library(cbrbase)
set_proj('DEVTRAJ', 'multiRegion')
source(paste0(bindir, 'multiRegion/load_metadata.R'))
library(tidyr)
... |
44c7868f92a5fc7be429abdb49a2c2fbd35535601486cabe01d79696288d2ee5 | R | 3,426 | 113 |
opnmfR_ranksel_perm_boot <- function(X, rs, W0=NULL, use.rcpp=TRUE, nperm=1, boot=TRUE, nboot=1,
plots=TRUE, fact=TRUE, seed=NA, rtrue=NA, ...) {
stopifnot(ncol(X)>=max(rs))
start_time <- Sys.time()
# original data
cat("original data... ")
nn <- list()
mse <- lis... |
7ea870e6a3d95f974cafd3476fe25abcdd9038bea86c1a01d82285e0e9e234a7 | R | 3,429 | 103 | library(testthat)
test_that("setup_glm_pipeline derives session_data internally from run and subject data", {
subject_data <- data.frame(
id = c("sub1", "sub1", "sub2", "sub2"),
session = c(1L, 2L, 1L, 2L),
session_label = c("baseline", "followup", "baseline", "followup"),
group = c("control", "contr... |
7c8629c5416db098f1f1b67dd2f122a757ad434c187177119fd1fd1797eb9ac2 | R | 3,448 | 114 | library(jsonlite)
library(lme4)
library(lattice)
library(lmerTest)
library(MuMIn)
library(performance)
library(rstudioapi)
library(emmeans)
library(car)
library(tibble)
library(dplyr)
library(ggplot2)
# ----------------------------------------------------------------------
# Configuration and data loading
setwd(dirn... |
7d5599609a3355fce9c03d0d76cd55fd1aa5f8c06589b299ff8b7aceb4bc9515 | R | 3,456 | 100 | library(tidyverse)
library(tidyseurat)
library(sccomp)
library(job)
library(patchwork)
job({
load("data/counts_obj.rda")
counts_obj |>
mutate(is_benign = type=="benign") |>
rename(cell_type = cell_group) |>
sccomp_glm(
formula = ~ is_benign,
sample, cell_type, count,
... |
9b3f07ea40f9719497249043e90ab38d00909f0b13d4c68e67e75319561e1b18 | R | 3,462 | 89 | library(data.table)
library(spacexr)
library(Matrix)
library(dplyr)
library(tidyr)
library(tibble)
hippo_ref <- readRDS('../inst/extdata/reference_scrna/scRefSubsampled1000.rds')
celltypes_hippo <- hippo_ref@meta.data$liger_ident_coarse
levels(celltypes_hippo)[levels(celltypes_hippo)=='Denate'] <- 'Dentate'
hippo_cou... |
a551259b33478c77dbcb434fdeb066b4d037fd63563eacd842989359f58c44e7 | R | 3,472 | 105 | #!/usr/bin/R
# ------------------------------------------------------
# Compare our microglia definitions to Sun/Victor et al.
# Updated 11/17/2023
# ------------------------------------------------------
library(cbrbase)
set_proj('DEVTRAJ', 'multiRegion')
source(paste0(sbindir, 'load_metadata.R'))
library(tidyr)
libr... |
ba9efb34868f84d36e8a5c93aaa366ed41dc381ba5f0789cf20879f1018143b7 | R | 3,478 | 107 | library(STAAR)
library(rhdf5)
library(dplyr)
library(arrow)
library(stringr)
args <- commandArgs(trailingOnly = TRUE)
genotype_file <- args[1]
annotation_file <- args[2]
x_file <- args[3]
y_file <- args[4]
out_path = args[5]
min_eac = 10 #as in original STAAR paper
print(paste("Using min EAC for variants per gene... |
ed82a7a7430932d91f533c055fc2d531d46441fe90289fcbbcf09b9ca7cb9360 | R | 3,479 | 69 | ## NOTE: integrated becomes integrated.test during selection testing
integrated <- qs::qread("C:/Users/Maurits/SynologyDrive/Projects/scRNAseqR/results/sakshi_pipeV8/NSM-NS-NC-M/NSM-NS-NC-M.qs")
# perform_cluster_level_selection <- T
# "CX3CR1" %in% rownames(integrated)
selection_panel <- c("VIM", "S100B", "SOX9") # 19... |
803c3e25d6331cee47f778bd82be7a941037bca604330f6db85171a29b05e772 | R | 3,483 | 98 | #!/usr/bin/R
# -------------------------------------------------------------
# Check the barcode / sample mapping for the snATAC-MR project:
# Updated 05/12/2023
# -------------------------------------------------------------
library(cbrbase)
set_proj('DEVTRAJ', 'multiRegion')
source(paste0(bindir, 'multiRegion/load_me... |
9e729fcb21715cff1b4baa74fe97cbcb09c777a81e333eda89cec600d202ca04 | R | 3,485 | 115 | # Function -------------------------------------------------------------------
#' Helper function to harmonize treatment of file import results
#'
#' This function provides two ways of post-processing imported spectra:
#'
#' - optionally remove empty spectra (some spectrograph software will produce
#' empty spectra ... |
4eedbb9b45476586d3c3edabad1f1060e778ff909edcfb8b0e11ed87dddf8432 | R | 3,486 | 112 | #
# This is a Shiny web application. You can run the application by clicking
# the 'Run App' button above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
library(shiny)
library(DT)
library(workflows)
library(magrittr)
library(dplyr)
library(sjlabelled)
library(sjmisc)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.