sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
832f5b756bf44a4703140eba43306aea29a76b1299594df15d00434ac2a0f477 | R | 4,012 | 107 | #' Plots gradient of (potentially imputed) values on ACTIONet scatter plot.
#'
#' @param ace 'ACTIONetExperiment' object
#' @param x Numeric vector of length NCOL(ace).
#' @param alpha_val Smoothing parameter for PageRank imputation of 'x'. No imputation if 'alpha_val=0' (default:0.85).
#' @param log_scale Logical valu... |
5468d59eb34f2d2bf6a1ae55b321e107451be9baaa5442cc41d087555e6bfeb0 | R | 4,071 | 150 | # Simulate lifespan data from Section 4.1 in Sørensen et al. (2023)
library(tidyverse)
library(mvtnorm)
library(mgcv)
set.seed(3)
trajectories <- readRDS("data-raw/trajectories.rds")
# Fix trajectory for executive function:
mod <- gam(execfun_trajectory ~ s(age),
data = filter(trajectories, age < 25 | age >... |
4b637b4077c65f242ad2088fc9ba1d742fa6c27f5c4d7b0b1c7629c8eb721ba4 | R | 4,098 | 131 | ## -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
source("0_SharedCode.R")
stopifnot(SharedCode_version == c(11,0))
# Run this script twice, first without all subjects,... |
6e65bbab90e9176b66708e91a34fe177cd2285d94c4c19c13e3a612d727563b4 | R | 4,112 | 129 |
#' plotAllSubclonalCN Plot the copy number of each subclone of a sample.
#'
#' @param sample Name of the sample.
#' @param pathOutput Path to the output folder containing the output of pipelineCNA.
#'
#' @return
#' @export
#'
#' @examples
#'
plotAllSubclonalCN <- function(sample, pathOutput = "./output/"){
allF... |
ad99d1ce6a959f81e2fcf25ed7d5ce6078650b4cb86a827e26b36e8d6f47a7bf | R | 4,128 | 138 | #' @title Compare likelihoods of galamm objects
#'
#' @srrstats {G1.4} Function documented with roxygen2.
#' @srrstats {G2.1a} Expected data types provided for all inputs.
#' @srrstats {RE4.11} Goodness-of-fit and other statistics associated such as
#' effect sizes with model coefficients.
#'
#' @description Anova fu... |
fb088837c737cd1d33f0c1292d66785a58f153540a8218aae262df5797b6ecb5 | R | 4,130 | 117 | library(tidyverse)
setwd("/Users/philippehabets/Dropbox/Git/fMRI-transcriptomics-cortisol/")
source("scripts/converting_mouse_marker_genes_to_human.R")
library(org.Hs.eg.db)
# Cell-type enrichment of differentially expressed genes
library(reshape2)
library(plyr)
library(DescTools)
library(abind)
# Filter cell-types ... |
e41b9cecfee7c3b16ed2e4e65d61df54c2cf917acc32127a5541b3198a2b6468 | R | 4,138 | 95 | #' Find statistically significant hub genes in each scHumanNets
#'
#' @param net.list output of SortAddLLS. list of network dataframe
#' @param centrality default is "degree" centrality. Available options are: c("degree", "betweenness","closeness", "eigenvector"). Degree is calculated with sum of weights. Weights are u... |
7bece293a837b5d8392e43c9891f9deab21777684dd101369690c7450ee4c448 | R | 4,149 | 141 | reference_filters <- local({
filters <- default <- list(
ignore_envirs = function(ref, typeof, class, ...) {
typeof != "environment"
}
)
function(action = "drop_function", ...) {
if (action == "drop_function") {
function(ref) {
typeof <- typeof(ref)
class <- class(ref)
... |
381affdd98a5b0b19d05972941221a25d18fe4bc0bd03f5a017b76c1a8736336 | R | 4,167 | 131 |
library(data.table)
library(ggplot2)
source('../config.r')
source('../utils.r')
source('../read_data.r')
extra_path <- file.path('inputs')
fname <-
'post_predictive_analysis_all_models_combined_imaging_non_imaging.csv'
DT_pred <- assemble_inputs(fname, path1 = extra_path)
#' Get point estimates + standard outpu... |
04c29ba80e471fb7839a90ddb60d22e79a34ad859db3d8c82251d8ca374ccac0 | R | 4,194 | 120 | library(data.table)
library(ggplot2)
source('../config.r')
source('../utils.r')
source('../read_data.r')
extra_path <- file.path('..', 'figure-2', 'inputs')
#' Get together all input files.
#' First the extra data files. We'll write a function for that.
#'
fname <- "../figure-3/inputs/post_predictive_analysis_imagin... |
2699d6be39c587509d07b9666fbf5e7d09a8ee8cca494102511244580b4af001 | R | 4,199 | 90 |
libs<-c("rBLAST","tidyverse","GenomicRanges","data.table","broom", "ape", "ggtree", "readr","geiger","nlme","phytools","grid","gtable","xtable","phangorn","Biostrings")
sapply(libs, require, character.only=T)
##########################################################
# separate sequences from library according to r... |
1da8b22868195ad2f57d13dcabb7a5499f6d8b57e2383fe6fb9be52a180ffcbd | R | 4,209 | 121 | #' @export
#' @importFrom dplyr mutate_if
#' @importFrom ggplot2 aes
summarise_read_quality <- function(fwd_fqs, rev_fqs, num = 50000) {
stopifnot(
all(file.exists(fwd_fqs)),
all(file.exists(rev_fqs))
)
smry1 <-
bind_rows(
ShortRead::qa(fwd_fqs, n = num)[["perCycle"]]$quality %>%
mutate_... |
bf23c32c853e1a0571ed2222bb9ff9c20ec6d564341b99cfe0f82d8845f722ca | R | 4,212 | 111 | #' @param FUN A \link[base]{function} to be evaluated.
#'
#' @param args A \link[base]{list} of arguments passed to function `FUN`.
#'
#' @return
#' `futureCall()` returns a [Future] that calls function `FUN` with
#' arguments `args`.
#'
#' @example incl/futureCall.R
#'
#' @details
#' The `futureCall()` function works ... |
2925c4a4e4c87d8f502c15b35ab69f501a07f5322dd43376ea571d65544c7323 | R | 4,224 | 133 | ## --------------------------------------------------------------------------------------------------------------------------------------------------------------------
source("0_SharedCode.R")
source("0_Analysis_helper.R")
stopifnot(SharedCode_version == c(11,0))
subjects <- readRDS(file.path(dir_data_misc, "HCP_... |
b4ebed7ca316e448980c6da0d5630782edcbfeeb2c96e9e0e3f1571080e3024d | R | 4,244 | 117 | ---
title: "Which Retest Subjects Have all the Data we Need?"
author: "Damon Pham"
date: "01/01/2021"
output: html_document
---
Three of the 45 subjects with retest data did not have all the files needed, leaving 42 subjects with complete data.
```{r}
dir_data_test <- "/N/dcwan/projects/hcp"
dir_data_retest <- "/N/u... |
e3cfef6aa58957a9437662ae6e5f3eccb2e1706540ed3aad05e5a44349952b98 | R | 4,253 | 116 | #' Domainogram of insulation
#'
#' Creates a domainogram of insulation scores for a genomic region of interest
#' by calculating the insulation scores for a range of sliding square sizes.
#'
#' @param explist Either a single GENOVA \code{contacts} object or list of
#' GENOVA \code{contacts} objects.
#' @param chrom O... |
3d7020f7c1a404c83c7c1033af59da35209222933ebe9e98b544c33015022a3a | R | 4,254 | 144 | loadCooler = function(cooler, balancing = T, scale_bp = NULL, scale_cis = F, resolution = 10e3){
bins_name = "bins"
pixels_name = "pixels"
ABS = NULL
SIG = NULL
# check if it contains bins or resolution groups:
if(any(grepl("/resolutions",rhdf5::h5ls(cooler)[,1]))){
# crap, one of those cooler-fil... |
b50d2442a4aaa3570e4ec56ed9170427ffce168f8c7bdb4866e26f5191335d4d | R | 4,254 | 98 | #!/opt/R/4.0.0/lib/R/bin/exec/R
#load libraries
libs <- c( "Biostrings","tidyverse", "rBLAST", "stringr")
sapply(libs,require,character.only=T)
setwd("/data/share/htp/TRNP1/paper_data/")
#read arguments
args <- commandArgs()
print(args)
input_species <-args[6]
print(input_species)
input_seq_dir <-args[7]
print(inp... |
fc4fa3ccab3ae850559a0be913e40e7d91f174a60dd984fc70bb8efbc3e902ee | R | 4,272 | 105 | ---
title: "Understanding Various DVARS Implementations"
author: "Damon Pham"
date: "1/1/2021"
output: html_document
---
```{r}
source("../analysis/0_SharedCode.R")
stopifnot(SharedCode_version == c(10,0))
```
DVARS is scale-dependent, so when replicating the DVARS measurement from various papers it is important to u... |
584031c18beade77440112c5771a016db50bfd187f7fe32b74e8e5866614726d | R | 4,281 | 131 |
#' plotAllSubclonalCN Plot the copy number of each subclone of a sample.
#'
#' @param sample Name of the sample.
#' @param pathOutput Path to the output folder containing the output of pipelineCNA.
#'
#' @return
#' @export
#'
#' @examples
#'
plotAllSubclonalCN <- function(sample, pathOutput = "./output/"){
allF... |
498f7c04f3a2eee05172e8342ecc06a29e2010aefb232e90a160b00781f587a3 | R | 4,285 | 168 | #' Check whether a future is resolved or not
#'
#' @param x A \link{Future}, a list, or an environment (which also
#' includes \link[listenv:listenv]{list environment}).
#'
#' @param \ldots Not used.
#'
#' @return
#' A logical vector of the same length and dimensions as `x`.
#' Each element is TRUE unless the correspon... |
3bddb3b3d6a673f41b6249a50ca99f9cd561bad34009bdc22b56397bb973e6ec | R | 4,290 | 141 | ##########################################################################################
## Generate network plot and pie charts for ASD PPI data
##
## Author: Yu-Han Hsu
##########################################################################################
rm(list=ls())
library(igraph)
library(qgraph)
library(... |
3dc5ca6673a1bf550b54b3a92fe6e35f42c7ac4634ae494ddb604d1c07a382f5 | R | 4,300 | 137 | #' Uses a variant of the label propagation algorithm to infer missing labels
#'
#' @param ace Input results to be clustered
#' (alternatively it can be the ACTIONet igraph object)
#' @param initial_labels Annotations to correct with missing values (NA) in it.
#' It can be either a named annotation (inside ace$annotatio... |
4f120db4b2259f54bc619d87d27259d823a55d934a1248b374b2bfb6d4cea69f | R | 4,309 | 122 | library(tidyverse)
setwd("/Users/philippehabets/Git/fMRI-transcriptomics-cortisol/data/")
# read in GSEA results
KEGG <- read_csv("Table.S4.csv")
GO <- read_csv("Table.S3.csv")
## clean data for plotting ##
#KEGG
KEGG_df <- KEGG %>%
filter(Bonferroni < 0.05) %>%
mutate(Term = str_replace(Term, ".*:", "")) %>%... |
4f1d9fb8463444364ec01c0bf04907b2d95d6163bef9072b141a38b412ab41aa | R | 4,318 | 116 | ---
title: "Permutation testing for META for dFC Metrics - COBRE RAW"
author: "Fran Hancock"
affiliation: Department of Neuroimaging, Institute of Psychiatry, Psychology and Neuroscience, King's College London, London, UK
date: "`r format(Sys.time(), '%B %d, %Y')`"
fontsize: 14pt
output: html_document
---
```{r setup... |
f0ba2a7e35f85fc4fbf69226171a199e90f5982f4f5a7020e3399ac39de0c453 | R | 4,320 | 148 | #' Imputing expression of genes by interpolating over archetype profile
#'
#' @param ace ACTIONet output
#' @param genes List of genes to impute
#'
#' @return A matrix of imputed expression values
#'
#' @examples
#' expression_imputed = impute.genes.using.archetype(ace, genes)
#' @export
impute.genes.using.archetypes <... |
56c5c6d140c7d986f52460a624e66adb0e26ebcac25f69edf8bb9c8409adab66 | R | 4,356 | 82 | ##########################################################
## ccAF: converting_to_loom.R ##
## ______ ______ __ __ ##
## /\ __ \ /\ ___\ /\ \/\ \ ##
## \ \ __ \ \ \___ \ \ \ \_\ \ ##
## \ \_\ \_\ \/\_____\ ... |
a4879511b8cd03281fecefa44df06c6342cb45b331781f7ca7169deead21eef7 | R | 4,359 | 126 | ---
title: "Permutation tests for dFC Global Metrics - META HCPEP RAW"
author: "Fran Hancock"
affiliation: Department of Neuroimaging, Institute of Psychiatry, Psychology and Neuroscience, King's College London, London, UK
date: "`r format(Sys.time(), '%B %d, %Y')`"
fontsize: axtxtpt
output: html_document
---
```{r s... |
0e312d598d41cd0629b773fab074e4f40749e46d80a2957119bcae5994ee12cd | R | 4,374 | 93 | runSsGSEAwithPermutation<-function(profile_data_file, number_perms){
# NEW ADD 1/3
profile_data_path = dirname(file.path(profile_data_file))
profile_data_name = basename(profile_data_file)
MOD_file = paste(system.file("data", package = "ssgsea.GBM.classification"),"/",sep='')
#please keep the fir... |
fd8210ad98087358db38159a12248add304759bc8a889b5f0827f34c2681cff9 | R | 4,377 | 131 | source ("Library.R")
# read data
data= NULL
for (i in 1:8) {
sname <- paste("Fly",i, sep="")
.data = read.xlsx("raw_data_imaging_S4B.xlsx",sheetName= sname) %>%
dplyr::mutate(Fly = paste(i)) %>%
tidyr::gather(key = sound, value = response, -Frame, -Fly)
background = .data %>%
dplyr::filter(Frame < ... |
822d24709548ccadb84c3b8e991c03283bc375af26bfc0f98b02806b54ba4758 | R | 4,394 | 142 | ## A *rough* estimate of size of an object + its environment.
#' @keywords internal
#' @importFrom utils object.size
#' @importFrom parallelly serializedSize
objectSize <- function(x, depth = 3L, enclosure = FALSE) {
# Nothing to do?
if (isNamespace(x)) return(0)
if (depth <= 0) return(0)
method <- getOption(... |
aed8e058eeb7bc7168d0396e41ad57f153c05d58111f7a59ff8a31d86470d7b1 | R | 4,399 | 25 | # Introduction
**Word limit**: `r wordcountaddin::word_count("01-introduction.Rmd")` of 400.
Deep Convolutional Neural Network (DCNN) is a class of machine learning (ML) methods with the potential to augment radiological diagnosis and research [@calliDeepLearningChest2021; @mohammad-rahimiMachineLearningOrthodontics2... |
0dd340e5a1f56474ee8b1ba1f5e586791a1400cb0b05bdc83116c17dd67b3256 | R | 4,454 | 111 | # Functions for cleaning metadata and trees
######################## DATA CLEANING FUNCTIONS #####################
"%w/o%" <- function(x, y) x[!x %in% y] #-- x without y
nospaces <- function(x) gsub(" ", "_", x) # replace spaces with "_"
no_ <- function(x) gsub("_", " ", x) # replace spaces with "_"
delspaces... |
dd5e825d2c98fc32b2fac60839cfa4622ea91a856a96742aee83331a9b53f88a | R | 4,456 | 151 | #' @tags nbrOfWorkers nbrOfFreeWorkers
#' @tags sequential multisession multicore cluster
library(future)
message("*** nbrOfWorkers() ...")
strategies <- c("sequential")
for (strategy in strategies) {
message("Type of future: ", strategy)
evaluator <- get(strategy, mode = "function")
n <- nbrOfWorkers(evaluat... |
5e86893b4a45facf646221f675a0072df511b894a2495ddbc2d36c08a219c5d8 | R | 4,471 | 147 | source ("Library.R")
####Figure 1 ####
a <- read_excel("copulation_rate.xlsx") %>%
dplyr::mutate(ctime=ctime/60) %>%
dplyr::mutate(event=ifelse(ctime>30, 0, 1)) %>%
dplyr::filter(ctime >0) %>%
dplyr::mutate(ID = row_number())
a$IPI <- as.factor(as.character(a$IPI))
a$species <- as.factor(a$species)
IPI_orde... |
3ba2be40f1f2617b236145e52f4cc9a04af4170424fa39e0613120f5660aca3a | R | 4,504 | 125 |
library(data.table)
library(ggplot2)
library(GGally)
library(ggrepel)
library(optparse)
library(ggExtra)
library(RColorBrewer)
library(fastDummies)
library("psych")
main <- function(){
options <- get_options()
# (un)comment depending on if it is an interactive test run
options <- test()
PCs <- annotate_PCs(o... |
41931fa391da9086da4d0ef3669b8319253fb8e40f589674e87b29957d7b5644 | R | 4,510 | 167 | ---
title: "--"
author: "rbarreiro"
date: "--"
output:
html_document:
theme: journal
css: rmark.css
---
```{r setup, include=FALSE}
suppressMessages({
library(tidyverse)
library(scales)
library(cowplot)
library(ggbeeswarm)
library(ggsci)
library(viridis)
library(knitr)
library(ggpubr)
libr... |
d65285cf032a51a8e1754f039e9ad236456c2ba63e66c283f0bf57199d2e14bb | R | 4,511 | 126 | vegaMC_R <- function(mtx, output_file_name="output",
beta=0.5, min_region_bp_size=1000, correction=FALSE,
loss_threshold=-0.2, gain_threshold=0.2, baf=FALSE,
loh_threshold=0.75, loh_frequency=0.8, bs=1000,
pval_threshold=0.05, html=TRU... |
ee16374797139ac2cd66512ae371753e405502b7a7588dc76e09ed1f3ce49308 | R | 4,529 | 101 | library(tidyverse)
library(plyr)
library(ggpubr)
library(nonpar)
library(RVAideMemoire)
setwd("/Users/philippehabets/Dropbox/Git/fMRI-transcriptomics-cortisol/data/")
## read in DEGs and check DS if available in ouputted list from Hawrylcyz 2015 paper
DS_all <- read_csv("differential_stability_tableS2_Hawrylycz2015.... |
e195f1d04e62c044f90d68a8a753459bf33c149cbecb2be6fed93e9324f205f7 | R | 4,536 | 92 | # Function for plotting heatmap from seurat 10x object
# col_order is a single element or a vector element. By default cells are ordered by the first element of the metadata variable.
# User can specify col_order as a vector, with cell order prioritised based on the order of the col_order variable.
# A custom_order c... |
09e08fde19e7560e8d167d84ee7d0454eca52e78962a9f2c0f5f229f89de3a3f | R | 4,538 | 146 | #!/usr/bin/env Rscript
#' Example usage of scHumanNet R package
#'
#' This script demonstrates how to use the scHumanNet R package for
#' cell-type-specific network analysis.
library(scHumanNet) # Assuming package is installed
library(igraph)
library(dplyr)
# Function to create example data
create_example_data <- fu... |
ecd359fbec826185a6fe98e7d7a7d051c39b87286b5e163ed4190095eb6a76ce | R | 4,538 | 144 | ### script to split by read length (to be used for calibration)
# load libs
library(foreach)
library(doParallel)
source('functions.R')
# load parameters
conf <- load_mapping_config()
# load tool locations
tool_path <- load_tool_location()
# set max cores
max_cores <- get_max_cores() # from functions.R
# register ma... |
05fcd50f909fc3cdb4a24ba1669d4760fd8b49172d43435bd9bfd473baf6f35a | R | 4,543 | 117 | ```{r}
if (basename(getwd()) == "downstreamer_main") {setwd("evaluating_coregulation")} else {setwd("../evaluating_coregulation")}
source("../downstreamer_functions.r")
source("data/source_olivier.r")
datasets <- read.downstreamer.batch("../data/final_paper_cov_correct/", USE.CACHE = F)
trans.eqtl ... |
d614aaae4565880abb49916010755f175917defb2aeea663e77b82a12010e1b7 | R | 4,543 | 128 | ```{r}
if (basename(getwd()) == "downstreamer_main") {setwd("evaluating_pathways")} else {setwd("../evaluating_pathways/")}
source("../downstreamer_functions.r")
library(tidygraph)
library(ggraph)
pathway.db <- "GenePrioritization"
datasets <- read.downstreamer.batch("../data/final_paper_cov_correct/", USE.CACHE=F, p... |
8859fe99f128b4dfa7d2b57bf69fabad3d5ccea309158cb83ce485a39bc6cce4 | R | 4,590 | 142 | #' @tags startup onLoad
library(future)
options(future.debug = FALSE)
maxCores <- min(2L, availableCores(methods = "system"))
plan("default")
strategy0 <- plan()
message("*** .onLoad() ...")
plan("default")
pkgname <- "future"
message("- .onLoad() w/out command-line options ...")
options(future.plan = NULL, futur... |
6362be17dd6e327fa997385684d28f1075f40262dc8727100c20d8367b3732c5 | R | 4,597 | 89 | library(tidyr)
source("utils_Florian.R")
behaviours <- c("rest", "forward_walking", "backward_walking", "antennal_grooming", "eye_grooming", "foreleg_grooming", "hindleg_grooming", "abdominal_grooming", "PER_event", "CO2")
intercept <- TRUE
standardize <- FALSE
standardize.response <- FALSE
non_negative_regressors <- ... |
7c475b7b436cd1ad36bd982d96419593b93308e2f64e4c44059f9938472e920f | R | 4,598 | 92 | shuffle_column <- function(metrics.df, column, number) {
all_shuffles <- replicate(number, sample(metrics.df[[column]]))
#now substitue shuffled column in the original "metrics" column for DESeq
shuffled_metrics <- metrics.df
dds.list <- list()
for (i in 1:ncol(all_shuffles)) {
shuffled_metrics[[col... |
d9979e13160994365082b2a2b96f48d38e4a2e4b3a28587083a8fee2f852f991 | R | 4,610 | 147 | #' An extension of the SummarizedExperiment class to store
#' the results of ACTIONet method
#'
#' @slot rowNets,colNets gene-gene and cell-cell networks, respectively
#' @slot rowMaps,colMaps Factorization results (W and H matrices)
#'
#'
#' @return an ACTIONetExperiment (ACE) object
#' @rdname ACTIONetExperiment
#' @... |
0548f79977f944641fffb0b314d540f9e7675860c8106eb8a0c7703246cafe74 | R | 4,614 | 167 | #' @srrstats {5.6} Parameter recovery tests are done here.
#' @srrstats {G5.6a} We are testing recovery within a relatively wide tolerance
#' here.
#' @srrstats {G5.6b} Parameter recovery with multiple random seeds tested here.
#' @srrstats {G5.7} Tests here show that parameter recovery becomes more
#' accurate as ... |
25b6f5edf25e6ecda8a22d0f69bac2dbc4b2021fc50866a980187dca4182d201 | R | 4,634 | 108 | #combining dN/dS estimates of the protein with the intronic activity and running PGLS on this
#load libraries
libs<-c("tidyverse","cowplot","GenomicRanges","data.table", "broom", "ape", "ggtree", "readr","geiger","nlme","phytools","grid","gtable","xtable","rr2")
sapply(libs, require, character.only=T)
##############... |
0752287f7b677bd3c6d0a5314651b3e5cef920c0e78189b44546856b4a627463 | R | 4,645 | 184 | #' Title
#'
#' @param theta
#' @param betXY
#' @param pi1
#' @param sig1
#' @param w8s
#' @param m0
#' @param pi_U
#' @param i_X
#' @param i_Y
#' @param nX
#' @param nY
#' @param model
#' @param bn
#' @param bins
#' @param M
#'
#' @return
#' NOT EXPORTED @export
#' @keywords internal
#'
#' @examples
pairTrait_singleSte... |
add2d05f007cdf6aa0b4e7106f4cc93c4f9d9edb7bfed7a9c808c5e9ee355c07 | R | 4,664 | 140 | #remoter::server(verbose = T, port = 55557, password = "laberkak", sync = T)
remoter::client("localhost", port = 55580, password = "laberkak")
setwd("/groups/umcg-wijmenga/tmp04/projects/depict2/")
setwd("D:\\UMCG\\Genetica\\Projects\\Depict2Pgs")
source(paste0("C:\\Users\\patri\\Documents\\GitHub\\systemsgenetics\\... |
2802d67fdfc6ba8c21f71094fc2a74d3ff06362bcc0f438b57a88aa72ad937d4 | R | 4,693 | 188 | #' Title
#'
#' @param theta
#' @param betXY
#' @param pi1
#' @param sig1
#' @param w8s
#' @param m0
#' @param pi_U
#' @param pi_X
#' @param pi_Y
#' @param i_X
#' @param i_Y
#' @param nX
#' @param nY
#' @param model
#' @param bn
#' @param bins
#' @param M
#'
#' @importFrom stats fft sd
#'
#' @return
#' NOT EXPORTED @exp... |
01c4fd07fff5052639d3692df44e499e164934d8b197d8b285cdc1b9834e1c7b | R | 4,696 | 159 | #' Get the number of workers available
#'
#' @param evaluator A future evaluator function.
#' If NULL (default), the current evaluator as returned
#' by [plan()] is used.
#'
#' @return
#' `nbrOfWorkers()` returns a positive number in \eqn{{1, 2, 3, ...}}, which
#' for some future backends may also be `+Inf`.
#'
#' @exa... |
3b488d91eca31ba8b0d436cd29ec6f6d4f8bfadcba05dc760db42c89157dc65c | R | 4,699 | 195 | #' Get row-associated networks
#' @return List of adjacency matrices
#' @rdname rowNets
#' @export
setMethod("rowNets", "ACTIONetExperiment", function(object) {
out <- object@rowNets
out
})
#' Get column-associated networks
#' @return List of adjacency matrices
#' @rdname colNets
#' @export
setMethod("colNe... |
3434b54293321ef897ad7e9f1918337bdf90ae49ec4d4ad4ffdb6ea4d9418877 | R | 4,719 | 120 | ##########################################################################################
## Compare and plot summary statistics of IP-MS datasets subsetted by MS site
##
## Author: Yu-Han Hsu, Joshua Ching
##########################################################################################
rm(list=ls())
libra... |
c13fbf980283df9cf388427fe4fc80c1dc27ae7c281e5949ab6971421b209d6a | R | 4,719 | 137 |
#***********************************************************************************
# upload and preprocess data %%%
#***********************************************************************************
library(h2o)
h2o.init(ip = "localhost", port = 54321, ... |
db8066bfb9c362f2ec246fc15a4b9e4d9a01484267c24a2e41200522830bdaa2 | R | 4,743 | 134 | ```{r}
source("downstreamer_functions.r")
setwd("evaluating_coregulation")
source("data/source_olivier.r")
# Read HPO enrichments
files <- list.files(hpo.prediction.path, pattern=".*_Coregulation_1588_auc_hpo.txt", full.names=T)
auc.coreg.1588 <- read.enrichments(files, trim.colnames="_Coregulation_... |
a63f441a9e9c435d0ead02ee93c2cd070895ddfb28d3a05ce4e0bd04c5665ffc | R | 4,762 | 161 | #' Empirical centromeres
#'
#' For each chromosome, finds and reports the largest stretch of unused bins as
#' centromeres.
#'
#' @param MAT The \code{MAT} slot of a GENOVA \code{contacts} object.
#' @param IDX The \code{IDX} slot of a GENOVA \code{contacts} object.
#'
#' @details A bin is seen as unused when the index... |
286dcac16252e1a8f354e150e1f5054fb47725e7fc580a6ba167efb8dd6dfce0 | R | 4,774 | 164 |
rm(list = ls())
# the libraries needed and the actual code for this section is within convenience functions in QCfunctions.R
source("QCfunctions.R")
grp="str3m"
outname<-grp
# set wd to QC if needed
# setwd(list.dirs(recursive = F)[grep("C_QC",list.dirs(recursive = F))])
# setup directory structure
dirSetup(out... |
1525c5e681b5206444727258c860b6644dc0e74fd045d58a88fb63514379c3fd | R | 4,788 | 145 | ```{r}
# Deprecated
library(tidygraph)
library(ggraph)
library(data.table)
path <- "/home/work/Desktop/depict2/coregulation_data/HP:0000991"
phenotype <- "30690_raw"
ngene <- 100
ensembl <- read.table("~/Documents/data/reference/ensembl/ensembl_gene_position_export.txt", sep="\t", header=T, stringsAsFactors = F)
ense... |
efef0aca4388b4efa70896c1271bd09bba1d509b22af668e385df6025f3202d3 | R | 4,805 | 152 |
library(data.table)
library(arm)
source('../config.r')
source('../utils.r')
source('../read_data.r')
extra_path <- file.path('inputs')
fname <-
'post_predictive_analysis_all_models_combined_imaging_non_imaging.csv'
DT_pred <- assemble_inputs(fname, path1 = extra_path)
#' Get point estimates + standard outputs f... |
f2991d308d3b96604d68f28549e81d945648b7e6b32dc5ca7e60e8c525af7bd9 | R | 4,814 | 112 | ## -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
source("0_SharedCode.R")
stopifnot(SharedCode_version == c(11,0))
## ------------------------------------------------... |
2887448be05b5e0efd6bcc23409fc99fe195ad4844010e657c71e28616b92598 | R | 4,817 | 152 | #' @tags FutureResult FutureGlobals FutureCondition sequential
library(future)
plan(sequential)
assertFutureResult <- future:::assertFutureResult
UnexpectedFutureResultError <- future:::UnexpectedFutureResultError
DeviceMisuseFutureCondition <- future:::DeviceMisuseFutureCondition
FutureLaunchError <- future:::Futur... |
21b4169ad37d84a13cf9c943cf5c65d855c0c493b5d7f2021c3e8e7d02df44bc | R | 4,841 | 100 | library(RISC)
library(RColorBrewer)
library(ggplot2)
colname <- function(x0){
colname0 <- colnames(x0)[-ncol(x0)]
x0 <- x0[,-ncol(x0)]
colnames(x0) <- colname0
x0 <- as.matrix(x0)
rownames(x0) <- sapply(rownames(x0), function(x){strsplit(x, "__", fixed = T)[[1]][1]})
return(x0)
}
PATH = "/Path to the dat... |
2e1cd48ac2388fe6fbeb20b3c7bd365855476175aa09c550bee9303338e5ef56 | R | 4,853 | 134 | ## --------------------------------------------------------------------------------------------------------------------------------------------------------------------
source("0_SharedCode.R")
stopifnot(SharedCode_version == c(11,0))
## ---------------------------------------------------------------------------------... |
fbd2dbe2e06cab113829c61472d0e22b388aeec29ae6f634ff3e22329cdf105f | R | 4,859 | 117 | #' Get classic markers
#'
#' Find markers between pairs of labels using the \dQuote{classic} approach,
#' i.e., based on the log-fold change between the medians of labels.
#'
#' @inheritParams trainSingleR
#' @param de.n An integer scalar specifying the number of DE genes to use.
#' Defaults to \code{500 * (2/3) ^ log2... |
d22e749337d6521baf4e7ecc452cef33229104163477df21ceb9c7f7ffcc195c | R | 4,898 | 129 | vegaMC_R <- function(mtx, output_file_name="output",
beta=0.5, min_region_bp_size=1000, correction=FALSE,
loss_threshold=-0.2, gain_threshold=0.2, baf=FALSE,
loh_threshold=0.75, loh_frequency=0.8, bs=1000,
pval_threshold=0.05, html=TRU... |
372e3186c4c6186e36c058695683932f723df63c2b86623129155d1204c093e2 | R | 4,903 | 137 | ##########################################################################################
## Generate gene expression heat map for:
## (1) 24 ASD risk genes from Satterstrom et al.
## (2) housekeeping or cell type marker genes
##
## Author: Yu-Han Hsu
###################################################################... |
f8b3beb02070b7afb9435eb0fb0b8c637f90a4a52d1ef76e86b610d9c0099844 | R | 4,911 | 163 |
library(readr)
colTypes <- cols(
.default = col_double(),
`X` = col_character()
)
expFile <- "/groups/umcg-fg/tmp01/projects/genenetwork/recount3/Recount3_QC_2ndRun/Filtered_Matrices/TPM_log2_QNorm_QCed_CovCorrected_AllCovariates.txt"
table_tmp <- read_delim(expFile, delim = "\t", quote = "", col_types = colT... |
9d08a6db69b28f5fc18d6a1f998b45287b93003866084379931723b77fdbb182 | R | 4,921 | 132 | library(data.table)
library(ggplot2)
library(GGally)
library(ggrepel)
library(optparse)
library(ggExtra)
library(RColorBrewer)
library(fastDummies)
library("psych")
main <- function(){
options <- get_options()
# (un)comment depending on if it is an interactive test run
# options <- test()
PCs <- annotate_PCs(op... |
89f194b492c90bb528361a5c2b151a05953910be0d029334dca6fc41923909c1 | R | 4,936 | 193 | #' @tags utils-internal
message("*** utils ...")
message("*** hpaste() ...")
# Some vectors
x <- 1:6
y <- 10:1
z <- LETTERS[x]
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Abbreviation of output vector
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
printf("x = %s.\n", hpaste(x))
##... |
ceefa43e9e2d49077fca7ac7b9aae56262ab609ac136c2397da38638ed84f2cd | R | 4,948 | 158 | library(BioCircos)
adj.dir = "Desktop/Gerald/RitaFetalLiver/central-100/0.01"
file.list = list.files(adj.dir)
file.list = file.list[grep('csv',file.list)]
file.list = file.list[grep('siVAE',file.list)]
meta.edges = read.csv(file.path(adj.dir,'sig_edges.csv'),row.names=1)
sig.edges = rownames(meta.edges[meta.edges$pva... |
3040b5ccccebefda245d7f03f3379ecb4b7ee583d5df11b147dbb765b4d0128f | R | 4,949 | 159 | library(BioCircos)
adj.dir = "Desktop/Gerald/RitaFetalLiver/central-100/0.01"
file.list = list.files(adj.dir)
file.list = file.list[grep('csv',file.list)]
file.list = file.list[grep('siVAE',file.list)]
meta.edges = read.csv(file.path(adj.dir,'sig_edges.csv'),row.names=1)
sig.edges = rownames(meta.edges[meta.edges$pva... |
2330270c628266c9e206316ec05b6729ea137942e160551c809708bbcb841afd | R | 4,954 | 144 | ```{r}
setwd("../coregulation_calculations")
source("../downstreamer_functions.r")
pc10 <- read.table("data/gn_coreg_10.coregulation.dist.metrics.txt", row.names = 1, header=T)
pc50 <- read.table("data/gn_coreg_50.coregulation.dist.metrics.txt", row.names = 1, header=T)
pc100 <- read.table("data/gn_coreg_100.... |
a38ea9bd94a68d7541ffbc29dceaad9d70151c002f033a2a60ce3c05b0984a4b | R | 4,964 | 160 | #' Cancel one or more futures
#'
#' Cancels futures, with the option to interrupt running ones.
#' A canceled future is invalid, e.g. calling [value()] on it produces
#' an error. `cancel()` is vectorized, i.e. accepts a set of futures to
#' be canceled.
#'
#' @param x A [Future], a list, an environment, or a list envi... |
fd129cc0a53fccfcee160c5a8453b4e862df959984d8f04747ad10625d55fdaf | R | 4,966 | 135 | ```{r}
if (basename(getwd()) == "downstreamer_main") {setwd("coregulation_clustering")} else {setwd("../coregulation_clustering")}
source("../downstreamer_functions.r")
library(apcluster)
library(tidygraph)
library(ggraph)
nodes <- fread("data/Urate_2021/Urate_2021_nodes.tsv", data.table = F)
edges <- fread("data/... |
3f547cc0096134e1c7c63ec91287cf50e69b5279c2e8f99c515b45fcfe82ce79 | R | 4,968 | 175 |
## Default ACE values
.default_rowData <- function(d) {
DF = DataFrame(feature_name = paste0("feat_", 1:d))
return(DF)
}
.default_colData <- function(d) {
DF = DataFrame(sample_name = paste0("sam_", 1:d))
return(DF)
}
.default_rownames <- function(d) {
n = paste0("feat_", 1:d)
return(n)
}
.d... |
f6f36e968cab1ae78c608c608102c982c2856b0b5747b442a5a14330d39971a6 | R | 4,977 | 202 | #' @tags globals tricky
#' @tags listenv
#' @tags sequential multisession multicore
library(future)
library(listenv)
oopts <- c(oopts, options(
future.debug = FALSE,
future.globals.resolve = TRUE,
future.globals.onMissing = "error"
))
## Muffle warnings on setting R option 'future.globals.method',
## which are... |
095143adf1ba3dfc06d557d86f94c2ca7dfd5f1ee7882daa2a08d5d629b738a1 | R | 5,009 | 148 | #START_OF_LICENSE_TEXT
######################
#License #
######################
# Copyright (c) 2020-2021 National Technical University of Athens
# Contact C. Gousiadou, email:cgousiadou@gmail.com
####################################
#https://opensource.org/licenses/BSD-3-Clause
#Redistribution and... |
ae3e1fd67e2e956331e2bb5bbefa312a3a6087a719c653a710f9b42c8142023c | R | 5,026 | 175 |
rm(list = ls())
# the libraries needed and the actual code for this section is within convenience functions in QCfunctions.R
source("QCfunctions.R")
grp="str1m"
outname<-grp
# set wd to QC if needed
# setwd(list.dirs(recursive = F)[grep("C_QC",list.dirs(recursive = F))])
# setup directory structure
dirSetup(out... |
8fd27129d69aa31e2a9cf31faf3d0b13f796abd277299dd3c403ee7fcb43cc62 | R | 5,033 | 157 | library(here)
library(tidyverse)
library(lme4)
library(car)
library(emmeans)
library(performance)
library(ordinal)
library(RVAideMemoire)
# global settings
options(contrasts = c("contr.Sum", "contr.poly"))
# import data
dat <- tryCatch( # navigate from base dir, otherwise try local
read.csv(file.path("stats", "wsws... |
b05663b549fc47d7932a7412b87edf1f6dce683ff6b7e4125213be252f71f087 | R | 5,048 | 184 | #' @tags relaying
#' @tags sequential multisession multicore
library(future)
options(future.debug = FALSE)
message("*** Relaying of standard output and conditions ...")
strategies <- supportedStrategies()
for (ss in seq_along(strategies)) {
strategy <- strategies[[ss]]
message(sprintf("Relaying w/ %s ...", nam... |
d6108999b4c3387cf863e0f8401b9f9d629cd2361d791e594ca880f044e89517 | R | 5,049 | 186 |
setwd("D:\\UMCG\\Genetica\\Projects\\Depict2Pgs")
library(readr)
cedGwas <- as.data.frame(read_delim("cedGwas.txt", delim = "\t", quote = ""))
str(cedGwas)
cedGwas$logP <- -log10(cedGwas$pValue)
cedDsGenes <- read.delim("cedGenes.txt", quote = "", stringsAsFactors = F)
str(cedDsGenes)
cedDsGenes$GWAS.gene.P.valueL... |
91bd503e22fcf174546f9a5143d0e2bfe10715201a67270f8a66aaadb8ee9de9 | R | 5,058 | 150 | #' @export
#' @keywords internal
result <- function(future, ...) {
## Automatically update journal entries for Future object
if (inherits(future, "Future") &&
inherits(future[[".journal"]], "FutureJournal")) {
start <- Sys.time()
on.exit({
appendToFutureJournal(future,
event = "gather... |
74c51fc75b6eb6625a27df36dacba13ac1a476b507a96e64907844d2de2bb542 | R | 5,074 | 138 | ##########################################################################################
## Generate social Manhattan plot using Satterstrom 2020 data
##
## Author: Yu-Han Hsu
##########################################################################################
rm(list=ls())
library(ggplot2)
library(dplyr)
lib... |
78fdab55c60107e56111cacf963068895c82d2a0363b6116145ca5eed3baff8e | R | 5,078 | 133 | #' Call TADs from insulation scores
#'
#' Runs peak detection on the genome wide insulation scores to identify
#' insulation valleys that correspond well to TAD boundaries.
#'
#' @param IS_discovery A GENOVA \code{IS_discovery} object as created by
#' \code{insulation_score()}.
#' @param method A \code{character} vec... |
d8d94181cb022f13a73a8266d7eb68cae1eeaba5358278cfbb11c6d12c9627af | R | 5,080 | 123 | # This tests the classification *without* fine-tuning.
# (Tests with fine-tuning are handled by 'test-SingleR.R'.)
# library(testthat); library(SingleR); source("setup.R"); source("test-classify.R")
trained <- trainSingleR(training, training$label)
test_that("correlations are computed correctly by classifySingleR", {... |
53ff814c62424a09d70cdb9107aab6a3e1e1575cbc88876a9fc9664ccc00aa27 | R | 5,086 | 49 | setwd("D:\\UMCG\\Genetica\\Projects\\Depict2Pgs")
connectivity <- read.delim("./connectivity.txt")
str(connectivity)
gnomadDs <- read.delim("./max_coregulation_zscore_and_gnomad_metrics.tsv", stringsAsFactors = F)
str(gnomadDs)
connectivityGnomad <- merge(connectivity, gnomadDs, by.x = "X.", by.y = "gene")
str(con... |
f9c8d1b4b265f5c462272cda8342a89c3bb5458b93544d19f20c5f0f1db42e2b | R | 5,089 | 160 | .package <- new.env()
## covr: skip=all
#' @importFrom utils packageVersion
.onLoad <- function(libname, pkgname) {
.package[["version"]] <- packageVersion(pkgname)
.package[["futureCounter"]] <- 0L
if (isTRUE(as.logical(Sys.getenv("R_FUTURE_PRUNE_PKG_CODE", "FALSE")))) {
prune_pkg_code()
}
update_pack... |
9bbeedafa6c5621ee4199d0b6df97adbe01b20087050ecf25b1fc7b433127732 | R | 5,120 | 182 | knitr::opts_chunk$set(echo = TRUE)
knitr::knit_hooks$set(inline = function(x) {
prettyNum(x, big.mark=",")
})
library(configr)
library(tidyverse)
library(patchwork)
library(colorspace)
library(reshape)
library(jsonlite)
library(httr)
options(scipen=5) # See https://stackoverflow.com/a/30889190 and https://sta... |
3449deb57c406de89c6fa7e085e6446afeb28ec6d2bdbddad43dca154e815870 | R | 5,122 | 144 | # Combine annotation datasets
library(dplyr)
library(tidyr)
library(purrr)
library(janitor)
library(tibble)
library(glue)
library(stringr)
library(readr)
library(forcats)
# Snakemake
## Input
path <- list(
adgwas = "intermediate/adgwas_snps.csv",
other = "intermediate/other_loci.csv",
tags = "intermediate/adgw... |
418a385a6d2de9e676e32497ae9958a7814ec9ae72991276c0cb37f134ed3a5f | R | 5,135 | 133 | #' A MultisessionFutureBackend resolves futures in parallel using a PSOCK cluster on the current machine
#'
#' @inheritParams ClusterFutureBackend
#'
#' @details
#' The `MultisessionFutureBackend` backend is selected by
#' `plan(multisession, workers = workers)`.
#'
#' @seealso
#' For alternative future backends, see t... |
d776846a7ecae0a314c62676a3f9dd053ee89665bec0ac485c633def1827e7e7 | R | 5,158 | 196 | # Expnames methods --------------------------------------------------------
# This is basically needed for all the analysis function to have a consistent
# way to prevent naming inconsistencies between functions such as in Github
# issue #175 and #153
# Getters --------------------------------------------------------... |
2d2700813a190872ecfa07593f2436d2a5339afb1917901d70497ccd61a5d773 | R | 5,179 | 133 | ####################################################################################
#' Clustering cells
####################################################################################
#'
#' In RISC, two different methods are provided to cluster cells, all of them are
#' widely used in single cells. The first me... |
a0d7b761205b76399005f9276bfb88f6e4fe00c3f063144a4e12499d59ae6db7 | R | 5,228 | 154 | #' @tags utils-internal startup
#' @tags detritus-files
library(future)
sourceFutureStartupScript <- future:::sourceFutureStartupScript
## A private folder, so that we do not pick up a real ~/.future.R
path <- file.path(tempdir(), "test-sourceFutureStartupScript")
dir.create(path, recursive = TRUE, showWarnings = FA... |
0a1d6000d4f5451d3955372c170c2ff6e3f285eac483c51729d1fa6affb0b6c4 | R | 5,236 | 125 | # End-to-end testing of SingleR on a dummy training/test dataset that should be near-perfectly assigned.
# library(testthat); library(SingleR); source("setup.R"); source("test-SingleR.R")
test_that("SingleR works in DE mode", {
out <- SingleR(test=test, ref=training, labels=training$label, genes="de")
tab <- t... |
01c45274987966caa65f7dbb52205002278a1864ca27b9f2a5fa8c1e4c282dab | R | 5,281 | 152 |
setwd("D:\\UMCG\\Genetica\\Projects\\Depict2Pgs\\IBD_test")
library(readxl)
read.depict2 <- function(path, potential_traits=NULL) {
if (is.null(potential_traits)) {
potential_traits <- excel_sheets(path)
potential_traits <- potential_traits[grep("Overview", potential_traits, invert=T)]
}
output <- ... |
cab616f96f25b1e59a8bf8299d13008fe7cff58971ed6da2d96c596ecbe93ebd | R | 5,285 | 191 | library(nVennR)
library(tidyverse)
# lambert
78 + 353 + 68 + 117 + 66 + 462 + 171
sample_size <- read_csv("~/Dropbox/Research/PostDoc-MSSM/ADGenetics/resources/ad_sample_sizes.csv")
sample_size %>%
rowwise() %>%
mutate(wightman = sum(wightman_cases, wightman_controls, na.rm = T),
bellenguez = sum(bell... |
a62245215a05c6c0c999dd8f1da22ffe033ba877b4b4c62dda284396e8ef5879 | R | 5,346 | 172 | ---
title: "--"
author: "rbarreiro"
date: "--"
output:
html_document:
theme: journal
css: /Users/rbarreiro/my_lab/my-lab_folder/resources/rmark.css
---
```{r setup, include=FALSE}
suppressMessages({
library(tidyverse)
library(scales)
library(cowplot)
library(ggbeeswarm)
library(ggsci)
library(v... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.