sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
2d648e693c17dacfd196d819a1adf31168e5932f1b853ff154ad3eced105ba66 | R | 528 | 13 | # Converting rds data file from https://zenodo.org/record/1443566\#.YEExrpMzbDI to csv files
dataname <-'fibroblasts'
filename <-'fibroblast-reprogramming_treutlein'
fname <- # <path_to_file>
outdir <- # <path_to_output_dir>
readRDS(fname) -> data
write.csv(data$cell_info , file.path(outdir, paste(dataname,'_cell_in... |
0eea92496912758290822d7817c6887de8f47e0070da38e76812ce1d3b716bc9 | R | 529 | 50 | # employee selection data - Enders, 2010, p. 2018
employee <- data.frame(
IQ = c(
78,
84,
84,
85,
87,
91,
92,
94,
94,
96,
99,
105,
105,
106,
108,
112,
113,
115,
118,
134
),
wbeing = c(
13,
9,
10,
10,
NA,
3,
... |
91eb6038e53de667c9814bfbc4cac02e82206b450173a6635fd7aeb93f298389 | R | 551 | 28 | source(here::here("src/shared/R-helpers/memoise_decorator.R"))
suppressPackageStartupMessages({
requireNamespace("clusterProfiler")
})
gseGO_memoise <- function(cache_dirname, ...) {
.gseGO_robust <- function(...) {
args <- list(...)
geneList <- args$geneList
if (length(geneList) == 0) {
out <... |
b3689445eeb4b2eede4c395f70b52075511a338194bcb95974e9428933b1628f | R | 553 | 27 | source(here::here("src/shared/R-helpers/memoise_decorator.R"))
suppressPackageStartupMessages({
requireNamespace("clusterProfiler")
})
enrichGO_memoise <- function(cache_dirname, ...) {
.enrichGO_robust <- function(...) {
args <- list(...)
gene <- args$gene
if (length(gene) == 0) {
out <- NULL
... |
43358f7652a9ff1e01fed812b4956944da65bc62eb4a0dbe25e0315f8e9da641 | R | 560 | 12 | #' ggcor: Extended tools for correlation analysis and visualization
#'
#' @description The 'ggcor' package can be used to visualize simply and directly a
#' correlation matrix based on 'ggplot2'. It provides a solution for reordering the
#' correlation matrix, displaying the different significance level on the plot and... |
a08b8db65b0c674756e845945b48f0559019e2327b676f0a62fe756a22b21a10 | R | 560 | 27 | source(here::here("src/shared/R-helpers/memoise_decorator.R"))
suppressPackageStartupMessages({
requireNamespace("clusterProfiler")
})
gseKEGG_memoise <- function(cache_dirname, ...) {
.gseKEGG_robust <- function(...) {
args <- list(...)
geneList <- args$geneList
if (length(geneList) == 0) {
ou... |
23defc00e5bb298c4d351c4dde3fd1ef3c43ad32592aad92529e0935946b0e04 | R | 562 | 13 | ah <- suppressMessages(AnnotationHub::AnnotationHub())
test_that("Test all links", {
annotationURLs <- stringr::str_subset(genomes$annotation, "^http")
annotationAH <- stringr::str_subset(genomes$annotation, "^AH")
expect_true(all(RCurl::url.exists(annotationURLs)))
expect_true(all(annotationAH %in% na... |
6280eb2c7808bea438bb9e2287f151f605da869e359f3205c2914a748e7d215f | R | 562 | 13 | #' Scale radius
#' @inheritParams ggplot2::scale_size
#' @param midpoint the midpoint (in data value) of the diverging scale. Defaults to 0.
#' @rdname scale_radius
#'
#' @importFrom scales rescale_pal
#' @importFrom ggplot2 continuous_scale
#' @export
scale_radius_area <- function(..., range = c(-1, 1), midpoint = 0, ... |
28b50755ba9d4d797dcb87f4680efdcc358ed747742d1649fb02935689297f5f | R | 569 | 21 | #@Time : 2022/12/18 22:47
#@Author : Biao Zhang
#@Email : littlebiao@outlook.com
#@File : load_mouse_region_tree.r
#@Description: This file is used to ...
# Packages -------------------------------------------------------------------
suppressPackageStartupMessages(library(tidyverse))
suppressPackageStartupMessages(l... |
97628b3a7ceb24b552b158739bff62fd47c47f153ac15fa9d1c9407caa1b3a01 | R | 575 | 27 | #' All Parameters
#'
#' Simple vector with all parameter names, e.g. activeboutMean.
#'
#'
#' @format ## `activityPercentageTimeActivy, activityTotalPx, ...`
#' A vector of strings:
#' \describe{
#' \item{allparameters}{All parameters}
#' }
#' @source
"allparameters"
#####
#' All Unique Parameters
#'
#' Simple vect... |
050ca75740562931d229906b4af69db1793a21af66d03a1193960970d0d9a090 | R | 578 | 16 | test_that("MICE-IMPUTE-MPMM-001: mpmm() works for any column order in data", {
set.seed(1)
beta2 <- beta1 <- .5
x <- rnorm(1000)
e <- rnorm(1000, 0, 1)
y <- beta1 * x + beta2 * x^2 + e
# dat <- data.frame(x = x, x2 = x^2, y = y) # worked
dat <- data.frame(y = y, x = x, x2 = x^2) # did not work
m <- as.... |
20d00159ff4f88724757e930007ea3e971f3945632c367f33726f0d9ca313058 | R | 579 | 15 | #!/usr/bin/env Rscript
# multiple hypothesis testing for DTU
StageR_func <- function(pScreen, pConfirmation, tx2gene, pScreenAdjusted){
stageRObj <- stageRTx(pScreen = pScreen, pConfirmation = pConfirmation, tx2gene = tx2gene,
pScreenAdjusted = pScreenAdjusted)
stageRObj <- stageWiseAdjust... |
ca508d910487f76d5f0618d43ab00b9c698f2c1a9fe93a748e1f3e1516268699 | R | 594 | 26 | # contributed by Simon Grund, #137
check.deprecated <- function(...) {
# print warnings for deprecated argument names
nms <- names(list(...))
replace.args <- list(
imputationMethod = "method",
defaultImputationMethod = "defaultMethod",
form = "formulas"
)
wrn <- names(replace.args) %in% nms
if ... |
77ce7c4546083ae7bc5ab9dedf79c48e57546d5e60336d2abfabdae733cf4f2a | R | 600 | 21 | suppressPackageStartupMessages({
requireNamespace("digest")
})
memoise_decorator <- function(cache_dirname, cache_prefix, fun) {
cache_dirname <- force(cache_dirname)
cache_prefix <- force(cache_prefix)
dir.create(cache_dirname, showWarnings = FALSE, recursive = TRUE)
function(...) {
args <- list(...)
... |
a84f966963b8ab608b9333507c6f0e3c86ed0f6c4184db546e203b444cbb5d9f | R | 605 | 19 | # anticipation/expectation of improvement
fname=file.path("data","raw", "AntExp_n29.csv")
antexp<-read.table(fname, header=T, sep=";", as.is = T)[,1:9]
antexp[antexp=="na."]<-NA
antexp<-droplevels(antexp)
antexp <- within(antexp,{
AAntDirection=factor(AAntDirection);
AAntAmount=as.numeric(AAntAmount);
... |
b0addb9d216f9dfe2058dcbe2e8ac53bff969b5dd5dfc87fdd08e9c776e90c78 | R | 610 | 15 | test_that("MD-PATTERN-001: patterns run as expected", {
# boys
expect_silent(md.pattern(boys, plot = FALSE))
# nhanes
expect_silent(md.pattern(nhanes, plot = FALSE))
# one whole column missing (single pattern) - should not produce output
expect_silent(md.pattern(cbind(na.omit(nhanes), NA), plot = FALSE))
... |
b4a203eac0fd345b052d1bad6fcc1496980bc67ad46b0c67a3c97f28d5cfd4dc | R | 615 | 11 | library(Seurat)
DefaultAssay(seurat_obj)="RNA"
seurat_obj <- NormalizeData(seurat_obj, normalization.method = "LogNormalize", scale.factor = 10000)
seurat_obj <- FindVariableFeatures(seurat_obj, selection.method = "vst", nfeatures = 2000)
all.genes <- rownames(seurat_obj)
seurat_obj<- ScaleData(seurat_obj, features = a... |
312dd894eb69ffa6efa0fafc45d38e139fae89a94771acf49982535639e45d85 | R | 630 | 32 | library(minfi)
args<-commandArgs(trailingOnly=TRUE)
cohort = args[1]
savedir <- args[2]
ls.files <- list.files(cohort)
i <- 1
files <- c()
arrayTypes <- c()
for (file in ls.files){
if (grepl("idat", file, fixed=TRUE)){
print(i)
filename <- paste(cohort, file, sep="")
data <- read.metha... |
733dabf1823b68a91555f33d67612ca539d05f945459d23a7544aa49e8f86908 | R | 632 | 13 | # train_cls: vector of names/IDs of training cell lines
# exp_matrix: data.frame containing gene expression values, rownames are cell line IDs/names, columnnames are gene names
# returns: data.frame with single column containing variance of gene expression, ordered descendingly by magnitude, rownames are gene names
... |
ee195b8f23613ae485ee6745ce34d7489d30d88035cf8b13a11c0a8456ac089c | R | 632 | 17 | object <- buildCDS(factRsample)
object <- getAAsequence(object)
out <- .runDomainSearch(object@domains$sequence[1,])
out2 <- .runDomainSearch(object@domains$sequence[1,], db = "pfam")
test_that("Test getAAsequence output", {
expect_equal(nrow(object@domains$sequence), 50)
expect_true(stringr::str_detect(object... |
6c59dabbe61c5be64cbb9436d64c0f5b0b6e094c371173443d53e36f61d52f93 | R | 640 | 26 |
#####################################
###### ID conversion ######
ensembl2symbolFun <- function(ensemblID, info='symbol') {
geneInfo <- biotype[match(ensemblID, biotype$ensemblID),]
geneSymbol <- geneInfo$geneSymbol
if (info=='symbol') {
return (geneSymbol)
} else if (info=='all... |
0f618186ee79855be8d7fc782f43967639453465ad8a085efc3983139ea322f6 | R | 643 | 23 | library(DESeq2)
library(magrittr)
expression_results <- readRDS(snakemake@input[["expression_results"]])
expression_results$timepoint <- as.factor(expression_results$timepoint)
DESeq_results <-
DESeqDataSet(
expression_results,
design = ~ tissue + maternal_fetal + exposure + timepoint
)
filtered_gen... |
d74475188722e01ac30d2e4dbf8ae26e43d3be32f129761cbb35abdef6ed8d1c | R | 649 | 23 | export.factR <- function(object, con, data){
# check for data input
if(!data %in% c("gtf", "gene", "transcript", "AS")){
rlang::abort("`data` to output does not exists")
}
# check for con
if(is_dir(con)){
dir.create(con, showWarnings = FALSE) # create dir in case
if(data ==... |
9774dc623011ac01b8280853866995901dcf9a79420a3f22e21d57f23d669edb | R | 653 | 27 | ### Compile all limma results in a single table
library(tidyverse)
library(magrittr)
fold_change_summary_maternal <-
snakemake@input[["limma_results"]] %>%
setNames(object = ., nm = snakemake@params[["models"]]) %>%
map_dfr(.f = read_rds, .id = "tissue") %>%
mutate(
tissue = as.factor(tissue)
)
writ... |
e5f8e07cbd868cc04eb2442fd0d68959a8890266b9800c40aa035bf6921411b4 | R | 656 | 13 | #test random slopes
dv="asinh_ll"
res <- lmerTest::lmer(formula = paste0(dv, '~ age_base + age_change +
SBP_base + age_change:SBP_base + SBP_change + WHR_base + WHR_base:age_change + WHR_change +
sex + (1+age_change|id)'),
data=... |
5ca7816eba4f0ec18d88f2613eb2afb88ffd9f8b0165defcfaf3d299c4c160f8 | R | 662 | 27 | test_that("Test object inputs", {
out <- .smartimport(genomes, "")
expect_equal(out, genomes)
})
test_that("Test local inputs", {
out <- .smartimport(gtf, ".gtf")
expect_equal(length(out), 8117)
expect_equal(ncol(mcols(out)), 9)
})
test_that("Test FTP inputs", {
out <- .smartimport(genomes[1,]... |
e17620f440357b926cd1cee95da4d2941af6f08ba10917ae2d92f73333de8771 | R | 673 | 19 | dpath<-file.path('data', 'raw', 'transfer', 'N')
fnames<-list.files(dpath, pattern = "*.csv")
stim.new=c("A", "B", "C", "D", "E", "F")
transfer.N<-NULL
for(fname in fnames){
d<-read.table(file.path(dpath, fname), header=T, sep=",")
stim.old<-sort(levels(d$Symbol1))
d<-d %>%
select(Participant=participant,... |
281b932b951caf099b1e6a3b6c3944241e84fa9638e63cf37f97efec345dfe1c | R | 675 | 19 | dpath<-file.path('data', 'raw', 'transfer', 'A')
fnames<-list.files(dpath, pattern = "*.csv")
stim.new=c("A", "B", "C", "D", "E", "F")
transfer.A<-NULL
for(fname in fnames){
d<-read.table(file.path(dpath, fname), header=T, sep=",")
stim.old<-sort(levels(d$Symbol1))
d<-d %>%
select(Participant=participan... |
ac7ccf675cf689cb7d3f2baaed6b3cfdd97df8be1caec80bf42ed4b73829fb05 | R | 679 | 20 | dpath<-file.path('data', 'raw', 'transfer', 'B')
fnames<-list.files(dpath, pattern = "*.csv")
stim.new=c("A", "B", "C", "D", "E", "F")
transfer.B<-NULL
for(fname in fnames){
d<-read.table(file.path(dpath, fname), header=T, sep=",")
stim.old<-sort(levels(d$Symbol1))
d<-d %>%
select(Participant=partic... |
58011763deba928b1799cebd756cb33244a75b52dbe8a01d092f27c2c4798005 | R | 682 | 17 | library("GenomicDistributions")
library(tidyverse)
query = rtracklayer::import('/home/yyasumizu/nanoporemeth/results/230228/ref_1000bp_2000regions_0.4diff.bed')
# # First, calculate the distribution:
# x = calcChromBinsRef(query, "hg38")
gp = calcPartitionsRef(query, "hg38")
write.csv(gp, file = '/home/yyasumizu/nan... |
9c9da7fa899469895b382ea254f6c50999e6a200b7518d4da676c0754928e4e7 | R | 685 | 18 | # genes: vector of gene names to sample from
# folder: path to folder where results will be saved
set.seed(2208)
list_lengths = c(1:25, 50, 100, 200, 300, 400, 500) # number of genes in random lists
number_of_lists = 10 # number of random lists generated for each length
dir.create(folder)
for(list_length in... |
caaa7ff6e051a39eb62429312b1aa212a369b017ae1a41c7779ea586bc2454e7 | R | 693 | 12 | .onAttach <- function(libname, pkgname)
{
packageStartupMessage("\n********************************************************")
packageStartupMessage("Note: As of version 0.9.8, ggcor does not change the")
packageStartupMessage(" default ggplot2 continuous fill scale anymore. To")
packageStartupMessage(" recov... |
94f5ab94fbd76ac468e796dd6ec9f67be6e490cc33b6a108b281896ee692a5f4 | R | 700 | 15 | library(readr)
library(proBatch)
#load the data
raw_proteome_PanCancer = read_csv('data_PanCancer/2_interim_data/raw_transitome_PanCancer.csv')
raw_proteome_PanCancer = log_transform_df(raw_proteome_PanCancer,
log_base = 2, offset = 1)
normalized_transitome_PanCancer = quant... |
2bfcd755831f3eb08dc669b0288709aa758dc6f09734e1b571b7b584cc6cb60d | R | 704 | 12 | ###########################################################################
## Author: Youtao Lu <luyoutao@sas.upenn.edu>
##
## Copyright (c) 2021-2023, Youtao Lu and Junhyong Kim, Department of Biology, University of Pennsylvania
## Copyright (c) 2021-2023, James Eberwine, Perelman School of Medicine, University of ... |
c6db9fc8ccfc9ceb1d3e768d84d54b38d3ebbab86ba7405d25f24aabf084ab64 | R | 707 | 18 | data <- nhanes
test_that("FORMULAS-001: model.matrix() deletes incomplete cases", {
expect_identical(dim(model.matrix(~age, data)), c(25L, 2L))
expect_identical(dim(model.matrix(~chl, data)), c(15L, 2L))
expect_identical(dim(model.matrix(~ poly(age), data)), c(25L, 2L))
expect_error(
model.matrix(~ poly(ch... |
e22e979382ac8fa939828a90a4d096defb07c9342e15255b99cbaf9db7459555 | R | 716 | 17 | #target2gene.txtを作成
# 下記コマンドで対象種のDataset名を確認する
ensembl = biomaRt::useEnsembl(biomart="ensembl")
#biomaRt::listDatasets(ensembl)
# 遺伝子IDと遺伝子名の対応情報を取得
mart <- biomaRt::useMart(biomart = "ENSEMBL_MART_ENSEMBL", dataset = "hsapiens_gene_ensembl", host = 'ensembl.org')
t2g <- biomaRt::getBM(attributes = c("ensembl_transcr... |
68056b2f87001fb9642ebcfc4eaf3464ab61b1e49e8c8aa78a20cd2a513a0bd6 | R | 729 | 30 | data(nhanes)
imp <- mice::mice(
nhanes,
maxit = 2,
m = 2,
seed = 1,
print = FALSE,
use.matcher = TRUE
)
fit_mira <- with(imp, lm(chl ~ age + bmi))
fit_mipo <- mice::pool(fit_mira)
test_that("TIDIERS-001: glance.mipo: nhanes lm", {
tmp <- glance(fit_mipo)
expect_true(inherits(tmp, "data.frame"))
})
tes... |
ba6875dc982648ed4b2a90612faf0285463c7c3a5853945c86265f07fcae7af5 | R | 738 | 13 | ###########################################################################
## Author: Youtao Lu <luyoutao@sas.upenn.edu>
##
## Copyright (c) 2021-2023, Youtao Lu and Junhyong Kim, Department of Biology, University of Pennsylvania
## Copyright (c) 2021-2023, James Eberwine, Perelman School of Medicine, University of ... |
ec2d82ddb1a753587712f67b2475c926422fdfd4addf515af611768a2236c5c2 | R | 739 | 24 | .updatefactR <- function(object){
# perform sample check if colData was modifieed
if("old.names" %in% colnames(object@colData)){
old.n <- object@colData$old.names
new.n <- rownames(object@colData)
# correct counts data
for(i in listSets(object)){
if(!i %in% "AS"){
... |
dd72dd7e0bf1573446af6c3d39f4464e4ce2755db65c3ed7daba202a39e84f32 | R | 740 | 30 | ## http://stackoverflow.com/a/15373917/972791
this.file.name <- function() {
cmdArgs <- commandArgs(trailingOnly = FALSE)
needle <- "--file="
match <- grep(needle, cmdArgs)
if (length(match) > 0) {
# Rscript
return(normalizePath(sub(needle, "", cmdArgs[match])))
} else {
# 'source'd via R console
... |
8975af92da0df5645a8854afa11ed44f5ab0af8d5d5df09c1fe4b2d7869c7b8f | R | 742 | 25 | # This script writes the metadata generated by download_recount3.R to a tsv
library(dplyr)
library(tibble)
if (rstudioapi::isAvailable()) {
setwd(dirname(rstudioapi::getActiveDocumentContext()$path))
} else{
# If running as a script, finding the file is harder
# https://stackoverflow.com/a/55322344/10930590
t... |
c28c26e3ad7321929baa30145879b7d8457deb1435b1e856bbe31f91ef84576f | R | 743 | 28 | setwd("C:/Users/xieji/Desktop/bvn/224615")
fil=dir()
library(readxl)
data=NULL
for (i in 1:length(fil)) {
print(fil[i])
dat <- as.matrix(read_excel("C:/Users/xieji/Desktop/bvn/224615/GSE224615_DEGs.xlsx"))
print(dat)
rownames(dat)=dat[,1]
print(dat)
dat=as.matrix(dat[,-1])
data=cbind(data,dat... |
7953534809657d4ab29cbc4d54979a29d0c338cc8ac731700e1cc38ebd2ca6d5 | R | 746 | 25 | # Script to install necessary libraries for CLIPplotR
# A. M. Chakrabarti
packages <- c("optparse", "BiocManager", "ggplot2", "ggthemes", "cowplot", "smoother", "zoo", "data.table", "patchwork")
for(package in packages) {
if(!suppressPackageStartupMessages(require(package, character.only = TRUE, quietly = TRUE)))... |
002c792fb125d080e7dd14520d3ce74dc6ff4260b057b54ecf09e2f1802313e8 | R | 748 | 18 | library(data.table)
library(dplyr)
library(ggplot2)
#Adopted from a script Nicole Gay developed for checking RNA-SEQ qc reports.
# check qc report
sinai=read.table("bismark_qc_sinai.csv",sep=",",header=T)
core3 <- read.table("core3/rrbs_qc_metrics_core3.csv",sep=",",header=T)
sinai_qc <- melt(sinai, id.vars='vial_label... |
cac00755bbfcd30980ed175e337d860baafcd592a958acc58143d7886d09f8cf | R | 749 | 24 | source(here::here("src/shared/R-helpers/get_top_n_variance.R"))
suppressPackageStartupMessages({
requireNamespace("stats")
requireNamespace("broom")
requireNamespace("tidyr")
})
pca_fit <- function(matr, ntop = 500, cent = TRUE, scal = FALSE, scores_metadata = NULL) {
pca <- stats::prcomp(get_top_n_variance(... |
fdbc994a4aae5f3e10ab78cb9e261e428e7bf38afee72770306009be9f46ceb1 | R | 749 | 29 | args <- commandArgs(TRUE)
defaultW <- getOption("warn")
options(warn = -1)
suppressPackageStartupMessages({
library(tidyverse)
library(rtracklayer)
})
options(warn = defaultW)
gtf_file <- args[1]
input_genes <- args[2]
prefix <- args[3]
outpath <- args[4]
ids <- str_split(input_genes, ";") %>%... |
a869792b7219a94783d82d18b6518a87f65ae18bc16da45da398ca3878cb9383 | R | 753 | 24 | #' Supports semi-transparent foreground colors?
#'
#' This function is used by \code{mdc()} to find out whether the current device
#' supports semi-transparent foreground colors.
#'
#' The function calls the function \code{dev.capabilities()} from the package
#' \code{grDevices}. The function return \code{FALSE} if the... |
6d4fe5f2a6088deff9aaf1e46c092fb15082f4ecc468a525c4a4b6e5379061b7 | R | 757 | 21 | data <- boys[c(1:10, 101:110, 501:510, 601:620, 701:710), ]
type <- c(2, 0, 0, 0, -2, 0, 1, 1, 0)
names(type) <- names(data)
z1 <- mice.impute.jomoImpute(data = data, type = type, format = "native")
test_that("MICE-IMPUTE-JOMOIMPUTE-001: jomoImpute returns native class", {
expect_s3_class(z1, "mitml")
})
blocks <-... |
c5ec2309173da5bdebe912be05554255d9401067af453110920a2ea16bd4c8b0 | R | 757 | 23 | #' @rdname geom_ring
#' @export
geom_pie2 <- function(mapping = NULL, data = NULL,
stat = "identity", position = "identity",
...,
remain.fill = NA,
end.radius = 0.5,
steps = 0.1,
na.rm = F... |
e7336e3ed21490d8332b427d7cbb1717c42cffb6d2ffe33376700c627756dd80 | R | 760 | 26 | #' Number of imputations per block
#'
#' Calculates the number of cells within a block for which imputation
#' is requested.
#' @inheritParams mice
#' @return A numeric vector of length \code{length(blocks)} containing
#' the number of cells that need to be imputed within a block.
#' @seealso \code{\link{mice}}
#' @ex... |
539361f4a1f9e0f7995479aa4ac05a5d14506e4b1e557ca52d055918fb122238 | R | 764 | 28 | #@Time : 2023/7/23 11:09
#@Author : Biao Zhang
#@Email : littlebiao@outlook.com
#@File : genomic_functions.r
#@Description: This file is used to ...
#source('./genomic_functions.R', local = TRUE)
library(Seurat)
library(anndata)
library(sceasy)
# convert_scanpy_seurat
if_success <- convert_scanpy2seurat(adata_path, s... |
45b17f23bff4be683af6b640f253dd731a906463557109ceafe3454733d53847 | R | 773 | 15 | #!/usr/bin/env Rscript
cache_biomart <- file.path(getwd(), ".cache_biomaRt")
dir.create(cache_biomart, showWarnings = FALSE, recursive = TRUE)
Sys.setenv("BIOMART_CACHE" = cache_biomart)
library("biomaRt")
ensembl<- useMart("ensembl", dataset="mmusculus_gene_ensembl", host="nov2020.archive.ensembl.org")
#values<- c... |
0b69c58d20563288e68faa706c51bc0a75b37811b88c91f50d37a5b636407ffa | R | 774 | 16 | #!/usr/bin/env Rscript
cache_biomart <- file.path(getwd(), ".cache_biomaRt")
dir.create(cache_biomart, showWarnings = FALSE, recursive = TRUE)
Sys.setenv("BIOMART_CACHE" = cache_biomart)
library("biomaRt")
ensembl<- useMart("ensembl", dataset="hsapiens_gene_ensembl", host="nov2020.archive.ensembl.org")
#values<- c... |
65e496c81b9bfcf5ab6060f4ca5ae6b4a666fd9ad97b92d77986cad412dce368 | R | 776 | 22 | #! /usr/local/bin/Rscript
#'#################################################################################
#'#################################################################################
#' Output projects labels
#'#################################################################################
#'##############... |
981526e450eb288b3cd000a914ddabf2650d41c74b2952316cc1e98eda1e668b | R | 782 | 29 | sim_tree_dists <- function(t) {
if(!require("ape",character.only = TRUE, quietly = TRUE)) install.packages("ape")
tree <- ape::rtree(t,tip.label=1:t)
inv_dist <- tree_dist(tree)
return(inv_dist)
}
sim_tree <- function(t) {
if(!require("ape",character.only = TRUE, quietly = TRUE)) install.packages("ape")
... |
e03421ee9d14406a85cf2904c6add047e3dd8400a6401e151e2d5906b86adf8a | R | 783 | 19 | #!/usr/bin/env Rscript
cache_biomart <- file.path(getwd(), ".cache_biomaRt")
dir.create(cache_biomart, showWarnings = FALSE, recursive = TRUE)
Sys.setenv("BIOMART_CACHE" = cache_biomart)
library("biomaRt")
ensembl<- useMart("ensembl", dataset="mmusculus_gene_ensembl", host="nov2020.archive.ensembl.org")
ensembl_s... |
c983aeae9bfff2f27ae5e86532b710d8dde056f3e6a89c16be958782edfa585e | R | 784 | 19 | #!/usr/bin/env Rscript
cache_biomart <- file.path(getwd(), ".cache_biomaRt")
dir.create(cache_biomart, showWarnings = FALSE, recursive = TRUE)
Sys.setenv("BIOMART_CACHE" = cache_biomart)
library("biomaRt")
ensembl<- useMart("ensembl", dataset="hsapiens_gene_ensembl", host="nov2020.archive.ensembl.org")
ensembl_sy... |
19de4fc674d464fe93dce7a170d677f56bbe1f56c11afdc9b89f72c4b4427e6f | R | 786 | 29 | test_that("MICE-IMPUTE-PANIMPUTE-001: panImpute returns native class", {
data <- boys[c(1:10, 101:110, 501:510, 601:620, 701:710), ]
type <- c(2, 0, 0, 0, -2, 0, 1, 1, 0)
names(type) <- names(data)
z1 <- mice.impute.panImpute(data = data, type = type, format = "native")
expect_s3_class(z1, "mitml")
})
test... |
4598c0357c8f3bfa8d6ac5b06f7d3d2a42cfa476215732b681f45223011e6d80 | R | 787 | 36 | d <- brandsma[1:200, c("sch", "lpo")]
pred <- make.predictorMatrix(d)
pred["lpo", "sch"] <- -2
test_that("MICE-IMPUTE-2L-LMER-001: mice::mice.impute.2l.lmer() runs empty model", {
expect_silent(
imp <- mice(
d,
method = "2l.lmer",
print = FALSE,
pred = pred,
m = 1,
maxit = 1
... |
403cfca494ad0915a9cad845a060a73d5145f2240d6d95a8e02b15005c3a28a0 | R | 793 | 18 | library(readxl)
library(ggplot2)
#1. load excel or csv file containing n-NRF magnitudes "both_sites_magnitudes.csv"
both_sites_magnitudes <- read.csv("both_sites_magnitudes.csv")
#2. create df with only hypothesis 3 data for both sites selected
both_sites_magnitudes_hyp3 <- both_sites_magnitudes[both_sites_magnitudes... |
e75e86df8840807511eb59af78fe08beb8252ab8444d8d734361e554355f9a0c | R | 795 | 29 | ###############################################################
# R functions for plotting using the new version of deseq
# taken from the vignette
###############################################################
plotDispEsts <- function( cds , main = "")
{
plot(
rowMeans( counts( cds, normalized=TRUE ) ),
fitInfo(c... |
fcec956dbb50ef9a9461cff0abf2ceaf7b90b88dd2140aa87a5e6b9a69650ab8 | R | 795 | 40 | ###DTS script cleaning memory loading libraries
rm(list=ls()) #clean memory
gc() #collect garbage
if(!is.null(dev.list())) dev.off() #clear plots
#load libraries
library(ggplot2)
library(cowplot)
library(ggiraph)
library(tidyr)
library(dygraphs)
library(grid... |
573759662b22893129caef2fbf44d10ba1f8b2d9193013d057c21cf4a272b8e4 | R | 803 | 29 | source('~/scripts/single_cell/graphs.R')
source('~/scripts/single_cell/de.R')
source('~/scripts/perturbator/de.R')
library(Pando)
library(destiny)
library(Signac)
library(BSgenome.Hsapiens.UCSC.hg38)
setwd('~/projects/cutntag/')
data('motifs')
select <- dplyr::select
#### Read data ###
marks <- read_rds('data/all_... |
e323aa26b02796ac5f0c862f20f76547beb2b2dc5331af8190d2433e04f267c0 | R | 819 | 28 | #######################
# 14 July 2023
#######################
invnorm <- function (x) {
y = (rank(x,na.last="keep")-0.5)/sum(!is.na(x))
return (qnorm(y))
}
directory <- "path/to/your/directory"
files <- list.files(directory, pattern = "\\.txt$", full.names = TRUE)
out = NULL
for (i in 1:length(files) ) {
file = ... |
e51810780378b763717d25b2345ddbac4bed66c7a8a2dd154d4fe7654c420ff3 | R | 819 | 15 | #################
#reading in Brain In A Blender Cell Type database:
BrainInABlenderDatabase<-read.csv("BrainInABlenderDatabase_DateGenesFixed.csv", header=TRUE, stringsAsFactors = FALSE)
str(BrainInABlenderDatabase)
BrainInABlenderDatabase_Human<-BrainInABlenderDatabase[BrainInABlenderDatabase$Species=="Human",]
Bra... |
efbb2da48b38c37117b7ac049c5ce7afeb5a707083d65f14efb0fddfdc4db883 | R | 820 | 32 | #!/usr/bin/env Rscript
# Set CRAN mirror
options(repos = c(CRAN = "https://cloud.r-project.org"))
# Install BiocManager if not already installed
if (!requireNamespace("BiocManager", quietly = TRUE)) {
install.packages("BiocManager")
}
# Install CRAN packages
cran_packages <- c(
"dplyr", "tidyr", "RColorBrewer", ... |
e90b5370e127f782a3c52f1c0119baf0a3414235fa18717b5a8b37b477f79383 | R | 828 | 22 | #! /usr/local/bin/Rscript
#'#################################################################################
#'#################################################################################
#' Remove probes with methylation range < 0.1
#'##############################################################################... |
6c3ce43744e602b688edc9ef35f35ff54b8cb3885c6429f30e07801a79fc0d5f | R | 830 | 34 | #' Creates a \code{post} argument
#'
#' This helper function creates a valid \code{post} vector. The
#' \code{post} vector is an argument to the \code{mice} function that
#' specifies post-processing for a variable after each iteration of imputation.
#' @inheritParams mice
#' @return Character vector of \code{ncol(data... |
7fe346860f83cd798c69a1282e44ec27e4d2c8aa429adfe62b27abc037054ade | R | 834 | 22 | #' Add panel grid line on correlation plot
#' @description \code{geom_grid} is mainly used with \code{ggcor} or \code{quickcor}
#' function to add a panel grid line on plot region.
#' @param colour,color colour of grid lines.
#' @param size size of grid lines.
#' @importFrom ggplot2 geom_segment aes_string
#' @rdna... |
c6728b3efde282a7255ef5eea8e0d761d3e09abb6b1d4230b9987c95df9de599 | R | 836 | 21 | library(MSstats)
library(readr)
library(dplyr)
library(proBatch)
#load the data
raw_transitome_unlogged = read_csv('data_PanCancer/2_interim_data/raw_transitome_PanCancer.csv')
##========Protein quantification=============
start.time = Sys.time()
raw_data_proBatch_MSstats = dataProcess(raw_transitome_unlogged,
... |
452ca0268b44ae379b38dcbab9490a4da89aa68e0480e74a40bac4cd559e471e | R | 837 | 23 | library(readxl)
library(boot)
#1. load excel or csv file containing n-NRF magnitudes "both_sites_magnitudes.csv"
both_sites_magnitudes <- read.csv("both_sites_magnitudes.csv")
#2. create dataframe for Exeter magnitudes separately
exeter_magnitudes <- both_sites_magnitudes[both_sites_magnitudes$Site == "Exeter", ]
#3... |
a3fbd831164a8226af0b48ef2a696b976607829329d0e826bd59e35a1088419d | R | 837 | 34 | ---
title: "dependencies"
author: "Jelena Chuklina"
date: "1/30/2020"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Dependencies in the project:
For Aging Mice data
```{r R3.6}
install.packages(c('dplyr','readr','tidyr','stringi','reshape2', 'ggplot2',
... |
e79f98ac2f088f01175c6392fa019f222befe912e04dfb26bd3de63daab5d946 | R | 837 | 35 | if("MASS" %in% loadedNamespaces()){
select <- dplyr::select
}
install.common.packages <- function(){
needed_pkgs=c('mvtnorm', 'ggplot2', 'dplyr', 'effects', 'pwr', 'arm', 'psych', 'car', "QuantPsyc",
"rjags", "reshape2", "tidyr", 'mvtnorm', 'truncnorm', 'Rcpp', 'ProjectTemplate')
# Install CRAN ... |
4f4186dc435bb4907eadf9a08a160750ae48429b144522873a9f0a0ac3a2bd2b | R | 842 | 23 | #! /usr/local/bin/Rscript
#'#################################################################################
#'#################################################################################
#' Select autosomic probes
#'#################################################################################
#'#############... |
771df56ca23fdcae30f5311bc58cbe701b0df81c25072b1a010e5b6b945a3209 | R | 844 | 27 | ---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# GBA1 and GBAP1 manuscript
This repository contains the code used ... |
7fc3627718786916c3a2d83e8de12cbb5517033038251dd1ae553365b69eb8b6 | R | 846 | 22 | #'#################################################################################
#'#################################################################################
# Download TCGA gene expression data
#'#################################################################################
#'#############################... |
9334ab3543a08a419bf93641e8f5e073770be1bf72d150e8ab6f497ea58e99a7 | R | 847 | 29 | # Wald confidence interval of robustlmm::rlmer beta coefficients
# Adapted from code provided Ben Bolker on StackExchange: https://stats.stackexchange.com/questions/233800/how-can-i-get-confidence-intervals-for-fixed-effects-using-the-rlmer-function-r
confint.rlmerMod <- function(object, level = 0.95) {
# Extrac... |
db7e7e8bc27af7161b9c51bba7e8e0acfb709c8665d4a7ffb20a507a885c5aba | R | 853 | 16 | ## Visel et al., Nucleic Acids Research (2007)
## Download VISTA database from https://enhancer.lbl.gov/frnt_page_n.shtml
library(tidyverse)
d0 = read.delim('~/Dropbox/Resources/VISTA/Human.pos.brain.VISTA', header = F)
d0$POS = do.call(rbind.data.frame, strsplit(x = d0$V1, split = '|', fixed = T))[[2]]
d0$CHR = do.c... |
49e572ff6dc2378300c91386879a98f4e3b7dcb96640a9820a7972d76be79cfc | R | 862 | 20 | # prepare the images data into one folder with table of locaiton information
rm(list=ls())
options(warn=1)
options(stringsAsFactors=FALSE)
options(digits=15)
require(stringr)
require(magrittr)
require(fs)
paredir="/work/aelab/AMF/AMF Imaging/0_Image_Collection/ZEISS Primo Star/Georgia/2021/Experiment002_Greenhouse_14_A... |
2e4937681bcd2825d6e0e9b8963d3450fd425fd7977f77e3d38ebe4d7ff8bc89 | R | 875 | 21 | #' Add diagnoal labels on correlation plot
#' @description \code{geom_diag_label} is mainly used with \code{ggcor} and
#' \code{quickcor} functions to add diagnoal labels on correct position
#' base on different type of cor_tbl object.
#' @param geom one of "text", "label" or "image".
#' @param remove.axis if T... |
fbe924b3653a0833971cb40149e34058033d787f8c037e734071235c4afe6dea | R | 878 | 26 | #' NHANES example - all variables numerical
#'
#' A small data set with non-monotone missing values.
#'
#' A small data set with all numerical variables. The data set \code{nhanes2} is
#' the same data set, but with \code{age} and \code{hyp} treated as factors.
#'
#' @name nhanes
#' @docType data
#' @format A data fram... |
41df147dc71a02088b20910362bf1eddb00eabe2b6931acc542eb902aef9d28e | R | 885 | 26 | #' Hox pupil popularity data with missing popularity scores
#'
#' Hox pupil popularity data with some missing popularity scores
#'
#' The original, complete dataset was generated by Joop Hox as an example of
#' well-behaved multilevel data set. The distributed data contains missing data
#' in pupil popularity.
#'
#' @n... |
036896bff4da1f309675ac3f931155a713ed38f9ebfbad2727b4d03a9b7d9f68 | R | 886 | 24 | #ID for user's trait of interest. (Can be any string)
trait = "T2D"
#path to the input files
traitFilePath = "/project/voight_GWAS/wbone/CHD_T2D_2020_bivariate_scan/T2D_Vujkovic_et_al_dbSNP150_onlySNPs_data.txt"
#column IDs from trait file
trait_A1col = "EA"
trait_A2col = "NEA"
trait_SNPcol = "name"
trait_CHRcol = "CHR... |
b48bf10827a642bbf075553d29847b19a16c0d2e5f118152ebc57dcae9b952ff | R | 886 | 15 | ############################################################################################
# Copyright (c) 2022 - Mucosal Immunology Lab, Monash University, Melbourne, Australia #
# Author: Matthew Macowan #
# This script is provided under the MIT l... |
ffa3bc2a5297439eae17efc6f858a48f886084f8ae87eca3a5240423bb57785c | R | 888 | 59 | #----define classes----
setClass(
Class = 'Node',
slots = list(
name = 'character',
spmax = 'numeric',
spdeg = 'numeric',
inedges = 'character',
outedges = 'character',
logiceqn = 'character'
)
)
setClass(
Class = 'NodeRNA',
contains = 'Node',
slots = list(
tau = 'numeric'
)
)... |
dec8ae8c6330b44b42912ffbd7d91741226976fec91ff289536d4c65974e55d7 | R | 890 | 32 | ---
title: "Supplementary Information for: Digestive, vascular and nervous systems of a Cambrian euarthropod larva"
author: 'Martin R. Smith\*, Emma J. Long\*, Alavya Dhungana, Katherine J. Dobson, Jie Yang, Xiguang Zhang'
output:
bookdown::word_document2:
reference_docx: "../TreeSearch/Character_report_t... |
0d6cb4420cd9dcb543f3e3bf4053384c0f7207ff0ab6562f40d6429787fe0bb6 | R | 893 | 28 | data <- matrix(
c(
1.0, 10.5, 1.5, 13.2, 1.8, 8.0, 1.7, 15.0, 23.0, 40.0,
2.0, 21.0, 3.3, 38.0, 4.5, -2.3, NA, -2.4
),
nrow = 9, ncol = 2, byrow = TRUE
)
df <- data.frame(data)
par <- list(
y = df$X1,
ry = !is.na(df$X1),
x = df[, "X2", drop = FALSE]
)
test_that("MICE-IMPUTE-RF-001: runs with a sing... |
7da4db70505124ce0f691462a97808c2e9011771caa78a7308f815c5f7a7daa5 | R | 903 | 16 | # train_cls: vector of names/IDs of training cell lines
# test_cls: vector of names/IDs of test cell lines
# exp_matrix: data.frame containing gene expression values, rownames are cell line names/IDs, columnnames are gene names
# returns: data.frames containing first 500 principal components for training/test cell l... |
7b1b942e21ed395445ed5facd1a8635a1023a3ba5c3a4c43dd4d31e9ef48cdb1 | R | 913 | 27 | #' NHANES example - mixed numerical and discrete variables
#'
#' A small data set with non-monotone missing values.
#'
#' A small data set with missing data and mixed numerical and discrete
#' variables. The data set \code{nhanes} is the same data set, but with all data
#' treated as numerical.
#'
#' @name nhanes2
#' @... |
02b9a9dc950de1dd029a3cf9dbe7386e39fe4dccaaa95dc448bf560d669d3259 | R | 917 | 26 | #! /usr/local/bin/Rscript
#'#################################################################################
#'#################################################################################
#' Output projects labels
#'#################################################################################
#'##############... |
ca93c10b5307ddf73d84851a59b62f9a3c7cdcd6c980f27ec21a3bd806d56dc2 | R | 917 | 24 | ---
title: "R Notebook"
output: html_notebook
---
The [R plugin](https://www.jetbrains.com/help/pycharm/r-plugin-support.html) for IntelliJ-based IDEs provides
handy capabilities to work with the [R Markdown](https://www.jetbrains.com/help/pycharm/r-markdown.html) files.
To [add](https://www.jetbrains.com/help/pycharm... |
18d588da5c1e34c420c4b3a868b546cb57142486bdc1786f44b8f4311415720a | R | 926 | 23 | library(MSstats)
library(readr)
library(dplyr)
library(proBatch)
corrected_transitome_proBatch = read_csv('data_PanCancer/2_interim_data/batchCorrected_transitome_PanCancer.csv')
start.time = Sys.time()
corrected_transitome_unlogged = corrected_transitome_proBatch %>% unlog_df()
corrected_data_proBatch_MSstats = data... |
cade492a519bf9790cd5a37d2441f44450f47ce7dffaaacb16cfcdc3eb9169a4 | R | 927 | 28 | ReadSS <- function(ssFile) {
results <- read.table(ssFile, header = TRUE, skip = 6)
runs <- grepl("^run\\d+$", colnames(results))
colSums(results[runs])
}
arthML <- ReadSS("../MrBayes/ss-Arthropoda-mbank_X27231_2024-03-22-1117.nex.ss")
tactML <- ReadSS("../MrBayes/ss-Tactopoda-mbank_X27231_2024-03-22-1117... |
0ed7bd6f6f0fec75958f288b24063ed11d1c30fb2133991907535f3b11f9c5d3 | R | 934 | 20 | library(MSstats)
library(readr)
library(dplyr)
library(proBatch)
normalized_transitome_PanCancer = read_csv('data_PanCancer/2_interim_data/normalized_transitome_PanCancer.csv')
start.time = Sys.time()
normalized_transitome_unlogged = normalized_transitome_PanCancer %>% unlog_df()
normalized_data_proBatch_MSstats = d... |
9dddd6c592ba5cea13c14c47a2b2e918e1394edc0919bb3e12f10948fdfd600b | R | 934 | 20 | #This code takes the qtlType_coloc_results_all_summary file generated by summarize_qtl_results.sh and generate a file where each lead SNP-Gene-Tissue result has a single row with PP3, PP4, and PP4/(PP3 + PP4)
library(tidyverse)
#use args to get the summary file name
args = commandArgs(TRUE)
all_summary_coloc_results_... |
33b5da1384d5cc8c492525d0776cde389c9b4e03e78e7dcf3501b0cf05f45d49 | R | 935 | 25 | #! /usr/local/bin/Rscript
#'#################################################################################
#'#################################################################################
#' Remove probes with methylation range < 0.1
#'##############################################################################... |
c43ce9692f8b869c448780dbf1864feab917c54818410423598e13013f455700 | R | 940 | 35 | library(dplyr)
library(ggplot2)
if(!exists("argv")) argv <- commandArgs(trailingOnly = T)
argc <- length(argv)
div <- read.table(argv[1])
lap <- read.table(argv[2])
ort <- read.table(argv[3])
div$metric <- as.factor("divergence")
lap$metric <- as.factor("laplacian")
ort$metric <- as.factor("orthogonality")
dat <- b... |
0244fdb92d833fbe2584e01815b0ca2f257350ac3e8600809b1e3ddcf4807b92 | R | 942 | 15 | library(readr)
library(proBatch)
normalized_transitome_PanCancer = read_csv('data_PanCancer/2_interim_data/normalized_transitome_PanCancer.csv')
sample_annotation_PanCancer = read_csv('data_PanCancer/3_data_for_plots/sample_annotation_PanCancer.csv')
corrected_transitome_proBatch = center_feature_batch_means_df(norma... |
5f103408f14d95010f0f75bd497dab13901942c076e625c3811aa8e7f06194ca | R | 942 | 29 | ---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
[](https://zenodo.org... |
b5a9324615d75c3f9f53b40f06a94cf878e766cc9abcd36577d8e14b69fd5b54 | R | 948 | 27 | data("factRsample")
test_that("Test head/tail", {
expect_equal(factR2::head(factRsample), utils::head(factRsample@custom))
expect_equal(factR2::tail(factRsample), utils::tail(factRsample@custom))
})
test_that("Test View", {
expect_error(view(factRsample, "WRONGENE"))
expect_warning(view(factRsample, "... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.