sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
6f8d6bf678ad60f55f3b5a6a4432c70a5994f0effaefc34cd70d45f7f4bb1dc9 | R | 3,079 | 105 |
# to analyze posterior samples from the 'diff' model
# and generate posterior predictions
rm(list = ls())
library(openxlsx)
library(plyr)
library(tidyverse)
# modeling dir
behmodelDir = '~/Desktop/BehavioralModeling'
# load function for simulating behaviors
source('Func_Simu.R')
modelname = 'diff'
modeldir = file.... |
d12668429e65233b05645a9925975be5b24d69ed3343e07ba1c8dbd4019bf2c9 | R | 3,085 | 64 | library(stringr)
library(ggplot2)
library(patchwork)
library(argparse)
parser <- ArgumentParser()
parser$add_argument("--generator", default="FABP7")
parser$add_argument("--cutoff",type="integer", default=0.5)
args <- parser$parse_args()
foldername=args$generator
cutoff=args$cutoff
input_path=paste0('/scratch/users/ban... |
417a3798781c3332d90af6794468747406d3586daf7ce9de061ef2e5b0cf2ab5 | R | 3,088 | 61 | #' prepare_contigs_for_JAMS
#'
#' JAMSalpha function
#' @export
prepare_contigs_for_JAMS <- function(opt = NULL, fastafile = NULL, contig_minlength = 500){
#Make sure youre in the right directory
setwd(opt$workdir)
#Ensure min contig size is 500 bp.
flog.info(paste("Ensuring contigs have a minimum siz... |
9fdc9d4e3ab36de00004fe31a29443fd3eeb4d479cf65126c8f2f5b98df3e3cf | R | 3,103 | 87 | context("summary")
test_that("summary", {
data(GlobalPatterns, package="mia")
sumdf <- summary(GlobalPatterns, assay.type="counts")
samples.sum <- sumdf$samples
# check samples
colnames.samples <- c("total_counts", "min_counts",
"max_counts", "median_counts",
... |
08f22547623418c7ec7ca2aabe4985631a6eee515e6cccbe574729d8f397a6fe | R | 3,113 | 69 | #' get_feature_stats
#'
#' JAMSalpha function
#' @export
get_feature_stats <- function(opt = NULL, ucoindex = "freq", doContigs = TRUE, doFeatures = FALSE){
#Cap threads to 32 because of memory issues
appropriatenumcores <- min(max(1, (opt$threads - 2)), 32)
get_TNF <- function(sequence = NULL){
... |
b0a420098c80ca9d3f97cbb49a9ddd1412a0b6d414066a5437841e7d95b6b021 | R | 3,151 | 68 | message("rrho_data func need statinf matrix which included idname, pname and logFCname column.")
rrho_data <- function(dat, idname = "ID", pname = "p.value",
logFCname = "log2FC") {
if(!idname %in% colnames(dat)) stop("wrong idname.");
if(!pname %in% colnames(dat)) stop("wrong pname.");
... |
b57762304ce3819a2030d47215c956ab93f9c869f20afc796de9c5986f211dd1 | R | 3,166 | 125 |
rm(list = ls())
#################### Prepare ######################
source('Setup.R')
usedir = dirname(getwd())
figDir = file.path(usedir,'Figs')
source('Func_Simu.R')
SubInfo = read.xlsx(file.path(usedir,'SourceData.xlsx'),'SubjectConds')
subs = subset(SubInfo,Excluded==0)$Sub
nsubs = length(subs)
dat = read.xls... |
0340ab0904cd0c2288610761db6a61ec97d61d76eb68b979f2295b4388dcb733 | R | 3,192 | 69 | library(ggplot2)
library(ComplexUpset)
output_path= '/scratch/users/banwang3/celllines/scripts/RScripts/Rplots10/'
celltypes = c('CM','SKM','HP','PP','MN','RPE')
asegenes<-c()
for (ct in celltypes){
input_filename=paste0('/scratch/users/banwang3/celllines/analysis/DESeq2_norm/merged/',ct,'_merged_qvalue_DESeq2.txt'... |
f807eaeacabb1c3c4987e40305ffb06bb779992181f8db0292121c3290fbe024 | R | 3,224 | 61 | #' plot_readdata(readdata=NULL)
#'
#' Plots available read data of sequencing statistics.
#' @export
plot_readdata <- function(readdata = NULL){
#Make a copy of readdata, excluding samples with input as contigs
if("Proj_type" %in% colnames(readdata)){
dfr <- subset(readdata, Proj_type == "Assemble_fro... |
29153fdfb314df3f76c7af0886cd6ad55de0ccdc71d07ada90ba3c57bffe7699 | R | 3,237 | 72 | # function to run gprofiler fea on each cluster from complexheatmap
enrich_clusters <- function(cluster_df, custom_bg = NULL){
tempdf <- NULL
for(i in seq_along(unique(cluster_df$Cluster))){
clust <- dplyr::filter(cluster_df, Cluster == unique(cluster_df$Cluster)[i])
fea <- gprofiler2::gost(clust$GeneID, e... |
f281b7ea6065bd69d7786b4a93d12429c53ac3672bc9efffba5a9ca89ce0161f | R | 3,257 | 65 | library(stringr)
input_path='/scratch/users/banwang3/celllines/scripts/RScripts/figscripts/suppfigscripts/EE/'
deseq2_path='/scratch/users/banwang3/celllines/data_backup/scratch/users/banwang3/celllines/analysis/DESeq2_norm/merged/'
celltypes=c('CM','HP','MN','PP','SKM')
countcutoff=25
dEE=c()
deseq2_all=c()
for (cellt... |
70c43a440e053a4d0ad755a1ce24fe80a700ab7c8abe04bccfb7a5e0bb25beb2 | R | 3,262 | 73 | library("DESeq2")
library("qvalue")
library("stringr")
#Pairwise detection for tissue specific expressed genes
align2 <-'human'
input_path=paste0('/scratch/users/banwang3/celllines/analysis/ASE_norm/',align2,'/')
# Read in raw counts for all samples
tpm<-read.csv(paste0(input_path,'rawcounts.txt'),sep='\t')
print(head(... |
290861ebd0bd13a65954d4cbff6e4d699413c3f4fd26c52b04de7fb38d0c67c1 | R | 3,271 | 106 | ##############
### Script ###
##############
# Script to get regularization plots comparing estimated coefficients across range of spike variances in backwards DPE procedure.
# (Code for Simulation Study)
#################
### Libraries ###
#################
library(ggplot2)
library(latex2exp)
############
### Plot... |
c9c91dddb4ccb59e481daff7d51b8a44d46baf5d5daa8f6120745b87174f2408 | R | 3,276 | 123 |
test_that("exporters", {
set.seed(123)
tse <- TreeSummarizedExperiment::makeTSE()
assayNames(tse) <- "counts"
taxranks <- c("Family", "Genus", "Species")
rowData(tse)[taxranks] <- lapply(
taxranks, function(x) sample(letters, nrow(tse), replace = TRUE)
)
# Test exportRaw
dpat... |
9adcb364cc0a0f42d0ba59cc9edacab9c900b15b9fb1420096f20db9a305a211 | R | 3,290 | 160 | ---
title: "Photometry data processing"
output: html_notebook
---
If you want to use this code, please cite our Jove paper:
__Martianova, E., Aronson, S., Proulx, C.D.__ [Multi-Fiber Photometry to Record Neural Activity in Freely Moving Animal.](https://www.jove.com/video/60278/multi-fiber-photometry-to-record-neural-... |
ab9f58cac0eeaabd2f58733607f2ca393f8c0287ce01e9e41da2bde74499725f | R | 3,290 | 78 | # power density spectrum
# lag autocorrelation
output$power_plot = renderPlotly({
req(input$power_dataset, input$power_series)
dataset = data.table()
values = data.table()
refs = data.table()
# for (s in input$lag_series) {
# .s = data$series[[input$lag_dataset]][[s]]
# ... |
e7dc1b7e0cb77167a7de7d02a89392ff9caf68dbfd03ccfaae953de14315bd4f | R | 3,300 | 37 | ---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
<!-- This line is from RStudio -->
# Giotto
<!-- badges: start -->
[](https://opensource.org/licenses/MIT)

testthat::skip_on_ci()
debug_flag <- FALSE
# Generic test.
familiar:::test_plots(
plot_function = familiar:::plot_decision_curve,
outcome_type_available = c("binomial", "multinomial", "survival"),
data... |
d288a345d2269e4c4d3a829d8403766cab3101f743c19851f34fc5fd9dd69659 | R | 3,312 | 62 | #' plot_genome_taxonomy_donut(opt = opt, contigsdata = NULL)
#'
#' JAMSalpha function
#' @export
plot_genome_taxonomy_donut <- function(opt = opt, assemblystats = NULL, taxlevel = "LKT", isolatename = NULL, percentage_threshold = 99, ntop = 8, brewer_palette = 3){
if (!is.null(opt)){
assemblystats <- opt$... |
a0f5eb42d92e9f8a557ff1671b00166a0105871fa5588e63823e206b4d3be18d | R | 3,315 | 85 | library(parallel)
basePath = "/data/bcu_projects/MelBrainSys_PostdocProject_Gruetzmann/publications/2022-my-MelBrainSys-paper/scripts-etc-for-publication/"
myPath = paste0(basePath,"regNet/validation-cohort/")
localRlibs = paste0(basePath,"conda/lib/R/library/")
library(regNet)
setwd(myPath)
localGeneCutoff = 30
pV... |
8702d53d340887e8e95434052c152bded1087fd0d33c1e9c9a89b73622a06568 | R | 3,329 | 116 | ## Twelve separate models: Cho and Ins each in BG, MFGM, PWM across water and creatine referencing
# X (IV) -> HIV.status
# Y (DV) -> total PHQ-9 score
# M (mediator) -> Cho/Ins in BG/MFGM/PWM
# Covariates: age, gender, time difference ("diff")
med.df <- data.frame(
label = character(0),
estimate = numeric(0),
... |
1c4da2f4d1b3cc0871c040d4b095e363aba584890a0023e01058aa1b66a7ae89 | R | 3,353 | 64 | ##################################
# Visualize specific genes for Supplementary Figure 6b - cluster gene expression violin plots.
# Updated: 2021.05.10
# Author: Kevin J.
###################################
mybasedir = "/Users/johnsk/github/"
setwd(mybasedir)
###################################
# Necessary packages:
... |
a0ec8087857c7dc08d5999fe1b9722fbd4602b95893103213b235d314e82515b | R | 3,369 | 121 | ## Twelve separate models: Cho and Ins each in BG, MFGM, PWM, with water and creatine referencing for each
# X (IV) -> HIV.status
# Y (DV) -> total PHQ-9 score
# M (mediator) -> Cho/Ins in BG/MFGM/PWM
med.df <- data.frame(
label = character(0),
estimate = numeric(0),
ci.min = numeric(0),
ci.max = ... |
50eaa762eeb2898d4ab8623f2a05d87c4d5ab5d62e0edd27ebdb90b3decc93df | R | 3,382 | 78 | # retrieval of gene disease associations from DisGeNET via disgenet2r
# vignette: https://www.disgenet.org/static/disgenet2r/disgenet2r.html
# install disgenet2r:
# library(devtools)
# install_bitbucket("ibi_group/disgenet2r")
library(xlsx)
library(disgenet2r)
# register with DisGeNET and enter credentials here:
dis... |
f7aabf960c27fae1fb1c31535742a69d47c528fe2dfaf23ebc4b95ecd32109c8 | R | 3,391 | 101 | .compute_rank_borda <- function(
x,
rank_threshold,
truncated = FALSE,
enhanced = FALSE
) {
# Borda selection methods, as in Wald R, Khoshgoftaar TM, Dittman D, Awada W,
# Napolitano A. An extensive comparison of feature ranking aggregation
# techniques in bioinformatics. 2012 IEEE 13th Int. Conf.... |
4f85c147a2b6dd414180403530638bc5d4e8901966c69c94c9cedc69d7942d55 | R | 3,428 | 117 | # First test if all selectable learners are also available
familiar:::test_all_learners_available(
learners = familiar:::.get_available_naive_bayes_learners(show_general = TRUE)
)
# Don't perform any further tests on CRAN due to time of running the complete test.
testthat::skip_on_cran()
testthat::skip_on_ci()
fami... |
0d67d43c14edcac2d6b5a0806348b99cca7a287aca0ff9f5bd2750a700263eaf | R | 3,438 | 106 | #############################################################
##################### GENERATE GRAPHS #######################
#############################################################
## load datasets
load(url("https://www.dcc.fc.up.pt/~vanessa.silva/datasets/NetF/Data/M3_data.RData"))
#############################... |
529120f3f6c648a5b028772a5845953724d58247be108d82428d06e713ac99b9 | R | 3,454 | 133 | #############################################################
######################### MAIN ##############################
#############################################################
#######################################################
#### load libraries
source("libraries.R")
##############################... |
9575baaacc51c9fd4838213a9b0f441d883ba1f8e0777d7202580d12ef9d9034 | R | 3,472 | 76 | # An example of the Metropolis-Hastings MCMC without likelihoods
# method ( Marjoram, P., Molitor, J., Plagnol, V. & Tavar´e, S. Markov
# chain Monte Carlo without likelihoods. Proc. Nat. Acad. Sci. USA 100, 15324–15328 (2003). )
# This function returns ndraws from an mcmc process to estimate the posterior
# distribut... |
6687b026ff366aeb62c7716037eecd70526a16c95b116b2e35bc2a046262f1c1 | R | 3,481 | 65 | # shiny ui layout
# simple ui generator for dropdown plot options
source("ui/plotOptions.R")
# source("ui/help-layout.R", local = T)
source("ui/data-layout.R", local = T)
source("ui/events-layout.R", local = T)
# source("ui/intervals-layout.R", local = T)
source("ui/analysis-layout.R", local = T)
# source(... |
be98525897e0ce4c9cb18737fdcf7c9d38ed91472e615ffe2d83e86fb7a721ce | R | 3,484 | 63 | #' make_readdata(Samples=NULL, list.data=NULL)
#'
#' This function makes a data frame with the sequencing statistics.
#' @export
make_readdata <- function(Samples = NULL, list.data = NULL){
#Consider all samples if list not given
if (missing(Samples)){
Samples <- name_samples(list.data = list.data)
... |
dbffb439047020153b81f7185e6258d62510f883df325d12474cdfa49fe2861d | R | 3,487 | 107 | #sAutomation of IRR using package irr
#set working directory for where you have this script and your data file saved
dir<-"C:/Users/ailbhe/Automation-InterRater-Reliability"
setwd(dir)
#install packages required to run the script - may take a few minutes to install
install.packages('irr')
install.packages('data.tab... |
3cdf7a4733dbbd211f28bced32c8a73199eb6029496f80d78a79f5039be03af0 | R | 3,501 | 87 |
#read.ms.output -- a function to read in the output of ms.
#
# This function reads in the output of the program ms, storing the
# results in a list of lists.
#
# The function takes a single argument,either a file name or a vector
# of character strings, one string for each line of the output of ms.
# The functio... |
5a0524c84915a75e0a74b9a0e93fdd682b1193819980a78c9d1d7dd278886888 | R | 3,501 | 97 |
#' Network inference module: Combine individual sub-networks to a global network
#'
#' This function integrates individual sub-networks into a global network.
#' @param networkName Name of network
#' @param cores Fixed number of sub-network inference problems
#' @param path Project path
#' @param output Show progress ... |
c042b0ebee2adc9f7148e90ae1279a639d4bd5f7ca2a0ec72c880d032335020b | R | 3,508 | 86 |
# observeEvent(input$events_dataset, {
# updatePickerInput(session, "events_binary_variable", choices = getCommonDatasetVariables(input$events_dataset), selected = input$events_binary_variable)
# updatePickerInput(session, "events_peakwindow_variable", choices = getCommonDatasetVariables(input$events_data... |
23475a6df5d148975921ac81f37d08716dd1b37187b21a42be27e2398d4f4b68 | R | 3,510 | 81 | library(data.table)
library(ggplot2)
library(ggtext)
library(tidyverse)
library(qvalue)
library(ggrepel)
tests_genes <- read.delim("local_data/burden_results/burden_selected/tests_genes.tsv", sep="\t")
pheno_table_count <- read.delim("run_folder/phenofile_counts.table", sep = "\t")
pheno_table_count$test_name <- sap... |
cba8e260bb428a129211c6269a8b6deeaeb982ac847472142f2dcb113e835a2a | R | 3,546 | 71 | #' Safely merges two sparse matrices. This function was written for exclusive use by the merge_JAMS_SEobj function (see). It has not been tested or benchmarked for a use other than that one.
#' @param matlist - A list of sparse matrices
#' @export
merge_sparse_matrix <- function(matlist = NULL) {
root_mat <- ma... |
1840fa7ac838ff681cd45e48ed9e7a8247ea790e153c2708d0a50c749b5c5e2b | R | 3,559 | 125 | CleanDiff=function(ymat,
distmat,
cortex,
mod0,
cov.interest,
sacf,
max.radius,
perm = "Draper–Stoneman",
nperm = 5000,
alpha = 0.05,
... |
94c3b7527cdf84fb51f12c8175a5e2d20db96b7895793d9ced3c0af5bf5ecca1 | R | 3,574 | 82 | # bulk-calc_chr_CpG_PDR.R - This script takes input epiallele data for one chromosome of one sample
# and calculates the proportion of discordant reads (PDR) per CpG
require(optparse)
require(genomation)
require(GenomicRanges)
require(tictoc)
# Input arguments
option_list <- list(
make_option(c("-i","--indir"), a... |
00519ea2eb45c3dd476eaa36d8713782fa4b3587a132e21afdd71d14e947bc7d | R | 3,584 | 112 | # Don't perform any further tests on CRAN due to time of running the complete
# test.
testthat::skip_on_cran()
testthat::skip_on_ci()
debug_flag <- FALSE
# Generic test.
familiar:::test_plots(
plot_function = familiar:::plot_permutation_variable_importance,
data_element = "permutation_vimp",
not_available_all_p... |
fd26593a0490082a2cbab5b8812f0ee3a86600c3c9faa0092f19646db25949d2 | R | 3,598 | 104 | #############################################################
##################### GENERATE GRAPHS #######################
#############################################################
## load datasets
load(url("https://www.dcc.fc.up.pt/~vanessa.silva/datasets/NetF/Data/real_ts.RData"))
#############################... |
d73eaa52041a3bb2bf11af7680b9d5f1d34d01df87af27f70a7e91d53c073153 | R | 3,601 | 85 | ---
title: "README"
author:
output: github_document
date: "`r Sys.Date()`"
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
# The Landscape of *SETBP1* tissue-specific gene expression and regulation across human tissues
## Authors
**Jordan H. Whitlock Elizabeth J. Wilk, Timothy C. Howton, Amand... |
460de7cc71705f238da2822247eb053496b99a614b482dce0d8946e421b9b7f8 | R | 3,613 | 72 | # bulk-prepare_calc_CpG_PDR.R - this script takes the output files generated by bulk-bam2epiallele.R
# ans splits them by chromosome to allow for downstream pipeline analyses to be processed in parallel
require(optparse)
require(genomation)
require(GenomicRanges)
# Input arguments
option_list <- list(
make_option(... |
67ad2a4a011a719a73eb3ec9ca6731d265212f18f40498888f8792b995b1910e | R | 3,614 | 103 | ####################################
## Retinol - Finemapped pQTL MR
## William Reay (2022)
#####################################
library(TwoSampleMR)
library(dplyr)
library(data.table)
library(hudson)
library(ggplot2)
library(viridis)
library(ggpubr)
setwd("~/Desktop/Retinol_GWAS/ARIC_MR_and_coloc/")
## Read in ... |
acba44a0d79f952f5dc7effa7d8356d21e53ad3405f493ed2ff6db9f0e496871 | R | 3,614 | 97 |
observeEvent(input$data_custom_finish, {
tryCatch({
start = proc.time()
.dt = copy(data$raw[[input$data_dataset]])
.env = env({ dt = .dt })
.exp = parse(text = input$data_custom_code)
.res = eval(.exp, envir = .env)
data$raw[[input$data_dataset]] = .env$dt
... |
48d0eb3b56cfe69640c74cfbc621105684541cda8ccc42cf6dc483a46f3aa3bf | R | 3,617 | 66 | ## Load results from SEM
plotdata <- read.csv("Results/Results - Blood Mediation All Parameters.csv")
plotdata <- plotdata %>%
mutate(sig = ifelse(p.fdr<0.05, "Significant", "Non-Significant"))
plotdata$parameter <- as.factor(plotdata$parameter)
## Subset for relevant parameters and re-code facet levels
plotd... |
2c885b3fc548a69621980db621e5609b341481a0abf137bcd197e4816a8ca01b | R | 3,620 | 101 | #'% FigureS21ABC.R
#'
#' Plots for Supplementary Figure S21, panels A, B, and C.
#'
#' EEG/fMRI STUDY, DONDERS INSTITUTE, NIJMEGEN.
#' J. Algermissen, 2018-2023.
#'
#' we are here:
#' /project/3017042.02/Analyses/FiguresOutcomeLocked
# ===================================================================================... |
a2423ba3a39e6be39d65d165923e6f774d13f4b53ec5046c4f33eb35bd1868c3 | R | 3,646 | 81 | #' declare_filtering_presets(analysis = NULL, applyfilters = NULL, featcutoff = NULL, GenomeCompletenessCutoff = NULL, maxl2fc = NULL, minl2fc = NULL)
#'
#' Performs vetting of a SummarizedExperiment object for use in several functions
#' @export
declare_filtering_presets <- function(analysis = NULL, is16S = FALSE, ap... |
f7591e2b3f646897f8c8ff09b46e2c6eb8f00bba50c2bef521d1b142e402736a | R | 3,649 | 108 |
# test fMRI univariate effect using other ROIs
rm(list = ls())
source('Setup.R')
usedir = dirname(getwd())
figDir = file.path(usedir,'Figs')
SubInfo = read.xlsx(file.path(usedir,'SourceData.xlsx'),'SubjectConds')
## read source data
UseAggBOLD = read.xlsx(file.path(usedir,'SourceData.xlsx'),'SFig6a')
UseDiffAggBOLD ... |
6d0bb2570dfbf5b89f99914abd7f4020a88922eb6c3d461c005870d55bc95c5d | R | 3,655 | 105 | #############################################################
##################### GENERATE GRAPHS #######################
#############################################################
## load datasets
load(url("https://www.dcc.fc.up.pt/~vanessa.silva/datasets/NetF/Data/production_Brazil.RData"))
###################... |
e92f057b1732c5bcee7f1595657883ea0c2d78e509073e9d4a0b3d5f440aeb69 | R | 3,659 | 77 | #!/usr/bin/Rscipt
library(data.table)
library(stringr)
setwd('/home/boris/Documents/PhD/single_sample/networks/')
LIONESS <- fread('./LIONESS/JDS_LIONESS_PCC_2_75_brain_no_doubles_no_loops_HumanNet_-1_1scaled_top_25000_edges.csv', header=TRUE, data.table=FALSE, fill=TRUE)
SSN <- fread('./SSN/JDS_SSN_2_75_brain_no_do... |
e12664096da861628c7690a902eaa00b3daf11f3251c3265ef2d20d88600c4b3 | R | 3,677 | 129 | # Don't perform any further tests on CRAN due to time of running the complete
# test.
testthat::skip_on_cran()
testthat::skip_on_ci()
debug_flag <- FALSE
familiar:::test_plots(
plot_function = familiar::plot_shap_waterfall,
data_element = "shap",
shap_max_iterations = 10L,
outcome_type_available = c("continuo... |
1570650051fdf29bb6a687d51423cf21231cfdf5dd805034864f031ac288b37b | R | 3,693 | 99 | context("splitOn")
test_that("splitOn", {
data(GlobalPatterns, package="mia")
x <- GlobalPatterns
################################## splitOn #################################
# Test that throughs an error
expect_error(splitOn(x, "test"))
expect_error(splitOn(x[1:10, 1:10], x$SampleType))
se... |
efcab565a20287de5c30e19fc4fe8059a3fc90c519d345e12e1a36a0bc59cccb | R | 3,695 | 116 | setwd("/Users/zhangyuan/Google Drive/2021_HCP_Gender_DNN")
rm(list=ls())
source("scripts/brainbeh/2022CCA/myRFunc_updated.R")
library(ggplot2)
#################################################
### test if male models can predict in female ###
### and if female models can predict in male ###
### for both HCP data and... |
28df23dc05ff6d7ccb48696e6205c681fd7500de90b8d64e23cfd97ab33476fe | R | 3,712 | 70 | library(stringr)
library(ggplot2)
library(dplyr)
df = c()
celltypes=c('CM','MN','HP','PP','SKM')
for (celltype in celltypes){
peaks = read.csv(paste0('/scratch/users/banwang3/celllines/scripts/RScripts/figscripts/suppfigscripts/ATAC_counttable/Filtered/',celltype,'_ATAC_Filtered_All_Peaks_fixed.txt'),sep='\t')
... |
f710e78f4213611825e1bb0ec723c31a2f9284a4655f3c6eac1ba1f6b4cd2cd2 | R | 3,721 | 82 | # In this file are scripts that use a simple rejection algorithm
# to obtain draws from the posterior distribution of a demographic
# parameter.
# The problem: With observed values of Tajima's D from 40 unlinked loci,
# make inferences about the time of expansion of a population.
# Solution: Summarize the data by... |
f32761735dd40569dc3c3f619949e527997292530c40b421c59b57483c4d5f9a | R | 3,752 | 130 |
.calc_bulla_evenness <- function(mat, ...) {
# Apply threshold, i.e., set values under and equal this threshold to 0
mat <- .apply_threshold(mat, ...)
# Species richness (number of species)
S <- colSums2(mat > 0, na.rm = TRUE)
# Relative abundances
p <- t(mat)/colSums2(mat, na.rm = TRUE)
... |
58d3c5c7ed69a6c5c3a04b05135ed5b3e9e4a8693cc841603bedf2c0a3dc9478 | R | 3,753 | 127 | # Create test dataset.
data <- familiar:::test_create_good_data(outcome_type = "binomial")
weights <- familiar:::create_instance_weights(
data = data,
method = "inverse_number_of_samples")
# Check that weights sum to the number of classes (2)
testthat::test_that("Weights sum to the number of classes.", {
testth... |
0a500ad1bbf1f407467bebfbf0d784477c1c89df0517c33996406cca014dfd96 | R | 3,765 | 67 | rm(list=ls())
pacman::p_load(ggplot2, stats, tidyverse, tidyr, dplyr, magrittr, reshape2, janitor, broom)
#setwd() set the working directory to the where the source data files are available
##### This script was used to verify statistical tests for the following panels. These formatted data files are available wi... |
e1df939723c71b13b4c62a18453968ac3d73959ca15ee203bb1f8f5c8dbecdaf | R | 3,765 | 78 |
observeEvent(input$data_rename_finish, {
# rename selected variable
ds.name = input$data_rename_current
if (str_length(input$data_rename_var_name) > 0) {
#this should work, but as it turns out only if the internal structure of the DT object wasn't loaded from a disk (see truelength() / alloc... |
23c31e249eaedde47fc5ce77795f51f33cedef4f64a6af3e567d6f6491b78361 | R | 3,766 | 72 | #' deconvolute_contaminated_isolates
#' This function is experimental.
#' Function to deconvolute contaminated isolates.
#'
#' JAMSalpha function
#' @export
deconvolute_contaminated_isolates<-function(opt=NULL, contigsdata=NULL, assemblystats=NULL, outputdir=NULL){
#Get data from somewhere
if(is.null(contigsd... |
6172698642335a1d077cb527eb185f689f76a7c62a235f17984c70144961cf5f | R | 3,771 | 119 | setwd("/Users/zhangyuan/Google Drive/2021_HCP_Gender_DNN")
rm(list=ls())
source("scripts/brainbeh/2022CCA/myRFunc_updated.R")
library(CCP) # for cca statistical test
#################################################
### test if male models can predict in female ###
### and if female models can predict in male ###
##... |
be44cbb185249322e5f4054788969dcb8a824678430dc15ea7f598d893328f24 | R | 3,778 | 137 | library(muxViz)
library(igraph)
library(RColorBrewer)
library(ggraph)
set.seed(1)
#Network setup
Layers <- 3
Nodes <- 10
layerCouplingStrength <- 1
networkOfLayersType <- "categorical"
layer.colors <- brewer.pal(8, "Set2")
cat("####################################\n")
cat("# Multilayer connected components\n")
cat(... |
4f1aadcab93bab873d7b88e6ba4c56fb7d071d75a6cce784aab398ebb8e41627 | R | 3,786 | 101 | library(stringr)
library(ggplot2)
library(dplyr)
library(epitools)
celltypes=c('CM','MN','HP','PP','SKM')
reffed='humreffed'
align2='human'
#input_path='/scratch/users/banwang3/celllines/scripts/RScripts/figscripts/suppfigscripts/ATAC_counttable/'
input_path='/scratch/users/banwang3/celllines/scripts/RScripts/figscript... |
0f86cbfcc6ccc4f4be6cae73ea1db69875bbf9d6d05ee55ffa8be6eb12cd76cd | R | 3,787 | 145 | .get_run_list <- function(
iteration_list,
data_id,
run_id = NULL
) {
# Check if data_id has any length.
if (length(data_id) == 0L) return(list())
# Return an empty list if data_id equals 0.
if (data_id == 0L) return(list())
# Return part of the run list.
if (is.null(run_id)) {
retu... |
0bee286aa9e1a5e8a3b69ca7554b6c1c24420b24a7c3b74769ac5667f7683fab | R | 3,794 | 90 | library(ggplot2)
library(stringr)
backup_path='/scratch/users/banwang3/celllines/data_backup'
df = read.csv(paste0(backup_path,'/scratch/users/banwang3/celllines/analysis/ASE_norm/human/filtered/TPM.txt'),sep='\t')
output_path='/scratch/users/banwang3/celllines/scripts/RScripts/Rplots/'
idx =grep('total',colnames(df))
... |
3c19d09f73f8d591354dc993f9113557ad184056a93bcded3ca93e43b0f9f493 | R | 3,795 | 97 | context("getAbundant")
# Sample data setup
data(GlobalPatterns, package = "mia")
tse <- GlobalPatterns
tse <- transformAssay(tse, method = "relabundance", pseudocount = TRUE)
# Example tests
test_that("getAbundant handles various inputs correctly", {
# Check that TreeSE works
abundant_taxa <- getAbundant(tse, ... |
72e349285907a2dd2af4a796e027cace1b21224b7ab417c1b2151d112d358775 | R | 3,797 | 102 | rm(list = ls())
## Load datasets
alldata <- read.csv("Full_Dataset.csv")
alldata$age <- as.numeric(alldata$age)
alldata$gender <- as.factor(alldata$gender)
alldata$ethnicity <- as.factor(alldata$ethnicity)
alldata$sexual.orient <- as.factor(alldata$sexual.orient)
alldata$alcohol <- as.factor(alldata$alcohol)
alldata$... |
8f060509ed413f57923aef86714ffc0b30cf9347fc44c547cd61b1dcc866d5b8 | R | 3,812 | 73 | #Infer the Last Known Taxon (LKT)
#' infer_LKT_pr2
#'
#' Infers the Last Known Taxon (LKT) from a taxonomic table or dataframe containing taxonomic information and adds an LKT column to the dataframe.
#' @export
infer_LKT_pr2 <- function(taxtable){
#pr2 has spelling error whereby Unclassified are incorrectly calle... |
3fef71f3fef39570686d1a9b94211016fa8146a9d088754800af3a6dcbe5dd22 | R | 3,817 | 88 | test_that("getMediation", {
# Load data from miaTime package
data("hitchip1006", package = "miaTime")
tse <- hitchip1006
tse <- agglomerateByRank(tse, rank = "Phylum")
tse$bmi_group <- as.numeric(tse$bmi_group)
### Batch 1: check errors when missing or wrong arguments ###
expect_error(
getMediation(... |
51e999fa72ba3a5f836f03e5a8f74c500890139eb5ed4c394de51213292d7d40 | R | 3,868 | 95 | # calculate auto-correlation of the expression of neighboring genes
# based on TCGA expression values, Figure S1
library(reshape2) # for melt()
library(ggplot2)
basePath = "/data/bcu_projects/MelBrainSys_PostdocProject_Gruetzmann/publications/2022-my-MelBrainSys-paper/scripts-etc-for-publication/"
setwd(basePath)
... |
0ac2cd2368ab969a002d84ba61ed68d1446d6b5624f2c9c0a5443b0c86b59cd7 | R | 3,870 | 94 | #' @importFrom ape drop.tip
.get_unifrac <- function(
x, tree, weighted = FALSE, node.label = nodeLab, nodeLab = NULL, ...){
# Transpose the matrix so that the orientation is the same as in other
# dissimilatity methods
x <- t(x)
# Check x
if( !is.matrix(as.matrix(x)) ){
stop("'x' mu... |
cdd89d5e676544d2a17eee6546f6e042dac6b43c31b6b154921e2ec57c689beb | R | 3,889 | 100 | #!/usr/bin/env Rscript
set.seed(2178)
# Load necessary libraries
library(dplyr)
library(tidyr)
library(netZooR)
args <- commandArgs(trailingOnly = TRUE)
file1 <- basename(args[1])
file2 <- basename(args[2])
cat("file1", file1, "\n")
cat("file2", file2, "\n")
#file1 <- gsub(".Rdata$", "", file1)
#file2 <- gsub(".Rdat... |
792523d039126a5935078a89b6223ef7f9a40b68616f2ebefae0935e515d45e1 | R | 3,895 | 124 | ###############################
## Cauchy aggregation at gene-level
## Retinol rare variants - Stouffer's meta-analysis (INTERVAL+METSIM)
## William Reay (2022)
###############################
library(dplyr)
library(data.table)
setwd("~/Desktop/Retinol_GWAS/Cauchy_rare_var_gene/")
## Load ACAT function
source("... |
2fa0e1a132964aa05c02911f9749f1678f33a918a54b905c16cfa3f0a1cc6536 | R | 3,898 | 116 | # Don't perform any further tests on CRAN due to running time.
testthat::skip_on_cran()
testthat::skip_on_ci()
debug_flag <- FALSE
# Default
results <- familiar:::test_export_specific(
export_function = familiar:::export_ice_data,
data_element = "ice_data",
sample_limit = 20L,
create_novelty_detector = FALSE,... |
8770879925c164c6352c2780ad2bd0e76218d630633f3df7f47a5e17022900f0 | R | 3,913 | 88 | #' download_SRA_reads(SRAaccessions = NULL, outfolder = NULL, tempfolder = NULL, prefetch = TRUE, threads = 8)
#'
#' Wrapper for safely downloading SRA reads within the JAMS framework. You will need to have SRAtoolkit installed on your system.
#' @export
download_SRA_reads <- function(SRAaccessions = NULL, outfolder =... |
e610102181c3e6f97f1e9de8f16d1e20dbd13481439a37f3fef83eefe7968af7 | R | 3,918 | 87 | library(DESeq2)
library(stringr)
library(ggplot2)
library(pheatmap)
align2='human'
reffed='humreffed'
output_path='/scratch/users/banwang3/celllines/scripts/RScripts/Rplots11/'
dir_folder=paste0('/scratch/users/banwang3/celllines/ATAC/All_Peaks_counts/')
filename='_ATAC_Filtered_all_peaks.txt'
floor_dec <- function(x, ... |
494393e1113aabb771b6f87f3569b404858e271c02f1aedc19dd84ebe8ea814c | R | 3,919 | 128 | library(shiny)
library(pheatmap)
library(stringr)
library(RColorBrewer)
library(circlize)
library(ggplot2)
# Load Data
load("data.Rdata") # object called data
# tf names
all_tfs <- rownames(data)
# UI
ui <- fluidPage(
tags$head(
tags$link(rel = "stylesheet", type = "text/css", href = "style.css"),
tags$scr... |
094b2f5b381a131f2bfa6b85ee173de5fc694e643bb171c4b43d886fc4bc09b1 | R | 3,926 | 128 | # Don't perform any further tests on CRAN due to time of running the complete
# test.
testthat::skip_on_cran()
testthat::skip_on_ci()
debug_flag <- FALSE
# AUC-ROC plots ----------------------------------------------------------------
familiar:::test_plots(
plot_function = familiar::plot_auc_roc_curve,
data_elem... |
f6be9247b25cf71f978a8358f98e0e7170ecb85120506fbdc8ed950b4ba01bb9 | R | 3,939 | 102 | library(stringr)
library(ggplot2)
library(dplyr)
library(epitools)
celltypes=c('CM','MN','HP','PP','SKM')
reffed='humreffed'
align2='human'
#input_path='/scratch/users/banwang3/celllines/scripts/RScripts/figscripts/suppfigscripts/ATAC_counttable/Downsampled/'
#output_path='/scratch/users/banwang3/celllines/scripts/RScr... |
6dc264c5c86da2112ec4cc96efeb33ea98f726e01c6dadf78c7e821ec4bdced1 | R | 3,943 | 89 | # Validation: Perform linear regression to examine the association between handgrip strength and cognition, additionally controlling for various nuisance covariates
# Inputs to the script:
# 1) datafile: name and path of spreadsheet containing demographic, cognition and handgrip strength data
# 2) outputfile: name and... |
600026e78b9e517270ab79f8c90f4e7dd4a57cf7691c23cd950d7dd19d1de197 | R | 3,950 | 106 | # for each of the 1-n networks:
# this will create the basic regNet folder structure
# and train a network with the corresponding training data (expression and methylation files)
# the results are split up into single parts for each network, which then are combined
myPath = "/data/bcu_projects/MelBrainSys_PostdocP... |
8f31e2b22a94d810f74bb1425c1e7a7c0abc09addd9ecfd57b72a37b7bead916 | R | 3,950 | 131 | library(shiny)
library(pheatmap)
library(stringr)
library(RColorBrewer)
library(circlize)
library(ggplot2)
# Load Data
load("data.Rdata") # object called data
# tf names
all_tfs <- rownames(data)
# UI
ui <- fluidPage(
tags$head(
tags$link(rel = "stylesheet", type = "text/css", href = "style.css"),
tags$scr... |
d4a1c1f8adf93a867f9430ae7feb966f7b0558b2b4f6700179e5a3f3038da7cc | R | 3,956 | 51 |
events.ui = nav("Events",
fluidRow(
column(6,
pickerInput("events_dataset", NULL, multiple = F, width = "100%", choices = c(), choicesOpt = list(subtext = c()), options = list(title="Select a dataset to add a new event series"))
),
column(6, style="text-align: center;",
... |
fa5074ea82da46e73c47ef8e06c34cc70f73ac405bd59e10eec109bd7f9f6338 | R | 3,968 | 112 | # ymat : a V times N matrix for the first modality (V: # of vertices, N: # of images)
# xmat : a V times N matrix for the second modality (V: # of vertices, N: # of images)
# mod : a N times p covariate matrix (p: # of covariates)
# : It can be generated easily by using the model.matri... |
ca18bd8c14206219772e6df65c4eb4e4ca872c5d338f2fc901242e20edf04656 | R | 3,991 | 131 | #############################################################
################## Experimental Evaluation ##################
#############################################################
### auxiliary variables to store results
dataset <- "M3"
data_name <- "m3_type"
total_comb <- 3
table_eval_mean <- data.frame("ARI... |
64162381dce5bd84165d38e393f527af7a15bec6cfd6790d04fbfb56d87001ef | R | 3,995 | 133 | #############################################################
################## Experimental Evaluation ##################
#############################################################
### auxiliary variables to store results
dataset <- "prodBrazil"
data_name <- "prodBrazil"
total_comb <- 3
table_eval_mean <- data... |
e5f4c1391d9a72b318770d0acc74024b59d452f519c17e6ad2261e2b4eb19137 | R | 4,004 | 87 | #' make_SummarizedExperiment_from_tables(pheno = NULL, pheno_fn= NULL, counttable = NULL, counttable_fn = NULL, featuretable = NULL, featuretable_fn = NULL, onlysamples = NULL, analysisname = NULL, restricttoLKTs = NULL)
#'
#' Safely makes a JAMS-compatible SummarizedExperiment object from a phenotable, a counttable an... |
01562b3f46e4cea7a664e8c84ec1abf52a658c79c0ac13109612c146d6a4c4c8 | R | 4,035 | 63 | #' denoise_contigs
#'
#' JAMSalpha function
#' @export
denoise_contigs <- function(opt = NULL, small_large_length_threshold = 2000) {
## Censor small contigs Taxonomy approach
#Isolate dark matter contigs
Dark_matter_contigs_df <- opt$contigsdata[which(opt$contigsdata$Taxid == "0"), , drop = FALSE]
Su... |
65b2aff11712e894d3c5cae2246aeceedaf86a18c1d4890e83f74d5eadcd2498 | R | 4,075 | 131 | #############################################################
################## Experimental Evaluation ##################
#############################################################
### auxiliary variables to store results
dataset <- "realts"
data_name <- "pairs"
total_comb <- 3
table_eval_mean <- data.frame("A... |
6aded9db102b2257448df97a6bcde61a58c4de15c7ccaaa5387c35fe4d73d160 | R | 4,080 | 92 | library("stringr")
#library(tidyverse)
library('ggplot2')
library(epitools)
align2 <-'human'
#input_path=paste0('/scratch/users/banwang3/celllines/analysis/ASE_norm/',align2,'/filtered/')
#tpm<-read.csv(paste0(input_path,'TPM.txt'),sep='\t')
#print(dim(tpm))
output_path='/scratch/users/banwang3/c... |
e9fa1abc67beb73408d06c10509d78b7dac38bec0ce77382c9ac6df4dcfd6a64 | R | 4,083 | 74 | # 2026-09-26 The R packages the release dashboard needs, pinned to a dated snapshot.
#
# Rscript summary/install-packages.R
#
# A file rather than a line in the workflow, for two reasons. The list is reviewable here and
# nowhere else -- it is what an `renv.lock` would have given without a lockfile nobody in the
# p... |
65afed6e2b26cfb3269fad3b4b5e4add8f99c2ded7b653dce0a6b2a963ca57df | R | 4,085 | 81 | output$heatmap2_plot = renderPlotly({
req(input$heatmap2_dataset)
req(input$heatmap2_series)
dataset = data.table()
aucs = data.table()
for (f in input$heatmap2_dataset) {
for (s in input$heatmap2_series) { #for (s in names(data$series[[f]])) {
.s = data$series[[f]][[... |
a6d0ee18011d13bd71a0322228f9111edd1bfcefab48da37b0b7a5d6896f3bfd | R | 4,089 | 88 | ##############
### Script ###
##############
# Run code to acquire cluster size distributions and credible intervals of cluster size.
# (Code for UK Biobank application)
#################
### Libraries ###
#################
library(oro.nifti)
library(ggplot2)
#################
### Constants ###
#################
#... |
5b8e580a62fe08a13781da553de7f695e4cd35950dcaea454faaf285983e9bc7 | R | 4,097 | 96 | library("stringr")
library('ggplot2')
library(epitools)
align2 <-'human'
backup_path='/scratch/users/banwang3/celllines/data_backup'
input_path=paste0('/scratch/users/banwang3/celllines/analysis/ASE_norm/',align2,'/filtered/')
output_path='/scratch/users/banwang3/celllines/scripts/RScripts/suppplots/'
tpm<-read.csv(pas... |
d2c77f7d22a5ccc2533f451b8704322153b713f18b303bd533a0554a5a465900 | R | 4,102 | 160 | #############################################################
################### TIME SERIES MAPPINGS ####################
################### VISIBILITY GRAPHS ####################
#############################################################
#######################################################
#### Natural V... |
22fb50217b349cb0326702f290c8711039d67b3cab706add0998997fbe350aff | R | 4,115 | 92 | # Perform linear regression to examine the association between functional connectivity and cognition
# Inputs to the script:
# 1) demofile: name and path of spreadsheet containing demographic, cognition and handgrip strength data
# 2) FCfile: name and path of spreadsheet containing functional connectivity measures
# 3... |
19ab2881fcd5905df7c9415551673db1e792fc8cf893c382904fbf7cf047ddfd | R | 4,134 | 198 | .start_random_number_stream <- function(seed) {
if (is.null(seed)) {
return(NULL)
}
r <- methods::new("rstream.runif", seed = seed)
return(r)
}
..fam_sample <- function(
x,
size,
replace,
seed = NULL,
rstream_object = NULL
) {
# Create a random generator stream to avoid touchi... |
dae53aea17c2939c78d6d1965b45a43a9ba744aa392a0213710113ccebf65018 | R | 4,154 | 95 | library("stringr")
#library(tidyverse)
library('ggplot2')
library(epitools)
align2 <-'human'
#input_path=paste0('/scratch/users/banwang3/celllines/analysis/ASE_norm/',align2,'/filtered/')
#tpm<-read.csv(paste0(input_path,'TPM.txt'),sep='\t')
#print(dim(tpm))
output_path='/scratch/users/banwang3/c... |
102308f179d672f6eb7732fd69aabd627154de82ce434c762268efe8a1e4ed59 | R | 4,156 | 116 | ---
title: "CPM measures calculations"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
options(scipen=999)
```
```{r}
library(tidyverse)
library(glue)
```
The goal is to make graphs on the proportion of edges in a network. We make two separate figures: one for the within netw... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.