sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
69b8b05c469910316a52ded853d69a561002a472d81c9d0c6319ba701296dca5 | R | 1,252 | 44 | # statistical analysies for low freq DBS project with Alex
# --- Preparation -----------------------------------------------------------
# get local functions and constants
source("local-functions.R")
source("local-constants.R")
# set orthogonal contrast settings
options(contrasts=c("contr.sum","contr.poly"... |
8034ae0306a8c73411345656bcd1f9f1ed34a26f0f61b096f7ae96e952ada264 | R | 1,260 | 56 | #' Print method for task_error object
#'
#' task_error are objects that result from failed methods
#'
#' @param x a task_error object
#' @param ... not used
#'
#' @return None
#'
#' @export
#' @keywords internal
print.task_error <- function(x, ...) {
cat(
glue::glue(
"error at step: '{x$error_lo... |
2caf48a56a41ecf69c2396e117a6b04f7d7cc7aae78b9062a63f773f09f8bc8c | R | 1,265 | 47 | library(tidyverse)
library(magrittr)
setwd(dirname(rstudioapi::getActiveDocumentContext()$path))
files <- fs::dir_ls("raw_data/")
tb <- read_tsv(files, id = "path")
summary <- tb %>%
group_by(path) %>%
summarise(acc = mean(correct))
tb_subset <- tb %>%
filter(path %in% summary$path[which(summary$acc > 0.7)... |
ee2984b202d484f2d6960a22e0607ea8bd226c1c9e8652eca55e00876458fc8f | R | 1,274 | 31 | args <- commandArgs(trailingOnly = TRUE)
stopifnot(length(args) == 5L)
pkgload::load_all(file.path(args[[1]], "packages/r"), quiet = TRUE)
source(args[[4]])
prepared <- read_source(args[[2]])
values <- cbind(prepared$X, y = prepared$y)
restored <- read.csv(
args[[3]], check.names = FALSE,
colClasses = c("character"... |
35a4976676419b7776ff75ca5e58de53e813cfa68b013bd196603313bb4afd41 | R | 1,284 | 41 | #!/usr/bin/env Rscript
args = commandArgs(trailingOnly=TRUE)
if (length(args)!=2) {
stop("Two argument must be supplied", call.=FALSE)
}
raw_counts_path = args[1]
output_dir = args[2]
library(DESeq2)
library(data.table)
raw_counts <- read.table(raw_counts_path, sep = "\t",
header = T, st... |
2939b71af1f35559fff61f040ec14bc6f6c165326ee4c6ac1155eda476143e17 | R | 1,290 | 23 | test_that("CSCORE_IRLS Rcpp version matches base version on a simulated independent gene pair", {
expect_equal(CSCORE_IRLS_cpp(ind_gene_pair$counts, ind_gene_pair$seq_depths,
IRLS_par = list(n_iter = 10, eps = 0.05, verbose = FALSE, conv = 'max')),
CSCORE_IRLS_base(ind_ge... |
13e4b6671deb580c8a332297c5188dbfa9d4c8ee3a6449d0319b374f934e90a6 | R | 1,298 | 26 | # Libraries
install.packages('heatmaply')
library(heatmaply)
# Load data
Antero <- read.csv("..path to your folder here\\Figure 1 -Source data.csv",sep=",")
row.names(Antero)<- Antero$Nucleus
Antero<-Antero[1:118,1:6]
Antero<-Antero[order(Antero$Mouse.1),]
Antero_matrix<-data.matrix(Antero)
# cluster rows
... |
5aaf9ac31395d4d86ad8c3a07db41a3438158d82341645c0c47e71838d0a4ed0 | R | 1,303 | 35 | #!/usr/bin/env Rscript
args = commandArgs(trailingOnly=TRUE)
if (length(args)!=2) {
stop("Two argument must be supplied", call.=FALSE)
}
dataset_path = args[1]
output_dir = args[2]
library(ggplot2)
dataset <- read.table(dataset_path, sep = "\t", header=T, stringsAsFactors = F)
samples <- dataset$sample
dataset_cou... |
c46ff5318d798eda1555df8e9282842e5cbc38da925a3d9ccd9ac5106c25957b | R | 1,310 | 81 | .new_registry <- function(
release,
index_sha256,
index_url,
schema_version = 1L
) {
structure(
list(
release = release,
index_sha256 = index_sha256,
index_url = index_url,
schema_version = schema_version
),
class = "datamonger_registry"
)
}
print.datamonger_registry <- ... |
b800cb35cc60ab98b7034c854f13710ae67af54198a1e06c69eaf32f3101fcad | R | 1,315 | 35 | #' @name getDist
#' @title Get tissue specific distribution
#' @description
#' This function counts the total number of tissue specific protein coding,
#' lincRNA, and miRNA genes for each tissue.
#' @param x ensembl annotated tau expression fraction file
#' i.e. output from getMart()
#' @param y threshold tau value... |
b599e9ed541477ddf0d7a9326d8c70a741fc3e1b19786800e7814ffe4112aa51 | R | 1,351 | 33 | #!/usr/bin/env Rscript
# module load R/4.0.2
library(genefu)
args<-commandArgs(TRUE)
annotation <- read.delim(as.matrix(args[1], header=T, sep='\t'))
rnaseq <- read.delim(as.matrix(args[2], header=T, sep='\t'))
# Prepare TPM input:
n <- rnaseq$probe
rnaseq_t <- as.data.frame(t(rnaseq[,-1]))
colnames(rnaseq_t) <- n... |
b9e54e9437e0021714144262312fbe8fd1f18fa0908ea5467d7a05bf75ae82f1 | R | 1,351 | 57 | # sample n rows from data
sample_rows <- function(x, n) {
if (nrow(x) > n) {
x[sample(seq_nrow(x), n), ]
} else {
x
}
}
# sample n cols from data
sample_cols <- function(x, n) {
if (ncol(x) > n) {
x[, sample(seq_ncol(x), n)]
} else {
x
}
}
#' Sample cells from a... |
e4e85df1a2bc224458c27de9810761e357d811d30e126518a904b55d6c5d5ca7 | R | 1,352 | 33 | read_source <- function(path) {
lines <- readLines(gzfile(path), warn = FALSE)
start <- match("!series_matrix_table_begin", lines)
end <- match("!series_matrix_table_end", lines)
stopifnot(!is.na(start), !is.na(end), start < end)
values <- read.delim(
textConnection(lines[seq.int(start + 1L, end - 1L)]),
... |
d5166993703475d0028bf6cd7f83758bb9924693d13b1365e18296d1aafd0ead | R | 1,389 | 43 | # start all statistical analyses from here in order to avoid loading the data
# several times over and also in order to keep an overview of the current pipeline
# of statistical analysis. All packages needed should also be loaded here
# --- Preparation -----------------------------------------------------------
# g... |
3be283d7202b46dfd05e289f9000876ddf738b4f32194bc86c199fe328c7183f | R | 1,393 | 39 | #!/usr/bin/env Rscript
library(ggplot2)
args = commandArgs(trailingOnly=TRUE)
if (length(args)!=4) {
stop("Four argument must be supplied", call.=FALSE)
}
expression_norm_path = args[1]
output_dir = args[2]
samples_percentage = as.numeric(args[3]) # default 0.2, minimum percentage of samples, a miRNA has to be expre... |
e7f8b8f6b202dc026cc2055605b69deb3ad9bb30cf5dcd4bfb840df5995dd650 | R | 1,399 | 40 | #' Combine all DESeq2 results into a single
#' excel file.
# req'd libs
x <- c("magrittr", "tidyverse", "openxlsx", "data.table")
sapply(x, library, character.only = T)
source("./functions/remove_redundancy.R")
# load deseq files
all <- list.files("./adj_data/deseq/filtered/", full.names = T)
# remove unncessary it... |
301fd4b933aa583ee5674745d6bb50947276ad600a52b764ff867916afbb3d90 | R | 1,406 | 23 | library(plotly)
df <- read.csv("./CMOT_Final/PBMC/Cell_TruevsPred_22642.csv")
scaleFUN <- function(x) format(x,scientific = TRUE, digits=3)
#df$Name <- c('CD3','CD4','CD8a','CD14','CD15','CD16','CD56','CD19','CD25','CD45RA','CD45RO','PD','TIGIT','CD127')
p<-ggplot(df, aes(x = TrueGE, y = PredictedGE )) +geom_point(c... |
ba6d0e99acf04d54a351f69b28f02842b9248fd9bf3b18f2cf831b42d66593a4 | R | 1,459 | 39 | #' Run Rsubread to obtain count data for re-running DESeq2 for
#' filtered MeDIP-Seq peaks - run this on linux ec2 for RAM > 16 cores.
# req'd pkgs
# NOTE: To run Rsubread for indexing of genome,
# alignment and counting, you need to run on a
# machine w/ > 16 GB RAM
x <- c("openxlsx", "magrittr", "tidyverse",
... |
ff1379ad284467900febfd1a7ae2432597d42cf904926abd7cdbfa53fdd8d6e7 | R | 1,464 | 40 | #' @name getTissue
#' @title Get expression and specificity of each gene in a single tissue
#' @description
#' This function takes a user defined tissue and extracts the ensembl
#' annotations, normalised expression values, tau values, and tau expression
#' fractions of all genes in that tissue. Each gene's score is... |
c2674420fe0caf9c555f057ade21a6bd2e65aeb45e859138e4c5e09450135dc6 | R | 1,469 | 53 | df = read.csv("../data/subjective_dbs_ranking.csv", header = TRUE)
df$best = as.character(df$best)
df$best[df$best == "100"] = "100%"
df$best[df$best == "33"] = "33%"
df$best[df$best == "66"] = "66%"
df$best[df$best == "130"] = "130Hz"
df$best[df$best == "85"] = "85Hz"
df$best[df$best == "30"] = "30Hz"
df$best... |
99f306fd01ab09e89b3c71df485b71116cc2beca20df74abd598af17aaeee14d | R | 1,472 | 48 | # comparing neff predicted vs. neff natural accors different alignments similarities.
# reading csv files
natural_var <- read.csv(file="./stats_align_all.csv", header=TRUE, sep=",")
natural_var_20 <- read.csv(file = "./stats_align_files/stats_align_20.csv", header=TRUE, sep=",")
natural_var_40 <- read.csv(file = "./s... |
677cc61ae9e13679fa1f07832d329b2184dd1df73b1588f2c7f5fe974f589a4b | R | 1,483 | 55 | #' Split combined pipeline step
#'
#' Some methods perform multiple steps of a pipeline. This function assists with
#' splitting the combined pipeline step into multiple steps with duplicated
#' method names.
#'
#' @param x a results data.frame from `apply_methods()`.
#' @param step the name of the column to split.
#' ... |
5d5d5aadaee5162f224e07f3a2c748d0cbf5db34c224cedd2abf1b4660c49e54 | R | 1,497 | 37 | #!/usr/bin/env Rscript
args = commandArgs(trailingOnly=TRUE)
if (length(args)!=5) {
stop("Six arguments must be supplied", call.=FALSE)
}
expression_norm_path = args[1]
samples <- read.table(file = args[2], sep = "\t", header = T)[,"sample"] # get samples from samplesheet
output_dir = args[3]
samples_percentage = a... |
eea7acceae9d5d9b433282b2ee6b839446df29019d78f002f8006f3c5c7c46c5 | R | 1,499 | 51 | library(uwot)
library(RSpectra)
context("Spectral")
test_that("1 dimensional output gives a matrix", {
expect_ok_matrix(spectral_init(V_union, ndim = 1, verbose = FALSE), nc = 1)
expect_ok_matrix(normalized_laplacian_init(V_union,
ndim = 1,
verbose = FALSE
), nc = 1)
expect_ok_matrix(laplacian_eigenmap... |
e118370b875a20d26d92d949b95da8db22e2c069868eb21cb328136c99666455 | R | 1,536 | 42 | ---
title: "Stride_Selection"
author: "Brett Hale"
date: "8/17/2022"
output: html_document
---
```{r}
library(dbplyr)
library(dplyr)
library(devtools)
library(ggplot2)
library(viridis)
```
```{r}
Stride <- read.csv("/Volumes/USB20FD/PhD Research/Chapter_2/Stride.csv")
Stride$Stride <- as.character(Stride$Stride)
... |
e5a7b26a41d07a37d35bd5a351369cbe57cae750506e964b0f221740577c98ad | R | 1,540 | 33 | # library
library(ggplot2)
library(plotly)
library(dplyr)
library(hrbrthemes)
p<- read.csv("./LiuCancer_RNA_TO_ATAC_Correlations_10000genes_BinNorm_60_40_split_2.csv")
#p$Method <- factor(p$Method, levels = c('CMOT(p=25%)', 'CMOT(p=50%)', 'CMOT(p=75%)','CMOT(p=100%)', 'MOFA+', 'Seurat', 'TotalVI'))
p$Method <- facto... |
05e6bc7be6de68f57089885231e4ea93fee295e227f0809f261cb3ddf8db0f08 | R | 1,546 | 49 |
#!/usr/bin/env Rscript
# module load R/4.0.2
# Use arguments:
args<-commandArgs(TRUE)
library("dplyr")
library("ggpubr")
library(PairedData)
t <- read.table(args[1], sep="\t", header=FALSE)
ref <- t$V1
other <- t$V2
my_data <- data.frame(group = rep(c(args[2], args[3]), each = 8), tsi = c(ref, other))
group_by(m... |
79091f4797f554b79cdce759887c12d8ec34f62c065b109d55e90c428dd08e89 | R | 1,558 | 40 | ---
title: "Checking SZ Pipeline outputs"
output:
html_document:
keep_md: TRUE
toc: TRUE
---
## gonna check that our subject list don't inlude any missing data
```{r}
library(tidyverse)
```
```{r}
## we created a list of files that are super short after censoring..
number_tr1 <- read_table2("../data/data/... |
6376e827536e7ab290c0af2964bf38629ffd0c448a2995eab6f974046ee52683 | R | 1,578 | 62 | #' @name check_class
#' @title Check class of object
#' @description Check an object against a vector of class names. Testing if they
#' match any or all of the classes. For is_all_of, the object needs to be at
#' least every class specified, but it can have addition classes and still
#' pass the check.
#'
#' @pa... |
e8890b03cd43fc9be258e82bfd558dedbabaa1efc28dc18277abb59886d64e64 | R | 1,591 | 78 | ---
title: "CellBench User's Guide"
author: "Shian Su"
date: "`r Sys.Date()`"
output: BiocStyle::pdf_document
vignette: >
%\VignetteIndexEntry{Vignette Title}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r}
library(CellBe... |
2dd1eb8567892da568633defa8d40b7f4249a5aa806d15949c29163747e26755 | R | 1,596 | 35 | #' @name plotDensity
#' @title Plot tissue specificity distribution
#' @description
#' This function plots the tau value of every gene to see which tau values
#' occur most often
#' @param x data frame of annotated tissue specificity (tau) values
#' i.e. output from getMart()
#' @return
#' Returns a tissue specific... |
93a225b420bd8b7165d25ea5ec4dae0b7db2e8dac0f51b3d2a065ca7df0da2d0 | R | 1,601 | 79 | rspectra_is_installed <- function() {
is_installed("RSpectra")
}
rspectra_eigs_asym <- function(L, ndim) {
res <- NULL
suppressWarnings(res <- tryCatch(
RSpectra::eigs(
L,
k = ndim + 1,
which = "LR",
opts = list(tol = 1e-4)
),
error = function(c) {
NULL
}
))
res
... |
accb909864c4920b4fe79e52e2c2aaaf8524cdcfa0b66751fbb118f0aab12e6a | R | 1,613 | 51 | dvs = c("gait_speed_meter_per_second", "stride_length_cm", "max_sensor_lift_cm")
#dvs = c("gait_speed_meter_per_second")
plot_model <- function(dvname, save = FALSE){
# define y axis label
if(dv == "gait_speed_meter_per_second") ylab = "gait speed (m/s)"
if(dv == "stride_length_cm") ylab = "stri... |
26736d3a4a499f8c9cac1fcaca9b52a469ddf96e69740146710e391c8ae3242d | R | 1,617 | 57 | #' Summary of benchmark_tbl
#'
#' @param object the benchmark_tbl to be summarised
#' @param ... additional arguments affecting the summary produced.
#'
#' @return None
#'
#' @export
#' @keywords internal
#'
#' @examples
#' # list of data
#' datasets <- list(
#' set1 = rnorm(500, mean = 2, sd = 1),
#' set2 = rn... |
99c082a1234ab8c59fa9457617d7ed13e792fbfb8c7a6b0c943e3b89981e5ad6 | R | 1,628 | 40 | #!/usr/bin/env Rscript
args = commandArgs(trailingOnly=TRUE)
if (length(args)!=3) {
stop("Three argument must be supplied", call.=FALSE)
}
expression_raw_path = args[1]
samplesheet <- read.table(file = args[2], header = T) # get samples from samplesheet
samples <- samplesheet$sample
output_dir = args[3]
suppressW... |
75ff31899c75ced89ce47ff3b0db78c86a3d02de646dded53ba010274b02d28b | R | 1,635 | 85 | ---
title: "ImputeBenchmark"
author: "Shian Su"
date: "08/11/2018"
output: html_document
---
```{r setup, include=FALSE}
library(CellBench)
library(dplyr)
library(ggplot2)
library(purrr)
knitr::opts_chunk$set(echo = TRUE)
```
```{r}
CellBench:::load_mrna_mix_data()
set_cellbench_threads(4)
data <- list(
mrna_mi... |
05b1038dfb78f45d54f1ba0c9fcb042b17e002ceae978bb1a983033d99e7b13e | R | 1,649 | 49 | library(uwot)
context("knn affinity")
expected_sparse <- matrix(0, nrow = 10, ncol = 10)
for (i in seq_len(nrow(nn$idx))) {
for (j in seq_len(ncol(nn$idx))) {
expected_sparse[i, nn$idx[i, j]] <- 2
}
}
expected_sparse <- Matrix::drop0(expected_sparse)
res <- nng_to_sparse(nn$idx, val = 2)
expect_equal(res, exp... |
d2282b02f89f4f4e42a04e2923980de1686aa12fca7e5be1b4c56aa6ee3cedec | R | 1,671 | 57 | df = read.csv("../data/subjective_dbs_ranking.csv", header = TRUE)
df$best = as.character(df$best)
df$best[df$best == "100"] = "100%"
df$best[df$best == "33"] = "33%"
df$best[df$best == "66"] = "66%"
df$best[df$best == "130"] = "130Hz"
df$best[df$best == "85"] = "85Hz"
df$best[df$best == "30"] = "30Hz"
df$best... |
ef32b0fe89e826ce5bd9c2a0a1331d2387f48d8544c38291dbc920e30743ed62 | R | 1,681 | 36 | #' @name checkInput
#' @title Checks the input data frame for incompatible values
#' values, and infinite values
#' @description
#' The input dataframe contains expression data so each cell should contain only
#' non-negative, non-infinite, numerical characters (>=0). This function
#' identifies if the dataframe con... |
13d222dea30e399dfb466a19fd92c0578011b107bbdf33bb1fe4c8663ed9fac1 | R | 1,701 | 34 | library(data.table)
library(readxl)
library(stringr)
setwd('/Volumes/ncatssctl/NGS_related/BulkRNA/ISB009')
files <- as.data.table(readxl::read_xlsx('/Volumes/ncatssctl/NGS_related/Sample Sheet/BulkRNA/ISB009_Library_prep_sample_sheet.xlsx', sheet=2))
files[,shortfile := tstrsplit(Sample, '_L')[1]]
files
dir <- '/d... |
373301efb1f7a140f6898746f511d8fc8ae05542a0ff7e69835cfc35ef9c2b84 | R | 1,718 | 35 | # code was adapted from: https://github.com/Noble-Lab/Polarbear
library(data.table)
library(readxl)
library(ROCR)
library(Matrix)
library(scran)
library(ggplot2)
library(ggallin)
df <- read.csv("./GeneWiseCorrelations.csv") #columns: methods, rows: inferred vs measured correlation of a gene
#colnames(df)[2]<- "Polar... |
1a066e21d19ad6b113ae8d4b7f919644730ccf5405bfba1b332d8833f65ad540 | R | 1,723 | 63 | .canonical_bytes <- function(components) {
.native_result(dm_canonical(components, FALSE))
}
.canonical_sha256 <- function(components) {
.native_result(dm_canonical(components, TRUE))
}
.descriptor_value <- function(value) {
if (.is_scalar_character(value)) {
if (identical(value, "-zero")) {
return(-0... |
c8013e6494e421d3764300ba893ec0f55aecfee3422e310abc34bc0f396a12ca | R | 1,724 | 41 | args <- commandArgs(trailingOnly = TRUE)
stopifnot(length(args) == 7L)
pkgload::load_all(file.path(args[[1]], "packages/r"), quiet = TRUE)
source(args[[6]])
prepared <- read_source(args[[2]], args[[3]], args[[4]])
numeric_values <- cbind(prepared$X, y = prepared$y)
metadata <- data.frame(
sample_id = prepared$sample_... |
15f0b6b055fc7bd388212540066f5158a90e756d42be2e844492f48abbb06bea | R | 1,778 | 57 | library(uwot)
context("Scaling")
iris10_sd <- apply(iris10, 2, sd)
iris10_mean <- apply(iris10, 2, mean)
iris10_none <- scale_input(iris10, scale_type = FALSE)
expect_equal(apply(iris10_none, 2, sd), iris10_sd)
expect_equal(apply(iris10_none, 2, mean), iris10_mean)
iris10_scale <- scale_input(iris10, scale_type = TR... |
359949a9cd67318587066b966def00b84d26ef77cf1db00fae7346cc44e3813d | R | 1,787 | 45 | #' @name calcTau
#' @title Implements tissue specificity algorithm
#' @description
#' This function first places all quantile normalised values into decile bins.
#' For each gene, it then uses the bin profile (row of bin values) to calculate
#' a single tau value between 0 (non-specific) and 1 (absolutely specific).... |
b4ef589392597608086181196ee95d0d05260b9189643776c6e3aa1fe3bcc27e | R | 1,807 | 64 | ---
title: "t-UMAP"
resource_files:
- img/tumap/umap.png
- img/tumap/tumap.png
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
If you choose the UMAP curve parameters to be `a = 1` and `b = 1`, you get
back the Cauchy distribution used in
[t-Distributed Stochastic Neig... |
9113402d707102965fe9b40e9c4b326e288196e35e0c60dde72092a679927bbe | R | 1,814 | 48 | #' @name getControls
#' @title Get a set of genes that can be used to differentiate between 2 tissues
#' @description
#' This function selects 2 lists of genes, 1 for each tissue. Each list includes
#' genes that are highly specific and expressed in one tissue with <0.1
#' quantile normalised expression in the other.... |
1968245a5793ca6f64f508bde4c0db0483c6af5e8ecde63be2fc0f64fc4dd6e0 | R | 1,826 | 67 | #' Create a cached function for CellBench
#'
#' Take a function and return a cached version. The arguments and results of a
#' cached method is saved to disk and if the cached function is called again
#' with the same arguments then the results will be retrieved from the cache
#' rather than be recomputed.
#'
#' \bold{... |
c56bcf64864e03f1d1da94a2e9db04a8a161c89a1f84eeb37f9fb14e747824bb | R | 1,837 | 55 | dvs = c("gait_speed_meter_per_second", "stride_length_cm", "max_sensor_lift_cm")
#tests = c("fast", "normal", "slow", "tug", "gait")
# Use these for the additional analysis of the "free" condition
#dvs = c("max_sensor_lift_cm")
#tests = c("free")
lme_model <- function(dvname, save = FALSE, padj = "fdr"){
modelform... |
36a1442c1c1776692148bedbbac6393a7ac6ce8738dcd359bbc77173621fc5b1 | R | 1,864 | 44 | #!/usr/bin/env Rscript
library(Biostrings)
library(argparser)
args <- commandArgs(trailingOnly = TRUE)
parser <- arg_parser("Argument parser for circRNA quantification", name = "quant_parser")
parser <- add_argument(parser, "--index", help = "Psirc index file name/file location", default = "psirc.index")
parser <- a... |
fbf57d2d723d1bbd66e0386143bfcdc4885427710efce5c4994a02e7d605f10b | R | 1,880 | 56 | .error_classes <- c(
"unknown-dataset" = "datamonger_unknown_dataset",
"unsupported-registry" = "datamonger_unsupported_registry",
"unsupported-decoder" = "datamonger_unsupported_decoder",
"artifact-unavailable" = "datamonger_artifact_unavailable",
"artifact-offline" = "datamonger_artifact_offline",
"retrie... |
d2f795fb23f5ba3792e8a15a1846419fc8cea1e6af83df7fce8f1642c9aecf73 | R | 1,900 | 59 | # remove "OFF" from dbsconditions
dbsconds = unique(df$dbscond)[!unique(df$dbscond) %in% "OFF"]
npcs = 10 # number of principal components to use
dopca = TRUE
verb = TRUE
# define svm model
model <- function(cond){
msg("Prediction for", cond, verbose = verb)
ddf = df[complete.cases(df) & df$dbscond == cond,]
n ... |
8d5f4baa23f4ca7077871444485e736efcab006135941bbcb7cd8a401a02caeb | R | 1,903 | 48 | test_that("Correct dimension", {
test_dat = readRDS("fixtures/mic_highly_expressed_500_AD_control")
count = test_dat[[1]]
seq_depth = test_dat[[2]]
CSCORE_result = CSCORE_IRLS(X = count, seq_depth = seq_depth)
rho = CSCORE_result$est
pvalues = CSCORE_result$p_value
test_stats = CSCORE_result$test_stat
p... |
58be7cb23f11d3ffbdd0f836565e41f43effbaf09d697d249f0c94ae20f8f822 | R | 1,918 | 67 | library(uwot)
context("PCA")
iris10prcomp <- prcomp(iris10, retx = TRUE, center = TRUE, scale. = FALSE)
test_that("PCA initialization", {
iris10_pca_scores <- pca_init(iris10, ndim = 2)
suppressWarnings(iris10_irlba_scores <- irlba_scores(iris10, ncol = 2))
expect_equal(abs(iris10prcomp$x[, 1:2]), abs(iris10_p... |
e18a7a753732c23e4c75f63823e26f7b2296efe1898c81d8454fa646b0d62082 | R | 1,944 | 58 | #!/usr/bin/env Rscript
if(!require(pacman)) install.packages("pacman", repos = "http://cran.us.r-project.org")
pacman::p_load(BSgenome, Biostrings, GenomicRanges, GenomicFeatures, seqinr, rtracklayer)
overlap <- function(exons, circRNAs) {
# find all exons within the circRNAs and reformat result
o <- findOverlap... |
10ff475abcc0bb0922acba60c4ee12bca9d3f859153c736f3cd664379d0ec2fa | R | 1,957 | 61 | #load libraries
library(magrittr)
library(tidyverse)
#CONSTANTS
#set a constant to attach to file names
outfileBase <- "03_NCATS_ATAC_"
#set a common theme for plotting
mytheme <- theme(plot.title = element_text(lineheight = 0.8, size = 20, family = "NotoSans-Bold"),
axis.text = element_text(size = ... |
c448fd72a54954d8f69c71f75633f75753010bee825dee23a33537f1cb99ea33 | R | 2,020 | 41 | #' Create manhattan plots for targeted genes:
#' elf5, dlk1, ube3a, igf2,
#' zfat, cdkn1c, proser2-as1
#' These are the only ones left of the 11
# req'd pkgs
x <- c("ggplot2", "tidyverse", "qqman", "data.table",
"ggrepel", "gtools")
sapply(x, library, character.only = TRUE)
source("./functions/build_manhattan.... |
83b43ecc73776e9a4aa04e8a7806b8f031471d5c915469077f8deeb3bf37ea70 | R | 2,049 | 101 | .new_int64 <- function(values, valid = !is.na(values)) {
values[!valid] <- NA_character_
structure(values, class = c("datamonger_int64", "character"))
}
.parse_binary64 <- function(value) {
result <- dm_parse_binary64(value)
if (is.null(result$category)) result$value else NULL
}
format.datamonger_int64 <- fun... |
9ffd2a3577b70359cae016e7f44e79a85c052d1b67143f9b05a91db5b6f364db | R | 2,060 | 57 |
trimExpression = function(expr,n.genes) {
m = apply(expr,2,function(x) {
n = min(n.genes,sum(x>0))
A = sample(which(x>0),n)
y = matrix(0,length(x))
y[A] = x[A]
y
})
rownames(m) = rownames(expr)
colnames(m) = colnames(expr)
m
}
summarySE <- function(data=NULL, measurevar, groupvars=NULL,... |
c140ae236ccf85dc1e7011af68b5d008f31692164a70e68a256048190f38ff1a | R | 2,061 | 75 | ---
title: "Visualize the result of simulation experiment"
output: rmarkdown::github_document
---
```{r}
library(tidyverse)
library(ggsci)
library(ggpubr)
theme_pwas = theme_pubclean(base_size = 7,base_family = "Helvetica")
p_list=list()
attribute_name ="n_vertex"
p_list[[attribute_name]]=lapply(paste0("../results/si... |
37234a578ab7fceef79ddcac286e57475401000d85b97a412794f332ca1f9838 | R | 2,071 | 47 | test_that("Windows release builds keep Cargo objects outside the install path", {
config <- test_path("..", "..", "tools", "config.R")
skip_if_not(file.exists(config), "Configuration is tested from the source tree.")
config <- normalizePath(config, winslash = "/")
package <- normalizePath(test_path("..", ".."),... |
deb44ea692dff26087beb8f66ea7348810eef80154511da4f69f8afbc1da05d6 | R | 2,159 | 83 | library(uwot)
context("rnndescent integration")
test_that("rnndescent accepts integer-valued doubles from uwot", {
testthat::skip_if_not_installed("rnndescent")
model <- umap(
iris10,
n_neighbors = 4,
nn_method = "nndescent",
nn_args = list(
n_trees = 2,
leaf_size = 5,
max_tree_d... |
8435b128a456d221a79add1b810ba4dfaf0a8f6f1b31ff0dc4947859d4543668 | R | 2,164 | 70 | library(tidyverse)
library(cowplot)
library(ggforce)
#getting the average % homology for all proteins in the alignment.
homol_data <- read.csv(file = "./output/output_PSICOV/percent_homol.csv", header=TRUE, sep=",")
plot_a <- homol_data %>%
ggplot(aes(x = percent_homol)) +
geom_density(fill = "seashell3", color =... |
48697705b8cc9087b30dadef2554ac6ebc1bf82efcfbb4e5c027deee43be9f66 | R | 2,210 | 54 | read_source <- function(directory) {
paths <- list.files(directory, pattern = "^TCGA-.*[.]txt$", full.names = TRUE)
sample_ids <- sub("[.]txt$", "", basename(paths))
stopifnot(length(paths) == 606L, !anyDuplicated(sample_ids))
# TCGA sample types 01 and 06 identify primary and metastatic tumors.
keep <- subst... |
e74808c0bcb2a9857e34e9ef7640d8180d0f3de37fc3caeb096be9fcba86cf2c | R | 2,234 | 90 | ---
title: "SZ Location Stats"
output:
pdf_document: default
html_notebook: default
---
```{r}
library(dplyr)
library(tidyr)
library(broom)
library(knitr)
library(igraph)
library(ggplot2)
library(readr)
library(stringr)
```
```{r}
# Number of subjects
# 258 SCZ, 225 HC
# PINT distances
qced_sublist <- read_csv(... |
00061d0944037be46c1131db8c472ee681f1e7b55dc860c68277ada0bfde8bd5 | R | 2,280 | 50 | #' @name plotDist
#' @title Plot number of tissue specific genes per tissue
#' @description
#' This function plots the number of absolutely specific genes (ASGs, tau = 1)
#' alongside the number of highly specific genes (HSGs, tau >=0.85) in
#' each tissue
#' @param x ensembl annotated tau expression fraction file
#... |
c4c757bb4abc8fc4ab90795c91050518b5e69b861e66f11a4c7f2d4ecac53088 | R | 2,305 | 67 | # Configure R package builds to use sccache.
#
# Pass --cmake to configure CMake launchers instead,to avoid selecting an sccache-wrapped
# CXX as NVCC's host compiler.
args <- commandArgs(trailingOnly = TRUE)
if (length(args) > 1L || (length(args) == 1L && args[[1L]] != "--cmake")) {
stop("Usage: setup_r_sccache.R [... |
b2dc27c5f9756f18fd8a59c4561a3f4bd1aa505e748cc23e41a7fd66adabb1ab | R | 2,311 | 45 | test_that("preprocessing metadata follows the shared contract without changing data", {
cache_dir <- tempfile("datamonger-preprocessing-")
seeded <- seed_conformance_cache(cache_dir)
cases <- read_fixture_json("conformance", "preprocessing.json")$cases
baseline <- fetch_data("conformance:mixed_csv@1", registry ... |
261317f669caea80b97bfe2f4f06d8b45e512165f54a3ec75b197bd0dea50321 | R | 2,327 | 51 | test_that("The covaiates' effect sizes are computed correctly", {
set.seed(202212)
n <- 6000
sim_seq_depths <- exp(rnorm(n, 7.3, sd=0.6))
sim_seq_depths <- sim_seq_depths[!sim_seq_depths < 400]
sim_seq_depths <- round(sim_seq_depths)
n <- length(sim_seq_depths)
mu <- 4.83 * 7.56e-05 # extracted from a sp... |
6abcc35f8a1ef8a38f76aeb430cf95f8537d2d904cfb1fc86d1ff15c092d9099 | R | 2,333 | 82 | ---
title: "20220618_coseq"
author: "Asela Wijeratne"
date: '2022-06-18'
output: html_document
---
```{r setup, include=FALSE}
library(coseq)
library(Biobase)
library(corrplot)
```
```{r}
###entire normalized expression matrix
corrected_data <- read.csv("20220304_corrected_data.csv", row.names = "X")
DE_DEseq_nor... |
624e55643ba2ddbaec5eeec05624a2bd0edac5413d11bc3c625e98bd208ddc13 | R | 2,335 | 88 | fixture_path <- function(...) {
testthat::test_path("fixtures", ...)
}
read_fixture_json <- function(...) {
jsonlite::fromJSON(
fixture_path(...),
simplifyVector = FALSE,
bigint_as_char = TRUE
)
}
dm_internal <- function(name) {
getFromNamespace(name, "datamonger")
}
write_bytes <- function(conte... |
77205db4f5271480db3f5047ca425e7837f0c9ea5dab261e4ee1d928a1dfd877 | R | 2,348 | 66 | #' simulated single cell multi-omics data.
#'
#' A dataset containing paired single-cell RNA-seq and ATAC-seq data as well as the true labels of cell groups
#'
#' @format A list contains two field data:
#' \describe{
#' \item{data}{Simulated single-cell RNA-seq and ATAC-seq data}
#' \item{labels}{The true labels of... |
6999e216a08777b5da526a0bdc8f23716631d2b78cd0dcba2dac3cd21f86d144 | R | 2,353 | 69 | log <- file(snakemake@log[[1]], open = "wt")
sink(log)
sink(log, type = "message")
message("CONFIGURATION STEP")
# A. Parameters:
# 1. Load libraries.
suppressMessages(library("Seurat"))
suppressMessages(library("dplyr"))
suppressMessages(library("data.table"))
suppressMessages(library("reticulate"))
suppressMessage... |
84d983146610c123a07c107855f5a7410e81cf1ba8dc4e62b730d0b9c5906adc | R | 2,395 | 67 | library(uwot)
context("optimization only")
# this mainly exists to hedge against rhub timing out during tests and to still
# exercise the main umap code even with RSpectra and other dependencies
# temporarily removed due to excessive compilation times. Filter on
# this in testthat.R:
#
# test_check("uwot", filter = "o... |
078ffbcbad8a423ceea9da738ea2d6a4b23b2b282e35005bbc2e1e134720cb58 | R | 2,412 | 61 | #' A simulated independent gene pair
#'
#' This data set is created only for illustrative purposes and is used to test CSCORE_IRLS.R.
#' The source code for generating this data set is in data-raw/ on Github.
#'
#' @format ## `ind_gene_pair`
#' A list with 2 elements:
#' \describe{
#' \item{counts}{A 1972 by 2 count ... |
0eda6590af1826208ee3e4a0a794c6b5615933fba37ce999c43a838a322950fa | R | 2,440 | 55 | #' @name getMart
#' @title Get ensembl annotations
#' @description
#' Connects to ensembl archive to get id, name and type for every gene
#' @param x species: 'human', 'macaque', or 'mouse'
#' @param y ensembl archive version: 79..90
#' @param z output from calcTau()
#' @return
#' Returns a dataframe containing tau val... |
ccfe433fd3c3514c77db676dfbbdf6e5a7bbe226ec6e9ebdb17992e08541f7c1 | R | 2,451 | 48 | library(data.table)
library(ggplot2)
library(Hmisc)
library(DESeq2)
load("/Volumes/ncatssctl/NGS_related/BulkRNA/ISB025/ISB025_Vukasin/Analysis/Vukasin.DDS.RData")
dds.subset <- dds[ , dds$condition %nin% c("NCRM5_astro_D4",
"NCRM5_astro_D7","NCRM5_astro_D14",
... |
cfd63e653c18dd84087af56c42da56c7351f30b43a215b9cf1d1e65ea663cc58 | R | 2,460 | 77 | source("http://webstimate.org/twolines/twolines.R")
library(tidyverse)
library(scales)
#load data
#friendship
friend <- read.csv('friend_baseline.csv')
#mental health
mh <- read.csv('cbcl_baseline.csv')
#cognition
cog <- read.csv('tbss_baseline.csv')
#covariates
covs <- read.csv('cov_beh_baseline.csv')
... |
12859486e25f634c8d228ebeeb6272f39f8ed2d08024fff7e07fef7b37d9512d | R | 2,527 | 81 | packages <- c("ggplot2", "reshape2", "dplyr")
for(i in 1:NROW(packages)){
if(!require(packages[i], character.only = TRUE)){
install.packages(packages[i])
library(packages[i], character.only = TRUE)
}
}
model <- "U256"
dir_parent <- "/home/manuel/Dropbox/tmp"
dir_sub <- "cpts/trained_mod"
filename <- "hist... |
f4c4a20cf25b3737ca2a72626e68bf50c686f625cd2b71586cb2927be3761fa0 | R | 2,563 | 100 | .validate_libsvm_options <- function(options) {
.require_exact_fields(
options,
c(
"index_base",
"feature_count",
"duplicate_features",
"label_type",
"row_order",
"target_name"
),
"LIBSVM options",
"datamonger_unsupported_decoder"
)
if (
!identical(opti... |
d83dadf9ff3baa87b32afed80737954b356d948be69b19c0acdc4285a95ab198 | R | 2,585 | 69 | test_that("fetch_data verifies native results without serializing them in R", {
cache_dir <- tempfile("datamonger-native-")
on.exit(unlink(cache_dir, recursive = TRUE), add = TRUE)
seeded <- seed_conformance_cache(cache_dir)
cases <- read_fixture_json("conformance", "cases.json")$cases
testthat::with_mocked_b... |
6d08444eb5c2654e397e652e099538b9ec16c838c9cea52f28ca3e3587d2edd7 | R | 2,586 | 50 | #' @name plotGene
#' @title Plot specificity of a user defined gene for each tissue
#' @description
#' This function takes a user defined gene (case sensitive) and plots the
#' tau expression fraction of that gene in each tissue. This allows the user
#' to visualize the tissue/tissues in which the genes has relativel... |
ee54e927fe1be8b10711c6e3fb745cdb4a52aa07e9f32051814facfa4feb5435 | R | 2,596 | 85 | #this code is a continuation of figure 4
#correlation coefficients of wt prob predicted by CNN as a function of
#neff in the alignment.
library(tidyverse)
library(cowplot)
library(sinaplot)
library(ggforce)
# reading csv files
natural_var <- read.csv(file="./stats_align_all.csv", header=TRUE, sep=",")
natural_var_20... |
912d144697d66c453727ad68bba2387fd8bf022003597c404e33e2afbd6b2048 | R | 2,681 | 68 | ---
title: "Figure_5"
author: "Brett Hale"
date: "8/22/2022"
output: html_document
---
```{r}
library(dbplyr)
library(dplyr)
library(devtools)
library(ggplot2)
```
```{r}
##Plot AT model generalization accuracies
cross_species_facet <- read.csv("/Volumes/USB20FD/PhD Research/Chapter_2/cross_species_facet.csv")
c... |
98ce43a35d130d5333da684ea7848c5f0d915fdc318c9ee27deb828dd5b9c609 | R | 2,728 | 84 | #############################################
##### Set directories
#############################################
if(Sys.info()['sysname'] == "Windows"){
# paths Win
wd <- "C:/Users/Manuel/Nextcloud/Masterarbeit/"
}else if(Sys.info()['sysname'] == "Linux"){
# paths Lin
wd <- "/home/manuel/Nextcloud/Masterarbeit... |
3b476c4ec960e5f0842162c2d47c6903bd841a66fdf067b0ab54c0aff371e8cf | R | 2,745 | 82 | .preprocessing_metadata <- function(dataset) {
if (!("preprocessing" %in% names(dataset))) {
return(NULL)
}
fail <- function(message) .abort_category("unsupported-registry", message)
nonempty <- function(value, field) {
text <- .require_string(value, field)
if (!nzchar(text)) fail(paste0(field, " mu... |
c99164f7fc7ced835e0ab32989d5ec62bced092a7d7c70c32010bb5ca0cb30c1 | R | 2,749 | 95 | library(tidyverse)
library(yardstick)
library(ggpubr)
library(cowplot)
library(sqldf)
library(sinaplot)
library(dplyr)
library(ggforce)
# reading csv files
natural_var <- read.csv(file="./stats_align_all.csv", header=TRUE, sep=",")
cnn_var <- read.csv(file="./stats_cnn.csv", header=TRUE, sep=",")
# joining the two da... |
2646874e9069a530ee2157afae105761983730933139ba5f1d49724c8ce46909 | R | 2,773 | 65 | ---
title: "Optional Dependencies"
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
eval = FALSE
)
```
There are a variety of packages that `uwot` will make use of if you install them
(and load them), but that you don't *need* so are optional. These include:
* [RcppHNSW](http... |
416986210838e0dae41e87a7942e8714aa2dabb9fea28d4ccc66d1e8b7cbee81 | R | 2,798 | 93 | #!/usr/bin/env Rscript
# Command line argument processing
args <- commandArgs(trailingOnly=TRUE)
if (length(args) < 3) {
stop("Usage: edgeR_heatmap_MDS.r <sample_1.bam> <sample_2.bam> <sample_3.bam> (more bam files optional)", call.=FALSE)
}
# Load / install required packages
if (!require("limma")){
source("ht... |
09f1ead043e137d8c21febd26e19452049192822adf6aad6c02dbaecef8d6445 | R | 2,824 | 113 | hnsw_nn <- function(X,
k = 10,
metric = "euclidean",
M = 16,
ef_construction = 200,
ef = 10,
n_threads = NULL,
n_build_threads = NULL,
ret_index = FALSE,
... |
f82c0f6070196116815cd22348ee535ddef79771353c28d9186e327f0951c1aa | R | 2,899 | 94 | #' Create a list of functions with arguments varying over a sequence
#'
#' Generate a list of functions where specific arguments have been pre-applied
#' from a sequences of arguments, i.e. a function f(x, n) may have the 'n'
#' argument pre-applied with specific values to obtain functions f1(x, n = 1)
#' and f2(x, n =... |
de49a60ae372cca7b77cd7928c23487e59d5d1217d92aa7b01c1aa51adb04a07 | R | 2,934 | 62 | # Function to plot relevance layer boxplots
relevance.boxplots <- function(plot.df){
curr.boxplot <- plot.df %>%
mutate(
GROUPS = fct_relevel(GROUPS, 'Top', 'Middle', 'Bottom'),
BaseToken = fct_reorder(BaseToken, median)
) %>%
ggplot(aes(y = BaseToken,fill=Type)) +
geom_boxplot(aes(xmin=m... |
96744186b8063fac2e3b0cbf74a81b7df4ff5bac11df7771f0f9327f9bba324d | R | 2,942 | 124 | #' Strip timing information
#'
#' Takes the result of a time_methods() call and remove timing information from
#' the `timed_result` column, replacing it with a `result` column and converting
#' it to a benchmark_tbl.
#'
#' @param x the benchmark_timing_tbl object
#'
#' @return benchmark_tbl
#'
#' @seealso \code{\link{... |
c3a9d407be8bb9ba596e59591ec2c1a83fe09c3a45bb8c51d2a7de1bef30f8a5 | R | 2,971 | 68 | personal_rust <- path.expand("~/.cargo/bin")
if (dir.exists(personal_rust)) {
Sys.setenv(PATH = paste(Sys.getenv("PATH"), personal_rust,
sep = .Platform$path.sep))
}
cargo <- Sys.getenv("DM_CORE_CARGO", unset = Sys.getenv("CARGO", unset = Sys.which("cargo")))
rustc <- Sys.getenv("DM_CORE_RUST... |
6bb2e8a732367b5b91c0ca25f2b9bc6d8ead9372c177fca9481178af5813bfa2 | R | 3,006 | 107 | #' Set number of threads used by CellBench
#'
#' Sets global parameter for CellBench to use multiple threads for applying
#' methods. If any methods applied are multi-threaded then it's recommended to
#' set CellBench threads to 1. It only recommended to use CellBench with
#' multiple threads if methods applied can be ... |
a51b66beb5f9b84dfe8ad289be3f9aebecc2113df4e0b3680c671440f5cf7c25 | R | 3,011 | 70 | #############################################
##### Load packages, set theme
#############################################
packages <- c("readxl", "ggplot2", "dplyr", "reshape2")
for(i in 1:NROW(packages)){
if(!require(packages[i], character.only = TRUE)){
install.packages(packages[i])
library(packages... |
8737c9588b9fe04c0244a8dfb7e9dd300fedfaf8641194417e8adc49a1fda232 | R | 3,017 | 79 | library(harmony)
library(Seurat)
library(biomaRt)
library(ggrepel)
setwd("~/Desktop/scRNA-seq_analysis/matrices")
# load seurat objects and annotate genes for FADS-sorted samples
obj <- readRDS('B_cell.dgecounts.rds')
matrix <- as.matrix(obj$umicount$inex$all)
annot <- getBM(attributes = c('external_gene_name','gene_... |
d29091a4ceac16cd3f2426b52f33b548daa9cba9b92a4b9fce9a73be7ab2fe30 | R | 3,019 | 92 | ### This script plot global cortical thickness values across age ranges
### Written and modified by Christina Stier, 2021/2022
### R version 3.6.3 (2020-02-29)
### RStudio 2021.09.0+351 "Ghost Orchid" Release (077589bcad3467ae79f318afe8641a1899a51606, 2021-09-20) for macOS
### Mozilla/5.0 (Macintosh; Intel Mac OS X 10... |
4043b4005d1c6eacc5108296ec32b37d9ca9b8a51c61d2669c4585362ab3ba9a | R | 3,029 | 76 | #!/usr/bin/env Rscript
library(data.table)
args = commandArgs(trailingOnly=TRUE)
if (length(args)!=2) {
stop("Two argument must be supplied", call.=FALSE)
}
dataset_path = args[1]
input_dir = args[2]
output_dir = "./"
dataset <- read.table(dataset_path, sep = "\t", header = T, stringsAsFactors = F)
samples <- data... |
efb58276689234eee7c11fe430ce16dd3467c491032ad460d9cff95b64e81fb8 | R | 3,033 | 104 | library(uwot)
context("mixed distance calculations")
set.seed(1337)
res <- umap(iris10,
n_neighbors = 4, n_epochs = 2, init = "spca",
verbose = FALSE, n_threads = 0
)
expect_ok_matrix(res)
set.seed(1337)
resmli <- umap(iris10,
n_neighbors = 4, n_epochs = 2, init = "spca",
metric = list("euclidean" = 1:4),
v... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.