sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
fd1cdfddaebf557564a0e25d1d1581f7e6ecdeaa36a847a50183cc680c467b73
R
522
28
suppressPackageStartupMessages({ library(yaml) library(tidyr) library(arrow) library(dplyr) library(multidplyr) library(purrr) library(forecast) library(multidplyr) library(parallel) library(R.utils) library(readr) library(ggplot2) library(sjmisc) library(viridis) library(foreach) librar...
48d7446cf5a84441d23c80f537df9a2ab98373e9043b29bb3ba6cd8cf167e703
R
525
15
#' @title Computes polygenic scores as a genotype matrix multiplied by a matrix of weights #' @description Note that this is a low-level command. For applying estimated #' betas to new bfiles, refer to https://github.com/tshmak/lassosum#apply-validated-betas-to-new-data pgs <- function(bfile, weights, ...) { #' @rd...
d587dfcc981521c9dc2db360564173454b3687732fa2e776ffd6cfc5ed0072c8
R
525
22
#' Paracetamol spectrum #' #' A Raman spectrum of a paracetamol tablet. #' #' @name paracetamol #' @docType data #' @format The spectrum was acquired with a Renishaw InVia spectrometer from #' 100 to 3200 cm^-1 in step scan mode. Thus the spectrum has several #' overlapping wavelength regions. #' @author C. Beleite...
24d5154ccda1f03338eaf43b2331e6f548a0e86830c9816f2c396e149ca6e8da
R
534
35
library(ggplot2) csvPath = "./plots/Vascular_Endothelium_fix_Anatomical_Site,Age,Sex_rand_Donor_Harmony_Aligned_CoordsRegress_Protocadherin_PC_20_All_CellsFRIP=0.2_FRIT=0.05UMI=1000DL=0.5_k_20_peak_cds_MMresult/Vascular_Endothelium_SexM_Table.csv" myCSV = read.csv(csvPath) png('./plots/VascEndothPlot.png'...
c54cdd3a8865f8c67f59e27738ae9030ae88f07eff35bfd31495f0aef00db53e
R
535
9
#!/usr/local/bin/Rscript library(MetaCycle) meta2d(infile = "metadata.csv", outdir = "metaout", filestyle = "csv", timepoints = "Line1", minper = 1080, maxper = 1800, cycMethod = c("ARS", "JTK", "LS"), analysisStrategy = "auto", outputFile = TRUE, outIntegration = "both", adjustPhase = "predictedPe...
98adbd04cc57297657c4b15d1f891e4477cd106159dcc19cf6ed7abf9882eca8
R
537
16
setwd("/media/hansruedi/12TB_HD/Brain_region_final_12TB") library(ggplot2) library(Seurat) pbmc <- readRDS(file = "Exc_raw_NP_ET.rds") #Marker genes DefaultAssay(pbmc)<-"RNA" pbmc <- NormalizeData(pbmc, normalization.method = "LogNormalize", scale.factor = 10000) Idents(pbmc)<-"cell_type_high_resolution" ...
8c554190c7e2dddf763669daf382a6f0cb589b3b213afd8802ad554ff43d7653
R
539
9
# Load Libraries library(ImpulseDE2) source('/E-P-INs/Scripts/ImpulseDE2/ImpulseDE2.R') # ImpulseDE2 Analysis ImpulseDE2_RNASeq(comparisons = "/E-P-INs/RNASeq/ImpulseDE2/Comparisons/0hrs_3hrs_6hrs_12hrs_24hrs_48hrs_72hrs_RNASeq.ImpulseDE2_comparisons.csv", conditions = "/E-P-INs/RNASeq/ImpulseDE2/Con...
5705dc10cbf2cbadc5ceb569523867940120d08a71b6bd2f05107c9fa9574394
R
543
14
retrieveFASTAQID <- function(sequences, PE=FALSE) { if (PE) { sequencesID <- as.character(ShortRead::id(sequences)) #sequencesID <- substr(ShortRead::id(sequences),1,width(ShortRead::id(sequences))) #Use for PE reads sequencesID <- unlist(lapply(strsplit(sequencesID, " "),"[",1)) #Use for PE ...
853ce4277be59f1e22d4567288dbca53da937f67473cdb8e0694321bcd569d18
R
543
22
library(data.table) library(dplyr) ### MetS trait <- "MetS_lind" file_in <- "leadSNP.MetS_lind.txt" df <- fread(file_in, data.table= F, nThread = 1) write.table(df$SNP, paste0("leadSNP_list.", trait, ".txt"), sep="\t", row.names = F, quote = F, col.names = F ) ### MetS trait <- "MetS_walree" ...
769b47d434cdf81b0175812dcfd5daa5026c84eba013982f05bfaec8ae56469f
R
548
9
# Load Libraries library(ImpulseDE2) source('/E-P-INs/Scripts/ImpulseDE2/ImpulseDE2.R') # ImpulseDE2 Analysis ImpulseDE2_ATACSeq(comparisons = "/E-P-INs/ATACSeq/ImpulseDE2/Comparisons/0hrs_3hrs_6hrs_12hrs_24hrs_48hrs_72hrs_ATACSeq.ImpulseDE2_comparisons.csv", conditions = "/E-P-INs/ATACSeq/ImpulseDE...
6948f26268ea96c1551fb4a5de8ccaef21fe8aaff7a74ae03dd4250929beb793
R
549
9
# Load Libraries library(ImpulseDE2) source('/E-P-INs/Scripts/ImpulseDE2/ImpulseDE2.R') # ImpulseDE2 Analysis ImpulseDE2_H3K27ac(comparisons = "/E-P-INs/H3K27ac/ImpulseDE2/Comparisons/0hrs_3hrs_6hrs_12hrs_24hrs_48hrs_72hrs_H3K27ac.ImpulseDE2_comparisons.csv", conditions = "/E-P-INs/H3K27ac/ImpulseDE...
63951f00757c05bb79bbf8e05526a70de0cae36ea6d4aa255b795e7b4d9a673c
R
550
15
library(biomaRt) ensembl = useMart("ensembl", dataset = "hsapiens_gene_ensembl") gene_ids <- read.csv("../../Dataset/mart_export.txt", header = TRUE, stringsAsFactors = FALSE) # Extract the Ensembl IDs into a vector ensembl_ids <- gene_ids$Gene.stable.ID refseq_ids = getBM(attributes = c("ensembl_gene_id", "refseq_mr...
be8b1a6dceb1ee038f3f0af3ae5504b8a8b24db881dceef09d42bd00d4bc0103
R
559
17
splitvec.from.bfile <- function(bfile) { #' Function to create split vectors from the info in vectors of bfiles #' @keywords internal pvec <- attr(bfile, "p") Pvec <- attr(bfile, "P") if(is.null(pvec) || is.null(Pvec)) { stop("Since v0.4.3 bfile should have the attributes 'p' and 'P' if it is a vector") ...
dafbc87fefe12876344f7e893ca8e0222e3e142cf9aded075868cfff14adb6ac
R
561
19
options(bitmapType='cairo') args <- commandArgs(TRUE) wd<-args[1] pvalueString<-args[2] replicateMean<-as.numeric(args[3]) replicateStdev<-as.numeric(args[4]) pvalues<-unlist(strsplit(pvalueString,",")) pvalues<-as.numeric(pvalues) ksTest<-ks.test(pvalues,pnorm,mean=replicateMean,sd=replicateStdev,alterna...
ee7df497f0479ec4892cc06b0508fce84d7157b6f4de381096e3a60550047411
R
561
14
library(dplyr) library(tidyr) setwd('~/hail/hail-files/SV') args = commandArgs(trailingOnly=TRUE) cn <- args[1] infile <- paste('SV-results/', cn, '-SV-inher-aggregated', sep ='') results <- read.table(paste(infile, '.tsv', sep =''), header=TRUE, sep = '\t') bed <- results %>% dplyr::select(SVloc, name) bed <- bed %>...
dc90ebf000ef82b9f3c64bdb15583b002036bfe050258c4347cec6c4453e833a
R
566
15
# Generated by using Rcpp::compileAttributes() -> do not edit by hand # Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 designTTest <- function(ints, design) { .Call(`_permFDP_designTTest`, ints, design) } permFDRAdjust <- function(expPs, threshold, design, intOnly, nPerms, nc, nt) { .Call(`_permFDP_per...
1585ccd481647b8ab9f99b6f00bd8ec4ce999ece4a4140f2bd68d4932e792f50
R
568
15
f <- function(x, output) { testor=rbind(c(as.numeric(x[2]),as.numeric(x[3])),c(as.numeric(x[4]),as.numeric(x[5]))) capture.output(fisher.test(testor,alternative="greater"), file = paste(x[1],"tests1.txt",sep=".")) foo=fisher.test(testor,alternative="greater") capture.output(foo$estimate[1], file=paste(x[1],"FisherOR.tx...
c3caa44d73ca8739a78f65fd8748cc40a307c3101dd5368199920559bce4829d
R
583
15
# Function that takes in full path to CSV file of FANC IDs and writes to a CSV # file in the same folder the latest FANC IDs # Expects no header for CSV file csvFancIDsToLatest <- function(csvFilePath) { # read in CSV file csvData <- read.csv(csvFilePath,header=FALSE, colClasses='character') # for each of th...
bc54598da1e19e20809d24b3894f7a68b5a6b3207e4e79452b1c4913ed5c16d9
R
588
18
#' @title Obtains the number of individuals in a PLINK bfile #' #' @param bfile Plink file stem #' @return an integer with the number of rows #' #@keywords internal #' @export nrow.bfile <- function(bfile) { famfile <- paste0(bfile, ".fam") if(!file.exists(famfile)) stop(paste0("Cannot find ", famfile)) return(...
e3d0f8087235a4090ed9c7d13365e61154d65b4424a7672cc70f0b56a3cd98b7
R
592
22
options(bitmapType='cairo') args <- commandArgs(TRUE) cwd<-args[1] inputFile<-args[2] jobName<-args[3] setwd(cwd) data<-read.table(inputFile,header=T,sep="\t",comment.char="#") dat.df <- data.frame(evr = data$evr,eigenvector = data$eigenvector) # turn into percent dat.df$evr<-dat.df$evr*100 pngfile<...
e568b76ba5fb8bf8f4b1529abde841aaaff55a8d02ddb0f5049de2c7cda6bc33
R
592
24
rm(list=ls()) b<- ("Z:/Shared/zhenzhen/VBN/handle") savepath <- "Z:/Shared/zhenzhen/VBN/result/" functionpath <-"Z:/Shared/zhenzhen/VBN" functionname <-'gretna_heritability.R' setwd(functionpath) source(functionname) library("R.matlab") { Files<-list.files("Z:/Shared/zhenzhen/VBN/handle") ACEresults <- lis...
0070ce5b0da9faf36a15ef3b2e52df659951733827b144475dc11881ab8a5d84
R
594
20
options(bitmapType='cairo') args <- commandArgs(TRUE) inputFile<-args[1] inputFileName<-basename(inputFile) myTable <- as.matrix(read.table(inputFile, header=TRUE, sep = "\t",row.names = 1,check.names=FALSE),check.names=FALSE) pngfile<-paste(inputFileName,".png",sep='') png(pngfile,height=800,width=800) ...
409b2ce96c3b71d121b1fe8afdb52933ba12f557ece0518fd23f8c47cd26d85d
R
595
15
# Function that takes in full path to CSV file of FlyWire IDs and writes to a CSV # file in the same folder the latest FlyWire IDs # Expects no header for CSV file csvFlywireIDsToLatest <- function(csvFilePath) { # read in CSV file csvData <- read.csv(csvFilePath,header=FALSE, colClasses='character') # for e...
ff06790ecb7f20869910f90d47977bd9242b708be99b153d910cbd33d3fbb20d
R
595
19
#' @title Obtains the number of column (SNPs) in a PLINK bfile #' #' @param bfile Plink file stem #' @return an integer with the number of columns #' #@keywords internal #' @export ncol.bfile <- function(bfile) { bimfile <- paste0(bfile, ".bim") if(!file.exists(bimfile)) stop(paste0("Cannot find ", bimfile)) ...
404596082db302e8b32a6f0bace2d405db65483100b5627257d2730b37f109ed
R
597
24
#' Quinine fluorescence spectra #' #' Fluorescence spectra of different dilutions of quinine forming a #' calibration set. #' #' See the vignette: `vignette("flu", package = "hyperSpec")` #' #' @name flu #' @docType data #' @format The data set has 6 fluorescence emission spectra measured on #' quinine concentrations...
2146903c0070cbf6c698c524f1f8bf7e5dbe33a4f229d4679db62f316a128788
R
598
10
test_that("run_spm_sepjobs final tracking reuses one terminal job status", { spm_path <- source_tree_file("R", "spm_utils.R") lines <- readLines(spm_path, warn = FALSE) expect_true(any(grepl("if [ $job_failed -ne 0 ]; then", lines, fixed = TRUE))) expect_true(any(grepl("job_status=\\\"FAILED\\\"", lines, fixed...
50e9a579779b4249374e2f80d3544da056b48906c44badaeda50068f847d2fae
R
602
18
plot.validate.lassosum <- function(obj, legend.x="bottomright", log="x") { #' @title Plot function for \code{validate.lassosum} objects #' @export t <- obj$validation.table if(!any(is.finite(t$value))) return(invisible(NULL)) # If nothing to plot plot(unlist(t$lambda), unlist(t$value), type="n...
c29f11900b3a648df03b9bf7776f2fa74d6eb6fcba48328bd1e74763349bdf13
R
607
22
library("tidyverse") library("data.table") setwd("./Step6.DEG/DEGs") # Load the combined DEG files DEGFileCombind <- readRDS("DEGFileCombind.rds") DEG.tables <- list() for (i in 1:length(DEGFileCombind)){ df <- DEGFileCombind[[i]] deg.sum <- setDT(df)[, .(DEG.number = .N), by = "DEG"] deg.sum <- drop_na(deg.su...
df7c94e7a9596a557263c4cff2df0e11986e580b17d9ee3209e01a009ccce498
R
613
20
options(bitmapType='cairo') args <- commandArgs(TRUE) inputFile<-args[1] jobName<-basename(inputFile) tmpData<-read.table(inputFile,header=T,sep="\t") pngfile<-paste(jobName,".png",sep='') png(pngfile,height=800,width=800) plot(tmpData$interactionDistance,tmpData$correlation,main="correlaton per distan...
fd79fadddf5241fb76e750362eb734d62610e1f733d02b3f594ae8ce202c0618
R
617
28
## Identify PRS outliers library(data.table) in_dir <- "/path/to/prs_comb" get_prs_n_files <- list.files(path=in_dir, pattern="*_eur.txt") prs_ids <- gsub("_full_eur.txt", "", get_prs_n_files) ## Identify sample IDs passing global PGS outlier threshold get_out <- lapply(prs_ids, function(prs_i) { ## Get PGS get...
1abb4a4206b227bba20867e03a09e3fe2780a2d8a5e17f0fe49494e2820af928
R
619
26
require(testthat) require(Cardinal) context("findNeighbors") test_that("findNeighbors", { pos <- expand.grid(x=1:9, y=1:9) pos <- PositionDataFrame(coord=pos) nb <- findNeighbors(pos, r=1) nb2 <- findNeighbors(pos, r=1, metric="euclidean") nb3 <- findNeighbors(pos, r=2, metric="euclidean") nb4 <- findNeighbor...
9e98c3f86a52b3de186d57553cf061a8d06081a3fb782ecbc27bc3aec3f225d8
R
622
22
#' archstabms__format_dir #' #' Plot fitness versus growth rate. #' #' @param dir_suffix directory suffix (required) #' @param stagenum stage number (required) #' @param base_dir base directory (required) #' @param no_digits number of digits to use for stage number #' #' @return Absolute directory character string #' ...
d2146990d01199fda445beaee0f715fab20cfd623d767c0ece2f05d1984a8bf6
R
636
15
calculateScore <- function(observations, predictions){ TruePositive <- sum(observations & predictions) FalsePositive <- sum(!observations & predictions) TrueNegative <- sum(!observations & !predictions) FalseNegative <- sum(observations & !predictions) PositivePredictiveValue <- TruePositive / sum(predicti...
23b53122d71a640a301c5934df809422ba8ae2822c9ac657355f1e57190f5cac
R
643
13
library(readr) glm_multi_beta_binomial = read_file("inst/stan/glm_multi_beta_binomial.stan") save(glm_multi_beta_binomial, file="data/glm_multi_beta_binomial.rda", compress = "xz") glm_multi_beta_binomial_generate = read_file("inst/stan/glm_multi_beta_binomial_generate_date.stan") save(glm_multi_beta_binomial_gener...
2813960da3736b02b68893b987a56046b67bf788e9d2f436b546b6cb0f619f28
R
644
20
# Function that takes in full path to CSV file of FANC IDs and writes to a # specified folder all the change logs for those IDs # Expects no header for CSV file csvFancChangeLog <- function(csvFilePath, outPath) { # read in CSV file csvData <- read.csv(csvFilePath,header=FALSE, colClasses='character') # set...
cfedd601ba1a78f049b6b3cd8d22fe65de65c2cd3d9a4349218e12d848dd0b25
R
646
22
# clear() # Tim.load(Rplink) # setwd(attachroot("~/WORK/myRpackages/lassosum/tests/")) # load_all() # # library(data.table) # bfile("../inst/data/refpanel") # n <- nrow.bfile(.bfile) # set.seed(1000) # pheno <- rnorm(n) # nfolds <- 3 # ss <- cp.plink.linear(bfile=.bfile, nfolds=nfolds, pheno=pheno) # # ld <- fread("....
d2efc7251096fb958c7c6a407d481c032d1511dcdb915b4fb0f65f09790e35dd
R
671
21
test_that("no data available", { analyser = test_analyser() no_df = NULL expect_warning(analyser$setData(no_df), "No data available to generate plots.") }) test_that("data available", { analyser = test_analyser() expect_equal(length(analyser$plots), 0) expect_equal(length(analyser$plot_data), 0) dfs = l...
03cd96d1339f6c66cdc6c05cd6df6663497fb36eed2abbe60f5f0cb7e217825c
R
676
25
library(data.table) library(dplyr) # IV list file_in_iv <- "MetS_exposure_IV_list.csv" df_iv <- fread(file_in_iv, sep=",", data.table = F, nThread = 10) iv_list <- df_iv$SNP # MetS no-UKB GWAS file_in <- ".MetS_noUKB_GWAS.csv" df <- fread(file_in, sep=",", data.table = F, nThread = 20) %>% filter(SNP %in% iv_lis...
f7df3cdfa2115a45c05dda86077c8b7f2e64bb6f2949e943ebc0056d1f852598
R
677
23
# clear() # Tim.load(lassosum) # Tim.load(Rplink) # Tim.load(mysimtools) # useWTCCC() # pl <- cp.plink.linear(bfile=.bfile, chr=22, nfolds=2, # pheno=rnorm(nrow.bfile(.bfile))) # # # Fake sumstats # bim <- read.bim(.bfile) # bim22 <- subset(bim, CHROM==22) # n <- 1000 # samp <- sample(nrow(bim22...
341da9efe43bac922150eed0e2eed12f8a50e6b0f184bfd3708905cd2601535f
R
683
50
library("optparse") source("/net/trapnell/vol1/home/readdf/trapLabDir/fibrosis/results/2020_12_29_SymSim_Power_Work/simFuncsDavidMod.R") print("Starting Now") option_list = list( make_option(c("-i", "--indiv"), action="store", default=3, type="integer", help="number of individuals per group"), make_option(c("...
a3e3978e3a6484dc82afb34067c8adaa192862268e1b4328142b868ce906b375
R
692
19
# Tmisc() # setwd0("~/WORK/myRpackages/lassosum/inst/data/") # for(pop in c("EUR", "ASN", "AFR")) { # # pop <- "EUR" # bed <- read.table.tim(paste("Berisa", pop, "hg19", "bed", sep=".")) # l <- liftover(bed$chr, bed$start, bed$stop, from=19, to=38, bedformat = TRUE) # chrs <- unique(l$chr) # ll <- lapply(chrs...
25abed2866c84dd5b20ff8d5acdbb97fbb6d423625a2c59e6b265be9d15430c6
R
697
22
#!/usr/bin/env Rscript #--------------------------- # R package check for SV-pipeline # Talkowski Laboratory # # Harrison Brand and Joseph Glessner # Update June 2017 #--------------------------- #Loads required packages; installs if necessary RPackages <- c("caret", "fpc", "optparse", "plyr", "MASS","ROCR", "zoo","d...
db2042492138a9832c16933ab7efd479f59b6872987a8efa7d4b8c32749bca22
R
703
31
# install.packages("tidyverse") # install.packages("lmSupport") # install.packages("gmodels") # install.packages("ez") # install.packages("psych") #--------------------------------------------# # change dir setwd("X:/07. Manuscripts/In preparation/Harnessing neural synchrony") # load dataset data2load = 'd...
d4580769a1d227a13d121e926d075c0cf482a3e81575fcb87c86860a57579738
R
708
31
#' @name DEPRECATED-pearson.dist #' @concept deprecated #' #' @title (DEPRECATED) #' Distance based on Pearson's \eqn{R^2}{R squared} #' #' @description #' #' This function is **deprecated**. #' Use [dist_pearson()] instead. #' #' @param ... Passed to [dist_pearson()]. #' #' @export pearson.dist <- function(......
22c802ef15b08363698906477f73a90d0f8fde7b33f4f1cd2531b59493bdd8b4
R
726
28
library("tidyverse") library("data.table") setwd("./Step8.SubCluster.DEG/DEG.random") FileList <- list.files(pattern = "Random.DEG.csv") Celltypes <- gsub(".Random.DEG.csv", "", FileList) DEGFileCombind <- list() for (i in 1:length(Celltypes)){ dat <- read.csv(FileList[i], row.names = 1) setDT(dat)[, fdr:= p.adj...
fc0cb2e3065c56e1a0cb1c578d1725c4be7f15fbe615b232fafafd6396f5c956
R
726
33
require(testthat) require(Cardinal) context("sliceImage") test_that("sliceImage", { path <- CardinalIO::exampleImzMLFile("continuous") s <- readImzML(path) s1 <- s s2 <- s runNames(s1) <- "run0" runNames(s2) <- "run1" s <- cbind(s1, s2) mz <- mz(s)[1:2] rs1 <- sliceImage(s, i=1) rs2 <- sliceImage(s, i=1:2...
584cff49a14cc03eb7c8ffbf92a8e1edcd3f476ffcb872bbad98b5b782145122
R
728
26
train_ae <- function(torch_dl, torch_model, torch_optim, #adv_model, adv_optim, n_epochs_total) { torch_model$train() for (epoch in 1:n_epochs_total) { loss_recorder <- 0 coro::loop(for (item in torch_dl) { torch_optim$zero_grad() outp...
60daa88006ae0d361742e9dd78f127edc6791665337b685b940fac1bab5cb396
R
728
23
## HiC-Pro ## Copyright (c) 2015 Institut Curie ## Author(s): Nicolas Servant, Eric Viara ## Contact: nicolas.servant@curie.fr ## This software is distributed without any guarantee under the terms of the BSD-3 licence. ## See the LICENCE file for details ## Install R packages for HiC-Pro...
d318abdc371beec55c42546361f53fb817ae60464543d7bc94d48c7f10ba23fe
R
728
20
test_that("lookup_* functions work correctly on a valid 4D NIfTI file", { skip_if_not_installed("RNifti") # Create synthetic 4D image with known dimensions dims <- c(5, 6, 7, 8) img_data <- array(rnorm(prod(dims)), dim = dims) img <- RNifti::asNifti(img_data) tmpfile <- tempfile(fileext = ".nii.gz") RN...
9f16391820b1e7671d1bf131c14140128fb2abd141177dfc9c2d1622beed06eb
R
732
19
# getPresynCSVsFlywire.r # # Function that generates CSV files of input neurons to neurons of interest and # the number of synapses they make # getPresynCSVsFlywire <- function(rootid, thresh, cleftThresh, csvFilePath) { thisID <- fafbseg::flywire_latestid(rootid) theseInputs <- fafbseg::flywire_partner_summa...
aaa0236c41d65643d37ac11fb321e6a7eb59aeeb5ca3f0e30215ff78aaa4cfec
R
734
27
require(GenomicSEM) library(data.table) NAME <- "MetS" model <- "F1 =~ NA*BMI_GIANT18 + WC_Watanabe_UKB F2 =~ NA*T2D_meta_FinR7_Mahajan22_MVP + FG_Lagou_MAGIC_noUKB + HYP_meta_FinR7_UKB F3 =~ NA*HDL_rev_GLGC + TG_GLGC MetS =~ NA*F1 + F2 + F3 MetS ~~ 1*MetS F1 ~~ 1*F1 F2...
e018dee9cd1264db105755c0fe83ccb41afa0f91f34ba0fd5cd3a760ec2d67e0
R
734
29
library("tidyverse") library("gprofiler2") library("data.table") library("BiocParallel") # load the DEG datasets setwd("./Projects/SNCSynuclein") # load the DEG files DEGFileCombind <- readRDS("Step6.DEG/DEGs/DEGFileCombind.rds") Cluser <- names(DEGFileCombind) DEGdf <- list() for (i in 1:length(DEGFileCombind)){ ...
8ede75b61f0a16925dd1419f7da212b3600a5ee0e036e278594954bffa97a06f
R
736
27
require(GenomicSEM) library(data.table) NAME <- "MetS_EVEN" model <- "F1 =~ NA*BMI_GIANT18 + WC_Watanabe_UKB F2 =~ NA*T2D_meta_FinR7_Mahajan22_MVP + FG_Lagou_MAGIC_noUKB + HYP_meta_FinR7_UKB F3 =~ NA*HDL_rev_GLGC + TG_GLGC MetS =~ NA*F1 + F2 + F3 MetS ~~ 1*MetS F1 ~~ 1*F1 ...
fe8eaa655783ea55f63afe166f4ff4da4db7958aae942f774b54698a13c8e53c
R
747
28
# getNTpredFlywire.r # # Function that generates text files of neurotransmitter summary, given csv file # of IDs (e.g. processedNeurons.csv from genPresynCSVsFlyWire.r) # getNTpredFlywire <- function(neuronsCSVpath, cleftThresh, outPath) { # read in csv file csvData <- read.csv(neuronsCSVpath,header=TRUE, colCla...
6f8fd30e38f7b8f31a87d8a358dd8eaa258179283affee7b67241282f689a31a
R
748
22
#' @title Function to convert p-values to correlation via the t-statistic #' @param n Sample size #' @param p Vector of p-values #' @param sign A vector giving the sign of the correlations (e.g. the log odds ratios) #' @param min.n The minimum sample size to be considered a valid p-value #' @return A vector of correlat...
8f512ed137c29387f4ed8aad2796f6c28cdfd3e4710236b272fcfc767ddad678
R
748
29
library("tidyverse") library("data.table") setwd("./Step6.DEG/DEGs") FileList <- list.files(pattern = "Random.DEG.csv") Celltypes <- str_split_fixed(FileList, "\\.", n = 4)[, 1] DEGFileCombind <- list() for (i in 1:length(Celltypes)){ dat <- read.csv(FileList[i], row.names = 1) setDT(dat)[, fdr:= p.adjust(`Pr..C...
4857c5ed6bc25ceb3fd8c36fc5e7ce5f61b27477ff41fee6e9fd5cf2a337de70
R
749
28
require(GenomicSEM) library(data.table) NAME <- "MetS_noUKB" model <- "F1 =~ NA*BMI_GIANT15_noUKB + WC_GIANT_noUKB F2 =~ NA*T2D_meta_FinR7_MVP_noUKB + FG_Lagou_MAGIC_noUKB + HYP_FinR7_noUKB F3 =~ NA*HDL_rev_GLGC_noUKB + TG_GLGC_noUKB MetS =~ NA*F1 + F2 + F3 MetS ~~ 1*MetS F1 ~~...
0bac532c3c79c6cc4b50eec402cc845c497105e296627411ff01638a9a897005
R
750
29
#' Mark peak #' #' Marks location of the *first* spectrum at the data point closest to the #' specified position on the current plot. #' #' @param spc the `hyperSpec` object #' @param xpos position of the peak(s) in current x-axis units #' @param col color of the markers and text #' #' #' @author R. Kiselev #' #' @conc...
a70ad11f9f9b46c193e1ac861a5a2889f787223753a287abacb409b82c57be5a
R
757
26
#' archstabms__mann_whitney_U_wrapper #' #' Mann-Whitney U test #' #' @param vals1 sample 1 (required) #' @param vals2 sample 2 (required) #' #' @return named vector with effect size (AUC) and p-value obtained from coin package #' @export archstabms__mann_whitney_U_wrapper <- function( vals1, vals2 ){ if(leng...
000de6bdfb653c86abd746700356f67063d4b7fe3aed985a7ebf4e6e17a97321
R
758
35
#' archstabms__pvalue #' #' Obtain P-value from z test or t test #' #' @param av sample mean (required) #' @param se sample standard error (required) #' @param degreesFreedom an integer degrees of freedom (default:5) #' @param mu population mean (default:0) #' @param testType type of test: either "ztest" or "ttest" (d...
5b6db069878ae87374a51de45819d8e36614b86747d1bb0f5a700cf2b693b7e7
R
759
28
require(GenomicSEM) library(data.table) NAME <- "MetS_noUKB_EVEN" model <- "F1 =~ NA*BMI_GIANT15_noUKB + WC_GIANT_noUKB F2 =~ NA*T2D_meta_FinR7_MVP_noUKB + FG_Lagou_MAGIC_noUKB + HYP_FinR7_noUKB F3 =~ NA*HDL_rev_GLGC_noUKB + TG_GLGC_noUKB MetS =~ NA*F1 + F2 + F3 MetS ~~ 1*MetS ...
2458b5a4ff8a7ff54366bfc5cb7f2c390d94097a5a2169be974311e3a5005cc1
R
780
11
geno_last_joined<-read.csv(file="../geno_hema_joined.uniq.last.within3years.csv") m<-lm(anemia_who~rs679515_dosage*ceradsc+msex+educ+age,data=geno_last_joined) capture.output(summary(m),file="ceradsc.output.txt",append = F) m<-lm(hemacrit~rs679515_dosage*ceradsc+msex+educ+age,data=geno_last_joined) capture.output(summa...
49dbc9dd4762aee036d831efdaab02268f281c5d89b32ecf5d3de4f75d0c5759
R
780
11
geno_last_joined<-read.csv(file="../geno_hema_joined.uniq.last.within3years.csv") m<-lm(anemia_who~rs679515_dosage*caa_4gp+msex+educ+age,data=geno_last_joined) capture.output(summary(m),file="caa_4gp.output.txt",append = F) m<-lm(hemacrit~rs679515_dosage*caa_4gp+msex+educ+age,data=geno_last_joined) capture.output(summa...
c98026e627ce278190093f3daf053a1d3f4d87adeb5980e8f2809e345e2d16bc
R
780
11
geno_last_joined<-read.csv(file="../geno_hema_joined.uniq.last.within3years.csv") m<-lm(anemia_who~rs679515_dosage*braaksc+msex+educ+age,data=geno_last_joined) capture.output(summary(m),file="braaksc.output.txt",append = F) m<-lm(hemacrit~rs679515_dosage*braaksc+msex+educ+age,data=geno_last_joined) capture.output(summa...
11040199013ac16532afffe7e64312e96874802b796b4fd38e51311758695920
R
789
31
setwd('~/multiome') library(ArchR) library(parallel) addArchRGenome("mm10") proj <- loadArchRProject('/ArchR/clusters_shendure') saveArchRProject(proj, outputDirectory = 'clusters_shendure_copy') ##### mat <- getMatrixFromProject(proj, useMatrix = 'PeakMatrix') mat_matrix <- mat@assays@data$PeakMatrix rownames...
03ab9b84873f5f74a504f2cdf0b03a7680c52b90e492e872b8db5eea12ae0703
R
792
19
setwd("/media/hansruedi/3b32f153-0651-4d56-b863-9b070ac7dd55/home/hansruedi/Brain_region_final") library(ggplot2) library(Seurat) pbmc <- readRDS(file = "Ex_raw_highly_variable_mscores_integrated2_adjusted_umap.rds") library(RColorBrewer) # Define the number of colors you want nb.cols <- 32 mycolors <- colorRa...
bf9bfa76335384af33385cf69b588631417a14a9750f21cba8746650a2f47ad1
R
795
40
library("readxl") library("ggplot2") library("ggpubr") library("reshape2") library("emmeans") library("hrbrthemes") library("umx") library("interactions") library("car") library("dplyr") library (tidyverse) library(rstatix) library(reshape) library(datarium) setwd("C:/Users/tup54227/Documents/GitHub/rf1-sra/stimuli/S...
6bb0296e72ddd8c66a32f4ec6999386504a09869887a270ac55beaeb856e554c
R
796
32
options(bitmapType='cairo') args <- commandArgs(TRUE) wd<-args[1] name<-args[2] setwd(wd) inputfile<-paste(name,sep='') data<-read.table(inputfile,header=F,sep="\t") dist<-data[,3] raw<-data[,4] loess<-data[,5] stdev<-data[,5]+data[,6] y<-raw y2<-y y2<-sort(y2) ysize<-length(y2) ysize<-floor(ys...
09dd7693dbaaa3561b68d3a8756d31240d29e1c365417deedbd165750642960c
R
800
11
geno_last_joined<-read.csv(file="../geno_hema_joined.uniq.last.within3years.csv") m<-lm(anemia_who~rs679515_dosage*cvda_4gp2+msex+educ+age,data=geno_last_joined) capture.output(summary(m),file="cvda_4gp2.output.txt",append = F) m<-lm(hemacrit~rs679515_dosage*cvda_4gp2+msex+educ+age,data=geno_last_joined) capture.output...
f44990088b1bde228c0aecdceb67bf9034dc3c45c015063ad347c38898af3f10
R
800
11
geno_last_joined<-read.csv(file="../geno_hema_joined.uniq.last.within3years.csv") m<-lm(anemia_who~rs679515_dosage*log(nft+1)+msex+educ+age,data=geno_last_joined) capture.output(summary(m),file="log(nft).output.txt",append = F) m<-lm(hemacrit~rs679515_dosage*log(nft+1)+msex+educ+age,data=geno_last_joined) capture.outpu...
b43d39e316054fdd69b3906ab1b669b47ffce5fc722e49ba01a5b9a82ae04402
R
806
27
test_that("L1 spec drops emmeans fields when no model is available", { mobj <- list( level = 1L, regressors = c("reg1"), signals = c("sig1") ) class(mobj) <- c("list", "l1_model_spec") spec_list <- list( diagonal = TRUE, cond_means = "cond", pairwise_diffs = "cond", cell_means = TRU...
df29e75d79594197167e9ea076d6f765219289a66d163f7346a91f317aae1191
R
812
34
print("starting script") library(arrow) args <- commandArgs(trailingOnly = TRUE) input_files <- head(args, -1) print("Input files: ") print(input_files) output_file = tail(args, 1) print(paste0("Output file: ", output_file)) print("Reading chunked rds files and combining them") for (file in input_files) { # if...
812a11c6a7343a5b74c36f82b4e05933e9c362d09418fbd445cbed16db757ada
R
814
23
library(tidyverse) library(scibet) library(Seurat) library(scMCA) seurat_data <- readRDS("scDART_integrated_seurat.rds") raw_count_data <- as.data.frame(seurat_data$RNA@counts) cell_to_sample <- seurat_data@meta.data$orig.ident # table(cell_to_sample) cell_to_cluster <- seurat_data@active.ident result <- scMCA(scdata...
c6822787f32d7e6492dd3ebd72994e673eec16a06745d074da8a6b9a0437850e
R
816
30
load_matrix <- function(path){ expr_matrix = read.table(path,sep=',',header=T,row.names=1) expr_matrix = as.matrix(expr_matrix) return(expr_matrix) } load_pathway <- function(path){ gSet=getGmt(path) return(gSet) } pathway_scoring <- function(gSet, mat_gene){ cells_rankings <- AUCell_buildRank...
39216985e7111074122e5d80d5fa9bc407c5c96b3578ad02bb792a8281923892
R
818
24
log <- file(snakemake@log[[1]], open = "wt") sink(log) sink(log, type = "message") suppressPackageStartupMessages(library("dplyr")) suppressPackageStartupMessages(library("readr")) suppressPackageStartupMessages(library("purrr")) suppressPackageStartupMessages(library("tidyr")) message(paste("log is", log)) # colDat...
87db07181d6cf77cbfc57c336b2952fc86e1dce2af779d991294babe9940e36a
R
818
18
#This function conducts RLE normalization of RNA-seq dataset RLE_normalization <- function(df, reads_thresh=10, percentage_thresh=0.5, constant=10^6){ library(edgeR) #A) Remove unexpressed genes (for RNA-seq) r <- apply(df, 1, function(x){sum(x>=reads_thresh)})>=ncol(df)*percentage_thresh ...
a194a8ff8f9b0c3fa5660e1ae12d2def25b6a100da28e2770a03d0eefeda74bc
R
820
11
geno_last_joined<-read.csv(file="../geno_hema_joined.uniq.last.within3years.csv") m<-lm(anemia_who~rs679515_dosage*log(gpath+1)+msex+educ+age,data=geno_last_joined) capture.output(summary(m),file="log(gpath).output.txt",append = F) m<-lm(hemacrit~rs679515_dosage*log(gpath+1)+msex+educ+age,data=geno_last_joined) capture...
c96fa7e9c58ed0f5918bfe1edd3898423cb8ce6d49e1c9acb095875a9ea936f1
R
820
11
geno_last_joined<-read.csv(file="../geno_hema_joined.uniq.last.within3years.csv") m<-lm(anemia_who~rs679515_dosage*niareagansc+msex+educ+age,data=geno_last_joined) capture.output(summary(m),file="niareagansc.output.txt",append = F) m<-lm(hemacrit~rs679515_dosage*niareagansc+msex+educ+age,data=geno_last_joined) capture....
e6b50666fdf03b6ade7a89d20da7820e11d6bca4948d08cc53f66b82cf9c0e2c
R
821
21
source("R/setup.R") # read the configuration file config <- yaml::read_yaml('config/config.yaml') # check that all forecasts exist as expected .check_expected_vs_forecasted(datasets = c("test", "eicu")) # store error metrics without grouping by hours_since_admission .store_error_metrics(targets = config$targets, ...
32824fdf169a5dde2f8fc89e94571b233c7dbe8ec1bf72a77506d531c818ff41
R
823
35
library("Seurat") library("tidyverse") setwd("./Projects/SNCSynuclein") # Intergrated datasets at the individual level Seurat.SNC.ind <- readRDS("Step3.Clustering/Seurat.SNC.Ind.rds") # Dimplot by individual DimPlot(Seurat.SNC.ind, label = T, split.by = "orig.ident") & NoLegend() # Featureplot FeaturePlot(Seurat....
0f9b437c0db99d22733fc83d6a02c1ac6339302e2dba510657170e092fd624b0
R
830
11
geno_last_joined<-read.csv(file="../geno_hema_joined.uniq.last.within3years.csv") m<-lm(anemia_who~rs679515_dosage*log(plaq_d+1)+msex+educ+age,data=geno_last_joined) capture.output(summary(m),file="log(plaq_d).output.txt",append = F) m<-lm(hemacrit~rs679515_dosage*log(plaq_d+1)+msex+educ+age,data=geno_last_joined) capt...
68655e1fbc57ee9c472c743fc2ed74ebd8a20b79c6f30156db8c7af921e62c7a
R
830
34
#' archstabms__plot_fitness_replicates_cor #' #' Plot fitness replicate correlations. #' #' @param input_dt list of folder paths to fitness data (required) #' @param output_file output file (required) #' @param colour_scheme colour scheme file (required) #' #' @return Nothing #' @export #' @import data.table archstabm...
ce25deb6cd9feb40e4bd98d495d76315707746993fb40eebdddf9447b69cbb43
R
830
11
geno_last_joined<-read.csv(file="../geno_hema_joined.uniq.last.within3years.csv") m<-lm(anemia_who~rs679515_dosage*log(plaq_n+1)+msex+educ+age,data=geno_last_joined) capture.output(summary(m),file="log(plaq_n).output.txt",append = F) m<-lm(hemacrit~rs679515_dosage*log(plaq_n+1)+msex+educ+age,data=geno_last_joined) capt...
ca76f1f8f53ad70f9d9eeb0f8fffde4cfb1980b1b7a3f9d0cad5c326694516e4
R
832
34
#' archstabms__get_ambiguity_code #' #' Get IUPAC ambiguity codes. #' #' @param input_nucs vector of nucleotides (required) #' #' @return ambiguity code #' @export archstabms__get_ambiguity_code <- function(input_nucs){ nuc_codes <- list( "A" = "A", "C" = "C", "G" = "G", "T" = "T", "R" = c("A", ...
70d9c8ebbbe342c246533b4c6b4a6b1fe57f7be05c1cdbfb80eff3cb9206e83f
R
838
30
--- title: "Untitled" author: "Kaitlyn Hair" date: "2023-07-21" output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` ## R Markdown This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R...
3947c09525811988b4060f34f9acf2611e0400157e59eef7459cf865db645831
R
840
11
geno_last_joined<-read.csv(file="../geno_hema_joined.uniq.last.within3years.csv") m<-lm(anemia_who~rs679515_dosage*log(amyloid+1)+msex+educ+age,data=geno_last_joined) capture.output(summary(m),file="log(amyloid).output.txt",append = F) m<-lm(hemacrit~rs679515_dosage*log(amyloid+1)+msex+educ+age,data=geno_last_joined) c...
5d4b3750ac80084a2f77b96bc96963cc78b2283c73177722648180eb441004f0
R
840
11
geno_last_joined<-read.csv(file="../geno_hema_joined.uniq.last.within3years.csv") m<-lm(anemia_who~rs679515_dosage*log(tangles+1)+msex+educ+age,data=geno_last_joined) capture.output(summary(m),file="log(tangles).output.txt",append = F) m<-lm(hemacrit~rs679515_dosage*log(tangles+1)+msex+educ+age,data=geno_last_joined) c...
4c8f133a66c418b7190a96c692b799cf2e39e05548519974181a162ca0383884
R
843
31
# Test script for sccomp issue #229 # ------------------------------------------------- # This script loads the toy dataset that was causing # the reframe/full_join error in issue #229 and runs # the exact analysis pipeline described in the GitHub # ticket to confirm that the bug is now resolved. # # Usage (from R cons...
db7af5f148bfebdbf2e7e95a874baadf98de41e4f38dd8db09a18376feaaa6e0
R
850
29
# clear() # Takes time to load so don't restart often # setwd(attachroot("/WORK/Projects/validation/simulations/BBsim/data/sim_1000/sumstats")) # load("ss_0.1_0.5_2000_.1.RData") # # load_all(attachroot("/WORK/Projects/validation/lassosum/.")) # ss.list <- result[[1]][[2]][1:2] # # test <- cp.lassosum(ss.list, trace=...
dcee55da53809a0068ec817c803523bc5b32795fa9930fd5e869f0a320cd9bbd
R
850
11
geno_last_joined<-read.csv(file="../geno_hema_joined.uniq.last.within3years.csv") m<-lm(anemia_who~rs679515_dosage*arteriol_scler+msex+educ+age,data=geno_last_joined) capture.output(summary(m),file="arteriol_scler.output.txt",append = F) m<-lm(hemacrit~rs679515_dosage*arteriol_scler+msex+educ+age,data=geno_last_joined)...
94176d525cb0522777a92b612038d59ea23e6a8ea022be0d45fc7b9a9000051f
R
853
33
# Function ------------------------------------------------------------------- #' @name DEPRECATED-isample #' @concept deprecated #' #' @title (DEPRECATED) #' Return vector of row indices #' #' @description #' #' This function is **deprecated**. #' Use `sample(..., index = TRUE)` instead. #' #' @param ... Argu...
a393371da24343459493c2106e05360df18f2d09d92897097238e2d633ba4831
R
853
26
# *************** # 0b-preprocessing.r # Initial preprocessing of the data. source('Analysis/util.r') library(Seurat) library(dplyr) library(magrittr) x@meta.data <- x@meta.data group_by(orig.ident) %>% mutate(keep = ifelse(nCount_RNA < quantile(nCount_RNA, 0.99) & nFeature_RNA < quantile(nFeature_RNA, 0.99), TRUE...
9e25ea2047db6d5d8e2dfd7a0fe9f868509103b13895bbec69b52f34c8b4bc03
R
859
21
setwd("/media/hansruedi/3b32f153-0651-4d56-b863-9b070ac7dd55/home/hansruedi/Brain_region_final") library(Seurat) pbmc=readRDS("Ast_integrated2.rds") DefaultAssay(pbmc)<-"RNA" pbmc <- NormalizeData(pbmc, normalization.method = "LogNormalize", scale.factor = 10000) addition=read.table("Ast_Metadata2_addition_c...
8c67d73e9f599f9827ec68c26be3436adfa3129da334e8bae061b595a5d90a58
R
860
33
# Function ------------------------------------------------------------------- #' @name DEPRECATED-chk.hy #' @concept deprecated #' #' @title (DEPRECATED) #' Validate `hyperSpec` objects #' #' @description #' #' This function is **deprecated**. #' Use [assert_hyperSpec()] or [is_hyperSpec()]. #' #' @param obje...
e9b13391e126007628e853dab422b69bd68b5216644185c3a850177fe480efeb
R
860
21
setup_future <- function(object, plan=c('multicore', 'multisession'), workers=4) { plan = match.arg(plan) library(future) options(future.globals.maxSize = object.size(object)*10) options(future.resolve.recursive = Inf) options(future.wait.timeout = 10) plan(strategy=plan, workers=workers) rlog::log_info(p...
8a1cabaee302a32a294afc7657e6219de2bc227d6e25ea2a37625a86005a874b
R
863
29
#' archstabms__create_dir #' #' Create results folder for analysis script plots and saved objects. #' #' @param archstabms_dir directory path string (required) #' @param execute whether or not the system command will be executed (required) #' @param message message string (optional, default: NULL i.e. no message displ...
37190ff37a743780aa1d65bbf0413b7613a363336b85a6d0b37cf0c499a4cdac
R
866
33
require(testthat) require(Cardinal) context("colocalized") test_that("colocalized", { set.seed(1, kind="L'Ecuyer-CMRG") s <- simulateImage(preset=2, dim=c(10L, 10L), centroided=TRUE) s$class <- makeFactor(circle=s$circle, square=s$square, bg=!s$circle & !s$square) co <- colocalized(s, i=1:2) co1 <- colocal...
837561f52547e86510f93245093789aa33866e8856d7acca1d058da300ce147d
R
870
11
geno_last_joined<-read.csv(file="../geno_hema_joined.uniq.last.within3years.csv") m<-lm(anemia_who~rs679515_dosage*log(hspath_typ+1)+msex+educ+age,data=geno_last_joined) capture.output(summary(m),file="log(hspath_typ).output.txt",append = F) m<-lm(hemacrit~rs679515_dosage*log(hspath_typ+1)+msex+educ+age,data=geno_last_...
3fa283d339f48f9e383d898b6bdd34cf314ddff65386ce15c8be1dc2e8b5d6be
R
875
35
#' Laser emission dataset #' #' A time series of an unstable laser emission. #' #' @seealso #' See the vignette `vignette("laser", package = "hyperSpec")`. #' #' @name laser #' @docType data #' @format The data set consists of 84 laser emission spectra measured during #' 95 min. Each spectrum has 36 data points in t...
f7226fba75aed68764a869c9335db33651923d30b1a62bad78d0b393cf53c988
R
880
23
test_that("choose_glm_set skips confirmation prompt when model names are explicit", { gpa <- create_mock_gpa(include_l1_models = TRUE, include_l2_models = TRUE, include_l3_models = TRUE) gpa$multi_run <- TRUE lg <- lgr::get_logger("glm_pipeline/run_glm_pipeline") choose_glm_set_local <- fmri.pipeline:::choose_...