sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
feb74e5ad4dda103a6f7951195589e34a8ee222bc06c9b9892e90c3cbbb47f03 | R | 847 | 29 | #setting the threshold
pval_threshold <- 0.05
logfc_threshold <- 1.5
## enhanced Volcano
EnhancedVolcano(deSeqRes1,
lab = NA,
x = 'log2FoldChange',
y = 'padj',
xlab = NULL,
ylab = NULL,
ylim = c(0, 30),
xlim... |
08f5b8a56b60ca5c8ff8357bffd49494d2ff77fc1b1bf271840023f91e799dff | R | 858 | 36 | data = readRDS("~/MinaRyten/Aine/wood_full/data/dreamlet/de_X_sum_all_DE.rds")
sig = data[data$adj.P.Val<0.05,]
#level1 = sig[sig$annot_level=='2',]
sig[sig$gene_sym=='NEAT1',]
level1 = data[data$annot_level=='2',]
level1[level1$gene_sym=='NEAT1',]
level1 = sig[sig$annot_level=='3',]
level1[level1$gene_sym=='UGCG',]
... |
eada45b6e34f74fdf2643e968dc033bbc878c72f45bc5f49b6c06a5a4774d3c9 | R | 865 | 21 | MDSplot <- function(rf, fac, k=2, palette=NULL, pch=20, ...) {
if (!inherits(rf, "randomForest"))
stop(deparse(substitute(rf)), " must be a randomForest object")
if(is.null(rf$proximity))
stop(deparse(substitute(rf)), " does not contain a proximity matrix")
op <- par(pty="s")
on.exit(p... |
71b8daa376d6849c3e19de5dd5a5d0b888fc81c222f0c6e5ae40bbe7c83676fa | R | 870 | 34 | # Author: Sangeeta Shukla
# Load required libraries
suppressPackageStartupMessages(library(optparse))
# read params
option_list <- list(
make_option(c("-c", "--tsv_file"), type = "character",
help = "TSV data file name"),
make_option(c("-o", "--outdir"), type = "character",
help = "Ou... |
c5c989e82163fa8abcb0edb429f1dad23f951513b58b55ca2640fe4e5d3620b6 | R | 871 | 29 | # Hua Sun
library(Seurat)
library(ggplot2)
CustomizedPlotUMAP <- function(obj=NULL, title='', reduction='umap', group_by='cell_type2', axislab='UMAP', label=FALSE)
{
p <- DimPlot(obj, reduction=reduction, group.by=group_by, label.size = 3, label=label, pt.size=0.05, repel=TRUE)
# theme_void() +
p <- ... |
36c8a7a2e622b9bbaa2ffd86eb5f537178349ac9fe74e5219f7c5874ca14fd1a | R | 875 | 26 | varUsed <- function(x, by.tree=FALSE, count=TRUE) {
if (!inherits(x, "randomForest"))
stop(deparse(substitute(x)), "is not a randomForest object")
if (is.null(x$forest))
stop(deparse(substitute(x)), "does not contain forest")
p <- length(x$forest$ncat) # Total number of variables.
... |
320f3dfcb36d2bc49130fc00ba92619f853c2b911b4baff739e5f41f1fd5c047 | R | 877 | 25 | test_that("reverse_list_comb extracts TRUE members of each logical column", {
df <- data.frame(
SymbolNCBI = c("TP53", "EGFR", "MYC"),
setA = c(TRUE, FALSE, TRUE),
setB = c(FALSE, FALSE, TRUE),
stringsAsFactors = FALSE
)
out <- reverse_list_comb(df, main_col = "SymbolNCBI")
expect_setequal(out$... |
4d7339cc1647377f775d29c57ff1dcf3c398a58141ee06717ef755635c7d3e74 | R | 877 | 29 | #' topmiRNA_toptarget_output
#'
#'
#' example output from topmiRNA_toptarget function
#'
#'
#'
#'
#' @format A list of data frames
#' \describe{
#' }
#'
#'
#' @references
#' Ru Y, Kechris KJ, Tabakoff B, Hoffman P, Radcliffe RA, Bowler R, Mahaffey S, Rossi S, Calin GA, Bemis L, Theodorescu D (2014). “The multiMiR R pa... |
3471a638a01a667c17d03796d78778d7614a92bb8ae61b4c2c332a6d120d39a6 | R | 878 | 27 | #'---
#' title: Export counts in tsv format
#' author: Michaela Mueller, vyepez
#' wb:
#' log:
#' - snakemake: '`sm str(tmp_dir / "AE" / "{annotation}" / "{dataset}" / "export_{genomeAssembly}.Rds")`'
#' input:
#' - counts: '`sm cfg.getProcessedDataDir() +
#' "/aberrant_expression/{annotation}/out... |
10b0dc14a193a15b32861d9e6ca39e1932a155db8c38c8d4a755a10cee4f57d6 | R | 882 | 30 | #' Encode unique gene counts into column names
#'
#' Renames each column of a data frame of gene lists so that the new name
#' encodes the number of unique, non-missing genes it contains
#' (\code{<name>_.x_<n>_x_log}). The data itself is returned unchanged.
#'
#' @param input A \code{data.frame} where each column is a... |
951a85f664d3f3d6345a046c1ebf66de51cd4993bc305afe24b8aa53a83533ab | R | 885 | 36 | getwd()
setwd("/data/nas1/liuyiding_OD/project/01_project_147/07_MachineVNN")
getwd()
library(ggvenn)
lasso=fread("LASSO.gene.txt",header=T,data.table=F)[,1]
svm=fread("SVM-RFE.gene.txt",header=T,data.table=F)[,1]
a <- list(`lasso` = lasso,
`svm` =svm)
mypal <- c("#0073C2FF", "#EFC000FF")
opar <- par(famil... |
3d0183ca79d56b0c45a7528991c25bf62c42c532b9aca77780fd72a9e921bcff | R | 888 | 23 | HDIofMCMC = function( sampleVec , credMass=0.95 ) {
# Computes highest density interval from a sample of representative values,
# estimated as shortest credible interval.
# Arguments:
# sampleVec
# is a vector of representative values from a probability distribution.
# credMass
# is a scalar... |
2bc0ed0587d25fc6ef38923b0a52762ceb8655b04fc7654d872267847599077c | R | 891 | 30 | #' @title Reorder the order in which metadata appear in the shiny app
#' @description Reorder the order in which metadata appear in the dropdown menu in the
#' shiny app.
#' @param scConf shinycell config data.table
#' @param nmo character vector containing new order. All metadata
#' names must be included, which c... |
ae91cbf53ae55e6977671b3158b98bab1ce8c596c1e529125eba1baaf50e8201 | R | 892 | 33 | library( rmarkdown )
library( ggplot2 )
stitchedFile <- "stitched.md"
rmdFiles <- c( "format.md",
"titlePage.md",
"abstract.md",
# "notes.md",
"intro.md",
"results.md",
"discussion.md",
"methods.md",
... |
cc979192dbf36a0c2a0102a42d74bee313614141344527ffb7d1d2a228db897b | R | 893 | 20 | #' A simulated single-cell RNA-seq dataset
#'
#' A toy simulated scRNA-seq dataset, used to demonstrate Augur.
#' The dataset contains three populations of cells (CellTypeA, CellTypeB, and
#' CellTypeC), each represented by 200 cells.
#' Each cell type has approximately half of its cells in one of two experimental
#'... |
2f1841bb401dbaec545500139df8a83d7e762604c7109e737d5315eda9364b74 | R | 896 | 30 | library(pROC)
test_that("roc rejects rejects invalid data", {
# Control always negative
controls <- c(-Inf, 1, 2, 3, 4, 5)
cases <- c(2, 3, 4, 5, 6)
expect_warning(r <- roc(controls = controls, cases = cases), "Infinite value")
expect_equal(r, NaN)
# Control always positive
# 100% specificity impossible... |
452542905f82669da3fc6757fc4b38dfae846d0f71aa753efc290d8594c3e734 | R | 897 | 32 | args <- commandArgs(TRUE)
name <- as.character(args[1])
if (!dir.exists(name)) {
dir.create(name)
}
setwd(name)
if (!dir.exists("DDD_FREE_TES")) {
dir.create("DDD_FREE_TES")
}
dir.create("DDD_FREE_TES")
setwd("DDD_FREE_TES")
dists <- list(
list(distribution = "uniform", n = 1, min = 0.5, max = 1.0),
list(... |
7ff0b67ca1d085fef1e74ca797ddb4f483de6c444c9be79ab62df7dff2112a2e | R | 898 | 36 |
library(readxl)
tt <- read_excel("metadata/metadata_mid_organoids_10x_sample.xlsx", sheet = "foetal")
tt <- as.data.frame(tt)
list_perFile <- split(tt$Donors, tt$Supplier_Sample_Name)
list_perFile <- sapply(list_perFile, function(x) x[!duplicated(x)], simplify=F)
tt2 <- read_excel("metadata/metadata_mid_organoids_10... |
f1e7919bc25338791ab3d9459b0b8d7222984268673ace82e08dcce8dfa5f48c | R | 900 | 27 |
# Generate some fake data from a multinomial distribution
# Group A, 4 samples, 1000 cells in each sample
set.seed(8596)
countsA <- rmultinom(4, size=1000, prob=c(0.1,0.3,0.6))
colnames(countsA) <- paste("s",1:4,sep="")
# Group B, 3 samples, 800 cells in each sample
set.seed(1658)
countsB <- rmultinom(3, size=800, p... |
bfe42822ef929c7a88b3557f71a3ccf65222ea948b1e28aadddf94ad9d2d0820 | R | 903 | 32 | if(!require(optparse)){install.packages('optparse')}
library("optparse")
#process inputs
option_list <- list(
make_option(
opt_str = "--input-tsv",
type = "character",
dest = "input_tsv",
help = "tsv RNA expression matrix",
),
make_option(
opt_str = "--gene-col",
type = "character",
d... |
8743173d1f1436ccd60bf202ff326d7b49ab6cca2d926d82f13d89d7e9c2aa8a | R | 905 | 28 |
# Make up some data with two groups, two biological replicates in each
# group and three cell types
# True cell type proportions for 4 samples
props <- matrix(c(0.5,0.3,0.2,0.6,0.3,0.1,0.3,0.4,0.3,0.4,0.3,0.3),
ncol=4, nrow=3, byrow=FALSE)
rownames(props) <- c("C0","C1","C2")
colnames(props) <- paste("... |
4c19f359fabf180281a60fbd85b4eecb226e395920e58aa65b15a6014c78f46a | R | 907 | 20 | # Extracted from test_new_betas.R:16
# setup ------------------------------------------------------------------------
library(testthat)
test_env <- simulate_test_env(package = "methylkey", path = "..")
attach(test_env, warn.conflicts = FALSE)
# test --------------------------------------------------------------------... |
42da90a863cc4da872a51e7aed3a6dff7ef280287bf9dc25d84f48df305836a0 | R | 912 | 26 | # .mofapy2_dependencies <- c(
# "h5py==3.1.0",
# "pandas==1.2.1",
# "scikit-learn==0.24.1",
# "dtw-python==1.1.10"
# )
.mofapy2_dependencies <- c(
"python=3.12.10",
"numpy=1.26.4",
"scipy=1.12.0",
"pandas=2.2.1",
"h5py=3.10.0",
"scikit-learn=1.4.0",
"dtw-python=1.3.1"
)
# P... |
a0844420929228dab4c22f2129dfcc1c2e10653eb67226c756831bcc18d022be | R | 912 | 33 | #' Reorder the order in which metadata appear in the shiny app
#'
#' Reorder the order in which metadata appear in the dropdown menu in the
#' shiny app.
#'
#' @param scConf shinycell config data.table
#' @param new.meta.order character vector containing new order. All metadata
#' names must be included, which can ... |
dd0983576f21ab3d62315f1dd5efecb1a765b64c78d1c757a03663092b9b5477 | R | 912 | 19 | ################################################################################
# Initialize the plot button click session variable to prevent NULL errors.
#
# As the plot parameter selection form is interacted with, we don't want things
# to change reactively until the show plots button is clicked. As a result we
# ... |
e400178ff7e614311ac02b21fd3c2986d9049684477013a3b261b2bb0f77f223 | R | 913 | 34 | library(digest)
# Function to compute SHA-256 hash of a file
compute_file_hash <- function(filepath) {
if (!file.exists(filepath)) {
stop("File does not exist: ", filepath)
}
hash <- digest(file = filepath, algo = "sha256")
return(hash)
}
# Function to save hash to CHECKSUMS file
save_hash_to_file <- f... |
712ee559767906eb516f46590c42860aff6c80a55a7f0e288c2a492731f72c1f | R | 919 | 26 | library(tidyverse)
library(optparse)
# x<-read_xlsx(path = "nextflow_pd/20201229_MasterFile_SampleInfo.xlsx" , sheet = 2, skip=1)
# write_csv(path = "nextflow_pd/20201229_MasterFile_SampleInfo.csv", x=x)
#1 is csv file #2 is key; both should be values
arguments <- parse_args(OptionParser(), positional_arguments = 2)
m... |
7195e061ff98a5175558249896781918f80c1bea0a8e0e9cd988421c437df43a | R | 919 | 33 | #This code will generate a one-sample ttest of global comonents across networks
df<-read.csv("Networks_Corr_Global_Components_last_mo_corr.csv")
df<-subset(df, select = -c(11:15))
results<-t.test(df$G_ddmn,mu=0)
results$statistic
t_results <- sapply(df, function(x) t.test(x,mu=0)$p.value)
tstat_results<-sapply(df,... |
b692217d97a7339aaac090a2675b318426aeabd78ac976b2075399601b3b9cb3 | R | 926 | 28 | library('Darts')
args <- base::commandArgs(trailingOnly=TRUE)
input_file_name <- args[1]
output_file_name <- args[2]
number_of_threads_str <- args[3]
cutoff_str <- args[4]
has_replicates_str <- args[5]
number_of_threads <- base::as.integer(number_of_threads_str)
cutoff <- base::as.numeric(cutoff_str)
has_replicates ... |
7bd19f709c2a19dab873e07bdb450530988ce5d89d8db739cc7c67d336117dca | R | 927 | 35 | #' LINCS.ResponseSigs
#'
#' 2017 Release TCSs as published in Stathias et al., 2018
#'
#' @format A data frame with 1679 rows and 961 variables:
#' \describe{
#' \item{id}{The unique identifier}
#' \item{name}{The name associated with the id}
#' }
#' @source \url{http://www.source-of-my-data.com}
"LINCS.ResponseSig... |
7994cc959b8e12ec540d4b47de1acf7c27ae00c1e110275b91fa85f07597aee6 | R | 934 | 43 | # install.packages("remotes")
# install.packages("glmnet")
# install.packages("gbm")
# install.packages("pec")
# remotes::install_github("dushoff/shellpipes", ref = "main", force = TRUE)
# remotes::install_github("CYGUBICKO/glmnetpostsurv", dependencies = T)
# remotes::install_github("CYGUBICKO/satpred", dependen... |
972c3eb8fb5d2643e889cbeaa39e86411382bac0592e12994f7243cb10e7f138 | R | 934 | 27 | outlier <- function(x, ...) UseMethod("outlier")
outlier.randomForest <- function(x, ...) {
if (!inherits(x, "randomForest")) stop("x is not a randomForest object")
if (x$type == "regression") stop("no outlier measure for regression")
if (is.null(x$proximity)) stop("no proximity measures available")
ou... |
a84875b98ad9715034c352a7ef1d7ed5361e490c4360d881e389937a56285b81 | R | 937 | 29 | # In this script we will be gathering pathology diagnosis
# and pathology free text diagnosis terms to select chordoma
# samples for following chordoma subtyping analysis and save
# the json file in chordoma-subset folder
library(tidyverse)
## Directories
root_dir <- rprojroot::find_root(rprojroot::has_dir(".git"))... |
5a70cd43a60b849c1bfaac2be4d5f50a4300e6c2a31c8d12796419ee07c69f41 | R | 944 | 21 | message("============================")
message("Check PAF breaking at indels")
## Test sample with no strand state changes
paf.file <- system.file("extdata", "test2.paf", package = "SVbyEye")
## Read in PAF alignment
paf.aln <- readPaf(paf.file = paf.file)
## Break PAF alignment at indels of 1 kbp and longer
paf.brok... |
6b65bb8a159f1f13a8850cc1b662c629096b5dbbaaae5b95319d45ed1f164a91 | R | 948 | 34 |
# Generate some data
# Total number of samples
nsamp <- 10
# True cell type proportions
p <- c(0.05, 0.15, 0.35, 0.45)
# Parameters for beta distribution
a <- 40
b <- a*(1-p)/p
set.seed(1957)
# Sample total cell counts per sample from negative binomial distribution
numcells <- rnbinom(nsamp,size=20,mu=5000)
true.p <... |
6a21ab9e59b05a7f80908327b0b757e7d7577960e0f5c632977a943ca3d72b03 | R | 949 | 27 | args=commandArgs(T)
input=args[1]
output=args[2]
data=read.table(input,sep="\t", header=T, row.names=1, check.names=FALSE)
assigned=as.numeric(data[1,])
aligned=as.numeric(data[2,])
refseqTot=as.numeric(data[3,])
refSeqUMI=as.numeric(data[4,])
#mat=cbind(refSeqUMI,refseqTot,aligned,assigned)
pdf(output,width=10,he... |
5777c0ca422bc6a7304be7c8d8b8adf96e0c0c49cb4ee3d9fa2c74b13c6ff533 | R | 954 | 32 | #'---
#' title: MAE analysis over all datasets
#' author:
#' wb:
#' log:
#' - snakemake: '`sm str(tmp_dir / "MAE" / "overview.Rds")`'
#' input:
#' - html: '`sm expand(config["htmlOutputPath"] +
#' "/MonoallelicExpression/{dataset}--{annotation}_results.html",
#' annotation=cfg.genome.... |
bf2d0218ffc9b3367f78de69f25ca6458d9c0a113ff03c609d17392264bc48de | R | 958 | 22 | deseq2_pvals_histogram <- function(res_df, xlab, ylab, title) {
stopifnot(all(c('pvalue', 'padj') %in% colnames(res_df)))
# basic histogram without density
p <- ggplot(res_df, aes(x = pvalue)) +
geom_histogram(binwidth = 0.05, center = 0.025) +
ggpubr::theme_pubr() +
scale_x_continuous(expand... |
286c7d1dadddd6952662b8317f96580af12f29e76cf2e120e1e242c458bd90eb | R | 959 | 16 | ### import gene signature scores from bulk transcriptome datasets of GSCs
bulk_Dev_I <- read.csv('/data/SourceData3_Bulk_IR_DEV.csv', header=T) ### THIS SOURCE DATA CAN BE DOWNLOADED FROM THE RICHARDS PAPER FROM NATURE CANCER 2021
DI_grad_bar <- data.frame(colorbar=c(rep(3,15)), colorlabel= grad_colours)
bulk_Dev_I <-... |
6b8f07899220117e3e752092890a76e4499d68254a444ef0cea968c338ab2a7b | R | 967 | 23 | #' wizbionet: non-coding RNAs and gene data integrator and prioritizer
#'
#' Tools for identifying and prioritizing top genes and non-coding RNAs
#' (miRNAs, lncRNAs) from expression studies or curated gene lists.
#'
#' @references
#' Primary citation for wizbionet:
#' Wicik Z, Jales Neto LH, Guzman LEF, et al. (2021).... |
d0d6c5c89eb5a9b851dbc305983443ff3ce945094bddb5b6660dcf38201060cc | R | 969 | 25 | source("../shinytest_helpers.R")
set_window()
app$setInputs(number_of_samples = "cohort")
app$uploadFile(layout_table_file = demo_path("MRA_Layout.xlsx"))
app$uploadFile(readout_matrices_file = demo_path("MRA_4ReadoutsXlsx.zip"))
app$setInputs(upload_reference_samples = TRUE)
app$uploadFile(reference_samples_file = de... |
41902897546603078c80e6f981e27a60ffa7611346d2401ece428e52f9d7544b | R | 974 | 20 | BiocManager::install(c("GEOquery", "limma", "sva", "DOSE", "clusterProfiler",
"rrvgo", "org.Hs.eg.db", "ComplexHeatmap"), force = F)
suppressMessages({
load_lib <- c("tidyverse", "highcharter", "BiocManager", "forcats", "stringr",
"ggrepel", "readr", "survminer", "phea... |
c392fa4b2d9bda66f86301c0398fa24f2c37c4669e0c8c2f392c46c67a8fa830 | R | 974 | 37 | test_that("lgb.importance() should reject bad inputs", {
bad_inputs <- list(
.Machine$integer.max
, Inf
, -Inf
, NA
, NA_real_
, -10L:10L
, list(c("a", "b", "c"))
, data.frame(
x = rnorm(20L)
, y = sample(
x = c(... |
8cdf8ef765bfffabcf098828038d527a094497e52c7cae893db727801f32e6f5 | R | 982 | 30 | setwd("/data/wuqinhua/phase/covid19/datasets")
library(Seurat)
library(SeuratDisk)
data <-read.csv("./pre_data/10_Schuurman_2021/GSE164948_covid_control_RNA_counts.csv.gz",row.names = 1)
pbmc = t(data)
pbmc <- CreateSeuratObject(counts = data)
rownames_pbmc <- rownames(pbmc@meta.data)
rownames_pbmc <- gsub("\\.", "-"... |
e612218cd9fdbe8901b10539f9c5a7532ed2a4665a643589f3914230d9e9c9f9 | R | 982 | 35 | library('pracma')
library('dplyr')
library('ggpubr')
stringsAsFactors=FALSE
library(circlize)
library(stringr)
library(EXTEND)
library(optparse)
################################################### Running Analysis on RSEM-FPKM data formats #####################################################################
# se... |
defd69aeeb0cdbd10c9c97d018a76a4bb2609e6319cf3248362eb921571897d3 | R | 983 | 33 | library(tidyverse)
library(optparse)
library(Biostrings)
library(GenomicRanges)
library(GenomicFeatures)
arguments <- parse_args(OptionParser(), positional_arguments = 2)
gtf_file<-arguments$args[1]
path_to_ENCODE_blacklist<-arguments$args[2]
# path_to_ENCODE_blacklist<-"../../../hg38-blacklist.v2.bed.gz"
B_list_gra... |
fc38b5e965028a210755f2a0a4970a5b53674a6117d47dfcd45cc0c0123bee8d | R | 984 | 34 | args <- commandArgs(TRUE)
name <- as.character(args[1])
boot_path <- file.path(name, "BOOTSTRAP")
if (!dir.exists(boot_path)) {
dir.create(boot_path, recursive = TRUE)
}
## load DDD gnn emp results
ddd_gnn_emp <- readRDS(file.path(name, "EMP_RESULT", "DDD", "DDD_EMP_GNN_predictions.rds"))
ddd_gnn_emp <- as.data.f... |
ad0a9332c4e8faa9e7f44998f21945b318e38f611c4705f9cc878d012a218a24 | R | 987 | 26 | suppressPackageStartupMessages(library("readr"))
suppressPackageStartupMessages(library("dplyr"))
suppressPackageStartupMessages(library("optparse"))
option_list <- list(
make_option(c("-f", "--fusionfile"),type="character",
help="Fusion calls from Arriba"),
make_option(c("-t", "--tumorid"), type="c... |
fcc89d2a25597562d332c217965ec82d903bfeeb3fbb2eeb0b2b3b97af765e1a | R | 990 | 29 | # Code to generate Figure 5 of the Jokura et al 2024 Ctenophore apical organ connectome paper
# source packages and functions ------------------------------------------------
source("analysis/scripts/packages_and_functions.R")
# assemble figure -------------------------------------------------------------
panel_comp... |
c52b6743a06728cde7bdf18bb26bddb63742c1c5995d3a60aeaec513483757bf | R | 991 | 28 | args <- commandArgs(TRUE)
name <- as.character(args[1])
if (!dir.exists(name)) {
dir.create(name)
}
setwd(name)
dir.create("DDD_CAP_TES")
setwd("DDD_CAP_TES")
cap_range <- c(10,1000)
ddd_cap_tes_list <- replicate(20000, eveGNN::randomized_ddd_fixed_la_mu_age(cap_range = cap_range,
... |
a109271a4fe45a09b3cee91a2e5e1f7afecd53e2376cadf0e0583cd65ac0be04 | R | 998 | 36 | # sDSS_heatmap.R
# Drug sensitivity heatmap using sDSS_asym scores
library(ComplexHeatmap)
library(circlize)
# Define data path
sDSS_path <- file.path("../data", "sDSS_asym.csv")
# Load drug sensitivity matrix
sDSS <- read.csv(sDSS_path, row.names = 1)
# Clean invalid values: keep NA, remove NaN and Inf
sDSS[is.nan... |
7ac2201d0b9d48bbb951aebb9634da1f2948181064584faeb09667a763134a0b | R | 1,002 | 21 | message("============================")
message("Check lifting ranges to PAF alignments")
## Define range(s) to lift
roi.gr <- as("chr17:46645907-46697277", "GRanges")
## Get PAF alignments to lift to
paf.file1 <- system.file("extdata", "test_lift1.paf", package = "SVbyEye")
paf.file2 <- system.file("extdata", "test_l... |
85ef99da5f610726ae8c5adb4546b6a1ac88f2864ac12d7e90a42b7c3909ffed | R | 1,002 | 25 | #' @title Map Genes to KEGG Identifiers
#' @description Maps gene symbols/Entrez IDs to KEGG Orthology (KO) IDs using a local mapping file.
#' @param id Data frame containing gene mapping info (SYMBOL, ENTREZID).
#' @param speciesname Species prefix for KEGG (e.g., "mmu", "hsa").
#' @return A data frame with 'gene'... |
743d3829c72076cb9b385cc66b30d19109bcb5258f3d7130770f8feb6f4bb158 | R | 1,003 | 30 | ## Example single patient script
library(LQT)
########### Set up config structure ###########
pat_id = "Subject1"
lesion_path = "/Users/JaneGoodall/Study/Images/Subject1/lesion_mask.nii.gz"
parcel_path = system.file("extdata","Schaefer_Yeo_Plus_Subcort",
"100Parcels7Networks.nii.gz",package=... |
bdcc67c4c9b0f0b1c69a1c8fab6fec61cf4995836b289fd9907830c58c6fa8e3 | R | 1,004 | 17 | classify_controlled <- function (cons_level1.5, outcome_var) {
out <- cons_level1.5 %>%
rename(outcome = {{outcome_var}}) %>%
# x_prefix = "voxel" works for both bold and encoding (assuming encoding is always by space)
fit_model_xval(x_prefix = "X",
y_prefix = "outcome",
... |
9d653085d0d454fecca2dfc250d42dd3a015209e9e19860e45ae0ec6911afa54 | R | 1,005 | 37 | # True cell type proportions for 4 samples
p_s1 <- c(0.5,0.3,0.2)
p_s2 <- c(0.6,0.3,0.1)
p_s3 <- c(0.3,0.4,0.3)
p_s4 <- c(0.4,0.3,0.3)
# Total numbers of cells per sample
numcells <- c(1000,1500,900,1200)
# Generate cell-level vector for sample info
biorep <- rep(c("s1","s2","s3","s4"),numcells)
# Numbers of cells for... |
4775284ae70fb597680ca4324e62924edab51569b8daa1dd858d5f70672cf887 | R | 1,006 | 30 | library(GenomicFeatures)
library(tidyverse)
library(optparse)
option_list <- list(
make_option(c("--gtf_file"),
type = "character", default = NULL,
help = "gtf file"
),
make_option(c("--output_file"),
type = "character", default = NULL,
help = "outputfile w... |
0105d756888a6231597d1cc08ea3df86d6cf2ddef4c94c6a96e6c5dcca38b441 | R | 1,013 | 32 | # In this script we will be gathering pathology diagnosis
# and pathology free text diagnosis terms to select EWS
# samples for following EWS subtyping analysis and save
# the json file in EWS-subset folder
library(tidyverse)
## Directories
root_dir <- rprojroot::find_root(rprojroot::has_dir(".git"))
output_dir <-... |
c44db66044a0f637168dbb1b776bdb801e95588c027c391bf3caf6a15f66ec29 | R | 1,014 | 36 | # calculate difference between u and 2^sum(-p_n*log2(p_n))
# https://en.wikipedia.org/wiki/Perplexity
compare_u<-function(u,euc_dist,sigma_n)
{
tmp=exp(-euc_dist/2/sigma_n^2)
log_tmp=-euc_dist/2/sigma_n^2
if (sum(tmp)==0) {return("P0")} # positive or division by 0
p_n=tmp/sum(tmp)
log_p_n=log_tmp-log(sum(tmp)... |
eea567c9e3a614ae6c18d92476f8e388a10a1507e398a2a3eccb7c7e7d20d9f7 | R | 1,014 | 33 | #'---
#' title: RVC datasets
#' author: nickhsmith
#' wb:
#' log:
#' - snakemake: '`sm str(tmp_dir / "RVC" / "RVC_Datasets.Rds")`'
#' input:
#' - summaries: '`sm expand(config["htmlOutputPath"] +
#' "/rnaVariantCalling/{annotation}/Summary_{dataset}.html",
#' annotation=cfg.genom... |
a94b6be63a7f2686425cff2c5f7d4c90fc196d418adc96c4e38a7f8357766ad3 | R | 1,023 | 17 | ################################# ED.Fig.2c
###R data adapted from Zhao, Q., Yu, C.D., Wang, R. et al. A multidimensional coding architecture of the vagal interoceptive system. Nature 603, 878–884 (2022). https://doi.org/10.1038/s41586-022-04515-5
AllVNG <- readRDS("Customized directory/Manuscript.Wei.et.al/Rds/All_VNG... |
800ffd6801b163653058e7a3a224aaee7232c8a07097fa37f06b7ce34f3bca36 | R | 1,025 | 30 | #'---
#' title: Full FRASER analysis over all datasets
#' wb:
#' log:
#' - snakemake: '`sm str(tmp_dir / "AS" / "FRASER_datasets.Rds")`'
#' input:
#' - fraser_summary: '`sm expand(config["htmlOutputPath"] +
#' "/AberrantSplicing/{dataset}--{annotation}_summary.html",
#' ... |
91bbe88f647006df498089ba68933d434274810d91592798c261b04b73d7ffd2 | R | 1,030 | 26 | # ciliopathy IDs
# Libraries ----
library(tidyverse)
# Open Targets EFO annotation ----
EFOAnno = ontologyIndex::get_ontology('./Datasets/annotation/efo.obo')
#EFOAnno = ontologyIndex::get_ontology('../../../Datasets/annotation/efo.obo') #from https://www.ebi.ac.uk/efo/
## select ciliopathies
cilioEFO = EFOAnno$... |
17f6e18942f5fb423ba11bac2db4ee767c967196ceb972589c695d3a12b69ff1 | R | 1,038 | 39 | gene_list1 <- list("Early vs Late" = set1,
"Early vs Mid" = set2,
"Late vs Mid" = set3)
venn1 <- Venn(gene_list1)
data1 <- process_data(venn1)
items <- venn_region(data1) %>%
rowwise() %>%
mutate(
text = yulab.utils::str_wrap(paste0(.data$item, collapse = " "), width = 40)... |
ee45230d53065ae188d5ce1735f9d61e68f12e9e03b573bd9b04cda24194b2c6 | R | 1,038 | 44 | rm(list=ls())
## COMMON LIBRARIES AND FUNCTIONS
source("100.common-variables.r")
source("101.common-functions.r")
source("300.variables.r")
source("301.functions.r")
## SCRIPT SPECIFIC LIBRARIES
## SCRIPT SPECIFIC FUNCTIONS
## SCRIPT CODE
##
##
if( 1 ) {
Print.Disclaimer( )
for( lset in BOOT.SET ) {
... |
76507c24d8cea232a3196c7876da9df8c801c3df04cedd384639c9b669c90494 | R | 1,040 | 26 | iwrd <- read.table("iwrd.loco.mlma", header = T, sep = "\t")
iwrd <- na.omit(iwrd)
iwrd <- iwrd[,c(1:5,7:9)]
colnames(iwrd) <- c("chr","rsid","bp","a1","a2","b","se","p")
iwrd$pos <- as.integer(iwrd$bp)
iwrd$chr <- as.integer(iwrd$chr)
write.table(iwrd, "iwrd_imputed_results.txt", col.names = T,
sep = "\t",... |
1410a7b5918442a1ce2ff8204bc8e4e055c0c047292535df455ff51d64458004 | R | 1,049 | 33 | # In this script we will be gathering pathology diagnosis
# and pathology free text diagnosis terms to select ATRT
# samples for following ATRT subtyping analysis and save
# the json file in ATRT-subset folder
library(tidyverse)
## Directories
root_dir <- rprojroot::find_root(rprojroot::has_dir(".git"))
output_dir... |
16bf1c263a7ac2a73cec5093a5d49546c7f45d47351d1fbe68ccd6c5e8ad4119 | R | 1,049 | 33 | #'---
#' title: Results Overview
#' author: mumichae
#' wb:
#' log:
#' - snakemake: '`sm str(tmp_dir / "AE" / "OUTRIDER_Overview.Rds")`'
#' input:
#' - summaries: '`sm expand(config["htmlOutputPath"] +
#' "/AberrantExpression/Outrider/{annotation}/Summary_{dataset}.html",
#' anno... |
754d6085c61f082a3a0967e32e5d3989dddc773a978c1bad6bfbc2936badb1c2 | R | 1,049 | 40 |
setwd("/data/nas1/liuyiding_OD/project/01_project_147/04_dealGSE280750")
exp=fread("GSE28750_series_matrix.txt",header=T,data.table=F)
exp=column_to_rownames(exp,"ID_REF")
qx <- as.numeric(quantile(exp, c(0., 0.25, 0.5, 0.75, 0.99, 1.0), na.rm=T))
LogC <- (qx[5] > 100) ||
(qx[6]-qx[1] > 50 && qx[2] > 0) ||
(qx[2... |
9db517b6efac9b16c73ee254cfc4d5d4ff7e6294d78a5056059d3d524b4b9466 | R | 1,049 | 33 | #'---
#' title: Counts Overview
#' author: mumichae, salazar
#' wb:
#' log:
#' - snakemake: '`sm str(tmp_dir / "AE" / "Count_Overview.Rds")`'
#' input:
#' - summaries: '`sm expand(config["htmlOutputPath"] +
#' "/AberrantExpression/Counting/{annotation}/Summary_{dataset}.html",
#' ... |
55e486cb7ae001eb3bda5c9c0f06599173a7f1dfbedbf31abe5b1aaf12c0059a | R | 1,050 | 30 | setwd("/media/user/disk21/completeAnalysis/")
# Load required library
library(networkD3)
library(dplyr)
links = read.csv('/media/user/disk21/completeAnalysis/infercnv_ivy_test.csv')
colnames(links) = c('target', 'source', 'value')
meta = read.table('/media/user/disk21/completeAnalysis/cellbrowser/Spatial-Data/meta_u... |
550a617f9a3fd6ab5e956cf970fc6dfd126d1ae2e234459b74d3b90d69368f05 | R | 1,051 | 28 | #!/usr/bin/env Rscript
args = commandArgs(trailingOnly=TRUE)
# test if there are 3 arguments: if not, return an error
if (length(args)!=3) {
stop("Two arguments must be supplied (input, output scaled and output scaled/smoothed file names)", call.=FALSE)
}
EL<-read.table(args[1],header=FALSE)
EL[,4]<-scale... |
a4b83fab3f34c32daa706138b73750ce0d8e4fc75d17e48982bba5ab1352b397 | R | 1,051 | 45 | #### variance of vec(Z'Z)
rm(list=ls(all=TRUE))
library(mvnfast);library(corrplot)
source('simulations/mugent/functions.R')
####
m=100
p=3
niter=10000
LD=ar1(m,0.5)
ldlist=lapply(1:p,function(h) LD)
K=kronecker(diag(p),LD)
z=rmvn(niter,rep(0,m*p),K)
H=matrix(0,p^2,p^2)
for(iter in 1:niter) {
Zi=c(z[iter,])
Zi=matri... |
8a9e90e2d04a16ad87d759592954e48cfc0ecf450c3fa9b79b1336668d2372dc | R | 1,053 | 34 | setwd("/media/user/disk31/Nameeta_230810_Xenium_5samples_230816/analysis_Dec/")
data = read.csv('xenium_meta_24Jan_with_info.csv')
num = which(data$sample %in% c('S1', 'S2', 'S34', 'S5', 'S6', 's1-3', 'EGFR-4'))
meta = data[num, ]
num = which(meta$core_info %in% c("SNU21", "SNU33", "SNU18", "SNU25"))
meta = meta[num... |
adaf60feb96e34ffab1081c1c4c59cba5914338aab5408f9011836617c0b6990 | R | 1,053 | 31 | source("../shinytest_helpers.R")
set_window()
app$setInputs(number_of_samples = "cohort")
app$uploadFile(layout_table_file = demo_path("MRA_Layout-Imaging-3Plates.xlsx"))
app$uploadFile(readout_matrices_file = demo_path("MRA_3ReadoutsMixed.zip"))
app$setInputs(upload_reference_samples = TRUE)
app$uploadFile(reference_... |
d8dcb4b3084a8757a26d25a7532a0706bf670ebfa1da6d62ddf619cda2bbc988 | R | 1,053 | 31 | test_that("get_plateform detects EPIC correctly", {
# Create a matrix with EPIC number of probes
mat_epic <- matrix(0, nrow = 866553, ncol = 5)
result <- get_plateform(mat_epic)
expect_equal(result, "IlluminaHumanMethylationEPIC")
})
test_that("get_plateform detects 450k correctly", {
# Create a matrix with ... |
c4d6962b30d4c81663eb90958cd28211d9a91a2297589265f64fd7b005c3a61c | R | 1,056 | 35 | #.libPaths(c("E:/R_packages", .libPaths()))
library("LQT")
Sys.setenv(QT_PLUGIN_PATH = "")
Sys.setenv(QT_QPA_PLATFORM_PLUGIN_PATH = "")
Sys.setenv(QT_DEBUG_PLUGINS = "0")
patient_id <- '/this/is/for/nipype/patient_id'
lesion_file <- '/this/is/for/nipype/source_lesion_file'
output_dir <- '/this/is/for/nipype/output_di... |
2c9a3a886427227c0cfa0356c18d8bac400686cffb48a176267c0824076269d0 | R | 1,058 | 35 | library(megadepth)
library(tidyverse)
library(optparse)
# arguments <- parse_args(OptionParser(), positional_arguments = 1)
#
# bam_files<-arguments$args[1]
# metadata_cols_path<-arguments$args[2]
metadata_cols_path<-"/home/jbrenton/nextflow_pd/metadata_cols_selected.txt"
bams<-list.files(path = '/home/jbrenton/bam_... |
63df19f70469011f487a12b2a5e2db791c6f47d59c0f10db8309f81f40557e2f | R | 1,060 | 29 |
# adapted from the JavaScript code at https://cs.uwaterloo.ca/~dmasson/tools/latin_square/
# which itself adapts Bradley (1958) algorithm
get_balanced_latin_square_order <- function (n_blocks, order_num) {
# Bradley's method only holds for even numbers of conditions
# and of course there are only n_blocks possi... |
12963b4a9f14c3592e2c7d5eecb53284facd4f82f0e40a9437cef9238382d11c | R | 1,063 | 36 |
library(sccomp)
#### loading RDS
# prepare sampleID as sample in meta data
# prepare cell_type as cell_group in meta data
sce_obj <- readRDS("thalamus.merge.QC.harmony.rename.major.forsccomp.SCE.rds")
#### run sccomp
sccomp_result =
sce_obj |>
sccomp_estimate(
formula_composition = ~ Disease + Age + Sex, ... |
4d1bab9d1903117c9e3e3c8497c26ae1f7a0bcc01cd2e2d312434e4c180f46e0 | R | 1,063 | 31 | # In this script we will be gathering pathology diagnosis
# and pathology free text diagnosis terms to select CRANIO
# samples for following CRANIO subtyping analysis and save
# the json file in CRANIO-subset folder
library(tidyverse)
## Directories
root_dir <- rprojroot::find_root(rprojroot::has_dir(".git"))
outp... |
6cca21888b8798473e33261cef5d63264a074bc8296d804a778007abf4ca389c | R | 1,063 | 34 | #' @title Shows the order in which metadata will be displayed
#' @description Shows the order in which metadata will be displayed in the shiny app. This
#' helps users to decide if the display order is ok. If not, users can use
#' \code{reorder_meta} to change the order in which metadata will be displayed.
#' @param ... |
7019741a3517a207445ff52d4fc117ccdd81cc6c61f87577d43602445068b894 | R | 1,068 | 33 | # ------ COMPUTE SCALAR PRODUCT
compute_scalar_product <- function(file2work, trig, headset_time2average){
# ------ Create an empty matrix
scalar_product <- matrix(nrow = headset_time2average + 1)
# ------ Run scalar production computation
for (line in trig:(trig + headset_time2average)) {
# Comp... |
f3a344c7cfa38c2bd6d91e8e9169eec79facf8074e69ca1258862de1f53ba421 | R | 1,070 | 21 | #' @name lgb.make_serializable
#' @title Make a LightGBM object serializable by keeping raw bytes
#' @description If a LightGBM model object was produced with argument `serializable=FALSE`, the R object will not
#' be serializable (e.g. cannot save and load with \code{saveRDS} and \code{readRDS}) as it will lack the ra... |
6d17710159c3707161cf056b7513cc41017ed902d52a5b27cbb852f408f5eed9 | R | 1,073 | 38 | #'---
#' title: MAE test on qc variants
#' author: vyepez
#' wb:
#' log:
#' - snakemake: '`sm str(tmp_dir / "MAE" / "deseq" / "QC--{rna}.Rds")`'
#' input:
#' - qc_counts: '`sm cfg.getProcessedDataDir() + "/mae/allelic_counts/QC--{rna}.csv.gz" `'
#' output:
#' - mae_res: '`sm cfg.getProcessedDataDir() + "/mae/R... |
19f06fb441771b069a0d336a227eb789398be749608649ecee64908f700b781c | R | 1,077 | 29 | library(pROC)
context("onLoad")
test_that(".parseRcppVersion works", {
expect_equal(pROC:::.parseRcppVersion("65538"), "1.0.2")
expect_equal(pROC:::.parseRcppVersion("1"), "0.0.1")
})
test_that("We're running the right Rcpp version", {
skip_if_not(exists("run_slow_tests") && run_slow_tests, message = "Skipping... |
6f959983e4fd7b12382a627321c0984e697399ece45e82f66959375877f1c047 | R | 1,078 | 30 | ## helper functions for constructing matlab calls used by targets ----
assign_variable <- function (var, val, force_unquote = FALSE) {
stopifnot(length(val) == 1) # do NOT want vectorized behavior
if (is.character(val) & length(val) == 1 & !force_unquote) val <- wrap_single_quotes(val)
glue("{var} = {val}")
}
c... |
01ee0c0eb360fc5e7c362ad955735fc6d3ebd5577e3cb16459349863ba1cd186 | R | 1,079 | 38 | #' @title Create config for shiny server
#' @description Create config for shiny server
#' @param path Path where to create file
#' @return Does not return anything. Writes a "shiny-server.config" to current working directory or path specified.
#' @author Roy Francis
#' @importFrom readr write_file
#' @export
#'
make_s... |
eef67a339cb8cf6652b1af70c25e58774c1ea118be466936e5d177f652b8e8e2 | R | 1,080 | 21 | #' @name lgb.drop_serialized
#' @title Drop serialized raw bytes in a LightGBM model object
#' @description If a LightGBM model object was produced with argument `serializable=TRUE`, the R object will keep
#' a copy of the underlying C++ object as raw bytes, which can be used to reconstruct such object after getting
#'... |
204e68b57543ad9518330b63526f91307fca56b35b6810c9fd7f7c93bd7715a9 | R | 1,081 | 22 | classCenter <- function(x, label, prox, nNbr = min(table(label))-1) {
## nPrototype=rep(3, length(unique(label))), ...) {
label <- as.character(label)
clsLabel <- unique(label)
## Find the nearest nNbr neighbors of each case
## (including the case itself).
idx <- t(apply(prox, 1, order, decreas... |
67bffb0b6888d2a30253a922e2355a51b4526358ad76539970dda9a4bee903b7 | R | 1,083 | 34 | # Make sure the value looks like a p value.
expect_p_value <- function(p.value) {
expect_is(p.value, "numeric")
expect_lte(p.value, 1)
expect_gte(p.value, 0)
}
# Make sure we got a htest
expect_htest <- function(ht) {
expect_is(ht, "htest")
expect_p_value(ht$p.value)
}
# Make sure we got a venkatraman test
... |
53e5fcf252c8063f24dd5bd59090ce0f6abe952743a1f356fbd0196c07b88eae | R | 1,087 | 42 | #' Standardise a genotype matrix X.
#'
#' @param X A genotype matrix in dosage encoding 0, 1, 2.
#' @param type A character string indicating which type of standard deviation
#' to use.
#' @param impute Logical. Whether to impute missing values to zero (=mean
#' after standardisation).
#' @details{
#' type 1 (old Eigen... |
208aa6b6bd73bdcf3b68ee2d25261c4d15226c83307b7724d59db2abecc3259d | R | 1,088 | 41 | #' Shows the order in which metadata will be displayed
#'
#' Shows the order in which metadata will be displayed in the shiny app. This
#' helps users to decide if the display order is ok. If not, users can use
#' \code{reorderMeta} to change the order in which metadata will be displayed.
#'
#' @param scConf shinyce... |
91ee59c639bd68ca68ce3f411cb88a7bb25a3cf7152bb503ede1e52a274ad68f | R | 1,088 | 58 | ---
title: "Chromosomal Location of MSLc Primed genes"
output: html_document
date: "2025-04-15"
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r}
library(ChIPseeker)
library(dplyr)
library(ggplot2)
library(rstudioapi)
```
```{r}
samplefiles <- list.files(path = "../processed_data/genom... |
bef2a3dce9b6a208a266f19ad3574f3a3dac1ee0a2a5276e4cec60f510bbc9a2 | R | 1,097 | 45 | ##--------------------------------------------
## required packages
message("Load packages")
suppressPackageStartupMessages({
library(rmarkdown)
library(knitr)
library(devtools)
library(yaml)
library(BBmisc)
library(GenomicAlignments)
library(tidyr)
library(data.table)
library(dplyr)... |
31f02c6a53ba6d9bbab0bfcdc97a1a7198c63d038013991705078887cf9c4b33 | R | 1,106 | 43 | # TODO: Add comment
#
# Author: fec
###############################################################################
library(R6)
Outcome <- R6Class("Outcome", list(
status = NULL,
time = NULL,
ids = NULL,
center = NULL,
initialize = function(status, ids=NULL, time = NULL, cente... |
8163119a01cc7d2d8ac0551579764ddfbd42e0b47dac40e05f13a34244b138dd | R | 1,110 | 34 | # In this script we will be gathering pathology diagnosis
# and pathology free text diagnosis terms to select HGG
# samples for downstream HGG subtyping analysis and save
# the json file in hgg-subset folder
library(tidyverse)
# Detect the ".git" folder -- this will in the project root directory.
# Use this as the r... |
7265b5da05ccc5ef8c5513c900d3377f5cbf747b34e5fe80aa35b3b14107aad1 | R | 1,111 | 32 |
#This code will derive the paths input needed to conduct a melodic group ICA
#load data frame (df) that has the name of the subjects
#redundant comment
df <-read.csv("/Users/roggeokk/Desktop/Projects/nki_anx_vig_proj/nki_data/nki_df_vig_img_stai_groups_mastr.csv")
#select a randome sample of 50 subject for group ICA... |
538033a84dd5b03bae0133f83a83875eb32974c19e971214b7de27bd0226b2f4 | R | 1,115 | 29 | library(Matrix)
library(Seurat)
library(SeuratObject)
library(reticulate) # allows use of Python functions in R; for some reason having trouble with Rstudio using it
sc = import("scanpy")
# For some reason, when reticulate reads the CSR-formatted integer matrix in adata.X,
# it loads it into a dgRMatrix object, whic... |
d9c76a7c05cddaff98c0589e0089330da61dc0a2e1ffb99f8619e26df83fdf7b | R | 1,115 | 27 | library(ggplot2)
library(data.table)
library(cowplot)
setwd("/local/s8frgran/Space_MIce_SNC/Plots_For_Paper/")
# Load color scheme and theme
colors <- fread("../Plotting/colors.csv", strip.white = F)
color_v <- colors$Color
names(color_v) <- colors$ID
source("../Plot_theme.R")
# Load PVCA variance results
var <- rea... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.