sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
9591ebf925209814c87aafc66d85b7a829a3d4d8786d98fe49559b9eaa3b2384
R
881
21
library(pheatmap) heatmapgenes<- read.csv(ordered_c,"upset_FCby1.5_ordered.csv") heatmapgenes1 <- na.omit(heatmapgenes) paletteLength <- 100 myColor <- colorRampPalette(c("blue", "white", "red"))(paletteLength) myBreaks <- c(seq(-4, 0, length.out=ceiling(paletteLength/2) + 1), seq(max1/paletteLength, ...
7b52d77c6564ac36c12f98c34be3bba97cdf36cafef4f644c6b22aa3dae28fb8
R
894
36
rm(list=ls()) alldata_BD<-read.delim("/Users/cazaledl-admin/Library/CloudStorage/OneDrive-UniversityofBirmingham/Post_doc/XP/ethograms/lisa_quantification/original.spreadsheet/analysisframeV2/Ethogramm_bending_V2.txt",h=T,sep="\t",na.strings = "NA", stringsAsFactors=T) # Create a new Quartz window quartz() ...
dc18c3efcb6357ee97e9eb4d2b0e854580c32318a1cde82835a563e8c759f417
R
894
37
#!/usr/bin/env Rscript # Talkowski SV pipeline downstream analysis helper script # Make list of all nonredundant pairs of batches from an input list of batches ###Set global parameters options(stringsAsFactors=F,scipen=1000) ###Read command-line arguments args <- commandArgs(trailingOnly=T) in.list <- as.characte...
2124e19f69a6fca441b23dd4fa583a60adfb5eceacab5d2fb4cbce2705e1dc5c
R
904
31
library(data.table) library(dplyr) trait_list <- c("MetS", "TG", "HDL", "FG", "BMI", "HTN", "T2D", "WC", "F1", "F2", "F3", "MetS_lind", "MetS_walree") for (trait in trait_list){ print(trait) dir_cojo <- paste0("....
6d88335077f9520cda84a800648bef457d59204d9ad30b3bb0f552c65c9fe480
R
907
23
#' @title Independent LASSO using summary statistics (a.k.a. soft-thresholding) #' #' @param coef vector of regression coefficients (\eqn{r}) #' @param lambda a vector of \eqn{\lambda}s #' #' @details A function to find the minimum of \eqn{\beta} in #' \deqn{f(\beta)=\beta'\beta - 2\beta'r + 2\lambda||\beta||_1} #...
b7b3464332cb23a52afbf0d62f82e71687b501feac1b6a9adea093b0a03e51ab
R
907
32
# common functions for reproducible reporting require("tidyverse") require("readxl") require("openxlsx") # for normal write xlsx format # require("patchwork") require("officer") require("rvg") require("boot") require("boot.pval") library("RColorBrewer") my.cores <- min(10, parallel::detectCores() - 1) # always leave ...
0e0f1c10216c3da455afbbb968c11ec31cf18b4e8496231b39df0fd5d9cfda92
R
916
24
library(data.table) ## Specify PRS file ID prs_file <- "PGS_file_name_here" ## Read files for specified PRS get_files <- list.files(path="/path/to/pgs_chr", pattern=glob2rx(paste0("plink_prs_", prs_file, "_chr*.profile"))) read_files <- lapply(get_files, function(i) fread(paste0("/path/to/pgs_chr/", i))) read_files_...
6a3558c20ed0794107f370d1661b937d9d515b34551f8303b6fdab674a9dcc8e
R
916
35
#' @name DEPRECATED-markpeak #' @concept deprecated #' #' @title (DEPRECATED) #' Find an evenly spaced grid for x #' #' @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 and ...
2a6f71a0432c4bcc8f55f22c159dbf61a99445f9f3ba93f068fd6776d7d24206
R
924
36
options(bitmapType='cairo') args <- commandArgs(TRUE) dir<-args[1] inputFile<-args[2] span<-as.numeric(args[3]) inputFileArray<-unlist(strsplit(inputFile, "\\/")) inputFileName<-inputFileArray[length(inputFileArray)] wd<-paste(dir,sep='') setwd(wd) tmpData<-read.table(inputFile,header=F,sep="\t") tm...
fbb2c12faaf2786cc61323acb0575ebc04951b7b6dac08fb0d089ac64696ae52
R
925
26
library(data.table) library(dplyr) for(tis in c("Brain", "Lung", "Muscle", "Heart")){ for(dir in c("m6A2ha", "ha2m6A")){ Coloc_res <- data.frame() for(i in 1:22){ Coloc_res0 <- fread(paste0("~/Coloc/", dir, "/", tis, "_", dir, "_coloc/chr", i, ".coloc.res"), sep = "\t", header = TRUE) Coloc_res <- bind_rows...
49dab01e7861556c5cd22b1f19f3684dcac9736e9ee59ab76c90259a6b8c7200
R
928
20
setwd("/media/hansruedi/3b32f153-0651-4d56-b863-9b070ac7dd55/home/hansruedi/Allen_Institute_06142020") data=read.csv("matrix.csv",header=TRUE,row.names=1) rows=row.names(data) columns=colnames(data) metadata=read.csv("metadata.csv") rownames(metadata)<-metadata$sample_name library(Seurat) counts=t(data) pbmc <-...
2a1be010740a891ff4d3e5b95cef67ba099d211628345159145f35ad4e18751c
R
929
36
#' @name DEPRECATED-plotc #' @concept deprecated #' #' @title (DEPRECATED) #' Plotting spectra #' #' @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 and will be #' removed ...
56762c48a21aa5d45b22d53e86bb3a0383e380c2a9a99ddb986bc893f7338eb5
R
934
30
test_that("setup_parallel_settings enforces memory floors for estimation jobs", { gpa <- list( parallel = list( l1_setup_cores = 1L, l1_setup_memgb = "8G", fsl = list( l1_feat_memgb = "8", l2_feat_memgb = "12", l3_feat_memgb = "4" ), spm = list( l1_spm...
9e60ab8a61d6a1999a3773d1b5b2a83389514abba2b27a1f6000ecf9c4aa1ad8
R
934
27
####### # Purpose: Visualize fastANI core-genome comparison # Usage: Rscript <this_script> <query sequence in fasta format> <subject sequence> <fastANI visualization output> # Output: <fastANI visualization output filename>.pdf # Uses genoPlotR package: http://genoplotr.r-forge.r-project.org #Parse command line argum...
02e104b6eac366b0b2c45f9096cc877fa27e95d9762d9149219c2b062ae4580f
R
937
29
##POE gene enrichement analysis dat <- read.csv("F:\\ATAC\\processFiles\\POE05112023\\MG_AllGenomePeakReadNumber.NoDistal.GroupByGene.csv", header = T, row.names = 1) geneList <- rownames(dat) POE <- read.csv("F:\\RNA_20221101\\02_ModifiedGenome\\C_POEgeneSelection\\result\\POE.list2.csv", header = T, row.names = ...
5e46e69c93a0d3e592c0a227cefc36b98533fe2088f72ca06ef74a7affe0d98c
R
938
32
#' @name DEPRECATED-stacked.offsets #' @concept deprecated #' #' @title (DEPRECATED) #' Calculate y-axis offsets #' #' @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 and w...
9bbcf9afad0729ff158413ca0453a380a9de8729d416fed86bfa5fe6626f06c4
R
941
29
#!/usr/bin/env Rscript # Helper script to merge outputs from count_svtypes task # in final_outlier_sample_filter.wdl ###Set master parameters & read arguments options(stringsAsFactors=F,scipen=1000) args <- commandArgs(trailingOnly=TRUE) INFILE <- args[1] OUTFILE <- args[2] ###Read input data & reformat dat <- read...
98ad2cfae932faf392b99216597af84c47d40d22d3c3bc128be4c5ec29fc9ab0
R
944
36
#' archstabms_fitness_plots_datasets #' #' Fitness 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 (required) #' @param colour_scheme colour...
246ea7fa54117e27ff5b81191de1231b1d64e96bc8dc5b5bef30fc076d64cde6
R
945
30
test_that("intercept-only L2/L3 models auto-add diagonal contrast", { df <- data.frame(y = rnorm(6)) lmfit <- lm(y ~ 1, data = df) mobj <- list(level = 2L, lmfit = lmfit) class(mobj) <- c("list", "hi_model_spec") res <- fmri.pipeline:::specify_contrasts(mobj, spec_list = NULL) expect_true(isTRUE(res$contr...
d1bf8febff07f775b227550e43bf32e9c56f653bfc946e6bbd1285df7f190150
R
948
27
DESeq2 <- function(comparisons, comparisons_dir, conditions, conditions_dir, results_dir, padj_threshold) { # Load Counts countData <- read.csv(paste0(comparisons_dir, comparisons, ".DESeq2_comparisons.csv"), row.names = 1) colnames(countData) <- substr(colnames(countData), 2, nchar(colnames(countData))) ...
6bdcb9aac491168c8dc9bfa00bb9753dff031f20f6b8868130c6b899b73dd56a
R
958
19
# ******* # 0a-import.r # Code for initial construction of the seurat object holding UMI # Note: Expected within Data/secondary are individual secondary 10X outputs for each organoid scRNAseq sample. library(tidyverse) library(magrittr) library(Seurat) source("Analysis/util/import_10x.r") meta <- readxl::read_xlsx('Dat...
30cebce391feb7617d0b10077e046161e46fba9d3ef1d77d54c8df2fcd4108f5
R
965
36
#' @name DEPRECATED-plotmap #' @concept deprecated #' #' @title (DEPRECATED) #' Plotting spectra #' #' @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 and will be #' remove...
9e7ea3554ce2e3dead491be91e6d2e55d43edd749122433daec17bce42f8cc7e
R
968
42
#' archstabms__temperature_factor_from_PDB #' #' Get residue-level data from temperature factor (B-factor) columm in PDB file. #' #' @param input_file path to PDB file (required) #' @param chain chain id (default:A) #' #' @return data.table with residue-level temperature factor (B-factor) column values #' @export #' ...
9f4219362878fba86a9722568591ec8245a0a0ebb54e9cc81d7ad3f793c6dfec
R
971
31
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...
c2c47cb56f5afaba94fb475da5bde04d699f180eee9d323982c7fd46951bfbab
R
971
17
library(spacexr) library(spASE) cere3 <- readRDS('results/rctd_cere_3.rds') cere3@config$max_cores <- 8 cell_types <- c('Fibroblast', 'Granule', 'MLI2', 'Purkinje', 'Bergmann', 'Oligodendrocytes') cere3_intercept <- run.CSIDE.intercept(cere3, cell_types = cell_types, cell_type_threshold = 50, spase=F, logs=T) cere3_i...
f02f5b7d56a5b7474e0b60234f43faa2ee591f26fbcf00ad8eaac9fb913263b3
R
973
32
library(data.table) library(dplyr) covariate_file <- "./UKB_covariates.csv" df_cov <- fread(covariate_file, sep="\t", data.table = F, nThread = 1) %>% dplyr::select(f.eid, SEX, BIRTH_YEAR, PC1, PC2, PC3, PC4, PC5, PC6, PC7, PC8, PC9, PC10) %>% rename(FID = f.eid) %>% mutate(IID = FID) %>% dplyr::sele...
a5e93b793c1bc027377fcd50d979119d97b96984cbd247f96c3f73c913d2c152
R
976
36
#' @name DEPRECATED-plotmat #' @concept deprecated #' #' @title (DEPRECATED) #' Plotting spectra #' #' @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 and will be #' remove...
22dcfdd62642efc98831260a6e0d0f1f2b1116ca730146a8cb2c300fe4b5d5de
R
978
22
NMD <- lapply(TargetGene,function(x) class.files$protein_filtered_final[class.files$protein_filtered_final$is_nmd == "TRUE" & class.files$protein_filtered_final$associated_gene == x,"corrected_acc"]) names(NMD) <- TargetGene NMDp <- lapply(NMD, function(x) plot_expression_summed(x, AgeDiv = TRUE)) for(i in 1:lengt...
bb9a6bafcc93ebded4ab3d346f68746018568caf42992c758f8098af7db65b23
R
978
16
library(spacexr) library(spASE) hippo1 <- readRDS('results/rctd_hippo_1.rds') hippo1@config$max_cores <- 8 cell_types <- c('Astrocyte', 'CA1', 'CA3', 'Dentate', 'Interneuron', 'Oligodendrocyte') hippo1_intercept <- run.CSIDE.intercept(hippo1, cell_types = cell_types, cell_type_threshold = 50, spase=F, logs=T) hippo1_i...
c6e9b3d09b5c59475529e31048cbe515867ac3d258bcf4debe7a8e3446c2320a
R
978
16
library(spacexr) library(spASE) hippo2 <- readRDS('results/rctd_hippo_2.rds') hippo2@config$max_cores <- 8 cell_types <- c('Astrocyte', 'CA1', 'CA3', 'Dentate', 'Interneuron', 'Oligodendrocyte') hippo2_intercept <- run.CSIDE.intercept(hippo2, cell_types = cell_types, cell_type_threshold = 50, spase=F, logs=T) hippo2_i...
c8bf6e5d5aa7ac200bad591628740e0d1ee51af2c9faaec7dbc990ce4042981e
R
979
22
library(Seurat) library(EmptyNN) library(tensorflow) tensorflow::install_tensorflow(python_version="4.4") # data.data <- Seurat::Read10X(data.dir = file.path(samples_dir, sample_name, "filtered_feature_bc_matrix"), strip.suffix = TRUE) # data <- Seurat::CreateSeuratObject(counts = data.data, project = sample_name, mi...
88656982e3fffb8c49b37d8a7d9dcfe6679a8db0b681ef6fa2fb0964a35f2553
R
980
53
#General library(tidyverse) library(reshape2) library(matlib) library(matrixStats) library(forcats) #DeepComBat library(torch) library(torchvision) library(neuroCombat) library(CovBat) #ML library(caret) library(randomForest) library(xgboost) library(e1071) library(MASS) #Statistics library(twosamples) library(group...
d22b527891a5a61f49af005e88b0fbd3a4415b347de54087462757f0f9d9dcda
R
983
17
library(spacexr) library(spASE) hippo3 <- readRDS('results/rctd_hippo_3.rds') hippo3@config$max_cores <- 8 cell_types <- c('Astrocyte', 'CA1', 'CA3', 'Dentate', 'Interneuron', 'Oligodendrocyte') hippo3_intercept <- run.CSIDE.intercept(hippo3, cell_types = cell_types, cell_type_threshold = 50, spase=F, logs=T) hippo3_...
9404b2730d47337d50ff1cf7ea6ac9cf0308b2c6fcb8bcc321aa77ea5649c70b
R
996
33
library(rhdf5) library(qvalue) library(dplyr) observedFeatures <- 0 results <- NULL snpAnnotation <- NULL featureAnnotation <- NULL tmp=h5dump(file = "perm_results_22.h5") if(length(tmp)>0){ for (j in names(tmp)) tmp[[j]][["feature"]] <- j observedFeatures = observedFeatures+length(tmp) df <- bind_rows(tm...
f1ee3e223ef76255a5ffeb3860eed5abfb72c0c0d4936d6e8b14aed83c1f1182
R
1,001
29
# csvFancGetNumInputSyn.r # # Function that takes in CSV file of FANC IDs and returns the total number of # synapses that neuron receives # Writes output CSV file with FANC IDs and number of synapses (name is same # with _synNum appended) csvFancGetNumInputSyn <- function(csvFilePath) { # read in CSV file csvDa...
47a254e835e80bcf13e5fa84d2fc0c317b58c68700f170eb747548f07cfd8a75
R
1,005
34
library("ukbtools") library(dplyr) library(ggplot2) library(arrow) library(stringr) library(tidyr) library(reticulate) phenotype_df = read_parquet('phenotypes.parquet') #as in https://github.com/PMBio/deeprvat/tree/main/example all_samples = phenotype_df %>% pull('sample') ukb_relatedness = read.csv('ukb_rel_a8135...
314c9e19646e404e88871e480c1f3dc519593b161652433e30c0bd5ad763fa91
R
1,006
35
plinkfileStem <- "test" plinkfile <- paste0(plinkfileStem, ".bed") n <- nrow.bfile(plinkfileStem) p <- ncol.bfile(plinkfileStem) beta <- rnorm(p) Xb <- pgs(plinkfileStem, beta) X <- genotypeMatrix(plinkfile, n, p, integer(0), integer(0), integer(0), integer(0), 1) Xb2 <- X %*% beta stopifnot(all.eq...
b772aff2cdc3e212bbcd0c4daccc16d1cdf41adb96e67846a3378c0970f1abbe
R
1,006
34
#' @title pgs for a list of bfiles #' #' @keywords internal pgs.vec <- function(bfile, weights, extract=NULL, exclude=NULL, trace=0, ...) { l <- splitvec.from.bfile(bfile) if(is.vector(weights)) weights <- matrix(weights, ncol=1) stopifnot(nrow(weights) == length(l$split_p)) weights <...
acba9afd771b8fc9ac02814b221380ae1a22d0626d28054a5fbbd89f91c80cc4
R
1,009
44
#' archstabms__secondary_structure_from_PDB #' #' Get secondary structure. #' #' @param input_file path to PDB file (required) #' @param chain chain id (default:A) #' #' @return data.table with secondary structure #' @export #' @import data.table archstabms__secondary_structure_from_PDB <- function( input_file, cha...
69e9f3e5251c74ff7adf1700419cbf30ba41265ff398fb4abbfd1f80bee316ea
R
1,010
39
options(bitmapType='cairo') args <- commandArgs(TRUE) dir<-args[1] inputFile<-args[2] inputFileName<-args[3] setwd(dir) data<-read.table(inputFile,header=F,sep="\t") x<-data[,2] # calcuate for full data range x.min<-floor(min(x)) x.max<-ceiling(max(x)) x.bound<-max(abs(x.min),abs(x.max)) if(x.boun...
9ba67f9b01075c2827048c6b326e748bb432763f2611dd0e9b8213e51b948f45
R
1,018
36
#!/usr/bin/env Rscript # Generates a UMAP plot based on a GRM ###Set master parameters & load libraries options(stringsAsFactors=F,scipen=1000) require(umap) #Inputs grm.input <- "~/scratch/grm.txt.gz" anc.input <- "~/Downloads/gnomAD_v2_SV.sample_population_assignments.rough_initial_simplified.txt" seed <- 1234567...
c930a74af977c7e62bd4b41a8ca6deb13632ec3155b50121f48842d3edc71a2b
R
1,018
36
#' @name DEPRECATED-plotvoronoi #' @concept deprecated #' #' @title (DEPRECATED) #' Plotting spectra #' #' @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 and will be #' re...
aaf91c76e412b27b188c74e50a2bb71bd8483f2c87b64b798c23bac3af38e4d6
R
1,019
18
#!/usr/bin/env Rscript requireNamespace('jsonlite') requireNamespace('pkgload') opts <- list( Azimuth.app.reference = 'https://seurat.nygenome.org/references/pbmc', welcomebox = "box(\n h3(\"Please upload a dataset to map to the Multimodal PBMC reference\"),\n \"Upload a counts matrix from an scRNA-seq dataset ...
8241544f61f85c3a3a539dbb8fcdae5049ddd7120174fecbe02161720b644261
R
1,030
29
mega <- readRDS("/proj/mnhallqlab/users/michael/fmri.pipeline/local/mega_brms_results.rds") library(data.table) get_df_from_mega <- function(mega, nm) { res <- rbindlist(lapply(mega, function(el) { df <- el[[nm]] cbind(el$metadata, df) })) res[, Evid.Ratio := NULL] res[, Post.Prob := NULL] res[, Hy...
213648632581fd04b030feee10ba931c3326fdf6fef0ab21cca9bcd1497d0ee7
R
1,043
35
#' @name DEPRECATED-mark.dendrogram #' @concept deprecated #' #' @title (DEPRECATED) #' Identifying spectra and spectral data points #' #' @description #' These \pkg{hyperSpec} functions are **deprecated** and not maintained any #' more. You should not use these. #' Currently they are present due to back-compati...
aadf1078699613a5cfb29043d662f8f8c7f3de20d7a4615fba72df3db4d41448
R
1,043
27
##Plot the ibs distance mtarix between RNA-seq sample according to variants calling results setwd("C:\\Users\\qjp\\Desktop\\Manuscript\\RNA\\Ori\\data\\IBS_heatmap") dat_now <- read.table("Autosome.allSample.ibs.matrix.txt", header = F) meta <- read.table("meta_data3.txt", header =T, row.names =1) rownames(...
fd1cbc510a9ddde3ce8fea1a80b136932c4c106710c79b71689ed0c7d04bd6a3
R
1,057
27
# first argument is the chunk of params to run (1-18) library(spacexr) library(spASE) devtools::load_all() args <- commandArgs(trailingOnly=T) source('../R/spase_sim_utils.R') myRCTD <- readRDS('results/results_celltype_cere_4_visium_df_5.rds') params <- read.delim('simulations_cere4_params.tsv') df <- 5 cell_types...
e30ea03523f227a63e171d2e3cb954e5a09a347e801e6bf8c557f6ac8c5d72d5
R
1,058
34
rm(list = ls()) library(e1071) MD_SVM <- read.csv("CDK_MOR_sn_svm_H_selected for Prediction.csv") MD_x <- data.matrix(MD_SVM[, 3:ncol(MD_SVM)]) MD_y <- MD_SVM$Y svm_model <- svm(Y ~ ., data=MD_SVM,na.cation=na.omit) summary(svm_model) library(caret) train_index <- createDataPartition(y=MD_SVM$Y, p=0.8, list=F...
a2b91b1f94f6769497ca2492a0b6344a696a5605bbd85b62733e16b7214cb2bc
R
1,059
31
test_that("runElnet" , { plinkfileStem <- "test" plinkfile <- paste0(plinkfileStem, ".bed") n <- nrow.bfile(plinkfileStem) p <- ncol.bfile(plinkfileStem) beta <- rnorm(p) Xb <- pgs(plinkfileStem, beta) X <- genotypeMatrix(plinkfile, n, p, integer(0), integer(0), integer(0), integer(0), 1) Xb2 <- X ...
177d67cdba1cf6b0fb1e78b22404d16947fb6853066778fdd07490df9553a6ad
R
1,062
22
#he global methylation level of each sample was calculated according to bismark methylation extractor module library(ggplot2) library(ggsci) library(ggtext) path <- "C:\\Users\\qjp\\Desktop\\Figures\\TissueCpGMethylationLevel\\" dat <- read.table(paste0(path,"MethylationLevelOfTissues.txt"), header = T, row....
c4e0786ffe91f4b9d10ef657bff2239a21b705c02dc47f4afb201b5cf2a4878e
R
1,063
30
rm(list=ls()) data<-read.delim("/Users/cazaledl-admin/Library/CloudStorage/OneDrive-UniversityofBirmingham/Post_doc/XP/revision_progression/binary_table_revision_progression_latethreat.txt",h=T,sep="\t",na.strings = "NA", stringsAsFactors=T) attach(data) library(dplyr) # Calculate the percentage of individuals pe...
cc2273ffc837873cf41d4d1cae6e2143656aa6fbbf1f682fc3c597ba9b37ac8e
R
1,063
34
#' 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 ...
c34c128718e4c4d5738ef53dac2e2a1604492625f9f86e2c8d409bb78715ef1d
R
1,067
39
#' @name DEPRECATED-plotspc #' @concept deprecated #' #' @title (DEPRECATED) #' Plotting spectra #' #' @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 and will be #' remove...
014e81b0eb8578cb6e4dbdcbbb1b72bc9be06a267e759f877c4ffefb174548b0
R
1,074
28
#!/usr/bin/env Rscript # override for debugging purposes quiet <- as.logical(Sys.getenv("QUIET", unset="TRUE")) library(parallel) Ncpus <- detectCores() # treat warnings as errors, otherwise script can fail silently if a package fails to install options(warn = 2) # packages to be installed to.be.installed <- commandA...
b557b33e2ca8863d01b715b8d71642f0258541c004996b79b20978f4eefdc426
R
1,077
25
##sorting out the biomarker mess upennbio <- read.csv("./UPENNBIOMK_MASTER_FINAL_21Nov2023.csv") roche_elecsys <- subset(upennbio, RUNDATE>=as.Date("2016-11-17")) #go through each RID and compute median of values at duplicate time points roche_elecsys$ABETA42 <- as.double(gsub("<","", gsub(">","", roche_elecsys$ABE...
c02492e3774a2c8aef373cb1279f71a18427e739631eb9041a3ae8ef1bc1b03e
R
1,096
31
library(data.table) library(dplyr) dir_har <- "tsmr_harmonized_data/" dir_out <- "cml_ma_input/" dir.create(dir_out, showWarnings = FALSE) # Metadata file_in_mr_result <- "tsmr_best_sig_result.csv" df_mr_result <- fread(file_in_mr_result, sep=",", data.table = F, nThread = 10, colClasses = c("cha...
8a5c5ee333abfee7b99f459a14c9ca0c31030893e21a5eac8304d2f884b469cd
R
1,098
25
setwd("/media/hansruedi/3b32f153-0651-4d56-b863-9b070ac7dd55/home/hansruedi/Brain_region_final") library(Seurat) adata <- ReadH5AD(file = "Brain_region_raw_highly_variable2.h5ad") pbmc <- CreateSeuratObject(counts = GetAssayData(object = adata, slot = 'counts'), project = "pbmc3k", min.cells = 0, min.features = 0) ...
e3f715670f7a333f31211b17d5665648d74b51ce9e1a9e7f9451df4afba6e032
R
1,101
48
--- title: "Normalisation of Nurr1 dataset" author: "Yuvarani Masarapu" date: '2022-11-30' output: html_document: self_contained: true number_sections: true highlight: tango df_print: paged code_folding: hide toc: yes toc_depth: 3 toc_float: collapsed: false smooth_scrol...
25b9c6ab5df3583285f87bd008d9f35993d8af501aa50a942921507069790173
R
1,103
40
#' @name DEPRECATED-pooled.cov #' @concept deprecated #' #' @title (DEPRECATED) #' Pooled covariance matrix #' #' @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 and will b...
0d3c4af5f26e64e9483a31925236e1a89c6243af94a3c26953f6b89d9cbd4a7c
R
1,105
45
```{r} require(arrow) require(ggplot2) require(dplyr) ``` ```{r} source("../figure2_association_testing_benchmark/rvat_figure_utils.R") ``` ```{r} scores = read_parquet("burdens_with_has_known.parquet") scores p = ggplot( scores %>% # filter(abs(ASXL1 - median(ASXL1)) > 0.0001) %>% arrange(ASXL1) %>% ...
c4006f6cc66d2702f287c77728153ce7e91b84413bbb7edb8c037710394f7a79
R
1,123
45
test_that("truncate_runs writes truncated NIfTI via subset_nifti_volumes", { skip_if_not_installed("RNifti") dims <- c(2, 2, 2, 15) img_data <- array(rnorm(prod(dims)), dim = dims) img <- RNifti::asNifti(img_data) infile <- tempfile(fileext = ".nii.gz") RNifti::writeNifti(img, infile) gpa <- list( c...
5f1a144c6884c4c89bb39b86fde0cbcc40542292bb05ff5b61de289956b5757b
R
1,130
32
#!/usr/bin/env Rscript # Script to QC merged per sample bincov files # Created by: Chelsea Lowther <clowther@mgh.harvard.edu> # Inputs: # 1) A single bincov file per sample that contains bins from the last 1 Mb per chromosome # 2) A sample ID string # Usage: bincov_QC.R BINCOV SAMPLE_ID OUTFILE ## Libraries req...
d0ddb4a4e507ce17155b17b4495bcd8caa6aaa29fa77c5a491cfb58ecd3fc481
R
1,153
29
library(tidyverse) library(SingleCellExperiment) library(scater) library(Seurat) options(future.globals.maxSize = 4000 * 1024^20) Sys.setenv('R_MAX_VSIZE'=2500000000000) library(scran) celltype<-readRDS("Oli.rds") DefaultAssay(celltype)<-"RNA" celltype.sce <- as.SingleCellExperiment(celltype) clusters <- quickCluster...
cca4aa3455e34d2b8bff38340a9bc5042723a7039e184832fcb4bacb10a15dc3
R
1,155
40
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # Generics #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #' Run Azimuth annotation #' #' @param query Seurat object or following type of path: #' \itemize{ #' \item A \code{.h5} matrix #' \item A \code...
e6f496301a14f0d05bc925c1a6baff673cbccff136ddbe9648cb862b645f3f8d
R
1,158
48
#' #' Yaml object for specific parameters. #' #' If the object has the param, then return it. #' If the param is unknown, create it with the given default value and return the default. #' #' @field yaml_obj A Yaml object #' #' @import yaml #' @importFrom methods new #' #' YamlClass = setRefClass( "YamlClass", fiel...
f3e4f75795d1a72a7ca45cbc63d0088dac85542dd33c98fee334f6120246a893
R
1,158
30
library(data.table) library(dplyr) ##Integrate m6A-H3K27ac MR results for the four tissues for(tis in c("Brain", "Lung", "Muscle", "Heart")){ for(dir in c("m6A2ha", "ha2m6A")){ MR_res <- data.frame() for(i in 1:22){ MR_res0 <- fread(paste0("~/2SMR/", dir, "/", tis, "_", dir, "_mr/chr", i, ".mr.res"), sep = "\t...
64d2e6f80b855e08d1036400cf0f68889fd77a0c313332bedef3dab1e03c21b2
R
1,159
34
rm(list=ls()) data<-read.delim("/Users/cazaledl-admin/Library/CloudStorage/OneDrive-UniversityofBirmingham/Post_doc/XP/revision_progression/binary_table_revision_progression_earlythreat.txt",h=T,sep="\t",na.strings = "NA", stringsAsFactors=T) attach(data) library(dplyr) quartz(title="title",width=10, height=12) ...
6a1e59657ad9f46823c23eb228a34e27f8937f374701453c2f6488bd6b1ba611
R
1,160
28
###PCA plot of WGS individual setwd("C:\\Users\\qjp\\Desktop\\Manuscript\\WGS\\data") ##pca value by gcta pca <- read.table("snp.gcta.eigenvec.txt", header = F, row.names=1) #data inpute library(ggplot2) library(ggord) pca <- pca[,-1] colnames(pca) <- paste0("pca",1:10) pca1_2 <- pca[,1:2] design <- da...
70407c17c6d1f85cbc744986c17c298b2ce5742225c58ad4988477ca5b699c16
R
1,162
35
#!/usr/bin/env Rscript # Helper script to return list of outlier samples from an svcounts.txt file # Read command line arguments options(stringsAsFactors=F) args <- commandArgs(trailingOnly=TRUE) if(length(args)!=3){ stop("Three positional arguments expected: svcounts.txt, N_IQR_cutoff, and OUTFILE") } countsfile <...
77a7b69c0e7ca57c90f058598d4f98efad116cd68e9a499d821565bb38066d14
R
1,162
20
library(spacexr) library(spASE) cere4 <- readRDS('results/rctd_cere_4_visium.rds') cere4@config$max_cores <- 8 cell_types <- c('Fibroblast', 'Granule', 'MLI2','Oligodendrocytes') cere4_intercept <- run.CSIDE.intercept(cere4, cell_types = cell_types, cell_type_threshold = 2^7, s...
0e32bd134d5f9ad443cea9ac27ee60bf5c228fc4910ff120d01b302576ecad64
R
1,165
42
library('RColorBrewer') library('MAST') library('data.table') library('Seurat') library('biomaRt') library('lme4') setwd("./Projects/SNCSynuclein") # load the seurat object Seurat.SNC.final <- readRDS("Step5.FinalClustering/Seurat.SNC.final.rds") # set the levels for factors: Seurat.SNC.final$TYPE <- factor(Seurat.S...
347d321d5c39b9d251ae627abaeb258f191be1743b6c25ca3c9484fceb38b617
R
1,165
27
#' archstabms__get_reference_id #' #' Get reference id with absolute amino acid residue position. #' #' @param input_dt data.table with id and mut_order columns (required) #' @param position_offset residue position offset (default:0) #' #' @return Reference id with absolute amino acid residue position #' @export #' @i...
7c310d2a9c03258ad1a6f9f86720815582d9a09622066f7845e58746934f4e84
R
1,168
48
#### Find spatial neighbors #### ## ----------------------------- setMethod("findNeighbors", "ANY", function(x, r = 1, groups = NULL, metric = "maximum", p = 2, matrix = FALSE, ...) { .findNeighbors(x, r=r, groups=groups, metric=metric, p=p, matrix=matrix) }) setMethod("findNeighbors", "SpectralImagingData", ...
2b24b1d77b90b119c93b225879d3315ee1f27430248a1ab55ea5c770dd805b7c
R
1,169
52
--- title: "Demo Vignette" output: html_document --- Example of running spASE on some simulated data. ```{r setup, include=FALSE} library(spASE) ``` ```{r null-genes} # Null simulation parameters ngenes <- 100 numi <- 5 p <- 0.5 phi <- 0.2 a <- p*(1-phi)/phi b <- (1-phi)*(1-p)/phi # Simulate raw ASE data in a squ...
a5e06c191afc91163e1cac4035136061f1778fdbceb2471e61990cd4c242f489
R
1,169
42
library(data.table) library(dplyr) ### F1 trait <- "F1" file_gwas <- "MetS_noUKB_F1_GWAS.csv" df <- fread(file_gwas, sep=",", data.table=F, nThread = 20) %>% dplyr::select(SNP, CHR, BP, A1, A2, MAF, est, Pval_Estimate) %>% rename(BETA = est, P = Pval_Estimate) write.table(df, file = p...
3dfd9ea4c6194eb2e7ea36532041daf5c9acc7b49dccc0a7d09dfc6ca6932882
R
1,177
31
#' @keywords internal "_PACKAGE" ## usethis namespace: start #' @importFrom Rcpp sourceCpp #' @importFrom rlang .data #' @useDynLib fmri.pipeline, .registration = TRUE ## usethis namespace: end NULL if (getRversion() >= "2.15.1") { utils::globalVariables(c( ":=", ".", "..split_on", ".filename", ".I", ".SD", ...
f815bfd2c3f2d8bb2e7e18b2e96a6c6a8f2c87e75284b2bffca0dadbbbd51964
R
1,187
55
--- title: "Trace Guide for NosaAnalysis" author: "Julia Thüringer" date: '`r Sys.Date()`' output: html_document: default pdf_document: null vignette: > %\VignetteIndexEntry{Trace Guide for NosaAnalysis} %\VignetteEngine{knitr::rmarkdown} \usepackage[utf8]{inputenc} --- ### Description ```{r description, ev...
f6dff01d26e9660add786b2eb9a56725187e9237c24422ffa4eeeff0deaa334d
R
1,197
29
# ********* # 0c-ambient.r # Script for estimating ambient RNA contamination in the dataset with DecontX. # Expected within the folder Data/secondary is are folders BU-SNCA-1, BU-SNCA-2, ..., BU-SNCA-24, # within which we expect the folder structure of: # outs/ # - filtered_feature_bc_matrix # - raw_feature_bc_matr...
2c8b453b500e4441bafabaa3dfed78ffd7809a5dc4867825933a1eb05c5f0e0f
R
1,199
44
## 3D scatter library(scatterplot3d) pc <- read.table("C:\\Users\\qjp\\Desktop\\BS\\PCA\\data\\SamplesPCA_prcomp_x.txt", header = T, row.names = 1) Tissue <- c() tis <- substr(rownames(pc),7,7) for(i in 1:nrow(pc)){ if(tis[i]=="B"){ Tissue[i] <- "Br" }else if(tis[i]=="L"){ Tissue[i] <- "Li" ...
e70f28808a11996183df7929c9795e27d34538b8407f81bcfda7558b56fca1ba
R
1,201
36
rm(list=ls()) library(conover.test) library(multcomp) library(beeswarm) data<-read.delim("/Users/cazaledl-admin/Library/CloudStorage/OneDrive-UniversityofBirmingham/Post_doc/XP/data/motioncontrols/foldchange.txt",h=T,sep="\t",na.strings = "NA", stringsAsFactors=T) attach(data) boxplot(cbind(MALE_THC1_CHRIMSON...
a60185d40abe308151bbe5a44549e37f17535cf50e9d1f4fa2114c245d7a7888
R
1,203
35
# Tmisc() # Tim.load(Rplink) # setwd(attachroot("~/WORK/myRpackages/lassosum/tests/")) # Tim.load(lassosum) # # library(data.table) # bfile <- "../inst/data/testsample" # n <- nrow.bfile(bfile) # ss <- read.table2("../inst/data/summarystats.txt", header=T) # cor <- p2cor(ss$P_val, n=60000) # lp <- lassosum.pipeline(co...
3f4802dca60d52298894893706c46071b3a905fc9158efaef7f0bfca0e3fd114
R
1,208
54
test_that("jlmer validates call-site inputs before starting Julia", { testthat::skip_if_not_installed("JuliaCall") df <- data.frame(y = 1:4, x = 1:4, id = factor(c(1, 1, 2, 2))) expect_error( jlmer(~ x + (1 | id), df), "two-sided" ) expect_error( jlmer(y ~ missing_x + (1 | id), df), "Variab...
6d6379f80a13f99a177d6258e11f2d6bf75954c38733e6708fdd934b780f6b30
R
1,209
40
library("harmony") library("Seurat") library("tidyverse") setwd("./Projects/SNCSynuclein") # load the Seurat object Seurat.SNC <- readRDS("Step2.QC/Seurat.SNC.QC.R1.rds") # run harmony for data integration options(repr.plot.height = 2.5, repr.plot.width = 6) Seurat.SNC <- FindVariableFeatures(Seurat.SNC, ...
a6d67bfa838458ed245e47acc3faa0d630ffb773eefdf680b2ab89d509552ab0
R
1,210
19
library(colorspace) library(dplyr) library(grid) library(httr) library(magick) library(spacesXYZ) library(stringr) # This is where the images downloaded from eLife are stored. images_dirpath = "Images" source("Functions.R") create_simulated_image("/shared_dir/ImageSample1to5000/elife-00640-fig6-v1/original_downloade...
4b7fcfd84aa17bdfaedbc1cffecf5cbb4b53c0037c087e1cd2be81f1bb476937
R
1,211
39
library("harmony") library("Seurat") library("tidyverse") setwd("./Projects/SNCSynuclein") # load the Seurat object Seurat.SNC <- readRDS("Step2.QC/Seurat.SNC.QC.R1.rds") # run harmony for data integration options(repr.plot.height = 2.5, repr.plot.width = 6) Seurat.SNC <- FindVariableFeatures(Seurat.SNC, ...
5d7055120110d45ac85b32704ca899d5cff4b5651ae99c41524cbb981112837d
R
1,215
47
# subset columns of a matrix # Mainly use for when we optionally subset the columns. # In this case, the option subsample should be set to a number subsample <- function(x, subsample=FALSE) { if (subsample) { keep = sample(1:ncol(x), size=subsample) if ('Seurat' %in% class(x)) { x <- subset(x, cells=col...
f9ce6cbe95f4be9db31da57a34fafe47af80aeb25860d0a6910c4e60a9f11b4c
R
1,220
31
--- title: "Compute word embeddings for Neurosynth functional terms" author: "Evan Collins" output: html_document date: '2024-02-06' --- All code in this markdown document has written by Evan Collins. Any questions can be sent to evantomcollins@gmail.com. ```{r} # Load packages library(word2vec) set.seed(123456789) `...
3a85a4e73091f03cbae27687c836a1ef794d0126d691cfdd2589ff73ff905484
R
1,221
45
options(bitmapType='cairo') args <- commandArgs(TRUE) inputFile<-args[1] inputFileName<-basename(inputFile) myTable <- read.table(inputFile, header=TRUE, sep = "\t",row.names = 1,check.names=FALSE) for(group in colnames(myTable)) { tmpTable<-myTable[[group]] if( (max(tmpTable)==0) && (m...
356481297406de55f00acbfbf506601a6b2f4d42c1aab2ffec20d56335584647
R
1,229
44
#' Barbiturates spectra from `.spc` example files #' #' A time series of mass spectra in a list of `hyperSpec` objects. #' #' #' @name barbiturates #' @docType data #' #' @format The data sets consists of a list of 5 hyperSpec objects with a single #' spectrum each. They are the first five spectra of the BARBITUATES....
d98a055ac12f66408d15196614921c70e6d2ea4c66fa3cd3906f5a81a7408b83
R
1,238
35
#!/usr/bin/env Rscript # override for debugging purposes quiet <- as.logical(Sys.getenv("QUIET", unset="TRUE")) library(parallel) Ncpus <- detectCores() # treat warnings as errors, otherwise script can fail silently if a package fails to install options(warn = 2) # packages to be installed to.be.installed <- commandA...
e0d8d5a1d038588ed950a5742e3a596242038fae6320dc971c8cffff52b18dec
R
1,247
28
## ---------- Script ----------------- ## ## Purpose of script: Identify Transcript ID associated with Bin1 isoforms for creating a blast library ## ## ---------- Notes ----------------- ## Prerequisite for downstream script (3b_bin1_blast_primer.sh) ## To generate Transcript ID for subsetting and to generate a fasta ...
ed5c1f4e62c8c0bfb6d065bf4a896e23ebdbbf3a3496bc9b5534c4e4bd119318
R
1,248
18
### ------------- Table 1 ------------------- mTable1 <- Merged_gene_class_df[c("Total.Number.of.Transcripts","Total.Number.of.Known.Transcripts","Total.Number.of.Novel.Transcripts","Total.Number.of.Coding.Transcripts", "Total.Number.of.Transcripts.with.canonical.splice.sites","Total.Number.of.T...
0b69f411e785b7126cfc14b0035a8e0b451ee6fc69f45c4fbbf279e497aeed80
R
1,255
36
#' @name hyperSpec-package #' @rdname hyperSpec-package #' @aliases hyperSpec-package #' #' @title Package "hyperSpec": interface for hyperspectral datasets #' @description #' This package gives an interface to handle hyperspectral data sets in R. #' Hyperspectral data are spatially or time-resolved spectra, or spectra...
a33ba16bedda469872ff862b9a7220e975017b7902dd88a030f06042e2545a04
R
1,255
48
#' archstabms__distance_matrix_from_PDB #' #' Residue distance matrix from PDB. #' #' @param input_file path to PDB file (required) #' @param residue_subset subset of residues (default:all) #' @param query_chain query chain (default:A) #' @param metric distance metric (default:'scHA') #' #' @return data.table with min...
f434b56efa6dc80d31fd53a6d59f11af8fcabb1a9fabe397ef5a447781a8752b
R
1,264
31
.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", ...
77eca576121d646f758bf68b40f8e7a24f5d75516ab6d75d09fc1dc3fdc00974
R
1,265
43
#' @describeIn DEPRECATED-read.ENVI #' @include DEPRECATED-read.ENVI.R #' @export read.ENVI.HySpex <- function(file = stop("read.ENVI.HySpex: file name needed"), headerfile = NULL, header = list(), keys.hdr2data = NULL, ...) { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
8338fa7ba58a416174d0797b1a5efd0a349ee4796597c58cfecb5c7373237f45
R
1,278
32
merge.lassosum <- function(...) { #' @title Merge lassosum results #' @description e.g. when calculated over different blocks/chromosomes #' @method merge lassosum #' @export #' ll <- list(...) stopifnot(all(sapply(ll, "class") == "lassosum")) stopifnot(all(sapply(ll, function(x) all(x$lambda == ll...
5d8fb5fa327a4fd8de8478142584bae829485353644cf5bb8dbce1c420d19bf5
R
1,281
50
require(testthat) require(Cardinal) context("spatialWeights + spatialDists") test_that("spatialWeights", { set.seed(1) x <- matrix(runif(81 * 6), nrow=81, ncol=6) co <- as.matrix(expand.grid(x=1:9, y=1:9)) nb <- findNeighbors(co, r=1) wts <- spatialWeights(co, r=1, weights="gaussian") sd <- 3 / 4 d1 <- matte...
fcb146a683393d0e30c6d497846a7d3b9759147bee38d1964b36027a35e5cccf
R
1,284
41
# Take .tsv of TE calls and convert from tall to wide format for hail matrix table import #de novos setwd('/hail-TE') TE <- read.csv('TE-denovos.csv', header=TRUE) R <- colnames(TE) TE$Chr <- str_remove(TE$Chr,'chr') TE$locus <- paste(TE$Chr, TE$Breakpoint, sep=':') library(stringr) #TE$famID <- str_split(TE$Sample, '...
2368c5e5defbf8e104ea5ff46bd8a8e4784e1f36c83b3cff2bea9f178f7645f5
R
1,285
47
plinkfileStem <- "test" plinkfile <- paste0(plinkfileStem, ".bed") n <- nrow.bfile(plinkfileStem) p <- ncol.bfile(plinkfileStem) beta <- rnorm(p) Xb <- pgs(plinkfileStem, beta) X <- genotypeMatrix(plinkfile, n, p, integer(0), integer(0), integer(0), integer(0), 1) Xb2 <- X %*% beta stopifnot(all.eq...