sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
205d5ac7b0a6624b99c81d1877c87085f76dd174d58ad45a27d8fc1f56a8acb4 | R | 10,978 | 217 |
marker_dir = file.path(getwd(), "../../data/cluster_annotation/")
argvs = commandArgs(trailingOnly=TRUE)
GSE = argv[1]
data_dir = file.path(argv[2], GSE)
meta_dir = file.path(getwd(), "../../data/metadata/", GSE)
if (!file.exists(data_dir)){
dir.create(data_dir)
}
if (GSE == 'GSE111586') {
a <- read.table(pas... |
e0bbd60761aba11e8b166df698c941bed2000cfafc4d47b256ff7887897f3a1d | R | 11,023 | 259 | dat_loci_power <- ad_loci %>%
left_join(adgwas, by = "study") %>%
filter(!str_detect(SNP, "APOE")) %>%
filter(study != "Jonsson") %>%
mutate( # TOFIX
OR = ifelse(SNP == "rs139643391", exp(-0.0619), OR),
gnomad_maf = ifelse(SNP == "rs149080927", 0.3829, gnomad_maf),
dir = ifelse(OR > 1, "risk", "pr... |
178051aba4eee993b66bb8ac17a03752b0f823ba0099e50101200661d9842d55 | R | 11,102 | 352 | #' Tools for Working with Parallel Random Seeds
#'
#' @param seed A random seed
#'
#' @param kind A character string or NULL. If kind is a character string,
#' set \R's RNG to the kind desired. Use `"default"` to return to the \R
#' default.
#'
#' @return
#' `get_random_seed()` returns the _current_ `.Random.seed`. If... |
09c112b0ceec4e24c8b343239b16b6978a9e58061533bac5f9402033680946dc | R | 11,126 | 288 | createHTML <-
function(output_file_name, segmentation, pval_threshold, loss_threshold,
gain_threshold, loh_percentage, loh_threshold, baf, n_samples,
n_probes, chromosomes, beta, min_region_bp_size,
bs, getGenes, correction){
## This function generates the html file reporting the list
## (with t... |
1a8f5054c313f91eaa0ca262ee9d7e76c973cff6a614660d92863e5e150d881d | R | 11,141 | 317 | #srun --cpus-per-task=1 --mem=50gb --nodes=1 --qos=priority --time=168:00:00 --pty bash -i
#remoter::server(verbose = T, port = 55556, password = "laberkak", sync = T)
remoter::client("localhost", port = 55556)#55556 55507
library(havok)
setwd("/groups/umcg-fg/tmp02/projects/genenetwork/recount3/")
load(file =... |
092af44ae83757e4141213bcf5e906d3c265cc33bcfe6c9551eea3f76566ea6f | R | 11,159 | 192 | ---
title: "Sankey plot of clustered bulk and neuronal intersection colPBond_STsep_LTsep"
output:
pdf_document: default
html_notebook: default
---
This is an [R Markdown](http://rmarkdown.rstudio.com) Notebook. When you execute code within the notebook, the results appear beneath the code.
load librarie... |
bc6e0a384b178373ba515ddd6ae258b88d316e780a7744af882f3ff58fb4d74b | R | 11,277 | 222 | ---
title: "WGCNA trait-module analysis for TRAP"
output: html_notebook
---
This is an [R Markdown](http://rmarkdown.rstudio.com) Notebook. When you execute code within the notebook, the results appear beneath the code.
#load libraries
```{r}
library(tidyverse)
library(WGCNA)
library(readxl)
library(beep... |
1f362daefb61120ac2d05038c237c277b708feae7f4e18be608d5b5e4a1ac1a1 | R | 11,312 | 327 | #!/usr/bin/env Rscript
# Clear workspace
rm(list = ls())
# Save original parameters
op <- par()
############################################################################
# Sample description
############################################################################
# Read phenotypic data
info <- read.csv("https... |
4000f51078ad3e78ee82c41047094f2f97b676f59cd1544762d1002c1248d3fb | R | 11,332 | 206 | .sumstats_main <- function(X, utilfuncs, filename, trait.name, N, keep.indel, OLS, beta, info.filter, linprob,
se.logit, name.beta, name.se, ref, ref2, file=NULL, log.file=NULL,direct.filter) {
if (!is.null(file)) {
file <- data.frame(file)
} else{
file <- data.frame(read.table(fi... |
a0fe9a9d02bea3f365be7f5e21fcd9b13321bd0dd73fda497fa2af9bf9ac5ab0 | R | 11,369 | 266 | library(readxl)
library(tidyverse)
library(reshape2)
library(plyr)
library(DescTools)
library(abind)
library(xlsx)
setwd("/Users/philippehabets/Dropbox/Git/fMRI-transcriptomics-cortisol/data")
###define functions#####################################################################################################
####... |
b01edb62f25c2355f4ee88dd2b2bf8c2e7cf2b3048b279a2f7c9f0fed6686d12 | R | 11,391 | 351 |
resize.mat <- function(mat, ndim = dim(mat)) {
# input object
odim <- dim(mat)
obj <- list(x = 1:odim[1], y = 1:odim[2], z = mat)
# output object
ans <- matrix(NA, nrow = ndim[1], ncol = ndim[2])
ndim <- dim(ans)
# rescaling
ncord <- as.matrix(expand.grid(seq_len(ndim[1]), seq_len(ndim[2])))
loc <- n... |
427d63a42817397635421082b462ad5bed67f2f9deac796d68d74488b8b022a6 | R | 11,519 | 430 | #============================#
# 1.Analyses: Module & Hub #
#============================#
## Set up ----
filepath <- ""
setwd(filepath)
### Load libraries ----
library(dplyr)
library(magrittr)
library(mice)
### Read in data ----
# Metabolite & outcome imputed data
dat <- readRDS("dat/ins_met_nodementia.Rdata")
#... |
87ea412a41949c4620a21f3caf4ab56f4cb225c2f2ead0aa6bcd96c3d09be63b | R | 11,557 | 274 | # This tests the trainSingleR function.
# library(testthat); library(SingleR); source("setup.R"); source("test-train.R")
test_that("trainSingleR works correctly for genes='de'", {
out <- trainSingleR(training, training$label)
expect_identical(out$ref, logcounts(training))
expect_identical(out$labels$full,... |
ed16e5c0a3ebc1922069f8d5c87082b8752001230ac3c2d2781c4be416fb296c | R | 11,564 | 307 |
#remoter::server(verbose = T, port = 55001, sync = T)
remoter::client("localhost", port = 55001)#55501 55556
setwd("/groups/umcg-fg/tmp02/projects/downstreamer/")
traits <- read.delim("traits.txt", header = T)
str(traits)
geneInfo <- read.delim("/groups/umcg-fg/tmp02/projects/downstreamer/depict2_bundle/referenc... |
e60898b710a07b0c6c829f8f12120c8f0e9afe3ffb7dd3c0c87eceab8ebe4ad2 | R | 11,569 | 394 | # R version:RStudio
# 2022.02.1 Build 461
# © 2009-2022 RStudio, PBC
## packages needed:
library(tidyverse); theme_set(theme_bw())
library(brms)
library(kableExtra)
library(patchwork)
library(readr)
library(dplyr)
library(ggplot2)
# install.packages("rlang")
# library(rlang)
options(knitr.kable.NA = '')... |
95220a75a10eb67344aa85ed7e398cacd4244aa337dd89191753c9d05081a08e | R | 11,614 | 279 | ##########################################################################################
## compare IP-MS results from ANK2-WT vs ANK2-KO (giant ANK2 KO; or ANK2-MUT)
## neural progenitor cells
##
## Author: Yu-Han Hsu
##########################################################################################
rm(list... |
bc4985cfdcfec01bb9356a454076bcc2bc357412578611b999ba85765bd6a8d3 | R | 11,620 | 348 | # User facing -------------------------------------------------------------
#' Repeated Hi-C matrix lookup
#'
#' Analyses like aggregrate peak analysis (APA) and paired-end spatial chromatin
#' analysis (PE-SCAn) require to look up regions of a Hi-C matrix repeatedly.
#' This function acts as a common method for the l... |
aa95ba41fc6410ce2fea11edd5c158a2b86916737a6cb9b3ad5470eeb43ae33d | R | 11,653 | 355 |
#' removeSyntheticBaseline Removes a synthetic baseline from a tumour pure matrix
#'
#' @param count_mtx count matrix
#' @param par_cores number of cores for parallel computing.
#'
#' @return relative matrix
#'
#' @examples
#'
removeSyntheticBaseline <- function(count_mtx, par_cores = 20){
d <- parallelDist::... |
97bec055edfd786ab209fb79a6c2f5faec67d7314e189eeb41a4350ee3b0e332 | R | 11,688 | 247 | #!/usr/bin/env Rscript
################################################
################################################
## REQUIREMENTS ##
################################################
################################################
## PCA, HEATMAP AND SCATTERPLOTS FOR SAMPLES IN CO... |
ef98d65bd07c21f0b174063ef7fa822bb721d33ebcdec9e85c2c31347862ad5d | R | 11,761 | 370 | options(stringsAsFactors = F)
virtualEnv = "/home/kp/Downloads/environments/my_env/"
library(SpatialPack)
library(imager)
shouldTrain = F
trainDescPath = "./data/train_aug_cl.tsv"
valDescPath = "./data/val_aug_cl.tsv"
testDescPath = "./data/test_aug_cl.tsv"
trainDesc = read.csv(trainDescPath, sep = "\t", header = T)
... |
98b48a324533e7d702e545f14b4a0bf4b40348284a8e5b532cdbfdaa181f6f53 | R | 11,829 | 280 | #analyse the proliferation rates induced by the different TRNP1 orthologues in vitro (mouse E14 neural stem cells)
#load libraries
libs<-c("tidyverse", "broom","multcomp","ape", "readr","geiger","nlme","phytools","xtable","rr2")
sapply(libs, require, character.only=T)
setwd("/data/share/htp/TRNP1/paper_data")
###... |
325078a96618c2bbae67519bfdcb408796e7c9e8b76f8413646aec3f8f94db75 | R | 11,834 | 314 | ## --------------------------------------------------------------------------------------------------------------------------------------------------------------
library(splines) # bs in est_trend
library(MASS) # mvrnorm
library(e1071) # kurtosis
color_phi <- c("#000000", "#fd68ad", "#95db3a", "#257cd1", "#491ebd... |
0dd0b1bcd0cb215e7d7744404a17c1529dc494c3fd2717d62d943dea165cab34 | R | 11,913 | 238 | library(RISC)
library(irlba)
library(umap)
library(ggplot2)
library(RColorBrewer)
library(biomaRt)
###################################################################################
### Prepare Data ###
###################################################################################
PATH = "/Path to the data/GSE8... |
118bc79cf6a037cdcd30ad35ef5c525e4761ac275dc420bc712bcd2f83d5c5f3 | R | 11,927 | 412 | create_formula <- function(vars) {
fml = Reduce(function(x, y) paste(x, y, sep = " + "), vars)
fml = paste("~", fml)
fml = as.formula(fml)
return(fml)
}
make_design_mat <- function(design, data = NULL){
if (is(design, "formula")) {
if(is.null(data))
stop("'data' is missing.")
design_mat... |
007a8140ed962bf4408e1e40ee91db1bd3fbc9896344560916f34320021c2334 | R | 11,951 | 276 | commonfactorGWAS <-function(covstruc=NULL,SNPs=NULL,estimation="DWLS",cores=NULL,toler=FALSE,SNPSE=FALSE,parallel=TRUE,
GC="standard",MPI=FALSE,TWAS=FALSE,smooth_check=FALSE){
# Set toler to machine precision to enable passing this to solve() directly
if (!toler) toler <- .Machine$double... |
65a9f89e089f3ff4f4d9f4308203473edf8eb04fa564436b2454be3b943f937a | R | 12,045 | 224 | ---
title: "RRHO to compare short- and long-term separation"
output: html_notebook
---
This is an [R Markdown](http://rmarkdown.rstudio.com) Notebook. When you execute code within the notebook, the results appear beneath the code.
load libraries
```{r}
library(tidyverse)
library(ggplot2)
library(GGally)
... |
4e9337bbd687d8fbabc640a784f14ed7d889775d5ca6d6df2ec34ea3fec02d25 | R | 12,052 | 220 | library(tidyr)
library(dplyr)
library(reshape2)
source("utils_Florian.R")
behaviours <- c("rest", "forward_walking", "antennal_grooming", "eye_grooming", "foreleg_grooming", "hindleg_grooming", "abdominal_grooming", "PER_event")
n_repetitions <- 5
base_folder <- paste(root_dir, "Ascending_neuron_screen_analysis_pipeli... |
d071e289a31fd6fcdacf30bbc1e04997591fbeb990a7e5c17affd723a57de5da | R | 12,104 | 364 | library(galamm)
library(tidyverse)
theme_set(theme_bw())
theme_update(panel.grid = element_blank())
library(gamm4)
dat <- readRDS("data/ses_model/dat.rds")
# Go on analyzing the model with lowest AIC
cases <- sort(
str_extract(list.files("results/ses_model/", pattern = "case_[a-z]+\\.rds"),
"(?<=case... |
b8c58ed021a7ca9f1ff83b3b485b2304136f3e959382642fea61ae73fb257b05 | R | 12,111 | 425 |
#' @title
#' Relative Contact Probabilities
#'
#' @description
#' Produce a dataframe with the probabilities of contacts in a set of distance-bins.
#' Bins are created on a log scale, which leads to equal amounts of datapoints per bin.
#'
#' @author Robin H. van der Weide, \email{r.vd.weide@nki.nl}
#' @param explist L... |
60b4615f972be73a0d45f34b68a4cdbb063015ac2e0c49b6ee396444b1f5bbd3 | R | 12,113 | 255 | #' Combine SingleR results with recomputation
#'
#' Combine results from multiple runs of \code{\link{classifySingleR}} (usually against different references) into a single \link[S4Vectors]{DataFrame}.
#' This involves recomputing the scores so that they are comparable across references.
#'
#' @param results A list of ... |
4ab268d4c4ad7f5aa12bb1e2b8b3427186c474a1231239eb8b348da52ba8c4fa | R | 12,141 | 287 | ####################################################################################
#' Import single cell data
####################################################################################
#'
#' The single cell RNA-seq (scRNA-seq) data can be imported in three different ways.
#' Primarily, we could import from... |
22c91c31f516a6167b9834dfba1b522750b6e1638811e9df5f8ec9aeab3aa96e | R | 12,181 | 248 | #!/usr/bin/Rscript
library(optparse)
library(ggplot2)
library(data.table)
library(reshape2)
library(grid)
library(gtable)
library(ggpubr)
library('scales')
option_list = list(
make_option(c("-e", "--eqtlGenReplication"), type="character",
help="File containing the replication of MetaBrain in eQTLgen a... |
3b43574496eb6f550c054c1acd2cc6238fb2070ae75a9e7a70f9352058d43d67 | R | 12,183 | 314 | ##########################################################################################
## BrainSpan expression profiles for various ASD gene sets
##
## Author: Kalliopi Tsafou, Yu-Han Hsu
##########################################################################################
rm(list=ls())
library(dplyr)
librar... |
402661d1c952a191393dc6eda62d72ccd9bff2623a2563c30b016bc90b83499f | R | 12,203 | 335 |
library(readr)
#change X1 in case of specified header for row names. Use ...1 if first colun has no ID
colTypes <- cols( .default = col_double(), `...1` = col_character())
table_tmp <- read_delim("/groups/umcg-bios/tmp01/users/umcg-pdeelen/tp53genotypes_LL.txt.dosages.txt", delim = "\t", quote = "", col_types = col... |
0fd86930e237e6904e71c3eb393d0faa81ebca3372dd33fb72316f5fbb861d26 | R | 12,209 | 306 |
# save figures
save_pdf <- function(x){
paste0("Figure/",x,"_",Sys.Date(),".pdf")
}
# calculate entropy in each cell
f.entropy <- function( m.in ){
m.in <- apply( m.in, 2, function( x ){ x / sum(x, na.rm=T ); } );
v.entropy <- apply( m.in, 2, function(x){ y <- unname(x); y <- y[ y > 0 ]; sum( -y * log(y) ); }... |
be78c99203544d3a2504f8d9f8fc233ec63305385679aa227a438aadd2f85bfd | R | 12,210 | 456 | #' Function for setting up GAM terms
#'
#' This function is derived from \code{mgcv:::gam.setup}.
#'
#' @param formula Formula including smooth terms, but not \code{lme4} style
#' random effect terms.
#' @param pterms Parametric terms.
#' @param mf Model data.
#'
#' @return A list containing all the data necessary to f... |
19a39e6da41d93f962837aeee7ab9ac4141929995a58288bca328bf35ebf9b46 | R | 12,212 | 309 | #' Title
#'
#' @param input.df
#' @param trait.names
#' @param run_ldsc
#' @param run_MR
#' @param saveRFiles
#' @param hm3
#' @param ld
#'
#' @importFrom stats fft filter qnorm runif sd
#' @importFrom utils write.csv write.table
#' @importFrom dplyr slice rename select
#' @return
#' @keywords internal
# NOT EXPORTED @... |
61942a07da57f1859c652b722df8c14bc1ffc1e3d68d74f5db293e5477794b04 | R | 12,361 | 293 | ---
title: "Rainclouds for SC Contribution - HCPEP"
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, include=FALSE}
k... |
951a21d30e2731fb32b707be7f9b8de75d43f59817b5b63cfb1e9480057b2308 | R | 12,426 | 297 | # Based on the code Jags-Ymet-Xmet-Mrobust.R accompanying the book:
# Kruschke, J. K. (2015). Doing Bayesian Data Analysis, Second Edition:
# A Tutorial with R, JAGS, and Stan. Academic Press / Elsevier.
#
# Adapted for use with the OH family of tasks
#
# 8 December, 2021
source("./DBDA2E-utilities.R")
#==========... |
c9593d06cc6445b5c517afa9eca0f06376e5a7257da583d20ce58a0b12f33b4b | R | 12,439 | 295 | #====================#
# Figure 3 #
#====================#
## Set up ----
filepath <- ""
setwd(filepath)
### Load libraries ----
library(cowplot)
library(dplyr)
library(ggh4x)
library(ggplot2)
library(grid)
library(ggtext)
library(magrittr)
library(openxlsx)
library(purrr)
library(tidyr)
### Read in files ... |
e3487ec7b57b1af418119d1f9359a5034d629b11660e5c6c7e7f72a0a2e41736 | R | 12,479 | 326 | #helper functions for MPRA analysis
#LOAD ALL THE PACKAGES
`%ni%`<-Negate('%in%')
#wrapping up PGLS output summary (for predicting EQ or GI using region activities)
wrap_summary_table<-function(model_output){
repl_summary<-summary(model_output)
repl_summary_table<-as.data.frame(repl_summary$tTable) %>%
rowna... |
91f3e6bc3b769b1d1aab3c70e691374f9a8498a81c9171c542fd027f01f3d570 | R | 12,492 | 253 | library(Rmisc)
library(tidyverse)
library(grid)
library(gridExtra)
library(RColorBrewer)
calcmetrics <- function(a, datatype, givenlabel) {
##metrics calculated according to definitions at https://en.wikipedia.org/wiki/Precision_and_recall
pdiscarded <- sum(a %>% filter(knownlabel == givenlabel & predictedlabel =... |
402645ca6c3ea8fa9f88eab80769c8b4c3d5ad12b1b0dd0e9d30f391eba50b14 | R | 12,499 | 378 | #!/usr/bin/env Rscript
#' Run a 'testme' Test Script
#'
#' R usage:
#' testme("<name>")
#'
#' Command-line usage:
#' tests/test-<name>.R
#'
#' Command-line usage without package re-install:
#' inst/testme/run.R --name=<test_name>
#' inst/testme/run.R <test-name.R>
#'
#' Options:
#' --package=<pkg> The name of the ... |
6736602fbc916e640d19bb5896d86150b5eb587a74106589f29220cf17c6b4e3 | R | 12,555 | 332 |
load('data/S2grid.rda')
load('data/xy_bd_chull_M.rda')
load('data/xy_com.rda')
load('data/LC4_grid_N.rda')
load('data/stim_poly.rda')
load('data/stim_LC4_ol.rda')
darc <- pi/180*1
# Anatomically predicted receptive fields (Fig.3h) ---------------------------------------
bd_grid <- S2grid
# guidelines
bkgd_eq <- Mo... |
26be2b99889c4a71eca0fb92620d4339359112aa9275e7d5025be5ea32745428 | R | 12,575 | 342 | #' Amplicon haplotype inference
#'
#' Haplotype inference for amplicons.
#'
#' @param seq_tbl (Required). The haplotype sequence table includes sample_id, marker_id, sequence (haplotype sequence), count (haplotype read counts), status (haplotype status), sample, info.
#' @param marker_info (Required). The target amplic... |
ad6237906a89d27e5ff5e587bf8a255a6ae4564bece44db19d351af114477435 | R | 12,580 | 279 | ---
title: "07_PRS.Brain"
output:
html_document:
df_print: paged
---
## Install packages #
```{r}
rm(list = ls())
options(stringsAsFactors = FALSE)
library(tidyverse)
library(lme4)
library(lmerTest)
library(ggseg)
library(sjPlot)
library(interactions)
```
## Load data #
```{r}
## Load data
load("ABCD.Release.3... |
39016842dfebc12779958639d3778ce4fd1d950ee82bbd85ce1bea77fb640cdd | R | 12,613 | 406 | format_int <- function(x, min_width = 1L, na_str = NA_character_) {
stopifnot(rlang::is_integerish(x))
width <- max(min_width, 1 + floor(log10(max(x, na.rm = T))))
stringr::str_pad(x, pad = "0", side = "left", width = width) %>%
tidyr::replace_na(na_str)
}
#' @importFrom rlang abort
#' @importFrom purrr ma... |
da86c2c0a3d91a9d562b170ae63cf0c1ba5494699a196742fd54f3c1e981a33e | R | 12,642 | 371 | my.drop1.mlm <- function (object, scope = NULL,
test = c("Wilks", "Pillai", "Hotelling-Lawley", "Roy"),
total=TRUE, add=FALSE, ...)
{
## add=TRUE do add instead of drop1
Pillai <- function(eig, q, df.res) {
test <- sum(eig/(1 + eig))
p <- length(eig)
s <- ... |
5f2d06063f28a30c6ed40801b96c73c6302840210df7f29e014273e8258e4dba | R | 12,645 | 347 | ## -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
source("0_SharedCode.R")
stopifnot(SharedCode_version == c(11,0))
## -------------------------------------------... |
8c05ace294ede82a67005da44733fa8dbdca7c9fd3599c404d10a974d768c666 | R | 12,711 | 149 | # add description of columns in dataframe
get_column_info <- function(phenotype_data){
#number_NA <- na_count(phenotype_data)
# Add info on what each of the columns mean, and check that there is info included for all columns in the output file
add_info <- function(df, colname, description, coltype, encoding=''){
... |
32e00c34b85be49f54bf5d0e8b1c60911904897bb684dc990b51946e3b4259f0 | R | 12,719 | 275 | library(readxl)
library(readr)
library(tidyverse)
library(org.Hs.eg.db)
library(EnsDb.Hsapiens.v86)
library(reshape2)
library(plyr)
library(DescTools)
library(abind)
setwd("/Users/philippehabets/Dropbox/Git/fMRI-transcriptomics-cortisol/data")
#check if any of the DEG is in selectively expressed marker genes from Hod... |
c52251a11afa183742c2315c506295d1f849fb17e80ceed69919ae21de913771 | R | 12,748 | 153 | #' Title - Read the columns from the summary statistics files and edit them as required
#'
#' @param input.files - list of data frames, where each data frame contains the summary statistics of a trait to use
#' @param trait.names - vector containing the trait names in the order they're found in 'input files'
#' @retur... |
c5f2f1f06bc1141f6514cb31e7c4b5e6d9bb7c80f4c13974b850e77638e03aaf | R | 12,830 | 432 |
#' @export
#' @importFrom rlang is_scalar_integerish is_scalar_character
#' @importFrom dplyr mutate filter left_join select add_count inner_join
#' @importFrom magrittr "%>%"
#' @importFrom Biostrings DNAStringSet
#' @importFrom purrr map2 map_dbl
#' @importFrom tidyr chop
call_vars <- function(seq_tbl, marker_info) ... |
7ee69f5b7fdea2f31cca42456525b9124a60b50f5facd105c54d40559666e4c2 | R | 12,860 | 460 | #' Internal function for fitting GAMMs using lme4
#'
#' This function is derived from an internal function in the \code{gamm4}
#' package.
#'
#' @param formula A formula excluding lme4 style random effects but including
#' smooths.
#' @param pterms Parametric terms in the model.
#' @param mf Model frame.
#'
#' @retur... |
0281ae493c0083199427a09abccbb7765d2de7302181bfc05f22d27a56aca13b | R | 12,910 | 253 | library("optparse")
library(ggplot2)
library(ggpubr)
library(gridExtra)
library(matrixStats)
library(plyr)
library(data.table)
library(stringr)
# Get command line arguments
option_list = list(
make_option(c("-c", "--cisQTLs"), type="character",
help="eQTLProbesFDR0.05-ProbeLevel.txt.gz of cis-eQTLs", m... |
500348501ba6d3d57b4599103e67da8b0cdbfc9f41b1defff6ba4cb8e34c90bc | R | 12,999 | 267 | ---
title: "TRAP GO analysis"
output: html_notebook
---
This is an [R Markdown](http://rmarkdown.rstudio.com) Notebook. When you execute code within the notebook, the results appear beneath the code.
Table of contents
1. DESeq with only TRAP samples
i. looking at Inputs vs Pulldown
ii. OS4I vs SS4I P... |
df35e1d23aa0ba26c002c610d3fcc224a4bb1376d0b7ba901adf5e22bbc38ca2 | R | 13,001 | 258 | ### Coexpression analysis workflow using the WGCNA package. The WGCNA package has a tutorial itself, which also includes some
### preparatory steps to check for sample outliers etc. As these are very specific to the input data, we have not included them
### as part of the workflow here but instead assume these have b... |
4841dd9176b6cb94ce67b112d229db2e322c0e505b7c4b28b8c802656cdb8c97 | R | 13,114 | 263 | #' SCEVAN: R package that automatically classifies the cells in the scRNA data by segregating non-malignant cells of tumor microenviroment from the malignant cells. It also infers the copy number profile of malignant cells, identifies subclonal structures and analyses the specific and shared alterations of each subpopu... |
c9cefc602f05d93c8a5eebb449464861b81b99ef652b4372a9de789054ece711 | R | 13,153 | 256 | ---
title: "08_PRSxGREx.Brain"
output:
html_document:
df_print: paged
---
## Install packages #
```{r}
rm(list = ls())
options(stringsAsFactors = FALSE)
library(tidyverse)
library(lme4)
library(lmerTest)
library(ggseg)
library(sjPlot)
library(interactions)
```
## Load data #
```{r}
## Load data
load("/Users/le... |
dbf2ed9d706f097fb0d927c1cacfbdf9f777b01deb22dca92df5dc2d224c31ae | R | 13,199 | 390 | #' Configure a backend that controls how and where futures are evaluated
#'
#' @description
#' _This functionality is only for developers who wish to implement their
#' own future backend. End-users and package developers use futureverse,
#' does not need to know about these functions._
#'
#' If you are looking for av... |
5ca4d83445f620995aef87d0a96502042aac057593550fe5a5a4c14ca8f6233c | R | 13,266 | 369 | library(Seurat)
library(rdist)
#functions
DE.list<-function(data,meta) {
genes = c()
for (t in unique(meta$time)) {
condition=as.factor(meta$time==t)
design = model.matrix(~0+condition) # Create a design matrix containing time information
... |
fee45c70c4a97d381bbe517c2dd8fa01f166071f626e0d12eb2a4675962ee5cc | R | 13,285 | 322 | ```{r}
if (basename(getwd()) == "downstreamer_main") {setwd("coregulation_calculations")} else {setwd("../coregulation_calculations")}
source("../downstreamer_functions.r")
library(GenomicRanges)
library(matrixStats)
gene.pvalues <- read.genep(list.files("../data/final_paper/gene_pvalues/", full.names=T), trim.... |
cb1e74ff4a8e31b6400031ef2d69b2cecddb37adbc4c0c3756c95b857239dffb | R | 13,361 | 236 | # Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
#' Evaluate the deviance at given values of random effects
#'
#'
#' @param parlist An object of class \code{parameters<T>} containing the
#' parameters at which to evaluate the marginal log-l... |
a03eb34de74d79d786ac6db1837e5a16c09f2b534abbc659b76102d23701ada7 | R | 13,387 | 380 | setwd("/Users/hastingj/Work/Python/semantic-prediction/regression")
if (!require('xlsx',quietly = T)) install.packages('xlsx'); library('xlsx')
if (!require('tidyverse',quietly = T)) install.packages('tidyverse'); library(tidyverse)
if (!require('lme4',quietly=T)) install.packages('lme4') ; library(lme4)
if (!require... |
08ff63e467e0d5e5a5079ae7436c46f3ac65656851f5c4aef4a45c597af67d28 | R | 13,403 | 314 | ```{r}
if (basename(getwd()) == "downstreamer_main") {setwd("evaluating_coregulation")} else {setwd("../evaluating_coregulation")}
source("../downstreamer_functions.r")
source("data/source_olivier.r")
library(ggsignif)
library(ggbeeswarm)
# Read reference datasets
ensembl <- read.table(ensembl.file, sep="\t", header=... |
e79d1057ed0cbe8c8aeac2f971ee630c8e13a90a00f199e07f351e73d84bf8bc | R | 13,418 | 228 | #!/bin/env Rscript
#
# Author: Alex Eng
# Date: 1/18/2018
###############################################################################
suppressPackageStartupMessages(library(argparse))
# Defining arguments and parser for command line arguments
parser = ArgumentParser(description = "Generate perturbed taxonmic and... |
993bd63621cbe2624e817769b4ba1352e90fe0f7826dfb403fa9a8f94eed3f93 | R | 13,532 | 404 | #read signature data
sig.genes <- read.table('~/HumanNetv3/BC_signaturegenes_33union.csv', header = T, sep = ',')
sig.genes$X <- NULL
rownames(sig.genes) <- sig.genes$gene
sig.genes$gene <- NULL
bc.sig.list <- list()
for (i in seq_along(colnames(sig.genes))){
sig.name <- colnames(sig.genes)[i]
gene.list <- sig.gen... |
7d4281d430814e044135ec4749fbd53805bda7a90193e78449c25ff01181e6aa | R | 13,583 | 161 | ---
title: "Selection analyses and cancer driver discovery using dNdScv"
author: "Inigo Martincorena"
output:
html_document:
toc: true
toc_float: true
---
The **dNdScv** R package is a suite of maximum-likelihood dN/dS methods designed to quantify selection in cancer and somatic evolution (Martincorena *et ... |
215037357a52cdcc92f81a553755d6a33d91a15ef85ae163bc5e752374820579 | R | 13,683 | 297 | .userGWAS_main <- function(i, cores, k, n, I_LD, V_LD, S_LD, std.lv, varSNPSE2, order, SNPs2, beta_SNP, SE_SNP,
varSNP, GC, coords, smooth_check, TWAS, printwarn, toler, estimation, sub, Model1,
df, npar, utilfuncs=NULL, basemodel=NULL, returnlavmodel=FALSE) {
#... |
eb02aac601e6a36cf573e925d9c1917346a051f044d6417d86d1c254a1e80a67 | R | 13,684 | 414 | #' Extract names of factor among column names
#'
#' @srrstats {G1.4a} Internal function documented.
#'
#' @param ff Character vector with names of candidate factors.
#' @param cnmf Column name, a single character.
#'
#' @return A character vector containing names of the factors which could be
#' found among the column ... |
72102d6b42f1aca1f39f75de4653f9369cdf84a5517871ac40f8502071ec15af | R | 13,695 | 338 | # MPRA data analysis by Zane Kliesmete
#load libraries
libs<-c("rBLAST","tidyverse","cowplot","GenomicRanges","data.table","reshape2", "broom", "ape", "ggtree", "readr","geiger","nlme","phytools","grid","gtable","xtable","rr2","Biostrings")
sapply(libs, require, character.only=T)
################
# LOAD DATA ####
#... |
16735de556e8100397a301413a882af5b64dcb0a2b2fbf152c9285752f9a4209 | R | 13,733 | 439 | #' @srrstats {G5.4} These tests compare the output of galamm() to output from
#' gamm4(), whenever gamm4() supports the type of model.
#' @noRd
NULL
testthat::skip_if_not_installed("gamm4")
test_that("galamm reproduces gamm4", {
dat <- subset(cognition, domain == 1 & item == "11" & id < 50)
mod <- galamm(formu... |
3969a3e0ef6cd356206a77a83f2f5a580b33f174e515588229b2a8fd26ef423c | R | 13,736 | 384 | #' Simulate boolean networks
#'
#' Simulation of networks with Inhibition Dominant ("ID") or Majority Rule ("MR") until point attractor is reached
#'
#' @param el Edge List
#' @param bool_data Booleanized data
#' @param rule "ID" (default) or "MR"
#' @return Final point attractor
#' @family simulation
#' @author Andras... |
370f32e6e2c52690ae879aa3311e7edf60ddb31e904cd19d486ee3c55bd5a91d | R | 13,758 | 618 | ### LM AVERAGE R2: 0.31
##Rep1
APred<-LM$pred
APred<-filter(APred, Resample=="Fold01.Rep1")
m<-mean(APred$obs)
APred<-mutate(APred,metric1=(pred - obs) ^ 2, metric2= (obs-m)^2)
s1<-sum(APred$metric1)
s2<-sum(APred$metric2)
ss<-s1/s2
R2=1-s1/s2
R2
APred<-LM$pred
APred<-filter(APred, Resample=="Fold0... |
cf64a971101f60d5b4777759ce4b87a79f48d5b87edc82b004732efb0cec7186 | R | 13,758 | 292 | # This script contains TRNP1 protein-coding orthologue search by Zane Kliesmete
setwd("/data/share/htp/TRNP1/paper_data/")
libs <- c("IRanges", "Biostrings", "tidyverse", "reshape2", "reshape", "GenomicRanges", "data.table", "phangorn", "ape", "ggrepel", "ggtree", "caper", "phytools", "rBLAST", "stringr","xtable", "g... |
8836431e3f9c559154e322c9e5cd87a9cd1010d77637698d387ab2d6e02a8278 | R | 13,777 | 430 |
.preprocess_marker_labels <- function(annotations, feature_set) {
if (is.matrix(markers) || is.sparseMatrix(markers)) {
common_features = sort(unique(intersect(feature_set, rownames(annotations))))
row_idx = match(common_features, rownames(annotations))
X = annotations[row_idx, ]
rownames(X) = common_featu... |
2c6dce67835984e2e83f24f1ec96f72eed88b3c9accc6fbc0770be6966efa047 | R | 13,820 | 394 | #!/usr/bin/env Rscript
# Clear workspace
rm(list = ls())
# Save original parameters
op <- par()
############################################################################
# Sample description
############################################################################
# Read phenotypic data
info <- read.csv("https... |
83847b23dac40315c470997e5b740bc2d1bd85fb99ad582e9486df45711c9c3c | R | 13,924 | 362 | #srun --cpus-per-task=5 --mem=100gb --nodes=1 --qos=priority --time=48:00:00 --pty bash -i
#remoter::server(verbose = T, port = 55556, sync = T)
remoter::client("localhost", port = 55502)#55501 55556
library("havok")
library(parallel)
setwd("/groups/umcg-fg/tmp01/projects/genenetwork/recount3/")
#load(file = "p... |
506211a37260dc1c17cd014703edb3e0d40b2daa0c3d19859991e0f798ed4a8b | R | 13,929 | 380 | # Main --------------------------------------------------------------------
#' Compartment score
#'
#' \code{compartment_score} calculates a compartment score per chromosome arm.
#'
#' @param explist Either a single GENOVA \code{contacts} object or list of
#' GENOVA \code{contacts}.
#' @param ev An \code{integer} of... |
c3416b2fae46d83cb201387fab7b902b4f4e61510678d06b0f559e07d763ab2d | R | 13,946 | 415 | #srun --cpus-per-task=1 --mem=200gb --nodes=1 --qos=priority --time=168:00:00 --pty bash -i
#remoter::server(verbose = T, port = 55556, password = "laberkak", sync = T)
remoter::client("localhost", port = 55501, password = "laberkak")
setwd("/groups/umcg-fg/tmp01/projects/genenetwork/recount3/")
#save.image(file=... |
e2a619d36b9b73995527c9b3b01b7acf5ce5ee2af0ff0ade9eb3475871f690c1 | R | 13,977 | 269 | source("utils_Florian.R")
# behaviours <- c("rest", "walking", "antennal_grooming", "eye_grooming", "foreleg_grooming", "hindleg_grooming", "abdominal_grooming", "PER_event", "pushing", "CO2")
behaviours <- c("rest", "forward_walking", "backward_walking", "antennal_grooming", "eye_grooming", "foreleg_grooming", "h... |
bc84af0715a94946d689c07f05bb46f5f5b12670e1a85fa357afe844c62d57c9 | R | 13,981 | 378 | #get bar graph of within connectivity of ICm geneset for each celltype network
library(ggpubr)
#read ICI gene list
ici.l <- readRDS('~/public_Data/ICI/immune_checkpoints_ligand.rds')
ici.r <- readRDS('~/public_Data/ICI/immune_checkpoints_receptor.rds')
ici.all <- unique(c(ici.r, ici.l)) #40
#read celltype specific ... |
145af5cfd71ee7a78de84b232d61a705435572d9f9528c7210e2024c458ebee9 | R | 13,989 | 294 | #!/usr/bin/env Rscript
################################################
################################################
## REQUIREMENTS ##
################################################
################################################
## DIFFERENTIAL ANALYSIS, SCATTERPLOTS AND PCA FOR... |
e996a9ff28006867a21820a1386c459796f15590024bd314ba38d46a2f9bd558 | R | 13,996 | 452 | ---
title: "Permutation testing for dFC Metrics - META HCPEP"
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, inc... |
ed505914a11946935dc778189a16af5f19b535ade158078d79d28cce39bd2778 | R | 14,012 | 457 | ---
title: "Permutation testing for dFC Metrics -without subjects with high FD COBRE"
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_documen... |
742908a4cfa6049a7f0a7301ef0d15f7a9974033bf7d0b5075e45da1159aac51 | R | 14,027 | 419 | #' Match bed-like entries to Hi-C bin indices
#'
#' @param IDX The IDX-slot of a \code{contacts} object
#' @param bed A 3-column data.frame
#' @param mode A \code{character} of length 1 indicating what position of the
#' \code{bed} argument to match with the indices. Possible values:
#' \code{"center"}, \code{"star... |
322563ae2afeb19075c420c96345340992e486fa2b8cc4db3488b74fe39171cb | R | 14,030 | 246 | #10014 genes included, probes based on RNAseq correlation with rho >= 0.2 and signal threshold >= 0.5
#normalizing left hemisphere samples (n=1285)
#within-sample normalization is done before additional between-donor correction.
#between-donor normalization is done using the Limma batch correction function, followed by... |
350027971c8219eaffec1223a167a025afefb71a38c725ca027cde0a1fb054c9 | R | 14,058 | 271 | source("utils_Florian.R")
# behaviours <- c("rest", "walking", "antennal_grooming", "eye_grooming", "foreleg_grooming", "hindleg_grooming", "abdominal_grooming", "PER_event", "pushing", "CO2")
behaviours <- c("rest", "forward_walking", "backward_walking", "antennal_grooming", "eye_grooming", "foreleg_grooming", "h... |
0e6c19b75346c50bac2233c38749084815415a9f624f37d3bb8be733cd0cf1cb | R | 14,072 | 269 | source("utils_Florian.R")
# behaviours <- c("rest", "walking", "antennal_grooming", "eye_grooming", "foreleg_grooming", "hindleg_grooming", "abdominal_grooming", "PER_event", "pushing", "CO2")
behaviours <- c("rest", "forward_walking", "backward_walking", "antennal_grooming", "eye_grooming", "foreleg_grooming", "h... |
9b9d2779efc6374654fed0b70c4690fbb4ce6718c7752d91b38a1b4cca162f2e | R | 14,072 | 269 | source("utils_Florian.R")
# behaviours <- c("rest", "walking", "antennal_grooming", "eye_grooming", "foreleg_grooming", "hindleg_grooming", "abdominal_grooming", "PER_event", "pushing", "CO2")
behaviours <- c("rest", "forward_walking", "backward_walking", "antennal_grooming", "eye_grooming", "foreleg_grooming", "h... |
49198c3413573d4714ac27c189212c34aeb0228204ed66229600d1e8ef93c2d4 | R | 14,079 | 465 | ---
title: "Permutation testing for dFC Metrics -without subjects with high FD COBRE"
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_documen... |
69720ec0073d52b9eeae7cbd6f2998c02aba92764ec5c1db9857e855b2a7cf32 | R | 14,126 | 459 | ---
title: "Permutation testing for dFC Metrics -META without subjects with high FD COBRE"
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_do... |
05a967831a4bbbc0341af7ebe021dd33cc285dae81b522fe622e0d861e1c6915 | R | 14,128 | 317 | ---
title: "AmpSeqR Introduction"
author: Jiru Han, Jacob E. Munro, Melanie Bahlo
output: github_document
---
## `AmpSeqR`: an R package for amplicon deep sequencing studies
**AmpseqR** is an R package for analysis of amplicon deep sequencing (AmpSeq) data generated on the Illumina platform. The pipeline offers vario... |
cceb49cd0907cbbee79dc3a870d3784271fc836eb9485cef6de20d67a0bdb55d | R | 14,147 | 393 | #' Construct a contacts-object.
#'
#' Make an object which holds the most needed information of a HiC-experiment at a given resolution.
#'
#' @param signal_path Full path to an Hi-C file. This could be \*.matrix (for HiCpro), \*.cooler or \*.hic (for juicer).
#' @param indices_path Full path the HiC-pro-like index-file... |
3b113cb2b22e7209396c821ccb2d34e26260d852c11ef17388841e3f3b8bbab5 | R | 14,237 | 332 | userGWAS <- function(covstruc=NULL, SNPs=NULL, estimation="DWLS", model="", printwarn=TRUE,
sub=FALSE,cores=NULL, toler=FALSE, SNPSE=FALSE, parallel=TRUE, GC="standard", MPI=FALSE,
smooth_check=FALSE, TWAS=FALSE, std.lv=FALSE){
# Set toler to machine precision to enable passi... |
e8c1117471a3a5ed56d42d55a6bf097ccb6cc857ec286a263dc4baa5b23cd68e | R | 14,244 | 409 | get_ICC31_decomp <- function(x) {
# x is measurements by subjects by variables
# Get data dimensions.
d <- dim(x)
if (length(d) == 2) { x <- array(x, dim=c(dim(x), 1)); d <- dim(x) }
stopifnot(length(d) == 3)
nM <- d[1]
nS <- d[2]
sub_mean <- colMeans(x, na.rm=TRUE)
visit_mean <- apply(x, c(1,3), mea... |
e11e98f16ba70de56a66901af360dd6a66c01445562feb7346e1248ad15d68d8 | R | 14,285 | 355 | #' dada_filter
#'
#' Translate dada2::filterAndTrim to AmpSeqR::dada_filter. Filter the poor-quality reads and trim low-quality bases.
#'
#' @param read_table (Required). The demultiplexed read table includes: sample_id, marker_id, reads_1 (the forward read fastq file path), reads_2 (the reverse read fastq file path), ... |
0b49fcbc6c275ef11fc1e18aed725706b8f48709bfcbc9be3fa1d7df595b7a39 | R | 14,392 | 397 | #' Create a qualitative color legend.
qual_cleg <- function(labels, colors, ncol, title=NULL, bgcol="#ffffff") {
scale_color <- setNames(as.list(colors), labels)
df_cleg <- unique(data.frame(value=1, label=labels, stringsAsFactors=FALSE))
plt <- ggplot(data = df_cleg, aes(x=value, y=value, color=labels)) +
... |
84577094a5aa101e78fdff91d8e2f220ed0eb20995d881c31edd4f08c542014b | R | 14,440 | 258 | ###load packages
library(CellChat)
library(Seurat)
Idents(rh.combined)<-"celltype"
HFD1M<-subset(rh.combined,Group=="HFD1M")
Ctrl1M<-subset(rh.combined,Group=="Ctrl1M")
HFD3M<-subset(rh.combined,Group=="HFD3M")
Ctrl3M<-subset(rh.combined,Group=="Ctrl3M")
#####
### Ctrl1M
data.input <- GetAssayData(Ctrl1M, assay = "RNA"... |
6fe99b32370bcc6c192048a08675fe6847af4364200f612b4722ec023d82857e | R | 14,468 | 274 | #' SCEVAN: R package that automatically classifies the cells in the scRNA data by segregating non-malignant cells of tumor microenviroment from the malignant cells. It also infers the copy number profile of malignant cells, identifies subclonal structures and analyses the specific and shared alterations of each subpopu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.