sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
db3f02e6cc4f874a3f1ee9e50af75380fa9273d7eb9a3ee30f653f45ee7cbe5e | R | 2,406 | 67 | # Check that input checks are working
test_that("addMDS errors", {
tse <- makeTSE()
assayNames(tse) <- "counts"
#
getMDS(tse, assay.type = "test") |> expect_error()
addMDS(tse, name = 1) |> expect_error()
addMDS(tse, name = c("test", "test2")) |> expect_error()
addMDS(tse, name = NULL) |> ex... |
ff8595bd327acf007dc66f61c0800d608cdfe182b46330c4f861260efbdd28f8 | R | 2,408 | 44 | #' cluster_strains(genes_df = NULL, normalize_length = FALSE, distmethod = "bray", cutoff = NULL)
#'
#' Clusters MAGs of a single working taxid into functional clades by Bray-Curtis
#' dissimilarity of their per-Product gene-length profiles, hierarchical average-linkage
#' clustering, and a dissimilarity cut. Used inte... |
5493688f0fc8a38c30560b6e41f6dae9eee8873852a931ab1569d8e83a50e8be | R | 2,410 | 78 | ##############
### Script ###
##############
# Run Firth Regression at each voxel independently. Due to the large data size this script needs to be run
# in parallel without the for loop at each voxel independently.
# (Code for UK Biobank application)
#################
### Libraries ###
#################
library(brg... |
31cb5caf19c6e95bb08d876572c4f0d22378e72ff1e94fd42fcae78abc4d8625 | R | 2,411 | 51 | #' plot_wordcloud_sample(featuredose_df = NULL, analysis = NULL, removeunclassifieds = TRUE)
#'
#' JAMSalpha function
#' @export
#Plot wordcloud of functional data
plot_wordcloud_sample <- function(featuredose_df = NULL, analysis = NULL, removeunclassifieds = TRUE){
if (!(analysis %in% featuredose_df$Analysis)){
... |
e4299f525bb14aff304bd5c9346721f81a796747e457f2ef9fbc9ac82a3488c1 | R | 2,417 | 77 |
test_that("applyByModule", {
set.seed(123)
tse <- TreeSummarizedExperiment::makeTSE()
assayNames(tse) <- "counts"
alpha.index <- c("observed", "shannon")
expect_error(
applyByModule(
tse, "rows", "var1", addAlpha, index = alpha.index, min.group.size = 2
),... |
8e342feb0b0e5d7fd79670091ab16afd5cba6d65225f22684df09a7a180f0314 | R | 2,423 | 32 | library(Seurat)
library(ggplot2)
library(reshape2)
library(tidyr)
library(dplyr)
library(hdf5r)
visiumBetaPhase2Samples <- c("144105","144106","144107","144108","144111","144112","144113","144114", "151673", "151674", "151675", "151676")
sample_objs <- list()
for(i in visiumBetaPhase2Samples) {
print(i)
spatialObj... |
bf358046f3368692769ed8a0a79ae6b236149b3a9648b1df40c46f1ba91f2d8d | R | 2,429 | 117 | logger_message <- function(
mess_str,
file_name = NULL,
indent = 0L,
verbose = TRUE
) {
# Write message to console and file
if (is.null(file_name)) file_name <- .get_log_file()
# Derive an indent string using two spaces for each indentation.
indent_str <- strrep(" ", indent)
# Date and tim... |
ebac54488052823972bda497d42ab6ac4427c55e8e6afc589cc4a8bd6ca7ec69 | R | 2,429 | 72 | library(data.table)
library(ggplot2)
library(ggtext)
library(tidyverse)
## https://danielroelfs.com/blog/how-i-create-manhattan-plots-using-ggplot/
args <- commandArgs(T)
gwas_data <- fread(
"run_folder/exon_distance/concated/Cns.Toxicity~rest_annotated.logistic_distance",
sep="\t",
)
selected_genes <- read.csv... |
250b90e04cb9534109fbbf53fc320a422a91b7c23f78c96f069945141e7defc6 | R | 2,431 | 99 | #############################################################
################### TIME SERIES MAPPINGS ####################
#############################################################
#######################################################
#### load time series mapping algorithms
source("vg_algorithm.R")
source("qg... |
5eb59cc39f87a5cd38322e202e0b0924aa44bfcdd3482b6ab6e1606bb5f7c90b | R | 2,432 | 73 | # written by Susan Holmes \email{susan@@stat.stanford.edu}.
# Adapted for phyloseq by Paul J. McMurdie.
# Adapted for mia by Felix G.M. Ernst
#' @importFrom DelayedArray rowSums
.JSD <- function(x, y){
# Function to compute Shannon-Jensen Divergence
# x and y are the frequencies for the same p categories
# ... |
81a3aef8697889b1b659ad908aa39635fa15493c429364cf66fa922e2731b274 | R | 2,432 | 51 | #' replace_Sample_names_in_SEobj(curr_SEobj = NULL, Sample_name_mapping = NULL, oldname_column = "Sample", newname_column = NULL)
#'
#' Renames samples in JAMS SummarizedExperiment objects safely.
#' Use with care and at your own risk
#' @export
replace_Sample_names_in_SEobj <- function(curr_SEobj = NULL, Sample_name... |
d879df41a28302323ca5ccacf72fa603a74139a432248bcebae0d999a5ad5afb | R | 2,449 | 98 | # Don't perform any further tests on CRAN due to running time.
testthat::skip_on_cran()
testthat::skip_on_ci()
debug_flag <- FALSE
exp_dir <- file.path(tempdir(), "familiar_intro_test")
testthat::test_that(
"Basic example works",
{
if (!debug_flag) on.exit(unlink(exp_dir, recursive = TRUE), add = TRUE)
... |
0499c92c5f3593b860cc9d17f5f25afe4f282b0a97dfc28bb9b3170a0b589673 | R | 2,459 | 110 | if(version$major<3 || (version$major==3 && version$minor<2.0)){
stop(paste("WARNING! muxViz requires R 3.2.x or higher in order to work properly. \nPlease update your R framework.\n"))
}
if(!require(devtools)){
install.packages("devtools")
}
if(!require(shiny)){
install.packages("shiny")
library(devtoo... |
edd845142e5a76e014814689f75472d10cebd630b2448f4cb9bd90d9ae902eb7 | R | 2,460 | 60 |
#' Network inference module: Load network
#'
#' This function loads a specified network (networkName) and filters for non-significant regulatory links (pValCutoff).
#' @param networkName Name of the network
#' @param pValCutoff Cutoff for significant links. Values from zero (most sparse network) to one (full network) ... |
1b15c76a9a7e3982fdf39f5e58598b38ec0cfddc889245c2b20d846b9e81a6a2 | R | 2,462 | 56 | #' print_table(tb=NULL, tabletitle=NULL, fontsize=6, numrows=20)
#'
#' JAMSalpha function
#' @export
print_table <- function(tb = NULL, tabletitle = NULL, fontsize = 6, numrows = 20){
if (class(tb)[1] != "data.frame"){
stop("Table must be a data frame")
}
#Define function to wrap text
wrap_ce... |
eb2853ed842fa87aa98fd4d1d8e9109c66d367dc9bc327a5d26e806f92318cc7 | R | 2,463 | 56 | #' loadobj(objfn = NULL, never_used_columns = c("AntiFam", "CDD", "Coils", "FunFam", "Gene3D", "PANTHER", "Phobius", "ProSitePatterns", "SFLD", "SignalP_EUK", "SignalP_GRAM_NEGATIVE", "SignalP_GRAM_POSITIVE", "SMART", "TIGRFAM", "MetaCyc")
#' JAMSbeta helper function used by load_jamsfiles_from_system.
#'
#' Do not fid... |
0b5bb63f8596b79583421ebb66bdd0c815b5d07a70f2dd13f529f9390db5717a | R | 2,467 | 54 | #!/usr/bin/Rscript
###################################################################################################################
#### Script to perform scaling on complete networks
###################################################################################################################
library(data.ta... |
9298830b59478510e080680a4f8614daf668be5d3c6ffd5b84ff956dcc7d6b68 | R | 2,467 | 70 | ##########################################
## Retinol GWAS meta - summary statistics QC and harmonisation
## RARE VARIANTS
## William Reay (2022)
##########################################
setwd("~/data/users/william/Meta_retinol_GWAS/")
library(dplyr)
library(data.table)
## INTERVAL raw - 11132 is max number of... |
ee84a2c4c6491d6f1aebd67fee3b926af3b6c6f1213a5cfa8a767b35502edb76 | R | 2,468 | 93 | # X (IV) -> HIV.status
# Y (DV) -> total PHQ-9 score
# M (mediator) -> biomarker 'conc'
med.df <- data.frame(
label = character(0),
estimate = numeric(0),
ci.min = numeric(0),
ci.max = numeric(0),
p.value = numeric(0),
stringsAsFactors = F
)
semdata <- blooddata
## Scale all biomarkers, ag... |
a82b52877a2da5536c5d55b5360820585958e2e59a21a2b419773344fb90ce44 | R | 2,470 | 64 | ##################################
# Visualize patient labels for UMAP in Supplementary Figure 6a.
# Updated: 2021.05.10
# Author: Kevin J.
###################################
mybasedir = "/Users/johnsk/github/"
setwd(mybasedir)
###################################
# Necessary packages:
library(tidyverse)
library(Seur... |
6bb81b8b021caa9e81f30aa487e18a4628dd10fa9c4ffd487575a7d221c55325 | R | 2,474 | 68 | #' Create a \code{TreeSummarizedExperiment} object from a phyloseq object
#'
#' @inheritParams convertFromBIOM
#'
#' @details
#' \code{convertFromPhyloseq} converts \code{phyloseq}
#' objects into
#' \code{\link[TreeSummarizedExperiment:TreeSummarizedExperiment-class]{TreeSummarizedExperiment}} objects.
#' All data sto... |
50e35b0bafcb8a9d7ebcde2bf71c9314e36f8871f22c9c1bb0797dd01aee80bf | R | 2,475 | 92 | # X (IV) -> HIV.status
# Y (DV) -> total PHQ-9 score
# M (mediator) -> biomarker 'conc'
# covariates: age and gender
med.df <- data.frame(
label = character(0),
estimate = numeric(0),
ci.min = numeric(0),
ci.max = numeric(0),
p.value = numeric(0),
stringsAsFactors = F
)
semdata <- blooddata
... |
d092d7a7d03cd71fa8cef3bf64b2ad1c25c6bae5776edce940b85197b310dd67 | R | 2,477 | 73 |
#' @title anndataToGiotto
#' @description Converts a spatial anndata (e.g. scanpy) .h5ad file into a Giotto object
#' @param anndata_path path to the .h5ad file
#' @param metadata_cols metadata columns to include
#' @param instructions giotto instructions
#' @param \dots additional parameters to \code{\link{createGi... |
3ed73655ea8d8f3814a55ecdd23145b7542d223273aa96f69f7173d2fceafd0d | R | 2,485 | 93 | ##############################
## RBP4 only IV
## FinnGen r8
## Dr William Reay (2023)
##############################
library(TwoSampleMR)
library(data.table)
library(dplyr)
library(ggplot2)
setwd("~/Desktop/Retinol_GWAS/MR_all_cis_acting_SNPs/FinnGen_r8_MR/")
## Harmonise data to generate heterogeneity statisti... |
ee447889114b7f9e8971bc5f6635d0c90defdfe57ae1eaae95e7b5545a297d92 | R | 2,502 | 77 | ---
title: "02_decoupleR_formatting_prior"
author: "Jordan Whitlock"
date: '2023-05-15'
output: html_document
---
```{r}
set.seed(2178)
library(here)
library(reshape)
source(here("src/functions/functions.R"))
ptm <- proc.time()
```
```{r}
# make list of expression files needed to loop through
files <- list.files(her... |
b67e174b42d43557acf3f2e34920c4bf1d81eb85b6d6d4b8e01688eb500b5890 | R | 2,506 | 75 | # 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_model_signature_occurrence,
not_available_no_samples = FALSE,
not_available_all_predictio... |
ae427db45fa51a0765ac45640ed8f8bdd27205e0e215c1c5ddc16f342e3ac004 | R | 2,520 | 99 | # This contains the archiving function for creating the zip files. We move it
# here so that CRAN doesn't get antsy. This is not a function that should be
# used (or visible to) users, and is not part of familiar.
test_run_archive_experiment <- function(parameters) {
# Create data.
data <- familiar:::test_create_g... |
ca74b5d5ab8c8221588e7bf52637f80f6903cb8052ec371d9e75a8a879e6db70 | R | 2,520 | 59 | #' sort_contigs_into_bins(opt = NULL)
#'
#' JAMSalpha function
#' @export
sort_contigs_into_bins <- function(opt = NULL, sortedbamfile = NULL){
#Do MetaBAT if applicable
if (opt$bin_contigs_with_metabat){
setwd(opt$covdir)
if (is.null(sortedbamfile)){
sortedbamfile <- paste(paste(o... |
c91c8be997ec20ed128c2eb89c31719e92f1852e707af7a4cae046d99141498a | R | 2,521 | 60 | # computes network flow/impact matrix of each gene on each other gene for each sample
# outputs in TrainNetwork-*/NetworkPropagation/NetworkFlow/
library(parallel)
basePath = "/data/bcu_projects/MelBrainSys_PostdocProject_Gruetzmann/publications/2022-my-MelBrainSys-paper/scripts-etc-for-publication/"
myPath = paste0(... |
59e0602e9e9f2872c04d37b56e80d9e8b318113c985fddbdced546bc4f304d70 | R | 2,530 | 52 | test_that("getDysbiosis and addDysbiosis", {
data(Tengeler2020, package = "mia")
tse <- Tengeler2020
res <- getDysbiosis(tse, col.var = "patient_status", reference = "Control")
expect_s4_class(res, "DataFrame")
expect_identical(rownames(res), colnames(tse))
expect_identical(colnames(res), "media... |
e13d24d5c04b7fd39daf99f2f2a669efec2cc213308e439c137e523ee8b640ec | R | 2,537 | 62 | #'
#' makes one file of seperate edgelist files
#'
#'
#' @param dir the directory of the files
#' @param pattern the pattern the files have in common
#' @param file_ext the extension of the files with the given input pattern (e.g txt, csv)
#' @param file_name which file name to give to the made file (withou... |
f5c7860c940d2d2be14f99dea6ac9a9b03a5e918080828f1b2afe96523b33cbf | R | 2,550 | 76 | # 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_export(
export_function = familiar:::export_prediction_data,
not_available_all_predictions_fail = FALSE,
not_available_some_predictions_fail = F... |
f5fdebe1392971def5787a1b2e3287b359eb02371e45a9bfcbc15fe71c06b48b | R | 2,558 | 53 | #Infer the Last Known Taxon (LKT)
#' infer_LKT
#'
#' 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<-function(taxtable){
dunno<-c("Unknown", "Unclassified")
taxtable$LKT<-rep("Unclassified", le... |
4632530990621bed115d52b1aea0ffb591cd42b2472719994d221354ee7435a4 | R | 2,559 | 79 | # xml2 is required to .
if (!rlang::is_installed("xml2")) testthat::skip()
# Find path to configuration file in package.
config <- system.file("config.xml", package = "familiar")
# Load the configuration file
config <- familiar:::.load_configuration_file(config)
# Check whether the main branches have the correct nam... |
98b00dd76bfadee08ac53a272fbf5c550e985c370130a7665608fa3d8245befb | R | 2,559 | 81 | library(ggplot2)
library(tidyverse)
library(ggtext)
args <- commandArgs(T)
assoc = args[1]
df_struc <- read.csv(
"/home/joel/Documents/swedegene/WGS_pipeline/master/structural_analysis/data/gene_struct.csv", sep = "\t", as.is=T, check.names = F, stringsAsFactors = F)
#assocs <- read.table("/home/joel/Documents/swe... |
512b47f8923de17a2b2ede5a202ea69e87f1b5614fa87d6ca480097a6cb28ec1 | R | 2,565 | 81 | library(data.table)
library(ggplot2)
library(ggtext)
library(tidyverse)
library(qvalue)
df_genes <- read.csv("local_data/burden_results/burden_vf_threshold_full_results.tsv", sep = "\t", as.is=T)
df_genes_unfiltered <- df_genes
df_genes %>% filter(p != 1 & p != 0) -> df_genes
genes <- fread(
"/home/joel/Documents/R... |
6213c74547e3f58875a9672ee295cbf158ffb9d2859db790898be3c2a33af239 | R | 2,576 | 63 | ## Use testdata to summarise descriptive statistics for PHQ-9 scores
## LINEAR REGRESSION OF PHQ-9 SCORE WITH HIV STATUS
summary(lm(total ~ HIV.status, data = alldata))
summary(lm(total ~ HIV.status + age + gender, data = alldata))
summary(lm(scale(total) ~ HIV.status, data = alldata))
summary(lm(scale(total) ... |
c1d979a5cdbe2fa29c576140898bd785f785108e39b859b1548daf63a4d01d83 | R | 2,583 | 67 | library(Rtsne)
library(data.table)
library(ggplot2)
library(lisi)
library(ggpubr)
library(dplyr)
library(cluster)
library(factoextra)
library(RColorBrewer)
library(randomcoloR)
embedding_clust=function(emb){
latent<-fread(emb,header=F)
gene<-fread("./data/node_order.txt",header=F)
input<-cbind(gene,latent)... |
ce8f9e7b197be17cb3b60f181b1e3f2860fac9ecf51267d7833924781a51eef5 | R | 2,583 | 81 |
# test fMRI univariate effect using functional ROI: lOFC
rm(list = ls())
source('Setup.R')
usedir = dirname(getwd())
figDir = file.path(usedir,'Figs')
SubInfo = read.xlsx(file.path(usedir,'SourceData.xlsx'),'SubjectConds')
UseTMSConds = SubInfo$Cond[SubInfo$Excluded==0]
Subs = SubInfo$Sub[SubInfo$Excluded==0]
## re... |
ad9307da9a998ab09d1b01f9c75a7837ad785b8ada0fb3a7caf874e3d8092804 | R | 2,590 | 39 | #******************************************************************
#Plot and compute markers
#
genes1 <- c('SLC17A6', 'GAD1', "SLC6A3", "TH", "SLC18A2",
'DCC', 'GALNTL6', 'RIT2', 'RBFOX3', "AQP4", "C3", "MOG", 'VCAN', 'FLT1')
genes1 <- genes1[genes1 %in% genes$Symbol]
features1 <- genes$Geneid[match(genes1, genes$... |
374ef5545b2af077ea846414601f23f49a4350128b987f8ad2742d5761c89ea6 | R | 2,592 | 69 | context("rarefyAssay")
test_that("rarefyAssay", {
seed = 1938
set.seed(seed)
data(GlobalPatterns, package="mia")
tse.subsampled <- rarefyAssay(
GlobalPatterns,
sample = 60000,
name = "subsampled",
replace = TRUE)
# check class
expect_s4_class(tse.subsampled... |
82c48ad41c3b29da69c02cf32f78fe2c78742ec8f40b63ddeaacf6e1f12679fd | R | 2,613 | 73 |
#' Data loader module: Create basic folder structure
#'
#' This function creates the standardized folder structure used by regNet for network inference, prediction, and network propagation.
#' @param projectName Name of project folder
#' @param path Directory where the project folder is created
#' @param output Show p... |
96f1e71be16cee21d54ac702f9368956837ec833aca31a63abd8ccf742ecbf14 | R | 2,617 | 80 |
context(".estimate_richness")
test_that(".estimate_richness", {
skip_if_not(requireNamespace("vegan", quietly = TRUE))
data(esophagus, package="mia")
indices <- c("ace", "chao1", "hill", "observed")
tse <- addAlpha(esophagus, index = indices, detection = 1)
cd <- colData(tse)
expect_equal(un... |
3a0e2f99f460b706dd818bc3a79584acfde548f1c9bf91e46a5b0498cd49d958 | R | 2,619 | 78 | library(data.table)
library(tidyverse)
phenofile <- read.csv(
"local_data/phenofile",
sep = "\t",
stringsAsFactors = F,
check.names = F)
excluded <- c("RI-1933-4606",
"RI-1933-1457",
"RI-1933-1334",
"RI-1933-1315",
"RI-1933-1096",
"RB-1745-... |
6f3806b437bbf6224735156aacc35341da2baf9e5c74f9d65cf5e79c6648e326 | R | 2,632 | 45 | #Doublet prediction
library(scDblFinder)
library(scater)
dblOutdir <- 'dblFinder/'
#First merge un-stable clusters C12 and C13 to C0
Ident_final = 'Cluster_final'
SeuratObject@meta.data[, Ident_final] = as.character(SeuratObject@meta.data[, Ident1])
SeuratObject@meta.data[SeuratObject@meta.data[, Ident_final] %in% c('1... |
5110d46f18d06d938a0aa379cac826795bf35aa0c3caa319753970bb6e446ca4 | R | 2,647 | 82 | # 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. Note that confusion matrices can be created if only one sample
# is present.
familiar:::test_plots(
plot_function = familiar:::plot_confusion_matr... |
304b642041102649121b3d5502d642f4644bc2c4b023ab21faa20df51a18801e | R | 2,657 | 75 | args <- commandArgs() #extract the argument given on the command line
print(args)
expr_table_dir <- args[6] #complete directory of input expression table
output_dir <- args[7] #directory (+ name) of output table
packages_dir <- args[8] #directory of R packages
functions_dir <- args[9] #complete directory of the ... |
0a63eebd8930f21af80c28bba9dbbc824a0240e2355df3578024bc0c2ac1de3a | R | 2,677 | 87 | # Don't perform any further tests on CRAN due to running time.
testthat::skip_on_cran()
# power.transform and other packages are required.
if (!rlang::is_installed("power.transform")) testthat::skip()
# Create data.table.
data <- familiar:::test_create_good_data(
outcome_type = "binomial",
to_data_object = FALSE
... |
c9b999b0be916574104bc3f2e999625c49462dae01e65915d3b9ba84a3b0707f | R | 2,679 | 79 | # Temporary version --- use with cautions
# ymat : a V times N matrix of imaging data (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.matrix() function.
# K : a N times N matrix specifyin... |
9995d448799815b3d0db9d1a08d39bbdfaf2475381f319253aeec2ba5d8f0738 | R | 2,680 | 92 | library(ggplot2)
library(plotly)
library(ggtext)
library(tidyverse)
library(ggrepel)
args <- commandArgs(T)
selected_subset = args[2]
hla_assoc_df <- read.csv(args[1],
sep="\t", as.is = T, check.names = F)
hla_assoc_df$PVALUE <- as.numeric(hla_assoc_df$PVALUE)
hla_assoc_df <- hla_assoc_df[!is.na(hla_assoc_df$PVAL... |
0eec4a2c08b7e33fdf6d0d31cea33ecdf656c189d87a37be55a4227b8afa6463 | R | 2,706 | 74 | ## read-sim.R -- contaminated read simulation using real Illumina qualities
NUCLEOTIDES <- c('A', 'T', 'C', 'G')
#adapters <- list("solexa_adapter_1"="AGATCGGAAGAGCTCGTATGCCGTCTTCTGCTTG")
adapter <- "AGATCGGAAGAGCTCGTATGCCGTCTTCTGCTTG"
#adapter <- "TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT"
set.seed(0)
addErrors <-
# give... |
8761562bad7415d8092b4bd5ba8f99a1de3753bc1d578b328ce7d91db95c63ee | R | 2,708 | 98 | # LOADING LEIDA DATA
df <- readr::read_csv(file = './data/df_LEiDa.csv') %>%
dplyr::select(-...1) %>%
dplyr::mutate(ttime = ttime + 1) %>%
dplyr::mutate(patTags = stringr::str_replace_all(patTags, "b'sub-", "'"),
patTags = stringr::str_remove_all(patTags, "'"),
ses = stringr:... |
7dcb0cf443b2a6402d95bd5c3d5ebf3fd4d926a1e1a6a4013d70bd0f032e08e1 | R | 2,724 | 69 | ###################################
## Manhattan plot - retinol (METSIM+INTERVAL) & All three meta
## William Reay (2022)
##################################
library(CMplot)
library(data.table)
library(dplyr)
setwd("~/Desktop/Retinol_GWAS/")
MET_INT_input <- fread("Meta_analyses/Common_var/Stouffers_METSIM_INTERVA... |
13345ab6b38d5b81e2d1202cac2452ea1e7abb7c21b9f1e937bb0edc5fa8a414 | R | 2,737 | 104 | library(ggplot2)
library(lavaan)
reg_data= read.table("./Study2_behavioral_data.txt",header=T)
out <-data.frame()
for(i in unique(reg_data$Subject) ){
sub_dat <- reg_data[reg_data$Subject==i,]
out<-rbind(out,scale(sub_dat,center = T,scale=F))
}
SEM_data = data.frame(cbind(scale(reg_data$Coplayer_cost),scale(reg... |
b0e4c08f989aef9988e21e65f3e9c571e6e6364a7f2b9e86d48cf2c3d5bf1ebd | R | 2,747 | 67 | #' make_antibiogram_experiment(mgseqresfinder = NULL, SEobjresfinder = NULL)
#'
#' Agglomerates data from a resfinder SEobj or mgSeq object to return an antibiogram-style mgSeq or SummarizedExperiment object
#' @export
make_antibiogram_experiment <- function(mgseqresfinder = NULL, SEobjresfinder = NULL){
if (is.n... |
6379f13a9bdeb2e03fade40a1ea7fe11f2a94630c14dc5e775b9dfdb3b192c74 | R | 2,749 | 52 | folder_name='FABP7_centeratpromoter'
input_path = paste0('/scratch/users/banwang3/references/outputs/',folder_name,'/sei_pantro6/sei/')
input_path1=paste0('/scratch/users/banwang3/references/outputs/',folder_name,'/sei_pantro6/sei1/')
input_path2 = paste0('/scratch/users/banwang3/references/outputs/',folder_name,'/sei/... |
968d357885ae43fecbaedffa2a1caed93cc68ef839d7dd493fb85bbd9f3be3bb | R | 2,750 | 64 | library(stringr)
library(dplyr)
library(ggplot2)
firstup <- function(x) {
substr(x, 1, 1) <- toupper(substr(x, 1, 1))
x
}
output_path='/scratch/users/banwang3/celllines/scripts/RScripts/Rplots/'
GSEA=read.table('/scratch/users/banwang3/celllines/scripts/RScripts/AGSEA_MWU_p-val_SignTest_Specific_025_test.csv',sep='... |
002f8719794a6e8d421ba442595a2dea6d8bc09faa0eac5d490eae86bc5eecc3 | R | 2,758 | 56 | # lag autocorrelation
output$lag_plot = renderPlot({
req(input$lag_dataset, input$lag_series)
dataset = data.table()
values = data.table()
refs = data.table()
for (s in input$lag_series) {
.s = data$series[[input$lag_dataset]][[s]]
ref.val = acf(data$raw[[input$lag_data... |
19a2079dc64dfb68390828b64a25ecc2b59b16cd65b826991937bd20f3ae1e3f | R | 2,764 | 84 | library(data.table)
library(ggplot2)
library(ggtext)
library(tidyverse)
library(qvalue)
library(ggrepel)
args <- commandArgs(T)
mytest <- args[2]
df_genes <- read.csv("local_data/burden_results/burden_dynamic_threshold_full_results.tsv", sep = "\t", as.is=T)
df_genes %>% filter(test == myte... |
0db52bd49db31d9171821c92ca86e02417ced04d718b9dbb6b311894cfe90951 | R | 2,770 | 97 | #' @include FamiliarS4Generics.R
#' @include FamiliarS4Classes.R
NULL
# familiarMetricBrier ----------------------------------------------------------
setClass(
"familiarMetricBrier",
contains = "familiarMetric",
prototype = methods::prototype(
metric = "brier",
outcome_type = NA_character_,
name =... |
d50043c89241f8ee5ed8be2b0e1327b3ad293b10f3ba9c324b9a3c15a6b15dc8 | R | 2,780 | 94 | library(circular)
## data
nameExp = "NPA_stich_3"
str_zone = "zoneA"
## parameters
σ2_flock = 1.5
σ2_stream = 1.0
## loading
folderDataZone = "../data_tracking/step3_data_zone/"
nameFile = paste0(folderDataZone,nameExp,"/df_velocity/",nameExp,"_",str_zone,".csv")
df = read.csv(nameFile, header = TRUE)
θ = -df$θ
par... |
9ebe5b728241932f10eba6bb0410d1aa901ab2f86c005d0d6be649852dee1484 | R | 2,787 | 86 | ################## GOAL: DETERMINE WHETHER ANY BIOMARKERS INTERACT SIGNIFICANTLY WITH GENDER FOR PATH A AND PATH B
## before running this script - run "mri-data" and "biomarkerdata" scripts to get processed and cleaned biomarker values
## now: merge all biomarkers into one dataframe with PID, age, gender, HIV.statu... |
34d4f6ebcd921c4de083f341504358fa5ff722b87a811d502040fd13b4f5e2a0 | R | 2,801 | 39 | # Cluster stability and robustness analysis by sub-sampling
subClusterDir = 'scclust/'
source('misc.R')
vars.to.regress = c('Sex', 'Age', 'PMI')
so1 <- CreateSeuratObject(counts = GetAssayData(SeuratObject, slot = 'counts'), min.cells = 0, min.features = 0, names.field = 2, names.delim = '.', meta.data = SeuratObject@m... |
477e4a15d4625eedd1ef1943ac22a2f1c532c36f6b57a84e5a0d4a32e9400079 | R | 2,810 | 135 | ---
title: "Multilayer motifs"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Multilayer motifs}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "../man/figures/"
)
```
```{r loa... |
c0a7343b36ddfdc56154868ca5b2ecaf4dabbcfbc2be17431f615a5ad15a9c9a | R | 2,817 | 46 | #' fix_feats2glomby_feats(feats2glomby_feats = NULL, glomby = NULL)
#'
#' Provides the correct algorithm for agglomerating taxonomic objects. This function is used by agglomerate_features and retrieve_features_by_taxa. No not attempt to use it outside of this context.
#' @export
fix_feats2glomby_feats <- function(feat... |
89d2a4b2a9eacbf4d800d6b96685b60f44991c2985e47b2857bebbd21e7c220a | R | 2,819 | 63 | #' annotate_contigs
#'
#' JAMSalpha function
#' @export
annotate_contigs <- function(opt = NULL){
#Set working directory to workdir
setwd(opt$workdir)
#Write a copy of contigs to be annotated to the system
flog.info("Writing contigs for annotation.")
write.fasta(sequences = opt$NHcontigs_sequence,... |
18dc99939084513161295b636d05813af3bdcc86022f0454ef8114cb4f950235 | R | 2,837 | 98 | CleanMean=function(ymat,
distmat,
cortex,
sacf,
max.radius,
nperm = 5000,
alpha = 0.05,
alternative = "two.sided",
seed = NULL,
nngp = T,
... |
6bb004e32a3112e3f2a9a5c3968a93502b1671e33cb5ac9b389ab3b073c04bd4 | R | 2,841 | 86 | # First test if all selectable learners are also available
familiar:::test_all_vimp_methods_available(
vimp_methods = familiar:::.get_available_glmnet_ridge_vimp_methods(show_general = TRUE)
)
familiar:::test_all_vimp_methods_available(
vimp_methods = familiar:::.get_available_glmnet_lasso_vimp_methods(show_general... |
ad02578ae768cd3506c3dea7c8dfac31d8f3f2d7388fedccd7590148e6654907 | R | 2,845 | 63 | # Perform linear regression to examine the association between handgrip strength and cognition
# Inputs to the script:
# 1) datafile: name and path of spreadsheet containing demographic, cognition and handgrip strength data
# 2) outputfile: name and path of output spreadsheet containing results of the linear regressio... |
5a17f769650761defeb82cef254b2b645acf6ab96cca302f93a7e249b6f2a725 | R | 2,849 | 78 | library(parallel)
library(ArchR)
library(gUtils)
library(pbmcapply)
library(dplyr)
args <- commandArgs(TRUE)
#setwd("./analysis/GM12878_merged_noerror")
# frag_file <- "./GM12878_merged_fragment.bed.gz"
# peak_file <- "./dscNanoATAC_GM12878_noerror_ArchR_peaks_local500k_q0.01_rep2.txt"
frag_file <- args[1]
peak_file... |
a04d5ed75897e37d6a928cfed26ca1f841ad0806b0aba840d99119572bd6d09f | R | 2,863 | 105 | library(ggplot2)
library(lavaan)
reg_data= read.table("./Study2_behavioral_data.txt",header=T)
out <-data.frame()
for(i in unique(reg_data$Subject) ){
sub_dat <- reg_data[reg_data$Subject==i,]
out<-rbind(out,scale(sub_dat,center = T,scale=F))
}
SEM_data = data.frame(cbind(scale(reg_data$Coplayer_cost),scale(reg... |
6b5142b9a3072f9376ee8a8c51e4145593a51bc63c6675e06259016ab3b14f66 | R | 2,871 | 90 | library("muxViz")
#Or build by specifying layers
Layers <- 5
Nodes <- 100
NodeTensor <- list()
g.list <- list()
g.list[[1]] <- igraph::barabasi.game(Nodes, m = 1, directed = F)
#generate a second layer, with 25% edge overlap, while preserving degree distribution
g.list[[2]] <-
GetRewiredLayerWithOverlappingEdges(g... |
70a0e97c841e642a107e911642636363dc5699c08b66d3b2a5d4561c93b15f9d | R | 2,881 | 88 | library(data.table)
library(ggplot2)
library(ggtext)
library(tidyverse)
library(qvalue)
library(ggrepel)
args <- commandArgs(T)
mytest <-"Cns.Toxicity~rest"
df_genes <- read.csv("local_data/burden_results/burden_vf_threshold_full_results.tsv", sep = "\t", as.is=T)
df_genes %>% filter(p != 1 & p != 0) -> df_genes
df_... |
327239bfffb81cfe47743ae0f2011e13dd94f08c79e6e07eefeaa9234ee3f900 | R | 2,905 | 82 | testthat::skip_on_cran()
testthat::skip_on_ci()
debug_flag <- FALSE
# Test that creates a single naive model.
familiar:::integrated_test(
experimental_design = "fs+mb",
vimp_method = "no_features",
cluster_method = "none",
imputation_method = "simple",
estimation_type = "point",
parallel = FALSE,
debug ... |
361a311f2aa3a3d1eb8e54f6a9498886da994f565cb4be480a915fecd86bc495 | R | 2,914 | 97 | #' @name
#' addPCA
#'
#' @title
#' Perform principal component analysis (PCA)
#'
#' @description
#' Perform principal component analysis (PCA). These functions are wrappers
#' for \code{\link[scater:runPCA]{scater::calculatePCA}}.
#'
#' @details
#' These functions are wrappers for
#' \code{\link[scater:runPCA]{scater::... |
9821c1895db304ece3868d4a8f6c13b4c619ec7535f2db5e0984438ad1b3781e | R | 2,915 | 98 |
.gini_dominance <- function(x, w=rep(1, length(x))) {
# See also reldist::gini for an independent implementation
x <- as.vector(x)
o <- order(x)
x <- x[o]
w <- w[o]/sum(w)
p <- cumsum(w)
nu <- cumsum(w * x)
n <- length(nu)
nu <- nu/nu[[n]]
sum(nu[-1] * p[-n]) - sum(nu[-n] * p[-1... |
9275a1a3ee3edf12dfbcc53c66ca88a1c349e3dd13cf90c1400980f9469564f4 | R | 2,928 | 86 | library("muxViz")
#Or build by specifying layers
Layers <- 3
Nodes <- 90
NodeTensor <- list()
#Generate an edge-colored network with SBM structure
g1 <- erdos.renyi.game(40, log(40)/40)
g2 <- erdos.renyi.game(30, log(30)/30)
g3 <- erdos.renyi.game(20, log(20)/20)
g.list <- list()
g.list[[1]] <- g1 %du% delete_ed... |
6656749d9a5228de0d5a471c82ec53cf86935f17a2446790b8ccedbe1eac19b2 | R | 2,930 | 66 | args <- commandArgs() #extract the argument given on the command line
print(args)
input_dir <- args[6] # directory folder of input files
input_pattern <- args[7] #pattern shared by all input files
output_dir <- args[8] #directory folder and shared pattern for output files
packages_dir <- args[9] #directory of R ... |
48cfdb330f7c9542dda00cc653970684add8b1a2a9e6eb0be0f6e3cb81339097 | R | 2,933 | 57 | library(gUtils)
## prepare a Seqinfo object
sl <- hg_seqlengths(BSgenome.Hsapiens.UCSC.hg19::Hsapiens)
si <- Seqinfo(seqnames=names(sl), seqlengths=sl, genome="hg19")
isCircular(si) <- rep(FALSE, length(sl))
## download data from UCSC Table Browser to include as example data in gUtils
library (rtracklayer)
mySession ... |
0284b13261a99cbf24d3327be256ddcdc79800db72840038d9ea86c3eb328e21 | R | 2,939 | 80 | ##############
### Script ###
##############
# Run independent Firth regression models for every voxel j = 1,...,M (Code for simulation study).
#################
### Libraries ###
#################
library(brglm2)
#################
### Constants ###
#################
# Number of dataset to perform analysis on.
sim ... |
395e1a2de72a95215aeda3f4258b186a7b2d01680c079470192230062d896dbe | R | 2,942 | 116 | #' @include FamiliarS4Generics.R
#' @include FamiliarS4Classes.R
NULL
setClass(
"familiarCorrelationVimp",
contains = "familiarVimpMethod"
)
.get_available_correlation_vimp_methods <- function(show_general = TRUE) {
return(c("pearson", "spearman", "kendall"))
}
# is_available ------------------------------... |
42afa55395d2baccb5c062c9a617e69b763b3fbedd1f7026274657e0cc67181d | R | 2,944 | 80 | skip_if_not_installed("biomformat")
# Get default taxonomy ranks (importTaxpasta sets ranks based on data)
default_ranks <- getTaxonomyRanks()
test_that("a complete BIOM file can be loaded without error", {
expect_no_error(
suppressWarnings({
importTaxpasta(system.file("extdata", "complete.biom", package ... |
d800ec84a0b7d7ee94000c55cb3750eb91f13f9b776e4a734702cbf9965a6519 | R | 2,944 | 73 | setwd("/data/bcu_projects/MelBrainSys_PostdocProject_Gruetzmann/publications/2022-my-MelBrainSys-paper/scripts-etc-for-publication/")
dataPath = "regNet/Data/"
trainingSetRatio = 3/4 # how many samples used for training, the remainder are used for test data
# full data set gene expression
fullExprDataFile = paste0( ... |
6a98ce20861336e40ce50c8a68dac55bb8b4d691e9ce593af3f96c060ec63343 | R | 2,946 | 122 |
# If you would like 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. J. Vis. Exp. (152), e60278,
# doi:10.3791/60278 (2019).
# https://www.jove.com/video/60278/multi-fiber-photometry-to-record-neur... |
698f7fd224461fd7e4bbdf9c702c8d47052dbbcd9d009fabfc9973405f239018 | R | 2,950 | 94 | library("muxViz")
Layers <- 4
Nodes <- 100
#Before doing this for data, I recommend to play a bit with smaller multilayers.
#There is a function that you can call to generate simple random multiplex networks:
#
#GetSampleMultiplex <- function(Layers, Nodes, p)
#
#where p is the wiring probability of Erdos-Renyi net... |
04b32e386fe1a7952fcc6b89e0b8f2c84fcf57c76888156be79cfa5b363c9cbc | R | 2,954 | 97 | ##############
### Script ###
##############
# Run code to combine bootstrap samples into matrices to acquire sample from posterior distribution.
# (Code for UK Biobank application)
#################
### Libraries ###
#################
library(oro.nifti)
#################
### Constants ###
#################
# Set ... |
3d9c75fe9af26881e8e39f977612dc7556dd534a2c6438c0576db21e1e33661e | R | 2,954 | 66 | # A simple example of a rejection algorithm for demographic inference of two parameters.
# This function returns ndraws from the posterior distribution of the
# time of expansion and f (the ratio of ancestral population size to present population
# size) conditional on the mean TD being within eps of an
# observed v... |
9e7d31c3a6cf3f34f9e2e0565e607f5952366ab72f357347a9ca12cd2a0d985d | R | 2,954 | 85 | library("muxViz")
set.seed(12345)
#Or build by specifying layers
Layers <- 3
Nodes <- 90
NodeTensor <- list()
#Generate an edge-colored network with SBM structure
g1 <- erdos.renyi.game(40, log(40)/40)
g2 <- erdos.renyi.game(30, log(30)/30)
g3 <- erdos.renyi.game(20, log(20)/20)
g.list <- list()
g.list[[1]] <- ... |
e6fd598ed40f6749eb68fcb573017b10349435205dc824491531f6b4a89fa745 | R | 2,954 | 85 | library("muxViz")
#Comment this line to generate different networks
set.seed(12345)
#Or build by specifying layers
Layers <- 3
Nodes <- 90
NodeTensor <- list()
#Generate an edge-colored network with SBM structure
g1 <- erdos.renyi.game(40, log(40)/40)
g2 <- erdos.renyi.game(30, log(30)/30)
g3 <- erdos.renyi.game(2... |
1134f139ab7b56c477a47ed3f82352b0de23fa21deb11376192899bbe62e6dbe | R | 2,957 | 61 | 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... |
f1b28327a1c6d7456ab893b30ed9522d17894647864add068aa0b8c354ac7773 | R | 2,982 | 66 |
updateCurrentVariableSelections = function () {
variables = names(data$raw[[input$data_dataset]])
updatePickerInput(session, "data_plot_x", choices = variables, selected = data$meta[[input$data_dataset]]$time)
updatePickerInput(session, "data_plot_y", choices = variables, selected = input$data_plot_y... |
e7ff75f9fa0113a106f67df68eb62502f5988b0843ce64e042c1b13b8029e8c7 | R | 2,984 | 94 | req_packages <- c("AnnotationDbi", "DESeq2", "devtools", "doParallel",
"dynamicTreeCut", "edgeR", "flashClust", "foreach",
"ggdendro", "ggrepel", "ggplot2", "igraph",
"limma", "MODA", "openxlsx", "org.Hs.eg.db",
"plyr", "preprocessCore", "Rcpp", "r... |
90beb24fd44a998f8b5a2a24b74783294e27ee55d13c5a798f1cfe7a642dd4bc | R | 2,998 | 91 | #!/usr/bin/env Rscript
set.seed(2178)
# Load necessary libraries
library(dplyr)
library(decoupleR)
library(CoSIA)
#source("/data/user/jbarham3/230323_JW_DiseaseNetworks/src/functions.R")
# Fetch command line arguments
args <- commandArgs(trailingOnly = TRUE)
gtex_file <- args[1]
prior_net <- args[2]
min_n <- as.nume... |
5994b3aaca00d37b117d5c5832bc787685bd38eb3b4a7d26efdcfe670ffbb381 | R | 3,022 | 105 | nest_fo <- function(tbl, vars, foVar){
require(dplyr)
require(tidyr)
require(janitor)
vars_ <- dplyr::syms(vars)
nested_fo <- tbl %>%
dplyr::rename('clus' = all_of(foVar)) %>%
dplyr::group_by(!!!vars_) %>%
dplyr::summarise(clusVec = list(clus)) %>%
dplyr::ungroup() %>%
dplyr:... |
15ace589f45aae984f917a61138dd8fb27d5d2602ed0b86c2e5ff54339ea32f1 | R | 3,023 | 67 | context("addDPCoA")
test_that("addDPCoA", {
skip_if_not(require("ade4", quietly = TRUE))
data(esophagus, package="mia")
#
esophagus <- addDPCoA(esophagus)
expect_named(reducedDims(esophagus),"DPCoA")
expect_true(is.matrix(reducedDim(esophagus,"DPCoA")))
expect_equal(dim(reducedDim(esophagus,... |
4702c8bed8ccc80f14ca582ea05b0c065ca911514d9666e9f3f664c782750297 | R | 3,025 | 88 | library(stringr)
folder_name='GAD1_centeratHAR'
input_path=paste0('/scratch/users/banwang3/references/outputs/',folder_name,'/sei/')
output_path=paste0('/scratch/users/banwang3/references/outputs/',folder_name,'/sei/')
id='hg38_all'
input_path1=paste0(input_path,id,'/')
df1 = list.files(input... |
c4492358a6f6b3db7cad8e37f6aa990877a34c888559b110b0cb7eb38f62a7c8 | R | 3,042 | 85 | #############################################################
########### MAIN PROCEDURE FOR CLUSTERING ANALYSIS ##########
#############################################################
## auxiliary variables
n_reps <- 10
data <- normetrics[, c(idxs, ncol(normetrics))]
## look for NA values
na <- c()
for(nn in 1:(n... |
dd059bf883b8965672bdf341d50b5a296a94c23e8a62b17a67db7447cd284267 | R | 3,044 | 92 | library(stringr)
input_path='/scratch/users/banwang3/celllines/Enrichment_test/ATAC_fortau/Unfiltered/'
allfiles = list.files('/scratch/users/banwang3/celllines/Enrichment_test/ATAC_fortau/Unfiltered/',pattern='.txt')
includeSKM=T
if (includeSKM){
celltypes=c('CM','MN','HP','PP','SKM')
SKM='includeSKM'
}else{
... |
94f871e163dddcf16905e34af10563d31ae75de63f6966c6d704228d635173e3 | R | 3,067 | 97 | # pull together human SETBP1 targets across data sets:
#* Obtained gene list of targets from msigdb SETBP1 target list
#* (https://www.gsea-msigdb.org/gsea/msigdb/human/download_geneset.jsp?
#* geneSetName=SETBP1_TARGET_GENES&fileType=TSV). The target list stored
#* in cheaha at '221018_Setbp1_msigdb_targets.csv' at /d... |
8f78bd9c2881a8cf719be24514055740d58286adea4145208e8d31bb459184cf | R | 3,069 | 61 | basePath = "/data/bcu_projects/MelBrainSys_PostdocProject_Gruetzmann/publications/2022-my-MelBrainSys-paper/scripts-etc-for-publication/"
setwd(basePath)
neededSamples = c("P03_Br","P03_Lu", "P04_Br", "P04_Sk_GA", "P08_Br", "P08_St_GA", "P08_St_BA", "P08_St_YA",
"P16_Br", "P16_Lu", "P18_Br", "P18... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.