sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
b3e739e7e0f3561f6d02f388053ce247e78db07e8cb3a38a8705aef5b74508e5
R
745
23
dp <- getOption("defaultPackages") #dp <- dp[dp != 'datasets'] ## Rscript loads it too #dp <- dp[dp != 'methods'] ## Rscript (in R 2.6.1) doesn't load methods either # Count of default packages cat("int packc = ",length(dp),";\n",sep='') # List of packages cat("const char *pack[] = {\n",paste('"',dp,'"',sep='',colla...
248ff664fe0bcc98dfcd8273ae0c0c75d24ffb2bdcd8f5034eb1cafad57e3141
R
751
36
# Function ------------------------------------------------------------------- .subset <- function(x, ...) { validObject(x) x@data <- subset(x@data, ...) validObject(x) x } #' Subset `hyperSpec` object #' #' @name subset #' @aliases subset subset,hyperSpec-method #' @docType methods #' #' @param x `hyperSpe...
eb1ec9cb376a63b72c29a487730e3e939746b7fa7204145ad5599a2788e2b03c
R
752
35
#' mochims__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" (defa...
dd4333f0c7257f1ab805124d97c56db1837eef9b2413be4ee86b6f1de0539e8b
R
753
23
library(Seurat) library(sctransform) library(patchwork) library(dplyr) #Load dataset dt.combined.sct <- readRDS("datasets/1_seurat_integrated.rds") #cluster dt.combined.sct <- RunPCA(dt.combined.sct) dt.combined.sct <- RunUMAP(dt.combined.sct, reduction = "pca", dims = 1:50) dt.combined.sct <- FindNeighbor...
418da52e63f05ed485c30915f3230e31742c23ca64dd4614d71507125ba82bac
R
754
21
n.sims <- 210000 msSimulate <- function(morgans.per.bp, ne, filename, n.chrom = 50, mu = 1.5e-8, bp = 20001){ # converts parameters to hudson style, note nchrom, mu and bp are fixed total.genetic.distance <- morgans.per.bp * (bp - 1) rho <- 4 * ne * total.genetic.distance theta <- 4 * ne * mu * bp ...
f9b852f93a932f076c1ac3d8fef2f5bc643795d9c18460b9a5781d78108be925
R
755
27
history <- function(accession, index = 1){ res <- data.frame() for(i in 1:length(accession)){ print(paste('Processing', accession[i], '-', i, 'out of', length(accession))) xml.url <- paste('https://www.uniprot.org/uniprot/', accession[i], '.rss?version=*', sep = '') x <- readChar(xml.url, nchars =...
87b5d6dbcc95ed2bd15dbee85b9ee098b49977039a9fb7d727b61e5b6012dd6a
R
756
26
#!/usr/bin/env r # # a simple example to install one or more packages if (is.null(argv) | length(argv)<1) { cat("Usage: installr.r pkg1 [pkg2 pkg3 ...]\n") q() } ## adjust as necessary, see help('download.packages') repos <- "http://cran.us.r-project.org" ## this makes sense on Debian where no packages touch /...
ac8a966c293385e0e7f2dfd1982f2940a45983b6c07d1947291765913e9795d4
R
759
19
options(warn=-1) a=read.delim("model_comparison.txt", sep=' ') a pdf("FigS4A.pdf", height=8, width=10) par(oma=c(1,20,1,1)) barplot(rbind(a$test_r_squared,a$test_r_squared_withHL),beside=T,horiz=T, names.arg=a$model,las=1,col=c("red","blue"), border=F, xlim=c(0,0.8)) legend("bottomright", bg="white", bty="n"...
dc31aa7c13f7bf220fbd2e3f02677d14ec61665798bea224f61351698854f454
R
759
22
data.pars <- read.csv('data/rltask_modelparameters.csv') data.pars$Parameter <- factor(data.pars$Parameter, c('L', 'U', 'm', 'k')) data.time <- read.csv('data/rltask_timingdata.csv') data.time$Epoch <- factor(data.time$Epoch, c('Pre-learning', 'Learning', 'Post-learning')) plot.rlparameters <- ggplot(data.pars, ae...
e5bc0ec98c601fd42b9e68a8408dea754f419a3a9c711f177e78d4b99a38dbe6
R
764
19
library(data.table) ad_gwas <- fread("/data_global/summary_statistics/GCST90027158_buildGRCh38.tsv.gz") top_snps <- c("rs6733839", "rs6460900", "rs4721058", "rs2000660", "rs72807981", "rs769449", "rs12721051", "rs4420638", "rs4803778" ) ad_gwas_top_snps <- ad_gwas[variant_id %in% top_snps] jansen_2...
d6d4fc837a4bd37f507b5857a81fd010e547b73682c6c5329a31e82cb8e93feb
R
765
13
library(phytools) library(ape) library(data.table) tree <- read.tree("SpeciesTree.txt") dist_matrix <- cophenetic(tree) write.csv(dist_matrix, 'cophenetic_distance_from_all-v-all.csv') ##get cophenetic distance for each branch v. every other on the tree # Extract distances for species of interest species_of_interest <-...
b3dbe13c0fd233235eb002cd04dbedf8ad3a9dd7d1abd22dcc0d32801d70583d
R
769
30
#' @export per_lm_variance <- function(shape.data){ variances<-rowSums(apply(shape.data ,c(1,2),var)) cols1<-colorRampPalette(c("#6e016b","#0c2c84","#225ea8","#005a32","#ffff00","#fe9929","#fc4e2a","red")) cols<-cols1(100) #calculate log rates: x=(log10(variances)) xlims<-NULL tol <- 1e-06 xlims <-...
ebed96fec1617293b3d318e73324e8eb3e8082918b18f79b410593e9c0c2af95
R
770
20
context("spd-interpolate") # Positive definite matrixTesting data x <- cov(matrix(rnorm(100), ncol = 5)) y <- cov(matrix(rnorm(100), ncol = 5)) test_that("Functions accurate interpolate", { # Euclidean expect_true(compare(x, spd.interpolate(x, y, t = 0, method = 'euclidean'))$equal) expect_true(compare(y...
ae119ff12ff42d870788460e14aeef440efb294f2312194f1d684d54fcfd0ca0
R
773
11
args <- commandArgs(trailingOnly = T) filenamex=as.character(args[[1]]) turan_SegNorm = read.table(file.path('./data/processed/', filenamex, 'SegFixed'), header=TRUE, sep="\t") turan_SegNorm$CHR= as.character(turan_SegNorm$CHR) turan_ploidy <- readRDS(file.path('./data/processed/rds', paste0('cell_cn_', filenamex, '.r...
17122d40749e64713214762a88f2002d94ebf2fe38846b64def7b10d915a2dc2
R
775
15
library(data.table) library(ggplot2) gwas_qtl <- fread("data/tmp/chr2_ENSG00000071575.11_Brain_Cortex_gwas_qtlNPOLD1_bin.tmp") setnames(gwas_qtl, c("P_gwas", "P_qtl"), c("Cerebral cortex microinfarcts", "TRIB2 expression in cerebral cortex")) gwas_qtl_long <- melt(gwas_qtl, measure.vars = c("Cerebral cortex microinfarc...
c0e87965a73f7dc5bd957740e8c38ac5b34ac402a8d2dbbb14f69770d2df9313
R
777
19
library(data.table) library(tidyverse) # Read sumstats. # For some reason fread couldn't read the header, so I read it separately # and added to the sumstats. header = read.table("/PATH/TO/DIR/rhythym_sumstat.txt", header = TRUE, nrow = 1) rhy_sumstat = fread("/PATH/TO/DIR/rhythym_sumstat.txt", skip = 1, header = FALS...
6b13cfa2c78797d7983bf3b578bb122549d7e918d5cd1b2f530ed25251ee4b46
R
778
18
#=========================================================================== # select only Chromosome 19 SNP Matrices for APOE-adjusted analysis #=========================================================================== # nacc snpmat_list <- readRDS("data/adc/SNPMatrix/SnpMatrix_list.Rds") snpmat_list <- snpmat_list...
115e998c30e444f645e8b134e625accc33106c52d127b91019b75f20278b9b87
R
785
23
# loading libraries library(Seurat) # v5.0.3 library(SeuratWrappers) library(patchwork) library(dplyr) library(ggplot2) library(sctransform) library(glmGamPoi) # Load merged and filtered object stress.merged.filt <- readRDS("~/Downloads/scRNA/stress_merged_filt.rds") # Normalizing object with scTransform stress.merge...
63320f5f641c7e467039fdaccf72642f120046ad98b5ca728371f6636c117535
R
793
29
#' Compute (partial) correlations #' #' Transforms an SPD matrix into a matrix of partial correlations #' #' @param x An SPD matrix to be whitened #' @param method A string specifying either "correlation" (default) orf #' "partial" correlation. #' @return A symmetric, positive-definite matrix. #' @export spd.correlati...
58fc1daf492e17cb7b0f4ec65fc1476e51e02f3964419376d0094bacf15f5d42
R
794
27
#' Covariance whitening transform #' #' Whitens an SPD matrix using the procedure advocated by Ng, et al. (2014) #' #' @param x An SPD matrix to be whitened #' @param p The SPD baseline whitening matrix #' @param unwhiten Logical. If TRUE, reverses a previously applied whitening transform. #' @return A symmetric, posit...
ed1433ec7d17bcd0a96923b8fc435123a3741299449d3731cd9e65d6d2accc7e
R
799
42
library(car) library(lsmeans) library(performance) df = read.csv("data\\coherence\\broadband\\SpectralFlux\\comparison\\SF-brain-CoherencePeaks.csv") colnames(df) # Select first peak data only dflow <- df[1:99,] m1 = lm(real ~ syll, data=dflow) summary(m1) m2 = lm(real ~ phon, data=dflow) summary(m2...
66727d770cea1ace576f2e33c930f2b0f5aaf348e36e8290c2625d85dc507107
R
804
29
#!/usr/bin/env Rscript args <- (commandArgs(TRUE)) qual <- read.table(args[1]) mapped_max <- max(qual$V2) mapped_min <- min(qual$V2) unmapped_max <- max(qual$V3) unmapped_min <- min(qual$V3) jpeg(file="quality.jpg", height=400, width=1300, pointsize = 25) par(mar=c(4,4,1,4)) plot(qual$V1,qual$V2,type="l",col="blue...
82a182f5ed7ed1d2026a27e0900e3c8d3cd2a6654e13b587fff6fdc3005c173d
R
807
33
#' Recode a Time variable to a different granularity #' #' A time variable is passed to this function and the corresponding #' downsampled time bin is returned. One between 'to_ms' and 'to_hz' must be null #' #' #' @param Time A vector variable indicating the elapsed time, in ms, aligned #' to some origin - i.e., not a...
21419a7e12c065384f88cfe4a002766721b301450ff6c1b5d030932d8e0c860d
R
809
19
# ============================================================================ # This code prepares `paracetamol` dataset # ============================================================================ # Required packages ---------------------------------------------------------- library(hyperSpec) library(usethis) # ...
d39d689e20ced52ee90afa9f2be9c527de16263d4fb7cc5fb71ebbe4d6ef5943
R
818
23
source('./scripts/01_Setup.R') setwd("./data/processed/rds") aa2=c("dMDA_101_500kb_ConfiScore.rds", "Pico_76_500kb_ConfiScore.rds", "Pico_101_500kb_ConfiScore.rds", "PTA_48_500kb_ConfiScore.rds" , "PTA_101_500kb_ConfiScore.rds") for (i in 1:length(aa2)){ fname = file.path('./dat...
d222f7b1fa5b32d264d52654efd7c0c022746857b672abfd829e3b43429c3ee0
R
821
21
# Copyright 2022 HYBRID Team INCIA, UMR5287, CNRS, Université de Bordeaux # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required b...
b8e0539200e88bfe391479455fb3829f17cd7af90a2c99ac3cd8380710ba3229
R
828
35
library(readr) library(dplyr) library(tidyr) save.image("debug.RData") clean_table_ld <- function(path_table_ld, path_output_ld) { table_ld <- read_tsv(path_table_ld) # Get upper triangle of the matrix mat_r2 <- table_ld %>% mutate(rsq = r^2) %>% select(g1_rsid, g2_rsid, rs...
208381ed689edfc0219c981a37022db957e0edf3d5b478cae4c16681dbb4cb1d
R
839
29
#' mochims__create_dir #' #' Create results folder for analysis script plots and saved objects. #' #' @param mochims_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 displayed) ...
1daf5781662f883ce465b5728571dee28b4f871e7f1c6fbe5333b508adb7700d
R
840
32
library(WRS2) d<-read.csv("median_gamm_all_groups.csv", header = TRUE, sep = ",", dec = ".") #----------------------- # One way Anova #----------------------- #perform Welch's ANOVA t1way(Gamma~Groupe, data=d, tr=0) #----------------------- # Mixed design ANOVA #----------------------- # subset dataset to remove ...
4557d66a9389d98970c46bfb5abd9997243dbec3ab6b0a8d742773284b59fd87
R
844
33
library(lme4) library(sjPlot) library(performance) library(ggplot2) library(lmerTest) library(multcomp) #df = read.csv("data\\acoustics\\syllabic_accuracy_scores.csv") df = read.csv("data\\acoustics\\phonemic_accuracy_scores.csv") colnames(df) # declare speed,trial and subject as factors df$features...
f3746f17a679d20f8f121e6b1c2ea0b6832114725bbb50889ce3dfb6f04d7866
R
861
40
smlab <- function(sm, backtransf, pscale, irscale, func.backtransf = NULL, forest = FALSE) { res <- sm # if (backtransf) { if (is_cor(sm)) res <- "correlation" # else if (is_mean(sm)) res <- "mean" # else if (is_prop(sm) || sm == "proportion") { if (pscal...
71c6705f20d1dea6d09554c4b0de66c3f3311081e45a5b9313a50f1034ccd4f4
R
867
42
#' @concept utils .validate <- function(object) { ncol <- ncol(object@data$spc) if (is.null(ncol)) { ncol <- 0 } if (length(object@wavelength) != ncol) { return("Length of wavelength vector differs from number of data points per spectrum.") } TRUE } #' @title Validation of `hyperSpec` objects...
dc2f992445da4ffe57d1b124eb72715d9ab0f029c9ac6e95fb738a79b969e2c0
R
868
30
library(Seurat) library(patchwork) plot_umap <- function(sobj_path, cell_name){ sobj <- readRDS(sobj_path) sobj <- UpdateSeuratObject(sobj) P <- DimPlot(sobj, raster = F) rm(sobj) gc() return(P) } sobjects <- list.files("ad_knowledge_portal_syn52293433/rds_files/", full.names = T, pattern = "rds") umap_...
5e3d6778f496139759c272089aa1c441b8562c2189325b610854acad79fc3e0b
R
871
24
# For creating categories highlight ---- grouping_helper_category_highligth <- rlang::expr( case_when( inNorway & isWTE ~ "NO: WTE", inNorway & (!isWTE) ~ "NO: Other Avian", TRUE ~ "Other Country") ) category_highligth_levels <- c("Other Country", "NO: Other Avian", "NO: WTE") # for funct...
5102dd0735ac5017e938d09885237118f22644c950850183684f6772f28ebed4
R
872
46
library(WGCNA) library(Seurat) #seur is Seurat object #genes, the array describing the current module getEigen<-function(seur,genes,mod="No Name",nam="Cluster1") { print("Prep Data") mn=Matrix::rowSums(seur@assays$RNA@data) dat=data.frame(t(as.matrix(seur@assays$RNA@data))) dat=dat[,mn>0] cols<-r...
79d0aa489494bdceebfe475ab7da951cecd1a2e75bf5190b380b2342e397ce52
R
872
29
#!/usr/bin/env r # # a simple example to update packages in /usr/local/lib/R/site-library # parameters are easily adjustable ## adjust as necessary, see help('download.packages') repos <- "http://cran.r-project.org" ## or use BioC's repo list if Biobase is installed: suppressMessages(rc <- require(Biobase)) if (rc) { ...
452190d7fd674c018ed3fe4bd71dff0151d073330e49eb4c205d51c88cfbe414
R
873
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...
3fb4e5f3f704f2990e16b04b58168909178b3760d40fd67a2735a9e2c9dc2a0e
R
877
21
library(latticeExtra) crp.rg <- colorRampPalette(c("red","orange","green","cyan","blue","purple","magenta")) cols <- sample(crp.rg(10)) plotresults = function(dir){ files = paste(list.files(path=dir, pattern='.txt', full.names=T)) pdf("Fig1C.pdf",width=5,height=4) plot(0, lwd=1, bty='n', type="l",...
4e35624e714167fdc2745bd2cfe1c098be26fa7ca255b2bd2e19b49e5f98abe5
R
883
36
#!/usr/bin/env Rscript # Load the data.table package library(data.table) # Function to count non-missing rows in a specified column count_non_missing <- function(file_name, column_name) { # Read the file data <- fread(file_name) # Check if the column exists if (!column_name %in% colnames(data)) {...
edab91289b38657d0216305cee530e59fb44ce261b83330228174c436c3b6044
R
890
17
library(Seurat) inforDir <- './data/PDAC-A/Infor_Data' sc.count1 <- t(read.csv(paste0(inforDir,"/ST_count/ST_count_1.csv"), header=T, row.names = 1,check.names=FALSE)) sc.count2 <- t(read.csv(paste0(inforDir,"/ST_count/ST_count_2.csv"), header=T, row.names = 1,check.names=FALSE)) st_counts <- list(sc.count1,sc.count2)...
db0da8b032e6f955743cb6c81873f91330f0b8a8f6a146bcbcb17218d3f52e50
R
892
26
.onAttach <- function(libname, pkgname) { unlockBinding(".options", asNamespace("hyperSpec")) desc <- utils::packageDescription("hyperSpec") first_url <- sub(",.*$", "", desc$URL) # To use the first URL only packageStartupMessage( "\n\n", "Package ", desc$Package, " (version ", desc$Version, ")\n\n", ...
889f13a0a46c807627c672dd108c67950554f25cb9d7f10fa3ec524180163d79
R
900
19
# ============================================================================ # This code prepares `barbiturates` dataset # ============================================================================ # Required packages ---------------------------------------------------------- library(hyperSpec) library(usethis) #...
e1421465c2c3db3e97c8a3df806339b3ab5e6a7d0c0be450310f8cbc62d328b8
R
903
39
#' A convenience function to preprocess pupillometry data #' #' The function calls, in order, 'speed_clean', 'interpolate', and 'smooth_vector' from this packages. #' Parameters can only be changed in the package options, i.e. 'Pupilla::pp_options()'. #' Warning, the best preprocessing parameters may deviate from the d...
881962e327ad142f3ad124147a1dc02d09e479fdb3c964febbae5ed2a130e830
R
907
34
source('./scripts/01_Setup.R') library(data.table) packageVersion("biomaRt") # Load required libraries library(biomaRt) library(GenomicRanges) library(rtracklayer) library(biomaRt) library("RSQLite") datax <- read.table("./data/processed/txt/Control_PANTHER_MF_GOslim.txt", sep = "\t", header=T, skip=11, quote = "", st...
39014424963b34498f36d11cff204ac505b95db3a81c9b8a1121eb016aa995a2
R
922
24
# ============================================================================ # This code prepares `flu` dataset # ============================================================================ # Required packages ---------------------------------------------------------- library(hyperSpec) library(usethis) # Read the...
41dadfe95440513ef8045d1438f1d301f5cb04e401d592daca98c6d2024cffc2
R
922
20
library(autofocus) library(magrittr) library(SummarizedExperiment) load(data.makepath("ADNI/ADNI_data_for_Annalise/ADNI_data_for_Annalise.RData")) data.mat <- dfs$bp1[3:ncol(dfs$bp1)] pheno.mat <- dfs$phe[dfs$phe$RID%in%dfs$bp1$RID,] mol.mat <- lapply(colnames(data.mat), function(i){names(fset.list)[grep(i,fset.list...
d0537e15ca9fe7c857bd90adbe1e82712936acd45e0510abba084c91de974290
R
922
27
require('plyr') require('ggplot2') require('patchwork') # Plot subjects' estimated implicit and explicit adaptation, along with # their early error (see figure 1) source('R/plotELbehaviour.R') plot.elbehavstats # Imports and plots the mean loadings for the implicit, explicit, and # performance axes, as well as the e...
41295473630b98dcbd902c8fb6a2527959c6918907c146a1739b033a55bd6895
R
927
32
--- title: "Version and necessary libraries" output: html_notebook --- ```{r} R.Version() ``` Necessary librairies ```{r} setwd(dirname(rstudioapi::getActiveDocumentContext()$path)) necessary_librairies <- c('ggplot2', 'tidyverse', 'ggVennDiagram', 'clustree', 'biomartr', 'circlize', 'readxl', 'readxl', 'UCell', '...
5bf72f5186db09451fc9a7ca2b57bc3f8efe40f563adb38a5f50f111a405b976
R
928
28
#============================================================== # perform PC-AiR #============================================================== pacman::p_load(data.table, GENESIS, SNPRelate) #----------- # PC-AiR #----------- # mostly taken from here: # https://www.bioconductor.org/packages/release/bioc/vignettes/...
2078135b609a41e66c1dc0c0f4c6f53c5d4f2b8c7ffeac6e4a3329a5358fb3d2
R
937
21
--- title: "Preprocessing your data" output: html_document --- Expression matrices derived from mass spectrometry data often contain many missing values. Rows with a high abundance of missing values can be considered uninformative for differential expression analysis and should be removed. The feature presented here l...
74455059e8aafb0ea324f1a36e03b766ddfab93eab9aae112b179e33331231fa
R
937
42
--- title: "News" #author: "Martin Rydén" output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` ##### April 15, 2021 * Easier data import * Improved PCA and heatmap functionality * Tooltips everywhere * Volcano plot for differential expression analysis * Volcano plot for enrich...
52c13f5ad61e346e5be3bb17e0af2547ccbf6e191fec2a97f0f6a5e1d2e66e7d
R
939
28
# Original script is taken from Jason Stein's ENIGMA-evo repository. # Gokberk Alagoz - 01/10/2021 library(gprofiler2) options(stringsAsFactors = FALSE) #Load in global gene list GlobalSAHGE = read.csv("/data/workspaces/lag/workspaces/lg-ukbiobank/projects/globularity/evolution/results/VEP/glob_gene_list.txt") GO <...
ea5baca9fbd95648aa41128f19cd834036a7c023e8298ce2829ff583f7a0366c
R
943
39
#' Smooth a time series through cubic splines #' #' This can be used as a simple smoothing function, in the case of eyetracking #' data it can be used as a low-pass filter, useful to correct artifacts, #' blinks, etc. #' #' @param vector A vector variable to be smoothed. #' @param time A vector variable indicating the ...
bc48bcdd8271726d6706b262180c350da8035ec5ae36c7cefeabac50ddc957dc
R
946
27
#' @details #' Computational methods for the scregclust algorithm #' @keywords internal #' @aliases scregclust-package #' @author Ida Larsson, Felix Held, Sven Nelander #' @import Rcpp #' @import cli #' @import ggplot2 #' @importFrom rlang .data #' @importFrom prettyunits pretty_dt #' @importFrom Matrix Matrix sparseMa...
f9915ad81a197412fb11fceadc3a00527ce14bb4b2ba8b601a8f7116ec92572e
R
959
35
#!/usr/bin/env r # # a simple example to convert miles and times into a pace # where the convention is that we write e.g. 37 min 15 secs # as 37.15 -- so a call 'pace.r 4.5 37.15' yields a pace of # 8.1667, ie 8 mins 16.67 secs per mile if (is.null(argv) | length(argv)!=2) { cat("Usage: pace.r miles time\n") q()...
8981cf38c927934e0ef01f2274582e4628f44e82014a31a42ce2825ad0dcca7b
R
960
27
#============================================================== # perform PC-AiR #============================================================== pacman::p_load(data.table, GENESIS, SNPRelate) study <- 'rosmap' #----------- # PC-AiR #----------- # mostly taken from here: # https://www.bioconductor.org/packages/relea...
ada111a9e63f96ac2a861cbf8c2f65f9a9aa99aa1fa4ce7fd63057f5e1416d93
R
962
39
args <- commandArgs(trailingOnly = TRUE) fasta_file <- args[1] png_file <- args[2] log_file <- args[3] log_con <- file(log_file, open = "wt") sink(log_con, type = "output") sink(log_con, type = "message") library(Biostrings) tryCatch({ # Read the fasta file reads <- readAAStringSet(fasta_file) read_lengths <-...
3af2a0e65ed104b24a993c87f71cedac30fcba69e5c0244a11a388669286326d
R
968
26
# ============================================================================ # This code prepares `laser` dataset # ============================================================================ # Required packages ---------------------------------------------------------- library(hyperSpec) library(usethis) # Read t...
a4a01144e335ef8604f5eca803b2e467e3ade83341de3f9f1b1d62216c31db9c
R
968
39
# dichotomize ordinal phenotypes for colocalization analysis library(data.table) phenos <- fread("shared/nacc_rosmap_act_np.pheno", na.strings = "") # braak stage: 0-3 vs 4-6 phenos[braak < 4, braak := 0] phenos[braak > 0, braak := 1] # cerad score: 0-1 vs 2-3 phenos[cerad < 2, cerad := 0] phenos[cerad > 0, cerad :...
eecd1cad7b8ee5c382b1bcc55ee5a0c7fa0bbfcde9062c677842be817a714c4b
R
969
25
source('./scripts/01_Setup.R') filenamesx <- gsub('.rds', '', readRDS("./data/processed/rds/filenamesx.rds")) aa2= paste0(filenamesx, '_SegFixed_cnv_stat_genome.rds') aa2= c( "PTA_48_500kb_lift_SegFixed_cnv_stat_genome.rds", "PTA_101_500kb_lift_SegFixed_cnv_stat_genome.rds", "Pico_76_250kb_lift_SegFix...
d26ed2ddcf7ff874ed3fd5dac0dfef0d3fdd2817bfa687ded1fb0929156f4375
R
972
27
#! /usr/bin/Rscript --vanilla #============================================== # Input text file with SNP IDs as one column # and output list of SNP IDs #============================================== library(data.table) library(argparse) parser <- ArgumentParser() parser$add_argument("-f", "--file", help = "text file...
87364df1c6664ea3454ed3fdf36e6102986a1190b7c24295ad037ad2e83b5a94
R
976
36
#' Thrombolytic Therapy after Acute Myocardial Infarction #' #' @description #' Meta-analysis on Thrombolytic Therapy after Acute Myocardial Infarction #' #' @name Olkin1995 #' @aliases Olkin95 #' #' @docType data #' #' @format A data frame with the following columns: #' \tabular{rl}{ #' \bold{\emph{author}}\tab fi...
d509cde40dda64662131fca0a2a44086f16db1f22b4696299ebb148a9b7d4bac
R
978
20
#' NeuroimaGene object for vignette illustration #' #' NeuroimaGene data table containing select associations used in the package vignette. #' #' @docType data #' @name ng_vignette #' @usage data(ng_vignette) #' @format A data.table with 6 columns and 3824 rows: #' \describe{ #' \item{gene}{character: ENSEMBL Gene ID...
cc687154d856786ff894aeea0ae4bd47d101c2abe6a8ce06f904633727c86e6b
R
984
26
#! /usr/bin/Rscript --vanilla #----------------------------------------------------------------------------- # Check heterozygosty and create a list of IDs that are > +/- 3 SD from mean #----------------------------------------------------------------------------- library(data.table) library(argparse) parser <- Argum...
1142d092de2117f8561b9fa3b09097495b0e2dbe51e912211f3e35ea9c677b41
R
988
48
#!/usr/bin/env r # # Convert miles-per-hour, time-distance measure settable # on treadmiles, to different race times. if (is.null(argv) | length(argv)<1) { cat("Usage: mph.r mph\n") q() } dig <- 5 mph <- as.numeric(argv[1]) cat("Mph : ",format(mph,digits=dig),"\n"); hourminsec <- function(totalsecs){ ret...
f4da9e0a896914b87fcf90406a4deadcaf84a17d3c927480a0af48c8babbe58e
R
988
31
# File: deWrapper.R # Author: Kelly Chang # Zhihua Li # Date: Oct 2017 # Version: 1.0 # # Description: Helper R function which evaluates an objective function for the # specified subpopulation. # deWrapper<-function(chrpernode,pop,objfun){ # returns function...
51d5d322054c95dbeac0be92c879dba47f91771339d5cd24f7400b3056171917
R
991
38
#!/usr/bin/env Rscript args <- (commandArgs(TRUE)) cov <- read.table(args[1]) c_max <- max(c(max(cov$V2),abs(min(cov$V3)))) c_max <- c_max+floor((c_max/10)) len <- max(cov$V1) jpeg(file="coverage.jpg", height=400, width=1300, pointsize = 25) par(mar=c(4,4,1,0)) plot(cov$V1,cov$V2,type="l",xaxt="n",yaxt="n",col="b...
e7450bab3b41cd96eca2f626b74230c904d6827caf4635e6d2c495dda1ace511
R
992
27
#========================================================================= # Convert plink2 .glm.logistic data.tables to a format that is backwards # compatible with scripts that use plink1.9 .assoc.logistic data.tables #========================================================================= plink2_to_plink_format <...
d59d2c0fbe0d83f0e657f03e35141dc78f94cb5f5809575d93c5cb9bd1c34f0d
R
993
31
#' mochims_structure_metrics_datasets #' #' Add 3D structure metrics of multiple datasets. #' #' @param dataset_names character vector of dataset names (required) #' @param pdb_file_list list of paths to PDB files (required) #' @param base_dir Base directory (required) #' @param output_dir Output directory (required) ...
b2a8d6654a84fb3c6cbde8a4aafc38cda47d2d8276bc2248e874ca53b41ecada
R
994
27
library(ggplot2) options(stringsAsFactors = FALSE) args = commandArgs(trailingOnly=TRUE) stats_out_file <- args[1] acc_file <- args[2] id_out <- args[3] out_dir <- args[4] stats_out <- read.delim(stats_out_file, stringsAsFactors = F, header=F, sep = "\t") acc <- read.delim(acc_file, stringsAsFactors = F, header=F) co...
5670c04d158a91880b93c7bb1caae113653de638c181ebe0fb6c07925b40ed07
R
998
37
#' @importFrom nlshrink linshrink_cov #' @importFrom huge huge huge.select spd.estimate.sample <- function(x, ...){ cov(x, ...) } spd.estimate.linshrink <- function(x, ...){ linshrink_cov(x, ...) } spd.estimate.nlshrink <- function(x, ...){ nlshrink_analytical(x, ...) } spd.estimate.glasso <- function(x...
916a387d170a819fb7dba02eeddd18e984c3266f0207010d2a9a032d72113320
R
998
20
#' NIDP freesurfer annotation data #' #' Freesurfer names for select cortical and subcortical NIDPs #' @docType data #' @name fs_anno #' @usage data(fs_anno) #' @format A data.table with 7 columns and 890 rows: #' \describe{ #' \item{gwas_phenotype}{character: UKB-derived neuroimaging derived phenotype} #' \item{at...
bc15d5bf13a9e052768b086ce49ba2f64e13ad03f67625729224ed0b4c257798
R
998
31
#' @importClassesFrom kernlab kernel spddot <- function(sigma = 1, method = 'logeuclidean'){ rval <- function(x, y = NULL){ # Type checking if (!is(x,"vector")) stop("x must be a vector") if (!is(y,"vector") && !is.null(y)) stop("y must a vector") if (is(x,"vector") && is.null(y)...
19ca88f68a86b8c9539464bb539452efced0f0e5ff81b5ccacaa0dee85c32d75
R
1,002
48
# Auxiliary functions to check inputs # # Package: meta # Author: Guido Schwarzer <guido.schwarzer@uniklinik-freiburg.de> # License: GPL (>= 2) # isCol <- function(data, varname) !is.null(data) & varname %in% names(data) is_log_effect <- function(x) x %in% c("PLN", "IRLN", "MLN") is_relative_effect <- function(x...
54a24a331773d573defb6abd965ab133349076c635d362073c9f38abaf2fe1bd
R
1,004
31
#' Get Nested Variable #' #' This function extracts a nested variable from a data frame and creates a new column with the concatenated values. #' #' @param data The input data frame. (plot_data) #' @param nested_col The name of the column containing the nested variable. #' @param var The name of the nested variable to ...
8ee263119d7b07d8cb6f8916ecee492f6501e960538c517d859a87108fbd34ae
R
1,005
29
source('./scripts/01_Setup.R') setwd("./data/processed/rds") aa= grep("MAD",list.files(), val=T) aa2= aa[aa%in%c("MAD_dMDA_101_5Mb_t2t.rds", "MAD_PTA_101_500kb_t2t.rds", "MAD_Pico_101_250kb_t2t.rds", "MAD_Pico_76_250kb_t2t.rds", "MAD_PTA_48_500kb_t2t.rd...
be91feb1c66bd861e7a72b40f07728155882970ec6820360964aa09661f559ee
R
1,008
34
#' mochims__predict_fitness_2state #' #' Predict fitness from energies for 2-state model. #' #' @param mochi_outpath path to MoCHI thermo model fit results (required) #' @param phenotype_name phenotype name (required) #' @param energy energies for 2-state model (required) #' @param RT constant (default:0.001987*(273+2...
7c50008bf67b4eeadf8bdf770e40e601ab3e73a82b1755a207ebe9ef0b1cb6c6
R
1,013
22
plotFit <- function(fitDat, readBw){ for(reg in unique(fitDat$Region)){ regDat <- fitDat[fitDat$Region == reg,] p1 <- ggplot(regDat) + geom_line(aes(x=EventPos, y=EventScore), size=0.1) + ggtitle(regDat$Region) + theme_minimal() + #geom_hline(aes(yintercept=yint),...
e00096d6f5e6ac781bc16e156a0ed711187d531ef03dd1b0840a1427a60d64b1
R
1,014
37
#' @title Command line completion for `$` #' @description #' Command line completion for `$`. #' This function is not intended to be used directly by users but provides #' auto-completion capabilities. #' #' @aliases .DollarNames .DollarNames,hyperSpec-method #' @author C. Beleites #' @seealso [utils::.DollarNames()] #...
97f6268c455eb50a562a4a42f2098b9fe1a17d5520dad7d05f80abb34c31f10c
R
1,015
37
#cross validation of exploratory best measure library(caret) library(party) library(flexplot) if (exists("bones_ukb")) { bones_ukb$eid <- as.numeric(bones_ukb$eid) bones_ukb <- select_if(bones_ukb, is.numeric) #get only numeric vars bones_ukb<- bones_ukb[,-c(nearZeroVar(bones_ukb, freqCut = 100/0))]#remove ...
1f24fb4e07a8586d1c92a6a0ac78515456024da0e19ce62d9675c0965bd4726d
R
1,019
28
source('./scripts/01_Setup.R') setwd("./data/processed/rds") standardize_name <- function(name) { return(gsub('[^0-9a-zA-Z]+', '_', name))} aa= grep("MAD",list.files(), val=T) aa2= aa[aa%in%c("MAD_dMDA_101_5Mb.rds", "MAD_Pico_76_250kb.rds", "MAD_Pico_101_250kb.rds","MAD_PTA_48_500kb.rds", "MAD_PTA_1...
6f8a3960aa1e883ed7f44035273e0f29b971574ae55b3c4ad721a7fe7935b869
R
1,019
30
#### Notes #### #### Libraries #### library(ggplot2) library(viridis) #### Sourced functions #### #source("../functions/annotate_boxplots.R") #### Plotting functions #### plot_triangle_correlation_matrix <- function(corr.matrix.diag, title="") { ggplot(data=corr.matrix.diag, aes(x=Condition1, y=Condition...
754674aa0530d9a3ebf9a105214d8b047db1a13247d8bc48ae0c3ddc65b90b93
R
1,027
29
install_libraries <- function() { if (!require("BiocManager", quietly = TRUE)) install.packages("BiocManager") if (!require("SingleCellExperiment", quietly = TRUE)) BiocManager::install("SingleCellExperiment") if (!require("scater", quietly = TRUE)) BiocManager::install("scater") if (!r...
82ae4e434b6c2fffaec0ca67738595451b6d5ea6bac6cb5d3ec5734693b7e4bc
R
1,037
29
source('./scripts/01_Setup.R') setwd("./data/processed/rds") aa= grep("MAD",list.files(), val=T) aa2= aa[aa%in%c( "MAD_dMDA_101_5Mb_lift.rds", "MAD_Pico_76_250kb_lift.rds", "MAD_Pico_101_250kb_lift.rds", "MAD_PTA_48_500kb_lift.rds", "MAD_PTA_101_500...
c71b9a769b076e286bc7258bed8ea61949edd0a3e2c768bd7130d34a6610aa69
R
1,044
30
#================================================== # compare imputed APOE e diplotype vs synapse data #================================================== library(data.table) rosmap_clin <- fread("data/synapse/ROSMAP_clinical.csv") covar <- fread("~/projects/np_phewas/data/mega/mega_np_apoe.covar") # harmonize varia...
fc87929564fafa7042fe04e5824a929930a3ba0a156238843fee02f2f2695241
R
1,044
32
##--------------------------------------------------------------------- ## make lists of snps of length 30K for analysis blocks ##--------------------------------------------------------------------- library(pacman) p_load(data.table, magrittr) # args <- commandArgs(trailingOnly = TRUE) # load snps from .bim file bi...
12644177f69c6b008bf297d2d614d6ecaeb53b0bff502f97c4da06463948a0de
R
1,046
30
source('./scripts/01_Setup.R') setwd("./data/processed/rds") aa= grep("ConfiScore",list.files(), val=T) aa2= aa[aa%in%c("dMDA_101_5Mb_ConfiScore.rds", "Pico_76_250kb_ConfiScore.rds", "Pico_101_250kb_ConfiScore.rds", "PTA_48_500kb_ConfiScore.rds", "PTA_1...
47a4f1038d5b2becd5be084cf479ab6e1dc7aac6e59c96fa42fd26fc4b65fc9a
R
1,050
27
library(dplyr) library(tidyr) library(bio3d) template_file <- unlist(snakemake@input) output_file <- unlist(snakemake@output) templates <- read.table("pdb/template.txt", col.names = c("ID", "_P_", "fname")) %>% mutate(ID = substring(ID, 2)) data <- lapply(templates$fname, read.pdb) %>% setNames(templates$ID) ...
b9a3214458a49b55e76f03b8854cc01a88d629077d3c0bf338e189f37d67d773
R
1,052
27
################################## # # This function is used to add the # network score to the TDp # # Net_annotation is the dataframe obtained # from ObtainNetID # AddNetworkScore_Schaefer <- function(dat_TDp, net_anna, prefix=1){ dat_tmp <- dat_TDp net_annotation <- net_anna network_name <- unique(net_annotat...
e07bece8d0f6d24ca3461bfd0b4251d1c31cfaefb3a2d624cd90e92af72e1c81
R
1,054
32
library(Seurat) library(dplyr) library(rhdf5) # Read in the data h5_file = h5read("./mouse_leukocyte.h5", name="dge") sample.data = t(h5_file$block0_values) colnames(sample.data) = h5_file$axis0 rownames(sample.data) = h5_file$axis1 # Make seurat object sample <- CreateSeuratObject(raw.data = sample.data) # Normaliz...
6fe68a076ae8a352a814a8b63ececba26860b3fac17732302696e0ca8906b09c
R
1,056
30
source('./scripts/01_Setup.R') setwd("./data/processed/rds") aa= grep("Confi",list.files(), val=T) aa2= aa[aa%in%c("dMDA_101_5Mb_t2t_ConfiScore.rds", "Pico_76_250kb_t2t_ConfiScore.rds", "Pico_101_250kb_t2t_ConfiScore.rds", "PTA_48_500kb_t2t_ConfiScore.rds", ...
9442d77afaa6c1b6c457bae86443f503d495b225b5e750fd445cd32419505e6d
R
1,057
32
##-------------------------------------------------- ## Single-CpG analysis for genes in gene list #--------------------------------------------------- library(data.table) library(synapser) cpg.meta <- fread("/data_global/ROSMAP/DNA_methylation/ROSMAP_arrayMethylation_metaData.tsv") genes <- fread("/data_global/UCSC...
1fd93d848437b38f826a13c46ed56cdf6a994a678a02a2260ff395b004f389a9
R
1,064
3
#!../r x<-"012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678...
2b42bcfd91eeb7b411fa81d3d1c166043757888407ac88c936566ef4af7d9088
R
1,064
35
#' List installed *R hyperSpec* family packages #' #' Convenience function that lists all installed #' [*R hyperSpec*](https://r-hyperspec.github.io/) family packages. #' These include **hyperSpec** and all packages that share common #' **`hySpc.`_something_** package name pattern. #' #' @return Character vector with ...
ffdb3372d1e54292c18c100aeb7729cab90047ab44301e5457d364ff42304872
R
1,070
23
--- title: "Inspect data" output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` ## Principal Component Analysis A common goal in many of ProteoMill’s functionalities is to reduce data complexity, and to provide a framework for extracting elements of biological relevance. PCA is ...
7e235e6e92de515561a2966b99e47599a50d54c5629c6d63639ab598ec587ad7
R
1,072
23
## should check if the stat is p-values, but this won't effect that ## so not fixing it now lhRatioMax <- 25 plotROCPerRead <- function(rocDat, denStats){ print(ggplot(rocDat) + geom_abline(slope=1, intercept=0) + geom_path(aes(x=FP, y=TP, color=Comparison)) + theme_bw() + xlab('False Positive ...
0db1998a61ee5ca497d4042b7bf6859c04525ed9b9428cce7efcdfe6e855f234
R
1,073
22
#----Figure_S06_A--------------------------------------------------------------- #------------------------------------------------------------------------------- # This is the code for Figure S06 Panel A for the connectivity analysis for # Reinhard and Fukuda et al. 2024 #------------------------------------------...
4b9ac66d76d3502aa74f7e5e551f84f7da3085eb9e826767572709a8c1391223
R
1,083
29
source('./scripts/01_Setup.R') setwd("./data/processed/rds") aa= grep("Confi",list.files(), val=T) aa2= aa[aa%in%c("dMDA_101_5Mb_lift_ConfiScore.rds", "Pico_76_250kb_lift_ConfiScore.rds", "Pico_101_250kb_lift_ConfiScore.rds", "PTA_48_500kb_lift_ConfiScore.rds", ...
7dcafd69fd574ee9036f9b1e178160c5fcb8c248fc6371d53c0f766581dd8a6e
R
1,086
35
####################################### # # This function is used to obtain the # time delay projecton maps from inputs # while matching the selected participants # # This function can load the data of TDp and # ETS. Indicates what kinds of data you want to # load in [type] parameter ObtainBrainData <- function(sbj_...
50df68f31aacc699589c139ca000a7076689917013c98cb3d1be06992df66708
R
1,094
37
#' mochims_coefficient_size_distribution_datasets #' #' Coefficient size distribution plots for multiple datasets. #' #' @param dataset_names character vector of dataset names (required) #' @param base_dir Base directory (required) #' @param output_dir Output directory (required) #' @param stagenum stage number (requi...