sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
252e017153273ecad4c2afcde4d4dbf6b833cd58adcd634d7ed2d531e3f87421 | R | 1,743 | 39 | #!/usr/bin/env Rscript
args = commandArgs(trailingOnly=TRUE)
# test if there is at least one argument: if not, return an error
if (length(args)<2) {
stop("At least two arguments must be supplied: segment_ratios.txt and rowranges.txt
The third argument will be used to set the output directory and will be the c... |
4c4fe38ff624665d4dc4d3ca1504dace27859dbbe8438ca2585219ea3b964c8f | R | 1,747 | 48 | #!/usr/bin/env r
#
# a simple example to install one or more packages
## load getopt package from CRAN, or stop if getopt not available
stopifnot(require(getopt, quiet=TRUE))
## default values
repos <- "http://cran.us.r-project.org" # us mirror
lib.loc <- "/usr/local/lib/R/site-library" # this makes sense on Debian ... |
a9732f93f01bac6723df7afecb61e37cd8360e785d3f8d013c5b7c5c870764e3 | R | 1,747 | 62 | ## process AFM data obtained from experiment and calibration to apply to CafeMol calculation
## Usage: Rscript process_afm_init.R afm.txt
## afm.txt is the AFM data file in Angstroms unit
## the output will be an input file (.inp) for cafemol
#!/usr/bin/env Rscript
args = commandArgs(trailingOnly=TRUE)
#print(args[1]... |
c927fca6a7f5f6a53244f86c9564603a0f044fde6083846bdab0053041827e3b | R | 1,748 | 55 | #=====================
# Make phenotype file
#=====================
library(data.table)
library(magrittr)
library(readxl)
rosmap <- as.data.table(read_excel(
"/data_global/ROSMAP/greg_20200109/dataset_843_basic_01-09-2020.xlsx"))
ids <- fread("data/rosmap/rosmap_np.fam")
setnames(ids, c('V1', 'V2'), c('FID', 'IID'... |
eaadfbd6f4ee3903e94641557eb79c1fefc210790c89ae0817d66b23c0182057 | R | 1,749 | 48 | # File: keep_only_Li2017_IC50.R
# Author: Kelly Chang
# Date: Oct 2017
# Version: 1.0
#
# Description: R script to remove IC50 values from MCMC simulation outputs
# that were not provided in the article
# "Improving the in silico assessment of proarrhythmia risk ... |
388a8369e567a29796ff723bbc9db60fbc8aa7114f79deb7056f416d20459fa9 | R | 1,757 | 46 | plotReadCorr <- function(OldSegDat, NewSegDat, SigDat, DiffDat){
OldSegDat <- cbind.data.frame(OldSegDat, Type='Signal')
NewSegDat <- cbind.data.frame(NewSegDat, Type='Signal')
for(readId in unique(SigDat$Read)){
rOldSegDat <- OldSegDat[OldSegDat$Read == readId,]
rNewSegDat <- NewSegDat[NewSegDat$R... |
fbbc20052093ec31f11451acdd132fc7afa6c750c820c52aff89a365bc8a72a4 | R | 1,766 | 54 | #!/usr/bin/env Rscript
library(caret)
library(waveslim)
library(gtools)
args <- commandArgs(trailingOnly = TRUE)
outdir <- args[1]
observations <- as.integer(args[2])
Level=1
for (i in 0:(observations-1))
{
M <- read.csv(paste0(outdir,"/sweep_align_",i,".csv"), header = TRUE, row.names = NULL)
wS<-dwt.2d(a... |
ced81862c2155ad59de8fa5d16af743c9dfae952a35c05d8b1d13ff1d0d80896 | R | 1,767 | 42 | ## Spatial concordance / overlap
calculate_spatial_concordance <- function(usage_matrix_1 = path_to_usage_matrix_1, usage_matrix_2 = NULL, threshold_1 = threshold_1, threshold_2 = NULL){
matrix_1 <- usage_matrix_1
if(is.null(usage_matrix_2)){
matrix_2 <- matrix_1
}else{
matrix_2 <... |
80519f85ba515bbd3a2fb97ccaf14caeb364fc00ecabcbb61eff6d45903a8311 | R | 1,770 | 31 | library(Seurat)
library(swne)
load("/media/Scratch_SSD_Voyager/sammi/RNA_editing/Figure3_ADARKO_R1/KO_4ter_project_SO_annot_collapsed_ADARB1-1rm_20230207.rda")
KO_sub
adipgenes <- c("AXIN1","AXIN2","CEBPA","CEBPB","CEBPG","FABP7","KLF4","KLF6","SULT1E1","DLK1","FRZB")
stressgenes <- c("CASP6","CCN2","GADD45A","GADD45... |
060c7a3ce8b8e34b3a32d8982bbb25ef0cbc974c48dda4584f26a5f07360a0e2 | R | 1,772 | 53 | # published on http://www.r-statistics.com/2010/07/visualization-of-regression-coefficients-in-r
# originally written by "<a href="http://statmath.wu.ac.at/~zeileis/">Achim Zeileis</a>"
# GPL-2
coefplot <- function(object, df = NULL, level = 0.95, parm = NULL,
labels = TRUE, xlab = "Coefficient confidence interv... |
75c5c09a2aefba89a612bcd84b73a0b8044adfe80e79a33b491271ed98d33758 | R | 1,772 | 56 | #============================================
# Writes a vector of 95% CIs for odds ratios
#============================================
make_or_95_ci <- function(or, l95, u95, or_ref, round_digits=2,
flip_less_than_1=FALSE) {
require(data.table)
if (is.na(or)) {
output <- paste0(" -... |
358362630f27d6bcbe344ab48538e75d1d48920518c00f0b223a3edb040dd118 | R | 1,774 | 54 | ##-----------------------------------------------
## merge ordinal regression results into one dt
##-----------------------------------------------
library(pacman)
p_load(data.table, magrittr, stringi)
cargs <- commandArgs(trailingOnly = TRUE)
out_prefix <- "output/ordinal"
pheno <- "NPOLD2" # cargs[1]
# include trai... |
fd9b676c374f03157dd6570fefa6e7706eb586e9549416c12f1d040c175891b6 | R | 1,775 | 36 | ## This script appends a tree to CellWalkRs Random Walk
#joins in Polioudakis tree
cellTypesH = cbind(
c(-8, -9, -11, -12, 3, -5, 5, -14, -3, -2, 9, 7, -4, -7, -6),
c(-1, 1, 2, -13, 4, -10, 6, -16, 8, -15, 10, 11, 12, 13, 14))
#function to turn tree into matrix
treeMatrix = function(treeMerge) {
A... |
f0b20dc7564f61548a43e01e3a2d21cb6fa6b8d1dc5585a8479b7eaa42d412b7 | R | 1,778 | 78 | library(reticulate)
np <- import("numpy")
# devtools::install_github("emanuelealiverti/SOG")
# require(sOG)
# orthogonal-to-group decomposition
OG = function(
X,
z,
K = max(2, round(NCOL(X)/10)),
rescale = T) {
if(!is.matrix(X)) stop("X must be a matrix")
if(rescale) X = scale(X)
SVD = svd(X, n... |
f1afa76c13b504f81c806de503981e3a8f837a1104452ee504ec32559ba7d0fe | R | 1,778 | 42 |
library(data.table)
library(flextable)
library(magrittr)
library(stringi)
coloc <- fread("output/coloc/mega/coloc_results.txt")
coloc <- coloc[!duplicated(coloc)]
coloc_ts3_dt <- coloc[
PPH4 >= 0.8,
.(GWAS_Phenotype, Chromosome, QTL_Target, Tissue, QTL_Type, QTL_Source,
P_GWAS, P_QTL, PPH4)]
coloc_ts3_dt[, Ch... |
6f4098da70326ed7fd5b429366c9e643947955e06787a042e173a57d0a4b62a9 | R | 1,782 | 63 | #' Color coding legend for factors
#'
#' Modifies a list of lattice arguments (as for [lattice::levelplot()], etc.) according to
#' the factor levels. The colorkey will shows all levels (including unused), and the drawing colors
#' will be set accordingly.
#'
#' `trellis.factor.key` is used during `levelplot`-based plo... |
7670aea1e8029c0b21e9de894059b5ab4a1946a81383b7674566fc2ba10bd2d7 | R | 1,784 | 50 | # File: get_boot_data.R
# Author: Kelly Chang
# Date: Oct 2017
# Version: 1.0
#
# Description: Helper R function which computes the mean fractional current
# from Milnes protocol data. The data are resampled according
# to the specified cell indices.
#
get_boot_... |
aa82217357e75ba7324a05616ce0a6e06d28816ae7afd3ccaef66c326be23583 | R | 1,784 | 66 | # load libraries and arguments
library(scPred)
library(Seurat)
library(tidyverse)
library(WGCNA)
set.seed(1234)
args = commandArgs(trailingOnly = TRUE)
query_path = args[1]
model_path = args[2]
pred_path = args[3]
threads = as.numeric(args[4])
model_type = args[5]
# get path for other output
out_path = dirname(pred_... |
b9665feb95d482f3c7b90e7def308353750936c9b05f110ef0dd6c91eb2e0fbd | R | 1,784 | 63 | # Load dtplyr
library(data.table)
library(dtplyr)
library(dplyr, warn.conflicts = FALSE)
library(readr)
save.image("debug.RData")
clean_phenotypes <- function(data_path,
field_ids_path,
std_exclusions_path,
withdrawals_path,
... |
693738bf546ba3848f67ab2e4527e7af44b3ad5ebd654fe0793ed6892fff385b | R | 1,785 | 46 | # TMEM106B and GRN expression -> HS and TDP-43 vs other phenotypes
library(data.table)
library(readxl)
library(ordinal)
library(MASS)
np <- setDT(read_xlsx("/data_global/ROSMAP/greg_20200109/dataset_843_basic_01-09-2020.xlsx"))
rosmap <- fread("data/rosmap_data.csv")
rna_seq <- readRDS("data/rna_seq/rna_seq.Rds")
rna... |
0a68e9d00c9e5e04eb570fa122345d23eb6ad7922f82c3b47a18464af5b1eca4 | R | 1,787 | 55 | #!/usr/bin/env Rscript
method = Sys.getenv('CIRRO_SEURAT_CONVERTER') # either reticulate or SeuratDisk
if (method == '') {
method <- 'reticulate'
}
# if (method == 'reticulate' && !requireNamespace("BiocManager", quietly = TRUE))
# install.packages("BiocManager")
# if (method == 'reticulate' && !require('SingleCe... |
42034c7963c5ebc4d937d607eb0623e9dddfd25e9559711fde0385b1aec5d22e | R | 1,789 | 41 | #' contingency_element_variable_fun
#'
#' Helper to create contingency tables for variables - iteratively
#' This function takes a list element and a variable name as input and performs the following operations:
#' 1. Converts the list element into a table using rlist::list.table() function.
#' 2. Converts the table in... |
89cdb72248a7e9ed5e312231ad4858716390cf8f26b70ade7ac21b79a0cac1ac | R | 1,790 | 51 | #transform_positions_at_unnest.R
#' Updates plot positions of a plot during unnesting of data.
#' It uses the pos variable to create steps that will be added to the positional
#' variable of choice
#' @param data plot data
#' @param pos_col positional variable to be updated (x or y). Default x.
#' @param sequence... |
67397a23d8b26bc4ab40deeb38af727541ce02e26fd8c69b8bb3748a1e88616a | R | 1,793 | 39 | # call overlap methylation from f5c (or nanopolish) output
# nanodip variant (adapted from Euskirchen et al. 2017)
# tested with R 4.0.3
# J. Hench, IfP Basel, 2021
# test if there are 4 additional command line argments, if not, then terminate
args = commandArgs(trailingOnly=TRUE)
if (length(args)!=4) {
messa... |
fe1e76934071d8dd47664df84575cd30d9c6d626f17dc8facd2e52f0b0b4fe2e | R | 1,793 | 74 | ---
title: "Regional plot for *FADS2* from Savage et al. (2018)"
output: html_notebook
---
```{r setup, echo = FALSE}
library(readr)
library(EnsDb.Hsapiens.v75)
library(dplyr)
library(locuszoomr)
#LDlink_token <- scan("../../../", what = character())
LDlink_token <- scan(snakemake@params[["LDlink_token"]], what = ch... |
dd56e465d18a9ec2002a9603cc73d54981a9c02a7f044b6411e0fde92ee168f1 | R | 1,797 | 46 |
setwd('../data_raw')
folders = list.dirs(recursive = F, full.names = F)
for(participant in folders){
setwd(participant)
files=dir(pattern='.csv')
# Read the data of one subject
data = read.csv(files[1])
# Find the scanning onset
scanning_onset = data$Scanning_onset[2]
# Onset of images, rela... |
e8ea55094f8efb1d706f73c867aaf7c8c904df4ce36c58ff2023eaf2686bbce9 | R | 1,797 | 36 | # attempt to replicate results using Mayo CAA study data
library(data.table)
library(ordinal)
mccaa = fread("data/mc_caa/Metadata/MC-CAA_individual_human_metadata.csv")
mccaa_geno = fread("data/mc_caa/Metadata/MC-CAA_assay_snparray_metadata.csv")
dup_ids = c("18645", "18549", "815", "1287", "874", "3900", "925", "101... |
bdb03695e0f0704f4b1b74ac9cb11aa942c459d1a79ffb849c9fb22531553228 | R | 1,799 | 52 | library(dplyr)
library(ggplot2)
ds_path <- "HepG2_asb_analysis.tsv"
database <- "ADASTRA"
variants <- read.csv(ds_path,
sep="\t",
header=TRUE)
variants$pred_pref_allele <- ifelse(variants$pred_score > 0,
'ref',
... |
72abede67daea3f84635343eeaa5b6fca92d7dcdb82690ee9a50455d2bae32f8 | R | 1,802 | 59 | #################################################################################
###
### plotvoronoi - plot spectral maps with irregular point pattern
###
### plots intensity or extra data column over 2 extra data columns
#' @param use.tripack Whether package \pkg{tripack} should be used for
#' calculating t... |
d51fa173742de404b15da2c8c332862dc538fd5cb420fcd60e5076841b1ee3fd | R | 1,802 | 55 | #!/usr/bin/Rscript
# Clear workspace
rm(list = ls())
# Load libraries
if(!require(igraph)) install.packages("igraph"); library(igraph)
# Read phenotypic data
info <- read.csv("https://raw.githubusercontent.com/zchuri/BilingualBrainNet/main/Data/Phenotypic/phenotypic.csv")
atlas <- read.csv("https://raw.githubusercon... |
c2db64ae3340946b34d285176da7fd7a62b0c693cfa33dd1560f25b73631d945 | R | 1,806 | 72 | #' Return subset of pairwise object
#'
#' @description
#' The \code{subset} method returns a subset of a pairwise object.
#'
#' @param x An object of class \code{pairwise}.
#' @param subset A logical expression indicating rows to keep; missing values
#' are taken as false.
#' @param \dots Additional arguments.
#' @... |
bd3cec4ee66f273419be61a955e5342bf8eeaaa506aecdca74eb2ea813046b66 | R | 1,812 | 33 | #----Figure_S06_D---------------------------------------------------------------
#-------------------------------------------------------------------------------
# This is the code for Figure S06 Panel D for the connectivity analysis for
# Reinhard and Fukuda et al. 2024
#------------------------------------------... |
cdc00a172b4f2891afbe68c8c61d247c7f449c1e0b613a30ebf067e621c2d3bc | R | 1,813 | 64 | ---
title: "Reanalysis of Blood data"
author: "Jack Humphrey"
date: "08/05/2023"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(tidyverse)
library(patchwork)
```
```{r fig.width = 10, fig.height = 10}
d <- readLines(here::here("data/nachun_blood/gds_result.txt"))
d <... |
e545b1763708f7311d6b9c6b98321080f2417367b9b18f1752f5f0ba008410a0 | R | 1,814 | 44 | #' data wrangling for phylogenetic annotations with ggtree::geom_facet using geom_text
#'
#' @description
#' Returns a dataframe for phylogenetic annotations with ggtree::geom_facet
#' with options geom_text to concatenate all the tips that are represented
#' at each label (tip or nodes) and transform those as trin... |
7530ea22c25cfe2597ce02a73b42891e8a33acbc72dd9c87ab6a2c2146825c4b | R | 1,829 | 49 | # get significant gwas snp
library('SNPlocs.Hsapiens.dbSNP144.GRCh37')
library('BSgenome')
setwd('~/PF_25BR/data/')
meta_gwas <- read.delim('metadata.tsv')
rownames(meta_gwas) <- meta_gwas$gwasAcronym
mytraits=list(`Neuropsychiatric and behavioral`=c("sz3",'asd', "bip2", "mdd_wray", #"bdAndSczShared",
... |
eb5dfd000be22d931358e9fb660b75cbe207f245f8e659c41fca189e601da1fc | R | 1,829 | 55 | # Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
#'@name permtest
#'@title permtest
NULL
#'@name hypergeo
#'@title hypergeo
#'@description
#'calculates an approximation for the hypergeometric function for use in DEGage_pdf. Equival... |
805e1bc05ae78d23e6f853004e3609df458eef7d3e2c16cf59038a68979fb35a | R | 1,838 | 36 | # Loading libraries
library(Seurat) # v5.0.3
library(SeuratWrappers)
library(patchwork)
library(dplyr)
library(ggplot2)
library(speckle)
library(sctransform)
library(glmGamPoi)
stress.merged.filt <- readRDS("~/Downloads/scRNA/stress_merged_filt.rds")
stress.merged.filt.sct <- SCTransform(stress.merged.filt, verbose = ... |
c9f21096422d755ccdcdca476b0f7a5703241c25024b19cc098f616c71ff1c09 | R | 1,838 | 36 | # modified from compute_clusterdepth_head, GAR, University of Glasgow, January 2024
# set alternative to greater as we use t2 values.
# cluster matrix calculated separately as we use the permutation distribution to form clusters;
# otherwise assumes a unique threshold for all time points, which implies constant varian... |
9aba504ddd9836b900b577214397710a848707558dabb9e6384ce13b758f6877 | R | 1,844 | 36 | #written by menggeliu 2023.10.1
arg = commandArgs(T); info = arg[1]; outdir=arg[2]; sig=arg[3];
library(LAVA)
### Read in data
sum.id<-read.table(info,header=T)
siglist<-read.table(sig,header=F)
loci = read.loci("shared_loci")
input = process.input(input.info.file=info, # input info file
... |
043688d29efde07a15bfb4fee16ed851aaffea858ab9f0e3a895459e3ee1e597 | R | 1,846 | 81 | library(data.table)
library(tibble)
library(purrr)
library(dplyr)
# Will be the dataset "wang" or "pbmc"
dataset <- commandArgs(trailingOnly = TRUE)[1]
output_path <- "output"
# Load data
source("../utils/0-indices.R")
gene_indices <- read_gene_indices(sprintf("data/%s-gene-indices.txt", dataset))
genes_meta <- frea... |
b08c23d2449d4dd575daa57a40a2a2438dbc0b9f2a53479ac1a1dda12f6c7a44 | R | 1,848 | 55 | #!/usr/bin/env Rscript
# This script is used to extract segments from NVI consensus files insaflu
# from cath naming
# renaming segt_isolate.fasta
require(optparse)
library(tidyverse)
library(seqinr)
option_list = list(
make_option("--msa", action = "store",
type = 'character',
help... |
e889592ac85b9aaa841ebcd2e0127589a5c020c244d53d689cc802082774c012 | R | 1,849 | 61 | #' @name DEPRECATED-spc-rubberband
#' @concept deprecated
#'
#' @title (DEPRECATED)
#' Rubberband baseline correction
#'
#' @description
#' These \pkg{hyperSpec} functions are **deprecated** and not maintained any
#' more. You should not use these.
#' Currently they are present due to back-compatibility reasons ... |
554ef2054f379ba82bbe2616a962eb3dd90c910b0dd4407f6d0432d346df8e44 | R | 1,853 | 64 | # load library
library(data.table)
library(foreach)
library(doParallel)
library(tidyverse)
library(broom)
# read in the GReX files
da30 <- fread("./DA30_eur.csv", h=T)
da52 <- fread("./DA52_eur.csv", h=T)
# chage to data frames
da30 <- as.data.frame(da30)
da52 <- as.data.frame(da52)
# relabel rownames
row.names(da3... |
3f8938f7f2df0115417e6635fd30f94e221d874b5d4fc1b23b00c33504a282ed | R | 1,857 | 55 | library(tidyverse)
library(Seurat)
library(SeuratDisk)
library(scCustomize)
library(SingleCellExperiment)
library(scDblFinder)
pth <- file.path("data","counts")
fls <- list.files(pth)
lst <- map(fls, function(x) {
map(list.files(file.path(pth,x,"outs","per_sample_outs")), function(i) {
tryCatch({
.df <- Rea... |
3f723b90b9ab5be3e0983e9d5079eb12cd81affc35a892fd47fbd5d29eeb22ed | R | 1,859 | 54 | #' Launch shiny app
#'
#' Main autofocus function to launch shiny app.
#'
#' @param R R struct
#' @param anno_list Vector of annotations to extract from R struct
#'
#' @return None (launches app)
#'
#' @import shiny
#' @import shinydashboard
#' @import plotly
#' @import networkD3
#'
#' @export
run_autofocus <- function... |
dfefe8d79cfa58994021a75efd8d1d0fff47820bbd60e5d2400d65408b378737 | R | 1,860 | 50 | # File: process_patchclamp_data.R
# Author: Kelly Chang
# Date: Oct 2017
# Version: 1.0
#
# Description: R script for processing patch clamp data from Li et al. 2017
# to be used for Markov-chain Monte Carlo simulation and
# uncertainty quantification.
# ... |
e176c620e0e42c31d33680a6250a8e3db6c859c3dba923e1d2b5fdaf24389dee | R | 1,865 | 79 | library(progressr)
library(foreach)
# Will be the dataset "wang" or "pbmc"
dataset <- commandArgs(trailingOnly = TRUE)[1]
output_path <- "output"
library(data.table)
source("../utils/0-indices.R")
expression <- fread(file = sprintf("data/%s-pearson-resid.csv", dataset))
genesymbols <- expression$genesymbol
expressi... |
6ae2eaed832746aa19b15b5a0ef59cb7197eb3393b6ed30f71fc344f29d6c89a | R | 1,869 | 61 | # Auxiliary function for forest_dims()
#
# Package: meta
# Author: Nour Edin Darwish <nouredindarwish@gmail.com>
# License: GPL (>= 2)
#
forest_dims_internal <- function(x, units = "in") {
chklength(units, 1, text = "Argument 'units' must be of length 1.")
units <- setchar(units, c("in", "cm", "mm"), pre = "ei... |
d2d3076ecf13a24bb58de40804988067522a2efc85146439a567ade8f4c062c3 | R | 1,870 | 54 | test_that("drapery shows back-transformed tick marks for single proportions", {
m <- metaprop(1:5, 101:105)
pdf(tempfile())
on.exit(if (dev.cur() > 1) dev.off())
expect_silent(res <- drapery(m, xlim = c(0.001, 0.1)))
expect_silent(drapery(m))
expect_silent(drapery(m, xlim = NULL, ylim = NULL))
expect_sil... |
40d09d6dc1a350ca0b33ef7ad395481a27240ef140c961cde3f371bf340e4a79 | R | 1,873 | 55 | test_that("metareg three-level robust example runs", {
skip_if_not_installed("metadat")
data(dat.konstantopoulos2011, package = "metadat")
dat <- dat.konstantopoulos2011
dat$idx <- seq_len(nrow(dat))
dat$group <-
factor(ifelse(dat$district <= median(dat$district), "A", "B"))
ma <- metagen(yi, sqrt(vi)... |
b27a11d3108432ff9a71a82cd72eee14b071793d34fecc5af2a2c70b80c96b94 | R | 1,881 | 57 |
library(Seurat)
library(sctransform)
library(patchwork)
library(dplyr)
library(DoubletFinder)
library(snow)
ids <- readRDS("output/files/scGSEA/all_scGSEA_res.rds") %>% rownames()
ids <- paste0(ids, "-1")
for (i in Sys.glob("raw_h5/*")) {
print(i)
x <- stringr::str_split(i, "_")[[1]][3]
print(x)
... |
c23ed9b1e46d30e9bc869ceb5da7afb0bda2916a81b954c95b829fb2dc1946ec | R | 1,881 | 76 | #' Get default for a meta-analysis setting.
#'
#' @description
#' Get default for a meta-analysis setting in R package \bold{meta}.
#'
#' @param x A character string or vector with setting name(s).
#' @param unname A logical whether to remove names from attributes.
#'
#' @details
#' This function can be used to get ... |
f6b89ee96f47d95f709e4334c78cf26a682c66ce03a53f097caef3e8c558c2af | R | 1,887 | 52 | #' Class `hyperSpec`
#'
#' This package gives an interface to handle hyperspectral data sets in R.
#' Hyperspectral data are spatially or time-resolved spectra, or spectra with
#' any other kind of information associated with the spectra. E.g. spectral
#' maps or images, time series, calibration series, etc.\cr
#' The ... |
e7c60b42b49de9e526461c6035a3c6f80c997d8d4efc8eaa1d612ebcc37bd6c6 | R | 1,888 | 42 | minDPScore <- -250
plotRawDP <- function(zDat, fwdDat, tbDat, sigDat){
for(reg in unique(zDat$Region)){
tbReg <- tbDat[tbDat$Region == reg,]
regZDat <- zDat[zDat$Region == reg,]
regZDat$Score[regZDat$Score < minDPScore] <- minDPScore
zP <- ggplot(regZDat) +
geom_tile(ae... |
22bd88895dca73ab78189807cfb146129a4dac923ad39f7d29fc1b3e3838ea48 | R | 1,893 | 54 | #' Dimension reduction
#'
#' Wrapper function for dimension reduction on SPD matrices.
#'
#' @param X A list of SPD matrices.
#' @param method Method of dimension reduction. See details
#' @param ... See details.
#' @details Allowable methods are:
#' \itemize{
#' \item{"congedo": }{Method proposed by Congedo et al. 20... |
1a99c5ba547f1df69bdacdc8dad14a3bcbdc7fcaafadb9b932e94d75cc1e9d2b | R | 1,894 | 56 | # This file is part of AD-EV-characterisation.
# Copyright (C) 2022-2024 Emir Turkes, Stephanie Fowler, UK DRI at
# UCL, Columbia University Medical Center
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# ... |
fab0831dbbc2d026340503f04a2be4981375db05e96a40974cefd51e9c9a7655 | R | 1,897 | 81 | library(ArchR)
library(BSgenome.Hsapiens.UCSC.hg38)
addArchRThreads(threads = 8)
addArchRGenome("hg38")
# Load Data
adata = loadArchRProject('HumanBrain')
# Add scRNA Human
Human_scRNA = readRDS('../RDS_Seurat/scRNA_Human.rds')
adata <- addIterativeLSI(
ArchRProj = adata,
useMatrix = "PeakMatrix",
n... |
7ce2f50b31af830c61a3ccf73a1699429afb43d2749ff4586f13bae489a159c3 | R | 1,898 | 49 | #==========================================
# create linker file for rsids
#==========================================
library(data.table)
library(stringi)
library(argparse)
parser <- ArgumentParser()
parser$add_argument("--pvar", help = "PLINK2 .pvar file")
parser$add_argument("--bed", help = "BED file with variant ... |
8b355db2cff643965b8194c863cd6e576d14c4c79886ab90d3e07d89ed59724e | R | 1,901 | 77 | layout_colors <- function(layout, classes = NULL) {
bmj <- layout == "BMJ"
revman5 <- layout == "RevMan5"
jama <- layout == "JAMA"
#
# Colour schemes for layouts:
# - color1 - vertical line for common effect or random effects model
# - color2 - diamond for meta-analysis results
# - color3 - outer lines ... |
7003c9bc779d187c1c130ab27cb3833d8f5eb376c0269caa2dfffc397a204418 | R | 1,904 | 67 | #' Amlodipine for Work Capacity
#'
#' @description
#' Meta-analysis on the effect of amlodipine on work capacity.
#'
#' This meta-analysis is used as a data example in Hartung and Knapp (2001).
#'
#' @name amlodipine
#'
#' @docType data
#'
#' @format
#'
#' A data frame with the following columns:
#' \tabular{rl}{
#'... |
a025a745866a1434936ee268e0ceab3f80627c33064b09168a3393a11dd96542 | R | 1,904 | 49 | # loading libraries
library(Seurat) # v5.0.3
library(SeuratWrappers)
library(patchwork)
library(dplyr)
library(ggplot2)
library(sctransform)
library(glmGamPoi)
# Loading Seurat object
stress.merged.filt.sct.cca.umap <- readRDS("~/Downloads/scRNA/stress_merged_filt_sct_cca_umap.rds")
# Loading Libra libraries
library(... |
2383fdbf9533e82854d751b4e5aec559155357147278d8b91c082096d723cac7 | R | 1,906 | 49 | library(ROCR)
a=read.delim("all_crossvalidated_predictions_mESC.txt")
colnames(a)[2:3]=c("mESCPred","mESCActual")
c=read.delim("ensembl2geneName_v90_mm10.txt")
colnames(c)[2]="geneName"
a=merge(a,c,by=1,all.x=T)
a$PredAdj=predict(lm(mESCActual~mESCPred, a))
a$resid = a$mESCActual-a$PredAdj
nrow(a)
a = a[a$mESCActual ... |
bbb3262b0216b30bbeb5ec4707360cfd22c0733146ac600bff7317bb54973181 | R | 1,906 | 52 | library(AUCell)
### Load data
expr_file <- "Hs_all.gene_spectra_score.k_15.dt_0_10.txt" ### Mm_all.gene_spectra_score.k_15.dt_0_10.txt for mm10
exprMat <- read.table(expr_file, sep="\t", header = TRUE, stringsAsFactors = FALSE, row.names = 1)
rownames(exprMat) <- paste("GEP_",seq(1,nrow(exprMat)),sep="")
colnames(ex... |
7c00b4dd568972bbd51196386000c3e19c8cc3d4c65340709d07121cbdb1a7a6 | R | 1,910 | 79 | TE.seTE.ci <- function(lower, upper, level = 0.95,
df = rep_len(NA, length(lower))) {
#
# Check arguments
#
if (missing(lower))
stop("Mandatory argument 'lower' missing.", call. = FALSE)
if (missing(upper))
stop("Mandatory argument 'upper' missing.", call. = FALSE)
#
k <- le... |
20c466f011764c2764e5adc954ee3af3237ac156271d621b81c0888042841980 | R | 1,912 | 93 | library(tidyverse)
library(conflicted)
library(tabulizer)
library(glue)
farrer1997_path <- "~/Downloads/jama_278_16_041.pdf"
farrer1997_raw <- extract_tables(farrer1997_path, pages = 1)
test <- farrer1997_raw[[1]] %>%
as_tibble() %>%
slice(1:51) %>%
unite(study, c(V1, V2, V3), sep = " ") %>%
select(-V4, -V10... |
7225ff88656fac20de55594e59c3e9993041e47196c3379d9a8276867938dbb0 | R | 1,915 | 39 | # command line arguments, specifying input/output file names and phenotype subset
arg = commandArgs(T); ref.prefix = arg[1]; loc.file = arg[2]; info.file = arg[3]; sample.overlap.file = arg[4]; phenos = unlist(strsplit(arg[5],"-")); out.fname = arg[6]
### Load package
library(LAVA)
### Read in data
loci = read.loci(l... |
dba340d302b9edab9fbc21f1776810ddf83fbb6c4ee86c78d807609086b34d63 | R | 1,919 | 52 | ############################################
# Functions to prepare data (specifically, generate the PCs) from a list or a single batch.
#' @importFrom BiocSingular ExactParam
#' @importFrom BiocParallel SerialParam
#' @importFrom irlba irlba
#' @importFrom BiocNeighbors findMutualNN
#' @importFrom methods as
#'
#' @ti... |
e50e90fba12ecc859b41d375646a1e0e6532667fcce2680a6cda066013ac745e | R | 1,926 | 74 | #' Plot loadings of a reduced time-series
#'
#' This function is under active development. It is
#' meant to depict the loadings of components obtained by reducing
#' pupillary time-series, as to ease interpretation.
#'
#' @param name A string indicating the component to depict (e.g., "PC1").
#' @param data An object a... |
4a5c8a57d5d8892f63e36497a071cdcf22666a00ee971e898cca099d74247a93 | R | 1,937 | 44 | #' checkDymamicChips
#'
#' Generate a dataframe of summary infformation for each chip defined using makeDynamicChipsSF().
#'
#' Generate set of summary information about each chip defined by makeDynamicChipsSF() including
#' all the information in the sf object generated by makeDynamicChipsSF() and the number of column... |
970446fba2d87e842bae77a2bd7d6f4fac92fe31721eaa819c99838ea2bff8a1 | R | 1,937 | 64 | # load library
library(data.table)
library(foreach)
library(doParallel)
library(tidyverse)
library(broom)
# read in the GReX files
epen30 <- fread("/data/***/Epen30_eur.csv", h=T)
epen52 <- fread("/data/***/Epen52_eur.csv", h=T)
# change to data frames
epen30 <- as.data.frame(epen30)
epen52 <- as.data.frame(epen52)
... |
b98bd244a61a388784dfd71ac0af13a7d68605afe24b0310592439abe360ce44 | R | 1,938 | 46 | library(data.table)
library(ggplot2)
library(stringi)
dt <- fread("data/rosmap_data.csv")
dt[, caa_4gp := ordered(caa_4gp,
labels = c("None", "Mild", "Moderate", "Severe"))]
dt[, apoe := factor(apoe,
levels = c("apoe33", "apoe34", "apoe44",
"... |
3cb2ab532eaac1c66ae4dceb610c2eedd6cddb5ba84ea44cc01e76e6ad350a00 | R | 1,940 | 61 |
#' mochims_position_class_violins
#'
#' Coupling scatterplots.
#'
#' @param input_file path to MoCHI thermo model fit results (required)
#' @param annotation_file path to MoCHI thermo model fit results (required)
#' @param outpath output path for plots and saved objects (required)
#' @param colour_scheme colour scheme... |
a9c2410dfe3ed7658db4cf0cfcab594df1b144df022de0b587ddda3fb27ace9f | R | 1,940 | 73 | #' @title Spectral smoothing by splines
#'
#' @description
#' Spectral smoothing by splines.
#' @param spc `hyperSpec` object
#' @param newx wavelength axis to interpolate on
#' @param ... further parameters handed to [stats::smooth.spline()]
#' @return `hyperSpec` object containing smoothed spectra
#' @rdname spc-spl... |
d3fb2d07cb079e10935386a9fadf8b7bef8bb31191d748ae4eac7e92cfe96e34 | R | 1,951 | 35 | library(stats)
aei_table_df <- read.table('/media/Scratch_SSD_Voyager/sammi/RNA_editing/Figure3_ADARKO_R1/KO_4ter_AEI_byCT_byExp_20230510.txt', header = T, sep =',')
guide_order <- c("NTC","AAVS1","ADAR1","ADARB1","ADARB2")
# quick plot
df_aei_by_prtb <- data.frame(matrix(NA, nrow = nrow(aei_table_df), ncol = 3, dimn... |
73de26bf48cd6c1d4d80ac507adabdf0eeb7fea4cb97ee3914298cdb38b8e36e | R | 1,952 | 45 | library(GRAB)
library(data.table)
library(stringi)
source("code/functions/strip_alleles.R")
PhenoData = fread("data/act/act_np.pheno", na.strings = "-1")
covar_data = fread("data/act/act_np.covar")
PhenoData = merge(PhenoData, covar_data, c("FID", "IID"))
PhenoData[, diffuse_abeta := factor(diffuse_abeta, levels = c(0,... |
7f937931f5cb68bd688ea9ce86f6138e85fa67023069c4361b73928102e4069d | R | 1,956 | 63 | #### Notes ####
#### Libraries ####
library(dplyr)
library(ggplot2)
#### Sourced functions ####
#### Functions ####
# Plot tau distribution
plot_tau_distribution <- function(tau, prob, tau.low=NULL, tau.high=NULL, xlim=c(0.0,1.0), ylim=c(0.0,2.4)) {
if (is.null(tau.low) & is.null(tau.high)) {
quant <- quantil... |
3995ae165c7ff44e1a1d6e066cccb83a018d9995b005fb9d3dc0038a308e0c9e | R | 1,964 | 76 |
### -----------------------------------------------------------------------------
###
### .paste.row
###
###
#' @importFrom utils head tail
.paste.row <- function(x, label = "", name = "", ins = 0, i = NULL, val = FALSE,
...) {
.print.val <- function(x, range = TRUE, digits = getOption("digit... |
52eb17088d3d3d0d899c0e42e7583f2dadc422900965047ad5aa8cf32a4acad3 | R | 1,964 | 52 | #GBM-brain maaslin2 analysis heatmap
library(tidyverse)
library(dplyr)
library(here)
library(scales)
#load in results table
res <- read.csv(here("results", "tables", "baseline_microbiota_brain_maaslin_gbms_results.csv"))
library(forcats)
res$correct_name <- as.factor(res$correct_name)
res$metadata_newname <- o... |
bf815c415e2911ca6387712bca64ae89e5455e58f0dd3221922ab4477164a4ff | R | 1,964 | 41 | ---
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%"
)
```
# geodl <img src="man/figures/logo.png" align="right" width="132" a... |
3ea72eb8a994b4b0cd59b52b00097ef28d22e98d1b438127142606d8dc4cfe71 | R | 1,965 | 50 |
#' mochims__plot_additive_trait_inferred
#'
#' Plot inferred global epistasis.
#'
#' @param mochi_outpath path to MoCHI thermo model fit results (required)
#' @param input_dt data.table with model free energy estimates (required)
#' @param phenotype_name phenotype name (default:'PSI')
#' @param report_outpath output p... |
de4f95467ecf035e38664f3c7cf98db0967ad2b5dd80a9d835a034198a3da971 | R | 1,969 | 58 | #' prepare the matrix and cell labels for training
#' @description prepare the matrix and cell labels for training
#' @param obj SeuratObject
#' @param column which column of cell labels
#' @param state1 target cell type
#' @param state0 non-target cell state
#' @param prefix prefix of file to save data
#' @param speci... |
e28e06bb700ee17c36b004282cedd1573135b3dad34a07bf585acf6300c1ed2a | R | 1,971 | 81 | library(ArchR)
library('BSgenome.Mmulatta.UCSC.rheMac10')
addArchRThreads(threads = 8)
rheMac10_UCSC = createGenomeAnnotation(genome='BSgenome.Mmulatta.UCSC.rheMac10')
# Load Data
adata = loadArchRProject('MacaqueBrain')
# Add scRNA Human
Human_scRNA = readRDS('../RDS_Seurat/scRNA_Macaque.rds')
adata <- addItera... |
00ece3d2519a73d84a1ad0263db5174c91d5fa2fc052354b76723b40fd22a535 | R | 1,972 | 41 | library(data.table)
library(latticeExtra)
setwd("subsampled_10fold/")
files = list.files(path='.', pattern='trial', recursive=T)
# files = files[grepl("^2000|4000|6000|8000|10000|14000|16000",files)]
table <- as.data.frame(do.call("rbind", lapply(files, FUN=function(file){
cmd = paste("tail -2", file, "| perl -ne \'... |
b7f8c00788d3596de013ea7d0e3580d3b141ad6a76237492c5f83392bf5f2c48 | R | 1,973 | 63 | #' Caffeine for daytime drowsiness
#'
#' @description
#' Caffeine for daytime drowsiness (Cochrane Practice review)
#'
#' @details
#' Data come from the Cochrane Practice review on caffeine for daytime
#' drowsiness. Eight fictitous studies evaluate the risk of headaches
#' after drinking either caffeinated or decaff... |
5cb44186c65865300dddc2aed2dfdc0203bcc2dbef4cf97299a96b2569b14867 | R | 1,975 | 55 | #==============================================================
# Create covar file
#==============================================================
pacman::p_load(data.table, GENESIS, SNPRelate, stringi)
load('data/adc/mypcair.Rdata')
n_pcs <- 10
pcs <- as.data.table(mypcair$vectors[, 1:(min(32, n_pcs))],
... |
e357d770fa8a67ce59900d6d85be6bbaf349c9b083bac3662c3822a629ef24ec | R | 1,976 | 41 | library(data.table)
library(latticeExtra)
setwd("subsampled_10fold/")
files = list.files(path='.', pattern='trial', recursive=T)
# files = files[grepl("^2000|4000|6000|8000|10000|14000|16000",files)]
table <- as.data.frame(do.call("rbind", lapply(files, FUN=function(file){
cmd = paste("tail -2", file, "| perl -ne \'... |
5f519a357cb98ab96e65ee8e84cb2041014411dd541146f7d26c647956f775ef | R | 1,982 | 56 | #' collapsing_nodes_from_nodes_fun
#' Function to collapse nodes recursively using a named node label.
#' The function gets the tips descending for each node and then collapse
#' the tree. Does that for each node to collapse iteratively.
#' Note: Must replace collapsing_nodes_fun
#'
#' Returns a tree with collapsed no... |
d6c8c2c02dcd863b3160c4e622911fd6bc48e50b31c018c7fa681363c3dfc4c2 | R | 1,989 | 54 |
library(data.table)
library(magrittr)
library(flextable)
library(table1)
pord <- fread("data/mega/mega_np_ord.pheno", na.strings = '-1')
pbin <- fread("data/mega/mega_np.pheno", na.strings = '-1')
pheno <- merge(pord, pbin, c("FID", "IID"))
covar <- fread("data/mega/mega_np.covar")
covar_apoe <- fread("data/mega/mega... |
c4ccb53710b0d7478a86480bec2ec83e613c50415d1977101b0797703da31a97 | R | 1,994 | 42 | library(Matrix)
library(GenomicRanges)
library(readr)
# Step1: Get Overlapped SNCs of DA-cCREs
celltype_list = c('ASC', 'EX', 'IN', 'MG', 'ODC', 'OPC')
input_dir = '../DAcCRE/'
output_dir = 'Overlap_SNCs/'
SNC_file = '../SNCs_hg38_995-matched.txt'
SNCs_df = read_delim(SNC_file, '\t')#, col_names=FALSE)
SNCs_df = S... |
a64b3f6838718bed85f31874664a0c6c830f0d688b544bed9b511aadce74ace0 | R | 2,003 | 59 | # Tests for indirect effects using the mediation and lm.beta packages.
# For questions: theodore_turesky@gse.harvard.edu
# Inputs required:
data <- read.csv("/Users/salmon/Box/bch/Provide/structMeds2-inf.csv") # a *.csv file that contains measures needed for mediation
med1 <- "crp" # mediator name, must be consiste... |
a0e88fc14f35af1c0d82e3465c112af1f3cb76b2d0bdfcad83959852c97c5316 | R | 2,008 | 61 | # use packrat to manage package versions/dependencies (optional)
install.packages("packrat")
packrat::init(
infer.dependencies = FALSE,
enter = TRUE,
restart = FALSE)
# Get package specific versions (used in current analyses)
# otheriwse, replace "install_version" below (and version numbers)
# with simple call ... |
c235534462788bc339bdd677b826b277b816fccc55bc926d1c878cf238972032 | R | 2,008 | 49 | #' Create a simple plot with bootstrap values and labeled nodes (HELPER)
#'
#' This function takes a tree object and creates a simple plot where nodes are labeled and bootstrap values are added to the plot data.
#'
#' @param tree A phylogenetic tree object.
#' @param ... Additional arguments to be passed to the ggtree:... |
1a4e75f8718d3aaf09f5d86aa4b370d50047d2825107c22dd7383c620bdad75e | R | 2,009 | 70 | #custom volcano plot
#setwd(dirname(rstudioapi::getActiveDocumentContext()$path))
data <- read.csv("data/Neuron_wald_all_genes_nopseudo.csv")
logfc_cols <- "log2FoldChange"
pval_cols <- "padj"
data$log2FoldChange[is.na(data$log2FoldChange)] <- 0
data$pvalue[is.na(data$pvalue)] <- 1
data$padj[is.na(data$pad... |
38cb3e53282d5e06f2ed15de689f6b952b8fb3e4171cea0676d550c5e8d1c0fb | R | 2,036 | 57 | ---
title: "Astrocyte Integration, subclustering, Differential expression"
date: "2023-07-25"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
The following script was run on a GPU cluster. This is an example script for EC Astrocytes integration and processing. The same scr... |
5d463a19c04a6d7c839306016eede9783162e008392443f97c1da4f6426f9560 | R | 2,036 | 61 | is_installed_package <- function(pkg, func, argument, value,
chksettings = FALSE, stop = TRUE,
version = NULL) {
pkginstalled <-
suppressPackageStartupMessages(requireNamespace(pkg, quietly = TRUE))
oldpkg <- pkginstalled && !is.null(versio... |
9d8660a7567ef5b5e501959f022aea56a47e159561d190805083a0d4cc4ecc8c | R | 2,038 | 42 | library(dplyr)
library(maplet)
source(codes.makepath("autofocus/initialize.R"))
load(data.makepath("ROSMAP/processed_data/autofocus/rosmap_brain_3omics.rds"))
medication_columns <- 'medication_columns.xlsx'
names(Dm)<-rowData(Dm)$...1
names(Dp)<-rowData(Dp)$uname
Dmc <- Dm %>% # converting all medication columns to fa... |
2a849f49bc8071842111f81e10aa6f6a7820c8f7a2299d42c9d161fab22879de | R | 2,039 | 75 | library(URD)
library(zellkonverter)
library(Rhdf5lib)
library(HDF5Array)
library(scater)
library(dplyr)
library(scran)
# prepare ZF data ####
zf_urd<-readRDS('URD_Zebrafish_Object.rds')
zf_segment<-read.table('URD_Dropseq_Meta.txt',row.names = 1,header = TRUE) %>% .[-1,1:2]
zf_lineage<-read.table('URD_Dropseq_Meta.... |
1924b64cd2136466a2b8b626234ecfecb24ccbb24e7870a714069296cf708184 | R | 2,048 | 65 | #' prepare_duplicate_metadata_fun
#'
#' HELPER
#' Simple wrapper to allow preparation of metadata formating, that contains information for duplicates
#' @param tree a phylo object
#' @param metadata the original metadata
#' @param dup_file the file path that contains duplicated sequences as identified by seqkit
#'
... |
e11b2e6a7a5e5c69fe3b9e66c3875bda5de324ca41479f81d514652717d07b79 | R | 2,053 | 69 | is.valid.input <- function(x, type){
if (type == 'spd.mat'){
if (!is.numeric(x) | !is.matrix(x)) return(FALSE)
if (any(Im(x) != 0)) return(FALSE)
if (!is.spd(x)) return(FALSE)
} else if (type == 's.mat') {
if (!is.numeric(x) | !is.matrix(x)) return(FALSE)
if (any(Im(x... |
2b85555e580405de05a78a3f1f171a230ae1260de5bbe8790f017b4fbf83b619 | R | 2,058 | 77 |
#=========================================================================
# perform colocalization analysis between Braak and CERAD BIN1 locus
#=========================================================================
library(data.table)
library(magrittr)
library(coloc)
pheno <- fread("shared/nacc_rosmap_act_np_dic... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.