sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
1339a14d6d4484432280dc6bd102dbd4cf928ae3244023850aade18e01d9b8da | R | 4,022 | 116 | ---
title: "Figure 1. Cell type correlation of brain single-cell RNA-seq data."
date: "2026/9/16"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
# Clean workspace
rm(list=ls())
# Load setting and functions
source("../script/stat_plot_functions.R")
# Set output directory
output... |
8038f06e86418e2f978a010fceaa887dde6fc5d686c735fa9e9c887fc6b32384 | R | 4,028 | 131 | #' Confident-Box Geom
#'
#' @param width the width of confident box.
#' @inheritParams ggplot2::layer
#' @inheritParams ggplot2::geom_polygon
#' @section Aesthetics:
#' \code{geom_confbox()} understands the following aesthetics (required
#' aesthetics are in bold):
#' \itemize{
#' \item \strong{\code{... |
3b4198ee1c25bd9067cb5ea1baed26db382846917e379208011651eb460361a9 | R | 4,035 | 90 | #@Time : 2023/3/11 20:17
#@Author : Biao Zhang
#@Email : littlebiao@outlook.com
#@File : barplot_degs.r
#@Description: This file is used to ...
# library
library(tidyverse)
library(viridis)
# Create dataset
data <- data.frame(
individual=paste( "Mister ", seq(1,60), sep=""),
group=c( rep('A', 60), rep('B', 30), r... |
02c93588749adc7ee50ac5e39fcb3dc32c97071d02b9af4ada25aa0422030bd6 | R | 4,038 | 99 | ## This script generates the upset plot for mash sig results.
library(ComplexHeatmap)
get_eqtls <- function(){
fn = "../../_m/lfsr.sex_interaction.txt.gz"
return(data.table::fread(fn))
}
memEQTLS <- memoise::memoise(get_eqtls)
prep_heatmap <- function(df){
caudate <- df |> dplyr::filter(Caudate < 0.05)
... |
9baf3a3a23db01e85c9c0fde5cbb143488814e4384b5a354ea258a2d092378e6 | R | 4,040 | 99 | ## This script generates the upset plot for mash sig results.
library(ComplexHeatmap)
get_eqtls <- function(){
fn = "../../_m/lfsr.sex_interaction.txt.gz"
return(data.table::fread(fn))
}
memEQTLS <- memoise::memoise(get_eqtls)
prep_heatmap <- function(df){
caudate <- df |> dplyr::filter(Caudate < 0.05)
... |
9f099bcaeb7aa3d4f1af86728d58b5b22d2049a3c7bfae54add95f1b31b3ea0e | R | 4,040 | 110 | ---
title: "Figure 4. GO Biological Process enrichment of DEGs in neuronal cell types."
date: "2026/9/16"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
# Clean workspace
rm(list=ls())
# Load setting and functions
source("../script/stat_plot_functions.R")
# Set output director... |
4e6bcee20d6133fb68fd707bacfd0639d216032226d992161f0ec617b6ca1ea7 | R | 4,042 | 99 | ## This script generates the upset plot for mash sig results.
library(ComplexHeatmap)
get_eqtls <- function(){
fn = "../../_m/lfsr.sex_interaction.txt.gz"
return(data.table::fread(fn))
}
memEQTLS <- memoise::memoise(get_eqtls)
prep_heatmap <- function(df){
caudate <- df |> dplyr::filter(Caudate < 0.05)
... |
b05c879e7ad841c8c6ed0c3a40323a020b56f4b21fb0c31dd65888212b633767 | R | 4,042 | 99 | ## This script generates the upset plot for mash sig results.
library(ComplexHeatmap)
get_eqtls <- function(){
fn = "../../_m/lfsr.sex_interaction.txt.gz"
return(data.table::fread(fn))
}
memEQTLS <- memoise::memoise(get_eqtls)
prep_heatmap <- function(df){
caudate <- df |> dplyr::filter(Caudate < 0.05)
... |
dec2a7a95c07527d614040e977811f527ed3f934ce4ba3622148ad9ddaf6f90e | R | 4,042 | 92 | library(tidyverse)
library(GenomicRanges)
library(plyranges)
library(rtracklayer)
library(here)
# Arguments ---------------------------------------------------------------
# Get GTEx median TPM
GTEx_path <- here::here(tempdir(), "GTEx_Analysis_2017-06-05_v8_RNASeQCv1.1.9_gene_median_tpm.gct.gz")
if(!file.exists(GTE... |
de0c8a2ab030d9f7c932a0c82d67f9f08675678f277ae42e9a2bb1fab4d9547e | R | 4,045 | 79 | library(Startrac)
library(pheatmap)
library(Seurat)
library(dplyr)
library(tidyr)
library(tibble)
library(ggplot2)
# Read Seurat object (must contain cell type annotation and group info)
sce <- readRDS("Brain_new.rds") # adjust to your input file path
output_dir <- "./"
phe <- sce@meta.data
# Tissue*group interacti... |
e40fd88f8b9ba34dda5f91285ef65c05a2980c70d00af3535afcd93e49465acb | R | 4,049 | 118 | #' Multiple imputation pooling: univariate version
#'
#' Pools univariate estimates of m repeated complete data analysis
#'
#' The function averages the univariate estimates of the complete data model,
#' computes the total variance over the repeated analyses, and computes the
#' relative increase in variance due to mi... |
145f295684f71ee80359bf5376e76f24c225dccd9d1342bb9dce04c0f1d190b3 | R | 4,050 | 103 | #' Linear regression for \code{mids} object
#'
#' Applies \code{lm()} to multiply imputed data set
#'
#' This function is included for backward compatibility with V1.0. The function
#' is superseded by \code{\link{with.mids}}.
#'
#' @param formula a formula object, with the response on the left of a ~
#' operator, and ... |
e166bbf876e2c60a67fd9da17b471c01e7e2dc3e46a9864fdeeaf4ca16f32386 | R | 4,051 | 142 | ---
title: "**Exon validation**"
---
The following page details the results of running the **cgat bam_vs_gtf** script. The metrics are to look at the number of mapped and spliced reads per bam file.
The following is a table showing the full metrics from the tool:
```{r exon_validation, echo=FALSE}
library(knitr)
li... |
36c2fec8a0f5c47698afc3d7e3fb740054f4e7d9ef53e3edb660023c2475bb2f | R | 4,052 | 99 | #!/usr/bin/env Rscript
source(here::here("src/shared/R-helpers/get_settings.R"))
suppressPackageStartupMessages({
library("dplyr")
library("tidyr")
library("readr")
library("tibble")
})
settings <- get_settings(omic = "proteomics", stage = "organize_samples", dataset_name = NULL) # dataset_name = "c9"
cohor... |
8d0aecc45fed835e9a5aa994249e8eb7bf6b5291f8b4b4c9cb2bd2d18ce9d508 | R | 4,052 | 114 | #### Residualize data
suppressPackageStartupMessages({
library(SummarizedExperiment)
library(tidyverse)
library(here)
})
## Helper functions for loading and combining data
load_rse <- function(filename){
load(filename)
rse_df = rse_gene
colData(rse_df) = colData(rse_df)[,c('BrNum', 'RNum', 'Reg... |
bb13e42ada26e571a38a19cf71c5b6fa34b12ed13924d5a1123b9265dca71127 | R | 4,063 | 116 | clusterPCA <- function(cluster_frame, expression_frame, n) {
# n = vector of time points
# cluster_frame = dataframe with genes and cluster assignments
# expression frame = dataframe with genes as rows and timepoints as columns
clusters <- levels(cluster_frame$cluster)
genes <- rownames(expression_frame... |
c1898645c4350946d90a035958df22b37f7f22b0f6c68720ef9792cde031993d | R | 4,063 | 73 | ## R-Script to read ASCII performance index data and plot them
library(ggplot2)
library(reshape2)
library(ggsignif)
library(effsize)
library(pwr)
library(BayesFactor)
#read data file
PIprofile <- read.csv(file=choose.files(), header=TRUE, sep=";")
#drop all columns not performance indices
PIprofile$FILE <- NULL
PIpr... |
1b1156144f28aba630c641132e20aa233ebc2a3126e26f0f70b0ddc542474585 | R | 4,077 | 154 | .libPaths(c("/maps/projects/scarball/people/chg306/R_libs",
"/opt/software/R/4.2.2/lib64/R/library",
"/maps/projects/scarball/apps/Modules/software/R-packages/4.2.2"))
library(limma)
library(edgeR)
library(DESeq2)
library(magrittr)
library(tidyverse)
library(Cairo)
library(MetabolAnalyze)
lip... |
57e648eaf515abfd8356cbb2040e4b8c255283bf25c2fc472b2b92568af80a66 | R | 4,080 | 122 | # Load libraries ----------------------------------------------------------
library(tidyverse)
library(here)
library(ggforce)
# Load data ---------------------------------------------------------------
sqanti_class <-
list(
GBA = read.table("/home/egust/Projects/GBA_GBAP1/raw_data/GBA_classification_processed.... |
d9c54b3e5db9723949e060ae481cae82b6a1d9ffc88993b65ff514b2365ea537 | R | 4,084 | 95 | # This code is from Vehtari + Gelman, 2014
# http://www.stat.columbia.edu/~gelman/research/unpublished/waic_stan.pdf
#
colVars <- function(a) {
n <- dim(a)[[1]];
c <- dim(a)[[2]];
return(.colMeans(((a - matrix(.colMeans(a, n, c),
nrow = n, ncol = c, byrow = TRUE)) ^ 2), n, c) * ... |
3eb83152c216874475e300c80d85d73a4b5e4665b4f75380e3c1096b3a4f4ab6 | R | 4,087 | 70 | library(ggpubr)
library(ggplot2)
library(ggsci)
library(ggsignif)
library(gghalves)
library(tidyverse)
# Donor1 new clone fraction
pred_donor1 = read.table('donor1/pred.tsv', header=TRUE, sep='\t')
test_donor1 = read.table('donor1/test.tsv', header=TRUE, sep='\t')
Hetero_donor1 = left_join(test_donor1, pred_donor1, by... |
d4e268a829875e57ccc5857f72b24d3205e9ac2dfcbd39d53c065473d5604c92 | R | 4,087 | 70 | library(ggpubr)
library(ggplot2)
library(ggsci)
library(ggsignif)
library(gghalves)
library(tidyverse)
# Donor1 new clone fraction
pred_donor1 = read.table('donor1/pred.tsv', header=TRUE, sep='\t')
test_donor1 = read.table('donor1/test.tsv', header=TRUE, sep='\t')
Hetero_donor1 = left_join(test_donor1, pred_donor1, by... |
c37a9f065b84e279dcdbcd6b4a201df632ea167e779e82a8d8c76d1d9c2ce6e4 | R | 4,091 | 103 | library(MotrpacRatTraining6mo)
library(devtools)
library(data.table)
load_all() # load dev version of this library
# compile sample-level data for all differential features
diff_features = data.table(TRAINING_REGULATED_FEATURES)
features = diff_features[,feature]
features = unique(features)
# handle metabolomics me... |
a0b94e0653308aeced228d4c2f1a603a425bdf028e6a8a9a8b62d995d423a1db | R | 4,094 | 161 |
sim.and.eval <- function(alpha, beta, ntrials, npairs=3, reward.prob=c(.8, .7, .6)){
Q=rep(0, npairs*2)
ACC=0
for(pair in 1:npairs){
for(t in 1:ntrials){
A=2*pair-1
B=A+1
pA=exp(Q[A]/beta-log.sum.exp( c(Q[A], Q[B])/beta ))
a=sample(c(A,B), 1, prob=c(pA, 1-pA))
reward=sample( c(a... |
51a1eb5d2bcbee27e2ce459f060a2a4774fb41f0027fbaf7aac5701c9a7fe56d | R | 4,096 | 69 | #!/usr/bin/Rscript
library("optparse")
option_list = list(
make_option("--PLINK_prefix", action="store", default=NA, type='character',
help="Prefix of PLINK files for the target sample [required]"),
make_option("--PLINK_prefix_chr", action="store", default=NA, type='character',
help="Pr... |
1b6843b12cbf794862559b84746e2341c2ae4121c51dcb70ddeaefc7faff8867 | R | 4,097 | 108 | ---
title: "Linking genetic markers and crop model parameters using neural networks to enhance Genomic Prediction of integrative traits"
output: html_notebook
---
# Install and load packages, declare functions
Three libraries are needed for the purpose of this analysis. The 'here' package manages relative paths. The... |
7d334d6a3e1668251904821641a86d4a643088864419e726528f80066323cf8b | R | 4,097 | 117 | library(data.table)
library(stringr)
### will want genes to also have prior info so...
long_prior <- fread("C:/STUDIES/RESEARCH/ODE_project_local_old/mias_bcell_data/otter_clean_harmonized_full_prior.csv")
all_prior_affiliated_genes <- unique(c(long_prior$from, long_prior$to))
### start cleaning
full_data <- fread("... |
c06feb236653510f75ea8eebd114a8002bc740f1f78167d2b560d77511e1acb4 | R | 4,101 | 107 | #6 Trajectory analysis
# Setup---------------------------------------------------------------
rm(list = ls()) ; gc() ; gc()
set.seed(1234)
wdir <- 'set your working directory'
setwd(wdir)
save.path <- 'object folder path'
# load library
easypackages::libraries(c('Seurat','SeuratWrappers','SeuratDisk',
... |
e87a05a17dcb7dc298cad7d336d4235fd623e97c562387b3e17c394dd35b7aa4 | R | 4,124 | 111 | library(Seurat)
library(SeuratDisk)
library(harmony)
library(rliger)
library(tidyverse)
library(SeuratWrappers)
library(EnsDb.Hsapiens.v75)
set.seed(1234)
file_path <- '/data/work/uniPort/spleen_ATAC/'
# load saved data from multiMAP tutorial
# RNA
spleen_count <- read.csv(paste0(file_path,'rna_count.txt'),header = FA... |
73d8ca561b3ba215510a057868c93b0159fd2123b9b07d807553452332a0ab93 | R | 4,128 | 95 | ##-------------------------------------------------------
## SEURAT ANALYSIS | MODULES & LIBRARIES
##-------------------------------------------------------
# module purge && module load shared slurm python/3.7.x-anaconda
# module load gcc/8.3.0
# module load hdf5_18/1.8.17
# module load R/4.1.1-gccmkl
##-------------... |
852824d8eb9625cdc576a605a94ea823aa79115e30ce659ef0fb51f3aad3c566 | R | 4,131 | 136 | #' Internal helpers for fitting hBayesDM Stan models via cmdstanr.
#'
#' Wraps the cmdstanr API so per-task R files don't have to know about it.
#' Compiled Stan binaries are cached next to the source `.stan` files.
#'
#' @keywords internal
#' @name hbayesdm-cmdstan
NULL
#' Locate the .stan file for a given hBayesDM m... |
326f9c4c29083e9ffe024b738bee317bcbde034d134f333a4a656c15dcc21f06 | R | 4,167 | 62 | #' @templateVar MODEL_FUNCTION hgf_ibrb_single
#' @templateVar CONTRIBUTOR \href{https://github.com/bugoverdose}{Jinwoo Jeong} <\email{jwjeong96@@gmail.com}>, \href{https://github.com/juhajulia}{Juha Lee} <\email{juhajulia44@@gmail.com}>, \href{https://github.com/0150362}{Yusom Jo} <\email{yaun2288@@snu.ac.kr}>
#' @tem... |
0739eda4a3238a0e478d73d82dfaf1bb9a8c5ba00e20525f97be95343ee5af99 | R | 4,172 | 149 | ---
title: 'Saldana, Montano, et al. -- ATAC-seq: Annotation and enrichment analysis'
author: 'Florian Halbritter'
date: '`r format(Sys.time(), "%B %d, %Y %H:%M:%S %Z")`'
output:
html_document:
toc: yes
toc_float: yes
code_folding: show
highlight: pygments
df_print: paged
---
# Intro
In this ... |
2b01676f81bc0f09375fea986ae725f65ae492d339461b0c206256f24d919fc8 | R | 4,176 | 109 | #!/usr/bin/env Rscript
suppressPackageStartupMessages({
library(dplyr)
library(ggplot2)
library(readr)
requireNamespace("gtools")
})
source(here::here("src/shared/R-helpers/remove_ensembl_version.R"))
source(here::here("src/shared/R-helpers/get_settings.R"))
settings <- get_settings(omic = "integration", st... |
45b3ea661d90e450e99eda3adcd3719a9753f165ef0e589a7e2c2e5625188ab9 | R | 4,178 | 101 | ## This script generates the upset plot for mash sig results.
library(magrittr)
library(ComplexHeatmap)
get_sig_genes <- function(){
fn <- paste0("../../summary_table/_m/",
"differential_expression_analysis_4features_sex.txt.gz")
return(data.table::fread(fn) %>%
dplyr::filter(Typ... |
5161b19537900dc6bf4247844d273c60fefbe694691363eb763cfad70256c264 | R | 4,178 | 122 | #' Curve layer
#'
#' @inheritParams ggplot2::layer
#' @inheritParams ggplot2::geom_curve
#' @section Aesthetics:
#' \code{geom_links()} understands the following aesthetics (required aesthetics are in bold):
#' \itemize{
#' \item \strong{\code{x}}
#' \item \strong{\code{y}}
#' \item \strong{\code{... |
b9de445c7ad2d3c35c2703fe64fd870115314ecc7f8bc138fb30e6b55f2df207 | R | 4,178 | 113 | suppressPackageStartupMessages({
requireNamespace("rlang")
requireNamespace("dplyr")
requireNamespace("ggplot2")
requireNamespace("ggrepel")
})
create_volcano_plot <- function(
df,
padj_thres = 0.05,
up_log2fc_thres = log2(1.5),
down_log2fc_thres = -log2(1.5),
padj_thres_loose=0.1,
cap_minuslog10pv... |
8ffff10e2baa57f5e9c94365cf5cc067e942e7af0a7a56e226f9828140381c5d | R | 4,189 | 98 | ###############################################
#Reading in DropViz cell type markers:
#Dropviz.org accessed 03-25-2021
#Query->Parameters->Clusters->CompareClusters
#Ran two queries:
#All Target Clusters within the striatum (STR) vs. as comparison "Rest of Striatum"
#All Target Clusters within the hippocampus (HC) v... |
202bab6e3b93401be64d5c17eb44c1b1a538a75afa2ae9e9090d77012daaeb80 | R | 4,192 | 122 | setwd('F:/deconbench/rosmap')
load('raw/bulk/rosmap_covcorrected_bulk.RData')#bulk-tissue expression
load('new/rosmap_meanref.RData')#reference
mg<-read.csv('new/mg_rosmap.csv',header=T,sep=',',row.names=1)#mg: edgerqlf, wilcox
#intersection of genes in bulk-tissue expression and reference
geneid<-intersect(ro... |
22a3a824231a94aeb2f50fe5eca1ec95d9e84d88773bc6bd151da35f5dd17796 | R | 4,198 | 93 | # path_to_matlab: path to bin folder of matlab installation
library(matlabr)
options(matlab.path = path_to_matlab)
stopifnot(have_matlab())
# train_cls: vector of names/IDs of training cell lines
# test_cls: vector of names/IDs of test cell lines
# exp_matrix: data.frame containing gene expression values, rowna... |
f211e26300978898ce43e7b0f4983d4c8bf316c9d6fee5d02c659968d7c27ef2 | R | 4,205 | 120 | #' Missing data pattern
#'
#' Display missing-data patterns.
#'
#' This function is useful for investigating any structure of missing
#' observations in the data. In specific case, the missing data pattern could be
#' (nearly) monotone. Monotonicity can be used to simplify the imputation model.
#' See Schafer (1997) fo... |
77b5f98b4cbdad863b1d84b8ce7946b02ee835a26a02a1b49532f1c74358f175 | R | 4,218 | 111 | ---
title: "ISTART Social Doors Plots"
author: "James Wyngaarden"
date: "2022-11-30"
output: html_document
---
Set working directory
```{r, echo=FALSE}
setwd("~/Desktop")
maindir <- getwd()
datadir <- file.path("~/Desktop/")
```
Load packages
```{r, echo=FALSE, results=FALSE, include=FALSE}
library("readxl")
library(... |
34cb94498a1749199f0ff3ad53869cada4d5f0a0adabb1b9c4719d7abdbe39bb | R | 4,228 | 114 | #############################################
##
## mash modeling in R
## Author: Kynon J Benjamin
##
#############################################
suppressPackageStartupMessages({
library(mashr)
library(dplyr)
library(ggpubr)
})
save_img <- function(image, fn, w, h){
for(ext in c(".svg", ".pdf")){
... |
6086c36c4130f33c7cd94febafdb420c27d86e1f6cf07e3d788fbef4a5cc3850 | R | 4,242 | 103 | #' SE Fireworks disaster data
#'
#' Multiple outcomes of a randomized study to reduce post-traumatic stress.
#'
#' Data from a randomized experiment to reduce post-traumatic stress by two
#' treatments: Eye Movement Desensitization and Reprocessing (EMDR)
#' (experimental treatment), and cognitive behavioral therapy (C... |
1e59b41837665caff7b805602d3b91e3085902bb9ad1608fbe5d00064860f23a | R | 4,258 | 63 | #' @templateVar MODEL_FUNCTION hgf_ibrb
#' @templateVar CONTRIBUTOR \href{https://github.com/bugoverdose}{Jinwoo Jeong} <\email{jwjeong96@@gmail.com}>, \href{https://github.com/juhajulia}{Juha Lee} <\email{juhajulia44@@gmail.com}>, \href{https://github.com/0150362}{Yusom Jo} <\email{yaun2288@@snu.ac.kr}>
#' @templateVa... |
e490fd94c02406316e53db16acbfc5614ea953821782b4b80b3f8d00524d6109 | R | 4,261 | 113 | ##' @title Merge RNA/miRNAs raw counts data
##' @description Merge raw counts data that is downloaded from GDC to a
##' single expression matrix
##' @param metadata metadata parsed from \code{\link{gdcParseMetadata}}
##' @param path path to downloaded files for merging
##' @param data.type one of \code{'RNAseq'} a... |
7a5b73e5acf1d2435b21afdbf46ee91d39e8db7531d414eebbed5d7978ef54a7 | R | 4,265 | 132 | #' Transform data base on different layout
#' @description These layout functions are not layout in the network diagram,
#' it just converts the original data into a form that makes it easy to draw
#' a curve graph.
#' @param data a data frame.
#' @param cor_tbl a col_tbl object.
#' @param start.var,end.var character t... |
7691d925d0b5a77191be9a9980b820d8073470132ea9fac8008bd9f17d99ee07 | R | 4,268 | 107 | ## Modules
# module purge && module load shared slurm python/3.7.x-anaconda
# module load hdf5_18/1.8.17
# module load gcc/8.3.0
# module load htslib
# module load gsl/2.4
# module load macs/2.1.2
# module load R/4.1.1-gccmkl
## R Libraries
rm(list = ls())
library(devtools)
library(dplyr)
library(scran)
library(Seura... |
f88ee7cf63440ce41db55a605f5738622fffe70ccb76afc0d0dc748e0f6c9a50 | R | 4,304 | 104 | #Gemma: Downloading NACC Differential Expression Results
#####################################
#I had trouble using the api to download differential expression results on mass. Here is the code that should work:
DEResults =
datasetInfo('GSE107999',
request='degs', # we want this endpoint to return da... |
3cd31c33e3991deb2b1a2cb8592e4efa25a5a576f45f238de8f4b9305f168d9e | R | 4,305 | 132 | #### This script explores sex steroid hormone levels
#### in the brain
suppressPackageStartupMessages({
library(dplyr)
})
get_expression <- function(region){
fn <- here::here("differential_expression",
tolower(region), "_m/genes/voomSVA.RData")
load(fn)
return(v)
}
memVOOM <- memo... |
63c980d449ba33e5bbf035209a53affac20621927bbc59bd0240e09db2ccf5cd | R | 4,313 | 100 | #' @title Count a tree length
#'
#' @description Count a tree length using the Morphy Lib implementation
#'
#' @param tree a \code{phylo} object.
#' @param matrix a discrete morphological matrix
#'
#' @examples
#'
#' @seealso
#'
#' @author Thomas Guillerme
#' @export
morphy.length <- function(tree, matrix) {
## ... |
94c4e9bb72096e3b8245ae08171b620dd0d545cbbf4e8b60f779f94f87312ae1 | R | 4,313 | 137 | parse.varname <- function(varname) {
## Try to parse string of form "a" or "a[n,p:q,r]" where "a" is a
## variable name and n,p,q,r are integers
v <- try(parse(text=varname, n=1), silent=TRUE)
if (!is.expression(v) || length(v) != 1)
return(NULL)
v <- v[[1]]
if (is.name(v)) {
##Full node array re... |
e20d4945262b0fec5938f3f29befa6ef2a5883cfbb529e5ef79462bc61bd3ecf | R | 4,315 | 148 | is_gtf <- function(x) {
if (is(x, "GRanges")) {
x <- as.data.frame(x)
if (all(c("type", "gene_id", "transcript_id") %in% names(x))) {
x <- x %>%
dplyr::select(type, gene_id, transcript_id) %>%
dplyr::distinct()
if (nrow(x) > 1) {
... |
efdfdfe02025ba27ebd387f000068c074b2a31e2c660558f8160d78a7ff1f870 | R | 4,316 | 102 | #!/usr/bin/Rscript
## Import Libraries
library("DESeq2")
library("ggplot2")
## Import counts matrix
cts_transcript <- as.matrix(read.csv("../../../data/bernardo/processed/04.deseq2/transcript_counts_unfiltered.tsv", sep="\t", row.names="transcript_id"))
cts_gene <- as.matrix(read.csv("../../../data/bernardo/process... |
4d9f36e8076ec6a3500a8cd57af2eeab04aafd33dc103d24f1b0f536f5c5d440 | R | 4,343 | 136 | #marker genes identification
load("ros_obj_rnaslot.RData")
##cell level: wilcox
load('ros_obj_rnaslot.RData')
Idents(ros_raw)<-ros_raw@meta.data$broad.cell.type
wilcox_ovs<-FindAllMarkers(ros_raw, test.use = "wilcox",min.pct = 0.1,logfc.threshold=0.25,only.pos=TRUE)
t1<-rep(colnames(meanexp),rep(ncol(meanexp)... |
98697f91f50d0e4da6002b160c55524654617046ae1a02c1be46fb7885fcb8a2 | R | 4,343 | 108 | ## WGCNA analysis
construct_network <- function(softpower){
library(WGCNA)
options(stringsAsFactors = FALSE);
enableWGCNAThreads(nThreads=16)
lnames = load(file = "01.RData")
# softPower value from previous plot
# power_parameter_se... |
b473fb10c012ba4233073127aab47233f091c1661205d1c593ef3879f2370167 | R | 4,343 | 108 | ## WGCNA analysis
construct_network <- function(softpower){
library(WGCNA)
options(stringsAsFactors = FALSE);
enableWGCNAThreads(nThreads=16)
lnames = load(file = "01.RData")
# softPower value from previous plot
# power_parameter_s... |
c417fde9ffa51dc89800e8edc321e26c9bfd74e5f7af211687912e18970a8a64 | R | 4,344 | 122 | ## This script analyzsis gene set enrichment with permutation
suppressPackageStartupMessages({
library(DOSE)
library(here)
library(dplyr)
library(biomaRt)
library(org.Hs.eg.db)
library(clusterProfiler)
})
get_biomart <- function(){
ensembl <- useMart("ensembl", dataset = "hsapiens_gene_ense... |
0a417a955a0feadd8bf72a9927ed48b808a82fb977279f262207195bc0a46ea1 | R | 4,346 | 106 | #### Data Simulation ####
###simulate some exemplary data for testing models
library(MASS)
library(tidyverse)
library(BayesFactor)
library(lme4)
simncalc <- function(n,
coeffs_bl, covmatrix, usable, mean_diff_y, sd_diff_y,
effect_age_change, sd_age_change,
... |
eaab121a16639f191de876d03aeaa0f26b0d375c9cb2cfcc4f7da2223e349840 | R | 4,346 | 158 | test_that("CBIND-001: combines imputations", {
data <- nhanes
data1 <- data[, c("age", "bmi")]
data2 <- data[, c("hyp", "chl")]
imp1 <- mice(data1, m = 2, maxit = 1, print = FALSE)
imp2 <- mice(data2, m = 2, maxit = 1, print = FALSE)
imp <- cbind(imp1, imp2)
expect_identical(ncol(complete(imp)), 4L)
e... |
d52ba287f123edaf060bd20eb59e4c654c17e8266ae64b48d09cdf511af066cc | R | 4,350 | 98 | #Gemma: What HC Differential Expression Results are Available?
###########
setGemmaUser(username="hagenaue", password=[DeletedForPublicRelease])
httr::set_config(config(ssl_verifypeer = 0L))
# This code prevents this curl error from occurring with some of Gemma's API functions:
# Error in curl::curl_fetch_memory(u... |
c4fafdb5ea06ec4c8ffc27c633606ba3b1ccc001b1f9547e2d740e5d335ca8ec | R | 4,352 | 176 | ### Process direct inflammation data, from
## Lien YC, Zhang Z, Barila G, Green-Brown A et al.
## Intrauterine Inflammation Alters the Transcriptome and Metabolome in Placenta.
## Front Physiol 2020;11:592689. PMID: 33250783
library(tidyverse)
library(magrittr)
library(limma)
library(edgeR)
count_data_names <-
... |
8cc887c8d215f6763ed21325b41a6fd697c5f99e96d6ee5c2baf7981cdefbc5c | R | 4,354 | 143 | #' Compare two nested models using D3-statistic
#'
#' The D3-statistic is a likelihood-ratio test statistic.
#'
#' @details
#' The \code{D3()} function implement the LR-method by
#' Meng and Rubin (1992). The implementation of the method relies
#' on the \code{broom} package, the standard \code{update} mechanism
#' for... |
87be4f963cde5ac7c9ee499f949c2808a9253a4fb4a35ecc951b8d77070c40b6 | R | 4,355 | 64 | ### DTS script to derive means and SDs for optomotor data in the group just evaluated and collect extracted OM parameters for dataset evaluation
library("wrMisc") #only needed for rowSEMs
if(any(grepl("optomotor", sequence$type)==TRUE)){ ###determine if there are optomotor periods
if (any(!grepl("optomotor", seque... |
c81f766711ba928e152136072591f06b90d8ea065a04166f90d9583fa00aff79 | R | 4,355 | 99 | library(limma)
library(edgeR)
library(tidyr)
library(reshape2)
library(plyr)
library(dplyr)
library(grid)
library(gridExtra)
current = getwd()
folder = "2_calculate_residuals_and_DE_analyses"
setwd(current)
system(paste0("mkdir -p outputs/",folder,"/2_3_popDR_results/"))
## inputs
meta_data_file <- paste0("inputs/",f... |
263dba2ad4ad47e6e21cb54ece5fba314f84ceabd0de99c8b356b3d9fa63b583 | R | 4,357 | 119 | library("lme4")
library("lmerTest")
library("BayesFactor")
# ensure that lmerTest doesn't mask lmer, which would cause us multiple problems
lmer <- lme4::lmer
library(broom.mixed)
library(dplyr)
setwd("/data/pt_life_whm/Analysis/VRF-and-progression-of-WML/data_analysis/")
n_it=10
dat=read.csv("../power_simulation/si... |
82e816d3b627bba836dbac633f8d5637f5a9b048acd100c1eecfe99a9ef25c0c | R | 4,362 | 102 | #!/usr/bin/Rscript
## Import Libraries
library("DESeq2")
library("ggplot2")
## Import counts matrix
cts_transcript <- as.matrix(read.csv("../../../data/bernardo/processed/04.deseq2/transcript_counts_unfiltered.tsv", sep="\t", row.names="transcript_id"))
cts_gene <- as.matrix(read.csv("../../../data/bernardo/process... |
d5e7d1ed8726ca9a5aa98e0b7ebb791b5b78655bea6a9fb34dd5d797e0d58020 | R | 4,368 | 113 | ---
title: "ncnb_cnv_filtering"
author: "Peter Zoescher"
date: "12/15/2023"
output: html_document
---
```{r libraries, echo=F, warning=F}
# to be run in ccribioinf/dockrstudio:4.0.3-v1
# dockerhub manifest digest: sha256:055a81938337a3fc2a15039476094058f5691e02b529578041af508352264323
suppressPackageStartupMessages(l... |
28fa7286365b020d029d25c787894dd33fd849521d9c4b71dada5e9d93b0d6ec | R | 4,369 | 120 | #' Imputation by the Support Vector Machine (mice-SVM)
#'
#' This function performs proper multiple imputation using the Support Vector Machine (SVM)
#' combined with bootstrapping, as proposed by Takahashi (2026). It is specifically
#' designed for binary variables in high-dimensional data settings.
#'
#' Note: Whe... |
2dc0b1b72000734bc6eb371729071ba0935721ea826995ee763017f2522fa030 | R | 4,370 | 108 | ## WGCNA analysis
construct_network <- function(softpower){
library(WGCNA)
options(stringsAsFactors = FALSE);
enableWGCNAThreads(nThreads=16)
lnames = load(file = "01.RData")
# softPower value from previous plot
# power_parameter_s... |
4fae456cb3391890ae3826c44a99ec1cc929d26114e9944c7abc6b7c1b87f7ec | R | 4,370 | 108 | ## WGCNA analysis
construct_network <- function(softpower){
library(WGCNA)
options(stringsAsFactors = FALSE);
enableWGCNAThreads(nThreads=16)
lnames = load(file = "01.RData")
# softPower value from previous plot
# power_parameter_s... |
5fc312d2bce273508cb203b156c101a30234b40cddc1d6dbec7f6702be7cfbce | R | 4,370 | 108 | ## WGCNA analysis
construct_network <- function(softpower){
library(WGCNA)
options(stringsAsFactors = FALSE);
enableWGCNAThreads(nThreads=16)
lnames = load(file = "01.RData")
# softPower value from previous plot
# power_parameter_s... |
81e391c4d240e81a0ad852e773362bca8854de8548b9704ee6ee8797d5797da5 | R | 4,371 | 109 | ## WGCNA analysis
construct_network <- function(softpower){
library(WGCNA)
options(stringsAsFactors = FALSE);
enableWGCNAThreads(nThreads=16)
lnames = load(file = "01.RData")
# softPower value from previous plot
# power_parameter_s... |
9911cd6c265f9a4d4a46c4c11eed29f46c8b3a0f6cce3ab21bdc03c16a87fa6f | R | 4,380 | 98 | ################################################################################
######## To be run after sequenza_analysis.R is done to extract info ###########
################################################################################
# Paths
input_path = "" # Where did you perform the Sequenza analysis?
sampl... |
b20061c6bd3daf27fbfb61a579983e8ae41c87b6372f2626e03f07cb6ee2c911 | R | 4,392 | 89 |
library("caret")
library("pROC")
library("plyr")
library("Boruta")
library("GMDH2")
set.seed(1234)
data <- read.csv("~/data.csv")
####################################################################################
#################################### Data split ####################################
###... |
9705cd425b7c9c6ee6c051d1bba8ce48dd657403dcef98acb9a1002b00007615 | R | 4,406 | 94 | #NACC - figuring out what differential expression results are available on Gemma:
setGemmaUser(username="hagenaue", password=[DeletedForPublicRelease])
httr::set_config(config(ssl_verifypeer = 0L))
# This code prevents this curl error from occurring with some of Gemma's API functions:
# Error in curl::curl_fetch_me... |
922dfcc0eebf4288b4aedfe200ce7ff8b8a0dee79ff93f6a5f25fb468bea27e2 | R | 4,408 | 151 | library(tidyverse)
library(epitools)
#######################################
# Concordance of High HERV Patients
#######################################
########
# Ctx Data
###########
Ctx_Freq_Pts_Vals <- read.csv("FreqCounts_Pts.csv")
Ctx_Freq_Ctrls_Vals <- read.csv("FreqCounts_Ctrls.csv")
Ctx_Freq_Pts_Samps <- C... |
199004266e2b31265e2bfb646c5ba4c201c8fc4a60adeab8f520af275e43ba75 | R | 4,414 | 101 | #' Score test for individual variants in a given variant-set
#'
#' The \code{Indiv_Score_Test_Region} function takes in genotype and the object from fitting the null
#' model to analyze the associations between a quantitative/dichotomous phenotype and
#' all individual variants in a given variant-set by using score tes... |
8dcf931e3f0e746e2bd7655e261eaee4d2d235571fbfd33e76e17c13e44ae080 | R | 4,414 | 128 |
ncs = length(oldprops)
oslopes = matrix(nrow = nrow(SpeciesMat), ncol = ncs)
oslopes = as.data.frame(oslopes)
colnames(oslopes) = c(paste0("OldSlope",oldprops))
oslopes$m0 = oslopes$M = NA
yslopes = matrix(nrow = nrow(SpeciesMat), ncol = length(props))
yslopes = as.data.frame(yslopes)
colnames(yslopes) = c(paste0("Yo... |
a2da22f63635d0b5796e2337e194d409587271ccbd06c57785920735406790f9 | R | 4,414 | 100 | library(tidyverse)
library(arsenal)
library(effectsize)
#read in ROI means
scd_table <- read_csv('roi_diff_means/scd_means_table.csv')
scd_table$cohort <- 'scd'
names(scd_table) <- sub('scd_', '', names(scd_table))
ctl_table <- read_csv("roi_diff_means/ctl_means_table.csv")
ctl_table$cohort <- 'ctl'
names(ctl_table) <... |
137528c9653bf4ef461115e8ac90c2b28700d1f1e06c31269fa144f53c92bc35 | R | 4,444 | 128 | jet.colors <- colorRampPalette(c("#00007F", "blue", "#007FFF", "cyan", "#7FFF7F", "yellow", "#FF7F00", "red", "#7F0000"))
# Adds a highest density ellipse to an existing plot
# xy: A matrix or data frame with two columns.
# If you have to variables just cbind(x, y) them.
# coverage: The percentage of points the el... |
032d4f57bfa0345b2f584fb013f14d01346eac983c5d68c71302cd8a35c17220 | R | 4,445 | 146 | #!/usr/bin/env Rscript
source(here::here("src/shared/R-helpers/get_settings.R"))
source(here::here("src/shared/R-helpers/pca_fit.R"))
source(here::here("src/shared/R-helpers/pc_scores_loadings_plot.R"))
suppressPackageStartupMessages({
library("dplyr")
library("tidyr")
library("readr")
library("tibble")
lib... |
4de8be47e71a88107a8ad12313aec00ddd9a3990bd22bde87e1777edb2748d65 | R | 4,450 | 103 | #'#################################################################################
#'#################################################################################
#' Explore GSE57945 features from different models
#'#################################################################################
#'###########... |
36217bca423c19ad056f12af20c25ea87b0135c534be731f910d0d187458c8f8 | R | 4,465 | 73 |
#Test run before going any further with things (just to make sure I didn't break anything essential while messing around with the .gmt files):
library(fgsea)
#First, for comparison, the old gmt:
setwd("~/Documents/Microarray Gen/Angela_HRLR_EE_Stress/NAcc_Remove2outliers/11_FGSEA/UpdatedGMT_20210325/GMTs_toMakeRat"... |
dfcc3f22221966cb987138f7f136e0fefe89ab509694a3204341ea7ec2a07ad7 | R | 4,467 | 174 | ---
title: "Saldana, Montano, et al. -- scRNA-seq: Dataset integration"
author: "Florian Halbritter"
date: '`r format(Sys.time(), "%B %d, %Y %H:%M:%S %Z")`'
output:
html_document:
toc: yes
toc_float: yes
code_folding: show
highlight: pygments
df_print: paged
params:
inputdata: '~/path/to/input_... |
a03e013d7cecfb75066b81ca994303b90313d7e1496cbf71ed3440891c78bccd | R | 4,476 | 146 | library(tidyverse)
source('~/scripts/single_cell/de.R')
source('~/scripts/single_cell/atac.R')
source('~/scripts/perturbator/de.R')
library(Pando)
library(ChIPseeker)
library(hdf5r)
library(anndata)
rename <- dplyr::rename
filter <- dplyr::filter
select <- dplyr::select
summarize <- dplyr::summarize
dist <- stats::d... |
4cb00516a12e462da9fe72b9262bb6234243ac0adccf94b5a1e113da328d1aeb | R | 4,481 | 155 | #' Helper function to extract cor_tbl.
#' @description These functions are used to quickly obtain the upper
#' trig, lower trig, diagonal, or remove the diagonal of the correlation
#' coefficient matrix.
#' @param x a cor_tbl object.
#' @param show.diag a logical value indicating whether keep the diagonal.
#' @... |
0be20db0d156c322049d435471164833f6198289bd794831ff5785a3e09a1c29 | R | 4,483 | 113 | #Evaluation of deconvoluted expression by bMIND, swCAM and TCA
load('tca_rosmap_withpropfile.RData')
load('swcam_rosmap_withpropfile.RData')
load('bmind_rosmap_withpropfile.RData')
load('ros_obj_rnaslot.RData')#load ground truth
scdata<-as.matrix(ros_raw@assays$RNA@counts)
smeta<-ros_raw@meta.data
scdata<-scd... |
64f4fee6b8cc41a7bcf20c3604e130dd9524013334f4abf1acc7421777505d85 | R | 4,484 | 120 | #############################################
##
## mash modeling in R
## Author: Kynon J Benjamin
##
#############################################
suppressPackageStartupMessages({
library(mashr)
library(dplyr)
library(ggpubr)
})
save_img <- function(image, fn, w, h){
for(ext in c(".svg", ".pdf")){
... |
e74e1715f07923949091b8d2c21eeb3ef29245fd5773bd1a551e79a4c9ae7ad7 | R | 4,491 | 127 | #' Imputation of ordered data by polytomous regression
#'
#' Imputes missing data in a categorical variable using polytomous regression
#' @aliases mice.impute.polr
#' @inheritParams mice.impute.pmm
#' @param nnet.maxit Tuning parameter for \code{nnet()}.
#' @param nnet.trace Tuning parameter for \code{nnet()}.
#' @par... |
d0fcbac46669b6fc5e823849dc90145b739493ee9a0dd9bff5d7f356c5ec33bb | R | 4,494 | 116 | ---
title: 'Saldana, Montano, et al. -- ATAC-seq: Unsupervised analysis'
author: 'Florian Halbritter'
date: '`r format(Sys.time(), "%B %d, %Y %H:%M:%S %Z")`'
output:
html_document:
toc: yes
toc_float: yes
code_folding: show
highlight: pygments
df_print: paged
---
# Intro
In this notebook, we p... |
627264fe11ad9ed57bc3ee01a32a1003d6da8a49e9b910ea3904d0db7c8f4907 | R | 4,500 | 133 | library(limma)
library(biomaRt)
library(expss)
library(ggplot2)
library(ggrepel)
library(egg)
################
## run LMMs
################
## load human counts and metadata
# add AGE column to 'gtex_meta.rds' using 'SAMPID' column if not already completed
hum_exp = readRDS('human_gtex_d0.rds')
hum_meta = readRDS('... |
b000247d4a2cc6f580ea70648c8ccf22242af26a1301de49a4fe7fdd595fe8b8 | R | 4,511 | 110 | # Kailash, can you please add the example for a gene pair based on Fig 1b of Cell Systems paper.
# Can you do it for 2 gene pairs- ZNF81-ZKSCAN1 & SH2D5-ZKSCAN1, both from PHG_IFG (BM36-44)
# Use cell-type corrected data
# Braak based colouring
rm(list = ls())
# Loading necessary packages ---------------------------... |
993bb6f4f9e06131bcf37346e01500b96672d07f737ae69a864f371f958ed9bc | R | 4,513 | 79 | library(tidyverse)
library(arsenal)
library(effectsize)
anat_over_55_mem = read.delim("anat_over_55.tsv", tryLogical = FALSE) %>%
select(participant_id, SCD, age, sex, homeint_v15, homeint_v24, homeint_v74,
homeint_mmse_cal, homeint_storyrecall_i, homeint_storyrecall_d,
objprpos_emotional_mem, ob... |
3e222de220cfed2ff76f4e2365c8cb4d75cf1eed82256b38e8f70a8f5b43dc3e | R | 4,522 | 103 | # to be run in ccribioinf/dockrstudio:4.0.3-v1
# dockerhub manifest digest: sha256:055a81938337a3fc2a15039476094058f5691e02b529578041af508352264323
addColsToEmptyGr <- function(gr, col_names) {
if (length(gr) != 0) {
stop("GRanges is not empty!")
}
n_old <- ncol(mcols((gr)))
n_new <- length(col_names)
ne... |
5ac9113d3a51f2e5e5ef9156f6babe117b9ba4a8256939f41523a55f9531e54f | R | 4,525 | 104 | #' Default \code{patterns} in \code{ampute}
#'
#' This function creates a default pattern matrix for the multivariate
#' amputation function \code{ampute()}.
#'
#' @param n A scalar specifying the number of variables in the data.
#' @return A square matrix of size \code{n} where \code{0} indicates a variable
# should ... |
37af2fa61f574f81a8ff1277280f51e9c204cb88db27f045b84e56e9c411b74a | R | 4,531 | 116 | #!/usr/bin/env Rscript
#' EnsembleAge: Simple Usage Example
#'
#' This script demonstrates how to use EnsembleAge with simulated data.
#' Run this script to test the package installation and basic functionality.
# Load required libraries
library(EnsembleAge)
library(dplyr)
library(tidyr)
library(tibble)
library(data.... |
fa593ac77f02bfb895478c5448c0c16b3453ea5d2d92cbedd3dc3eeea7085cfc | R | 4,536 | 130 | #' Scatterplot of amputed and non-amputed data against weighted sum scores
#'
#' Plotting method to investigate relation between amputed data and the weighted sum
#' scores. Based on \pkg{lattice}, \code{xyplot} produces scatterplots.
#' The function plots the variables against the weighted sum scores. The function
#' ... |
1517a6dbbc4402838da683d07e8b497a9595274ef25e97ce08976f2a1d613b09 | R | 4,539 | 123 | ---
title: "Linking genetic markers and crop model parameters using neural networks to enhance Genomic Prediction of integrative traits"
output: html_notebook
---
# Install and load packages, declare functions
Three libraries are needed for the purpose of this analysis. The 'here' package manages relative paths. The... |
6391ce2878f7af0e7c72b2b8d298c1852eba36d216e052288cb62a084ffbb4f4 | R | 4,551 | 79 | setwd("~/Documents/Microarray Gen/Angela_HRLR_EE_Stress/NAcc_Remove2outliers/11_FGSEA/UpdatedGMT_20210325/GMTs_toMakeRat")
c8_WhichAreRelevant<-read.delim("c8_WhichAreRelevant.txt", sep="\t", header=FALSE, stringsAsFactors = FALSE)
str(c8_WhichAreRelevant)
#'data.frame': 673 obs. of 2 variables:
table(c8_WhichAreRele... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.